~vcs-imports/monouml/trunk

« back to all changes in this revision

Viewing changes to src/Widgets/Tabs/UMLProperties/SlotValueViewer.cs

  • Committer: rodolfocampero
  • Date: 2007-07-25 15:20:48 UTC
  • Revision ID: vcs-imports@canonical.com-20070725152048-03z7yvqy4o5o9ata
Refactored UMLPropertiesTab in order to simplify adding new widgets. Now adding new widgets is less error prone.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
namespace MonoUML.Widgets.Tabs.UMLProperties
25
25
{
26
 
        public class SlotValueViewer : MultipleObjectViewer
 
26
        public class SlotValueViewer : MultipleObjectViewer, IPropertyViewer
27
27
        {
28
28
                public SlotValueViewer(IBroadcaster hub)
29
29
                        : base (hub, GettextCatalog.GetString ("Values:")) {}
54
54
                        _hub.BroadcastElementSelection(_slot.Value[index],null);
55
55
                }
56
56
 
57
 
                public void ShowSlotValueFor(UML.Slot slot)
 
57
                public void ShowPropertyFor(UML.Element element)
58
58
                {
59
 
                        _slot = slot;
60
 
                        string[] valueList = new string[slot.Value.Count];
61
 
                        for (int i = 0; i < slot.Value.Count; i ++)
 
59
                        _slot = element as UML.Slot;
 
60
                        this.Visible = _slot != null;
 
61
                        if(_slot == null) return;
 
62
                        string[] valueList = new string[_slot.Value.Count];
 
63
                        for (int i = 0; i < _slot.Value.Count; i ++)
62
64
                        {
63
 
                                string current = slot.Value[i].ToString();
 
65
                                string current = _slot.Value[i].ToString();
64
66
                                valueList[i] = (current==null || current=="") ? "empty" : current;
65
67
                        }
66
68
                        base.ShowList(valueList);