/* * Process Method */ public override ConcreteInteractionObject Process(ListItemNode node, ConcreteInteractionObject cio, UIGenerator ui) { if (node.Decorations[ItemDecision.DECISION_KEY] == null && node is LabeledListNode && cio is PhoneListViewCIO) { // the item node represents an appliance object and it will be // contained within a list LabeledListNode newList = (LabeledListNode)node; PhoneListViewCIO list = (PhoneListViewCIO)cio; PhoneListViewCIO subList = new PhoneListViewCIO(); IPhoneListViewItem listItem = new SubListViewItemCIO(list, subList, newList.Labels); list.AddItem(listItem); newList.Decorations[ItemDecision.DECISION_KEY] = new ListItemDecision(listItem); return(subList); } return(cio); }
public UnitDecision( Decision baseDecision, ConcreteInteractionObject cio) : base(baseDecision) { _cio = cio; }
/* * Constructor */ public TwoColumnRow(PanelNode panel, ConcreteInteractionObject cio1, ConcreteInteractionObject cio2) : base(panel) { addCIO(cio1.GetLabelCIO()); addCIO(cio1); addCIO(cio2.GetLabelCIO()); addCIO(cio2); }
/* * Constructor */ public LabeledTwoCompRow(GroupNode g, PanelNode panel, LabelCIO labelCIO, ConcreteInteractionObject cio1, ConcreteInteractionObject cio2) : base(g, panel) { addCIO(labelCIO); addCIO(cio1); addCIO(cio2); }
protected ConcreteInteractionObject invokeRules(ListItemNode node, ConcreteInteractionObject cio, UIGenerator ui) { IEnumerator e = _rules.GetEnumerator(); while (e.MoveNext()) { cio = ((BuildConcreteListRule)e.Current).Process(node, cio, ui); } return(cio); }
/* * Process Method */ public override ConcreteInteractionObject Process(ListItemNode node, ConcreteInteractionObject cio, UIGenerator ui) { if (node.Decorations[ItemDecision.DECISION_KEY] == null && node is PanelListNode && cio is PhoneListViewCIO) { // the item node represents an appliance object and it will be // contained within a list PanelListNode newPanel = (PanelListNode)node; PhoneListViewCIO list = (PhoneListViewCIO)cio; ListViewItemCIO listItem = null; ConcreteInteractionObject panel = null; if (((ListNode)node).Items.Count == 1) { ConcreteInteractionObject statecio = ((CIOListItemNode)newPanel.Items[0]).CIO; if (statecio is StateLinkedCIO) { StateLinkedCIO childCIO = (StateLinkedCIO)statecio; listItem = new SingleItemPanelListViewItemCIO( list, (ApplianceState)childCIO.GetApplObj()); panel = ((SingleItemPanelListViewItemCIO)listItem).Panel; } else { listItem = new PanelListViewItemCIO(list, newPanel.Labels); panel = ((PanelListViewItemCIO)listItem).Panel; } } else { listItem = new PanelListViewItemCIO(list, newPanel.Labels); panel = ((PanelListViewItemCIO)listItem).Panel; } list.AddItem(listItem); newPanel.Decorations[ItemDecision.DECISION_KEY] = new ListItemDecision(listItem); return(panel); } return(cio); }
/* * Process Method */ public override PanelNode Process(GroupNode g, PanelNode p) { if (g.Decorations[UnitDecision.DECISION_KEY] != null) { UnitDecision unitDecision = (UnitDecision)g.Decorations[UnitDecision.DECISION_KEY]; ConcreteInteractionObject cio = unitDecision.CIO; if (((ControlBasedCIO)cio).PrefersFullWidth() && !unitDecision.Handled) { p.AddRow(new FullWidthRow(p, cio)); unitDecision.Handled = true; } } return(p); }
/* * Process Method */ public override void Process(GroupNode g, UIGenerator ui) { if (!g.IsObject()) { return; } ObjectGroupNode og = (ObjectGroupNode)g; ConcreteInteractionObject cio = ui.Core.ObjectRegistry.ChooseWidget((ApplianceObject)og.Object); if (cio != null) { g.Decorations.Add(UnitDecision.DECISION_KEY, new UnitDecision(cio)); } }
protected void processHelper(ListNode node, ConcreteInteractionObject cio, UIGenerator ui) { IEnumerator e = node.Items.GetEnumerator(); while (e.MoveNext()) { ConcreteInteractionObject newCIO = cio; ListItemNode item = (ListItemNode)e.Current; newCIO = invokeRules(item, newCIO, ui); if (item is ListNode) { processHelper((ListNode)item, newCIO, ui); } } }
/* * Process Method */ public override PanelNode Process(GroupNode g, PanelNode p) { if (g.Decorations[UnitDecision.DECISION_KEY] != null) { UnitDecision unitDecision = (UnitDecision)g.Decorations[UnitDecision.DECISION_KEY]; ConcreteInteractionObject cio = unitDecision.CIO; if (!unitDecision.Handled) { p.AddRow(new OneColumnRow(g, p, cio)); unitDecision.Handled = true; } } return(p); }
/* * Process Method */ public override ConcreteInteractionObject Process(ListItemNode node, ConcreteInteractionObject cio, UIGenerator ui) { if (node.Decorations[ItemDecision.DECISION_KEY] == null && node is StateValueListNode && cio is PhoneListViewCIO) { // the item node represents an appliance object and it will be // contained within a list StateValueListNode newList = (StateValueListNode)node; PhoneListViewCIO list = (PhoneListViewCIO)cio; PhoneListViewCIO subList = new PhoneListViewCIO(); LabelDictionary labels = null; if (newList.State.Type.ValueLabels != null) { labels = (LabelDictionary)newList.State.Type.ValueLabels[newList.Value]; } if (labels == null) { labels = new LabelDictionary(); labels.AddLabel(new StringValue(newList.Value.ToString())); } IPhoneListViewItem listItem = new SubListViewItemCIO(list, subList, labels); ItemActivationListener l = new ItemActivationListener(newList.State, newList.Value); listItem.ItemActivated += new EventHandler(l.itemActivated); list.AddItem(listItem); newList.Decorations[ItemDecision.DECISION_KEY] = new ListItemDecision(listItem); return(subList); } return(cio); }
/* * Process Method */ public override PanelNode Process(GroupNode g, PanelNode p) { if (g is BranchGroupNode) { BranchGroupNode bg = (BranchGroupNode)g; if (bg.Children.Count == 2 && !g.ContainsGroups()) { IEnumerator child = bg.Children.GetEnumerator(); while (child.MoveNext()) { if (((ObjectGroupNode)child.Current).Decorations[UnitDecision.DECISION_KEY] == null || ((UnitDecision)((ObjectGroupNode)child.Current).Decorations[UnitDecision.DECISION_KEY]).Handled || ((UnitDecision)((ObjectGroupNode)child.Current).Decorations[UnitDecision.DECISION_KEY]).CIO.HasLabel()) { return(p); } } LabelCIO labelCIO = null; if (g.Labels != null) { labelCIO = new LabelCIO(g.Labels); } UnitDecision d = (UnitDecision)((ObjectGroupNode)bg.Children[0]).Decorations[UnitDecision.DECISION_KEY]; ConcreteInteractionObject cio1 = d.CIO; d.Handled = true; d = (UnitDecision)((ObjectGroupNode)bg.Children[1]).Decorations[UnitDecision.DECISION_KEY]; ConcreteInteractionObject cio2 = d.CIO; d.Handled = true; LabeledTwoCompRow r = new LabeledTwoCompRow(g, p, labelCIO, cio1, cio2); p.AddRow(r); } } return(p); }
/* * Process Method */ public override ConcreteInteractionObject Process(ListItemNode node, ConcreteInteractionObject cio, UIGenerator ui) { if (node.Decorations[ItemDecision.DECISION_KEY] == null && node is CIOListItemNode && !((PanelDecision)node.Decorations[PanelDecision.DECISION_KEY]).IsPanel && cio is PhoneListViewCIO) { // the item node represents an appliance object and it will be // contained within a list CIOListItemNode item = (CIOListItemNode)node; PhoneListViewCIO list = (PhoneListViewCIO)cio; IPhoneListViewItem listItem = (IPhoneListViewItem)item.CIO; list.AddItem(listItem); item.Decorations[ItemDecision.DECISION_KEY] = new ListItemDecision(listItem); } return(cio); }
/* * Process Method */ public override void Process(GroupNode g, UIGenerator ui) { if (!g.IsList()) { return; } ListGroupNode lg = (ListGroupNode)g; ConcreteInteractionObject cio = ui.Core.ObjectRegistry.ChooseWidget(lg); g.Decorations.Add(ListDecision.DECISION_KEY, new ListDecision()); if (cio != null) { g.Decorations.Add(UnitDecision.DECISION_KEY, new UnitDecision(cio)); } else { // add in some components to allow the user to scroll through elements // in the list and make selections (if relevant) ApplianceState indexState = new ListIndexState(lg.Appliance, lg); ObjectGroupNode idxGrp = new ObjectGroupNode(indexState); lg.Children.Add(idxGrp); idxGrp.Parent = lg; if (lg.SelectionType == SelectionType.One) { lg.SelectionState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(((ListIndexState)indexState).SelectionChanged); } // TODO: Implement multiple selections code } }
/* * Process Method */ public override ConcreteInteractionObject Process(ListItemNode node, ConcreteInteractionObject cio, UIGenerator ui) { if (node.Decorations[ItemDecision.DECISION_KEY] == null && node is CIOListItemNode && cio is ScrollingPanelCIO) { // the item node represents an appliance object and it will be // placed on the ScrollingPanelCIO CIOListItemNode item = (CIOListItemNode)node; ScrollingPanelCIO panel = (ScrollingPanelCIO)cio; LabelDictionary labels; if (item.CIO is StateLinkedCIO) { labels = ((ApplianceState)((StateLinkedCIO)item.CIO).GetApplObj()).Labels; } else if (item.CIO is SmartCIO) { labels = ((SmartCIO)item.CIO).Labels; } // get information about the bottom of the current // panel's layout PanelLayoutDecision panelDecision = (PanelLayoutDecision)node.Parent.Decorations[PanelLayoutDecision.DECISION_KEY]; if (panelDecision == null) { // make one panelDecision = new PanelLayoutDecision(); node.Parent.Decorations.Add(PanelLayoutDecision.DECISION_KEY, panelDecision); } LabelCIO label = null; if (item.CIO.HasLabel()) { label = (LabelCIO)item.CIO.GetLabelCIO(); panel.AddCIO(label); } ControlBasedCIO control = (ControlBasedCIO)item.CIO; panel.AddCIO(control); // do some sizing here int width = ui.Size.Width - 2 * ui.LayoutVars.RowPadding - 5; if (item.CIO.HasLabel()) { // layout label CIO label.GetControl().Location = new System.Drawing.Point(ui.LayoutVars.RowPadding, panelDecision.Bottom); label.GetControl().Size = new System.Drawing.Size(width, label.GetMinimumSize().Height); panelDecision.Bottom += label.GetControl().Size.Height + ui.LayoutVars.RowPadding; label.FinalSizeNotify(); } control.GetControl().Location = new System.Drawing.Point(ui.LayoutVars.RowPadding, panelDecision.Bottom); control.GetControl().Size = new System.Drawing.Size(width, ((ControlBasedCIO)item.CIO).GetMinimumSize().Height); panelDecision.Bottom += ((ControlBasedCIO)item.CIO).GetMinimumSize().Height + 2 * ui.LayoutVars.RowPadding; item.Decorations[ItemDecision.DECISION_KEY] = new PanelItemDecision(item.CIO); } return(cio); }
/* * Constructor */ public CIOListItemNode(ConcreteInteractionObject cio) { _cio = cio; }
/* * Member Methods */ protected void addCIO(ConcreteInteractionObject cio) { _CIOs.Add(cio); }
/* * Constructor */ public UnitDecision(ConcreteInteractionObject cio) : this(null, cio) { }
/* * Member Variables */ /* * Constructor */ /* * Process Rule Method */ public abstract ConcreteInteractionObject Process(ListItemNode node, ConcreteInteractionObject cio, UIGenerator ui);
/* * Constructors */ public PanelItemDecision(ConcreteInteractionObject cio) : base() { _cio = cio; }
/* * Constructor */ public FullWidthRow(GroupNode g, PanelNode panel, ConcreteInteractionObject cio) : base(g, panel) { addCIO(cio); }
public PanelItemDecision(ConcreteInteractionObject cio, Decision rootDecision) : base(rootDecision) { _cio = cio; }
/* * Constructor */ public OneColumnRow(GroupNode g, PanelNode panel, ConcreteInteractionObject cio) : base(g, panel) { addCIO(cio.GetLabelCIO()); addCIO(cio); }