Пример #1
0
        /*
         * Process Method
         */

        public override ListNode Process(GroupNode group, ListNode list)
        {
            if (group.Decorations[UnitDecision.DECISION_KEY] != null)
            {
                // get the values that we need
                UnitDecision decision =
                    (UnitDecision)group.Decorations[UnitDecision.DECISION_KEY];

                CIOListItemNode item = new CIOListItemNode(decision.CIO);
                item.Decorations[GroupDecision.DECISION_KEY] =
                    new GroupDecision(group);

                // determine whether this CIO should be on a panel
                bool onPanel = decision.CIO is ControlBasedCIO;

                item.Decorations[PanelDecision.DECISION_KEY] =
                    new PanelDecision(decision, onPanel);

                if (onPanel)
                {
                    LabelDictionary labels;
                    if (decision.CIO is SmartCIO)
                    {
                        labels = ((SmartCIO)decision.CIO).Labels;
                    }
                    else
                    {
                        labels = ((ApplianceState)((StateLinkedCIO)decision.CIO).GetApplObj()).Labels;
                    }

                    if (labels != null)
                    {
                        PanelListNode pNode = new PanelListNode(labels);
                        pNode.Add(item);
                        list.Add(pNode);
                    }
                }
                else
                {
                    list.Add(item);
                }
            }

            return(list);
        }
Пример #2
0
        /*
         * 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);
        }
Пример #3
0
        /*
         * 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);
        }