Beispiel #1
0
        /*
         * Constructors
         */

        public ImageListSmartCIO(GroupNode specSnippet)
            : base(new ThumbnailViewer(), specSnippet)
        {
            if (specSnippet.IsObject())
            {
                _imageState = (ApplianceState)_objects[SINGLE_STATE];
            }
            else
            {
                _imageState = (ApplianceState)_objects[IMAGE_STATE_NAME];

                // look for labels in state if none were found in group
                if (_labels == null)
                {
                    _labels = _imageState.Labels;
                }
            }

            // move template group above list-group
            ((BranchGroupNode)_specSnippet).Children.Remove(_templateGroup);

            int parentIdx = _specSnippet.Parent.Children.IndexOf(_specSnippet, 0, _specSnippet.Parent.Count);

            if (parentIdx < 0)
            {
                parentIdx = 0;
            }

            _specSnippet.Parent.Children.Insert(parentIdx + 1, _templateGroup);
            _templateGroup.Parent = _specSnippet.Parent;

            // add labels to template and list groups
            LabelDictionary ldict = new LabelDictionary();

            ldict.AddLabel(new StringValue("Detail View"));
            _specSnippet.Labels = ldict;

            ldict = new LabelDictionary();
            ldict.AddLabel(new StringValue("Thumbnails"));
            _templateGroup.Labels = ldict;

            // register event handlers
            ((ListGroupNode)_specSnippet).SelectionState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(SelectionChanged);
            ((ThumbnailViewer)_control).SelectedIndexChanged += new EventHandler(SelectedIndexChanged);

            _imageState.VariableTable.BinaryDataChanged += new PUC.VariableTable.BinaryEventHandler(VariableTable_BinaryDataChanged);
        }
Beispiel #2
0
        /*
         * 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);
        }