Пример #1
0
        protected BranchGroupNode findInTree(GroupNode g,
                                             ApplianceObject ao)
        {
            // if a unit has been found the represents this portion of the
            // group tree, then don't search for mutual exclusion within it
            // (any such relationships will presumably be handled by the
            //  the custom CIO)
            if (g.Decorations[UnitDecision.DECISION_KEY] != null)
            {
                return(null);
            }

            if (g.IsObject())
            {
                if (((ObjectGroupNode)g).Object == ao)
                {
                    return(g.Parent);
                }
            }
            else
            {
                IEnumerator e = ((BranchGroupNode)g).Children.GetEnumerator();
                while (e.MoveNext())
                {
                    BranchGroupNode br = findInTree((GroupNode)e.Current, ao);
                    if (br != null)
                    {
                        return(br);
                    }
                }
            }

            return(null);
        }
Пример #2
0
        protected ArrayList collectDependency(GroupNode g,
                                              ApplianceState state)
        {
            if (g.IsObject())
            {
                ApplianceObject obj = ((ObjectGroupNode)g).Object;

                if (obj == state)
                {
                    return(new ArrayList());
                }

                return(getDependenciesOfState(state, obj));
            }
            else
            {
                ArrayList results = new ArrayList();

                IEnumerator e = ((BranchGroupNode)g).Children.GetEnumerator();
                while (e.MoveNext())
                {
                    results.AddRange(collectDependency((GroupNode)e.Current, state));
                }

                return(results);
            }
        }
Пример #3
0
        /*
         * Member Variables
         */


        /*
         * Constructor
         */

        public ExplanationCIO(ApplianceObject ao)
            : base(ao, new Label())
        {
            ((Label)GetControl()).TextAlign = System.Drawing.ContentAlignment.TopCenter;

            refreshDisplay();
        }
Пример #4
0
 protected void labelChanged(ApplianceObject o)
 {
     if (Changed != null)
     {
         Changed(this, new EventArgs());
     }
 }
Пример #5
0
        /*
         * Member Methods
         */
        public override PUC.CIO.ConcreteInteractionObject ChooseWidget(
            ApplianceObject ao)
        {
            ApplianceState state = (ApplianceState)ao;
            Decision       d     = null;

            switch (state.Type.ValueSpace.Space)
            {
            case PUC.Types.ValueSpace.BOOLEAN_SPACE:
                if (state.Type.ValueLabels != null &&
                    state.Type.ValueLabels.Count == 2)
                {
                    d = (Decision)_choices[TRUE];
                }
                else
                {
                    d = (Decision)_choices[FALSE];
                }
                break;

            default:
                d = (Decision)_choices[FALSE];
                break;
            }

            if (d != null)
            {
                return(d.ChooseWidget(ao));
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        private ObjectGroupNode findObjectGroup(GroupNode g, ApplianceObject ao)
        {
            // + 1 to get rid of separatorChar
            String relName = ao.FullName.Substring(g.FullPath.Length + 1);

            String[] names = relName.Split(VariableTable.NAME_SEPARATORS);

            bool      found;
            GroupNode cursor = g;
            GroupNode newG   = null;

            for (int i = 0; i < names.Length; i++)
            {
                found = false;

                IEnumerator e = ((BranchGroupNode)cursor).Children.GetEnumerator();
                while (e.MoveNext())
                {
                    newG = (GroupNode)e.Current;
                    if (newG.Name == names[i])
                    {
                        cursor = newG;
                        found  = true;
                        break;
                    }
                }

                if (!found)
                {
                    return(null);
                }
            }

            return((ObjectGroupNode)cursor);
        }
Пример #7
0
        /*
         * Member Methods
         */
        public override PUC.CIO.ConcreteInteractionObject ChooseWidget(
            ApplianceObject ao)
        {
            Decision d = null;

            if (ao.State)
            {
                d = (Decision)_choices[STATE];
            }
            else if (ao.Explanation)
            {
                d = (Decision)_choices[EXPLANATION];
            }
            else
            {
                d = (Decision)_choices[COMMAND];
            }

            if (d == null)
            {
                d = (Decision)_choices[DEFAULT];
            }

            if (d != null)
            {
                return(d.ChooseWidget(ao));
            }
            else
            {
                return(null);
            }
        }
Пример #8
0
        /*
         * Event Handler
         */

        public void ValueChanged(ApplianceState state)
        {
            IEnumerator e = _depObjs.GetEnumerator();

            while (e.MoveNext())
            {
                ApplianceObject obj = (ApplianceObject)e.Current;
                obj.EvalDependencies();
            }
        }
Пример #9
0
        /*
         * Member Methods
         */
        public override PUC.CIO.ConcreteInteractionObject ChooseWidget(
            ApplianceObject ao)
        {
            PUC.CIO.ConcreteInteractionObject.CreateCIO fptr = PUC.CIO.ConcreteInteractionObject.GetCIOFactory(_widgetName);
            if (fptr == null)
            {
                return(null);
            }

            return(fptr(ao));
        }
Пример #10
0
        /*
         * Member Variables
         */

        /*
         * Constructor
         */

        public LabelLinkedCIO(ApplianceObject ao)
            : base(ao, new Label())
        {
            ApplianceState state = (ApplianceState)ao;

            state.EnableChangedEvent += new ApplianceObject.EnableChangedHandler(this.EnableChanged);
            state.LabelChangedEvent  += new ApplianceObject.LabelChangedHandler(this.LabelChanged);
            state.TypeChangedEvent   += new ApplianceState.TypeChangedHandler(this.TypeChanged);
            state.ValueChangedEvent  += new ApplianceState.ValueChangedHandler(this.ValueChanged);

            refreshDisplay();
        }
Пример #11
0
        /*
         * Constructor
         */
        public TabbedLinkedCIO(ApplianceObject ao)
            : base(ao, new System.Windows.Forms.Panel())
        {
            ApplianceState state = (ApplianceState)GetApplObj();
            Panel          panel = (Panel)GetControl();

            _tabControl = new TabControl();
            panel.Controls.Add(_tabControl);

            _tabControl.Location = new System.Drawing.Point(0, 0);
            _tabControl.Size     = panel.ClientSize;

            panel.Resize += new EventHandler(this.Resized);

            _panelCIOs = new ArrayList();

            object          stateval = state.Value;
            EnumeratedSpace espc     = (EnumeratedSpace)state.Type.ValueSpace;
            Hashtable       labels   = state.Type.ValueLabels;

            int labelWidth = _tabControl.ClientSize.Width / espc.GetItemCount();

            for (int i = 1; i <= espc.GetItemCount(); i++)
            {
                object          labelSpace = i;
                LabelDictionary ldict      = (LabelDictionary)labels[labelSpace];

                TabbedPanelCIO pageCIO = new TabbedPanelCIO(ldict);

                TabPage page = pageCIO.TabPage;
                page.Enabled = ldict.Enabled;

                _tabControl.Controls.Add(page);
                _panelCIOs.Add(pageCIO);

                pageCIO.ChooseLabel(labelWidth - 2 * MINIMUM_TAB_PAD);

                if (state.Defined && i == (int)stateval)
                {
                    _tabControl.SelectedIndex = i - 1;
                }
            }

            state.LabelChangedEvent  += new ApplianceObject.LabelChangedHandler(this.LabelChanged);
            state.EnableChangedEvent += new ApplianceObject.EnableChangedHandler(this.EnableChanged);
            state.TypeChangedEvent   += new ApplianceState.TypeChangedHandler(this.TypeChanged);
            state.ValueChangedEvent  += new ApplianceState.ValueChangedHandler(this.ValueChanged);

            _tabControl.SelectedIndexChanged += new EventHandler(this.SelectedIndexChanged);

            refreshDisplay();
        }
Пример #12
0
        /*
         * Member Methods
         */
        public override PUC.CIO.ConcreteInteractionObject ChooseWidget(
            ApplianceObject ao)
        {
            Decision d = (Decision)_choices[FALSE];

            if (d != null)
            {
                return(d.ChooseWidget(ao));
            }
            else
            {
                return(null);
            }
        }
Пример #13
0
        /*
         * Member Variables
         */

        /*
         * Constructor
         */

        public CheckboxLinkedCIO(ApplianceObject ao)
            : base(ao, new CheckBox())
        {
            ApplianceState state = (ApplianceState)ao;

            state.EnableChangedEvent += new ApplianceObject.EnableChangedHandler(this.EnableChanged);
            state.LabelChangedEvent  += new ApplianceObject.LabelChangedHandler(this.LabelChanged);
            state.TypeChangedEvent   += new ApplianceState.TypeChangedHandler(this.TypeChanged);
            state.ValueChangedEvent  += new ApplianceState.ValueChangedHandler(this.ValueChanged);

            GetControl().Click += new EventHandler(this.StateClick);

            refreshDisplay();
        }
Пример #14
0
        /*
         * Constructor
         */
        public TextFieldLinkedCIO(ApplianceObject ao)
            : base(ao, new System.Windows.Forms.TextBox())
        {
            ApplianceState state = (ApplianceState)GetApplObj();

            _sentValues = new Hashtable();

            state.LabelChangedEvent  += new ApplianceObject.LabelChangedHandler(this.LabelChanged);
            state.EnableChangedEvent += new ApplianceObject.EnableChangedHandler(this.EnableChanged);
            state.TypeChangedEvent   += new ApplianceState.TypeChangedHandler(this.TypeChanged);
            state.ValueChangedEvent  += new ApplianceState.ValueChangedHandler(this.ValueChanged);

            ((TextBox)GetControl()).TextChanged += new EventHandler(this.TextChanged);

            refreshType();
        }
Пример #15
0
        protected void doNotRenderObject(ApplianceObject ao)
        {
            ObjectGroupNode objGrp = null;

            // find the object
            if (_specSnippet.IsObject() &&
                ((ObjectGroupNode)_specSnippet).Object == ao)
            {
                objGrp = (ObjectGroupNode)_specSnippet;
            }
            else
            {
                // find the object group that contains ao
                objGrp = findObjectGroup(_specSnippet, ao);
            }

            objGrp.Parent.Children.Remove(objGrp);
            _templateGroup.Children.Add(objGrp);
            objGrp.Parent = _templateGroup;
        }
Пример #16
0
        /*
         * Member Methods
         */
        public override PUC.CIO.ConcreteInteractionObject ChooseWidget(
            ApplianceObject ao)
        {
            ApplianceState state = (ApplianceState)ao;

            PUC.Types.ValueSpace vs = state.Type.ValueSpace;

            Decision d = null;

            if (vs.Space == PUC.Types.ValueSpace.INTEGER_SPACE &&
                ((PUC.Types.IntegerSpace)vs).IsRanged())
            {
                d = (Decision)_choices[TRUE];
            }

            else if (vs.Space == PUC.Types.ValueSpace.FIXED_PT_SPACE &&
                     ((PUC.Types.FixedPtSpace)vs).IsRanged())
            {
                d = (Decision)_choices[TRUE];
            }

            else if (vs.Space == PUC.Types.ValueSpace.FLOATING_PT_SPACE &&
                     ((PUC.Types.FloatingPtSpace)vs).IsRanged())
            {
                d = (Decision)_choices[TRUE];
            }

            else
            {
                d = (Decision)_choices[FALSE];
            }

            if (d != null)
            {
                return(d.ChooseWidget(ao));
            }
            else
            {
                return(null);
            }
        }
Пример #17
0
        /*
         * Constructor
         */
        public SelectionListLinkedCIO(ApplianceObject ao)
            : base(ao, new System.Windows.Forms.ComboBox())
        {
            ApplianceState state = (ApplianceState)GetApplObj();

            ComboBox cbox = (ComboBox)GetControl();

            cbox.DropDownStyle = ComboBoxStyle.DropDownList;

            _itemIndexMap = new Hashtable();
            _indexItemMap = new Hashtable();

            state.LabelChangedEvent  += new ApplianceObject.LabelChangedHandler(this.LabelChanged);
            state.EnableChangedEvent += new ApplianceObject.EnableChangedHandler(this.EnableChanged);
            state.TypeChangedEvent   += new ApplianceState.TypeChangedHandler(this.TypeChanged);
            state.ValueChangedEvent  += new ApplianceState.ValueChangedHandler(this.ValueChanged);

            ((ComboBox)GetControl()).SelectedIndexChanged += new EventHandler(this.SelectedIndexChanged);

            refreshDisplay();
        }
Пример #18
0
        /*
         * Member Methods
         */
        public override PUC.CIO.ConcreteInteractionObject ChooseWidget(
            ApplianceObject ao)
        {
            ApplianceState state = (ApplianceState)ao;

            Decision d = (Decision)_choices[state.Type.ValueSpace.Name];

            if (d == null)
            {
                d = (Decision)_choices[DEFAULT];
            }

            if (d != null)
            {
                return(d.ChooseWidget(ao));
            }
            else
            {
                return(null);
            }
        }
Пример #19
0
        /*
         * Member Methods
         */
        public override PUC.CIO.ConcreteInteractionObject ChooseWidget(
            ApplianceObject ao)
        {
            ApplianceState state = (ApplianceState)ao;
            Decision       d     = null;

            if (state.ReadOnly)
            {
                d = (Decision)_choices[TRUE];
            }
            else
            {
                d = (Decision)_choices[FALSE];
            }

            if (d != null)
            {
                return(d.ChooseWidget(ao));
            }
            else
            {
                return(null);
            }
        }
Пример #20
0
        /*
         * Constructor
         */
        public ButtonLinkedCIO(ApplianceObject ao)
            : base(ao, new System.Windows.Forms.Button())
        {
            GetControl().Font = new System.Drawing.Font(GetControl().Font.Name, GetControl().Font.Size, System.Drawing.FontStyle.Regular);

            ao.LabelChangedEvent  += new ApplianceObject.LabelChangedHandler(this.LabelChanged);
            ao.EnableChangedEvent += new ApplianceObject.EnableChangedHandler(this.EnableChanged);

            if (ao is ApplianceState)
            {
                ApplianceState state = (ApplianceState)ao;

                state.TypeChangedEvent  += new ApplianceState.TypeChangedHandler(this.TypeChanged);
                state.ValueChangedEvent += new ApplianceState.ValueChangedHandler(this.ValueChanged);

                GetControl().Click += new EventHandler(this.StateClick);
            }
            else
            {
                GetControl().Click += new EventHandler(this.CommandClick);
            }

            refreshDisplay();
        }
Пример #21
0
        /*
         * Dynamic Loading Code
         */

        public static ConcreteInteractionObject CreateCommandListViewItemCIO(ApplianceObject ao)
        {
            return(new CommandListViewItemCIO((ApplianceCommand)ao));
        }
Пример #22
0
        /*
         * Dynamic Loading Code
         */

        public static ConcreteInteractionObject CreateCheckboxLinkedCIO(ApplianceObject ao)
        {
            return(new CheckboxLinkedCIO(ao));
        }
Пример #23
0
        /* Ascent line at TOP_PAD.  Label is centered within button,
         * but horizontally and vertically.
         */


        /*
         * Dynamic Loading Code
         */

        public static ConcreteInteractionObject CreateButtonLinkedCIO(ApplianceObject ao)
        {
            return(new ButtonLinkedCIO(ao));
        }
Пример #24
0
 protected ArrayList getDependenciesOfState(ApplianceState state,
                                            ApplianceObject obj)
 {
     return(getDepsOfStateHelper(state, obj.Dependencies));
 }
Пример #25
0
        /*
         * Event Handlers
         */

        public void LabelChanged(ApplianceObject ao)
        {
            refreshDisplay();
        }
Пример #26
0
 private void PrevTrack_EnableChangedEvent(ApplianceObject o)
 {
     ((PhoneMediaControls)GetControl()).PrevTrackEnabled = o.Enabled;
 }
Пример #27
0
 public void EnableChanged(ApplianceObject ao)
 {
     GetControl().Enabled = ao.Enabled;
 }
Пример #28
0
        /*
         * Dynamic Loading Code
         */

        public static ConcreteInteractionObject CreateStateListViewItemCIO(ApplianceObject ao)
        {
            return(new StateListViewItemCIO((ApplianceState)ao));
        }
Пример #29
0
 /*
  * Member Methods
  */
 public override PUC.CIO.ConcreteInteractionObject ChooseWidget(
     ApplianceObject ao)
 {
     return(null);
 }
Пример #30
0
        /*
         * Constructor
         */

        public ObjectListItemNode(ApplianceObject obj)
        {
            _object = obj;
        }