Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        /*
         * Constructor
         */

        public TabbedOverlappingPanelsNode(ApplianceState state)
        {
            TabbedLinkedCIO tabPanel = new TabbedLinkedCIO(state);

            _tabbedPanel = tabPanel;
            _tabNodes    = new ArrayList();

            EnumeratedSpace espc = (EnumeratedSpace)state.Type.ValueSpace;

            for (int i = 1; i <= espc.GetItemCount(); i++)
            {
                TabbedPanelCIO p = (TabbedPanelCIO)tabPanel.GetContainerByValue(i);

                TabPanelNode tp = new TabPanelNode(p, null);
                _tabNodes.Add(tp);
                AddPanel(tp);
            }
        }
Exemplo n.º 3
0
        /*
         * Process Method
         */

        public override ListNode Process(GroupNode g, ListNode list)
        {
            // look for MutualExclusionDecisions

            object o = g.Decorations[MutualExclusionDecision.DECISION_KEY];

            if (o != null && o is MutualExclusionDecision)
            {
                MutualExclusionDecision d = (MutualExclusionDecision)o;

                if (!d.Handled &&
                    d.State.Type.ValueSpace is EnumeratedSpace)
                {
                    EnumeratedSpace espc = (EnumeratedSpace)d.State.Type.ValueSpace;

                    if (espc.GetItemCount() == (d.DependencySets.Count - 1))
                    {
                        for (int i = 1; i < d.DependencySets.Count; i++)
                        {
                            ArrayList dep = (ArrayList)d.DependencySets[i];

                            if (dep.Count != 1)
                            {
                                // Globals.AddLogLine("size! " + dep.Count );
                                return(list);
                            }
                            if (!(dep[0] is EqualsDependency))
                            {
                                // Globals.AddLogLine("not equals!");
                                return(list);
                            }
                        }
                    }
                    else
                    {
                        return(list);
                    }

                    // we need a pointer to the GroupNode that contains the state
                    // variable that we are looking at (because tree manipulations
                    // will need to use it)

                    ObjectGroupNode stateGroup = null;

                    BranchGroupNode bg = (BranchGroupNode)g;
                    IEnumerator     e  = bg.Children.GetEnumerator();
                    while (e.MoveNext())
                    {
                        if (e.Current is ObjectGroupNode &&
                            ((ObjectGroupNode)e.Current).Object == d.State)
                        {
                            stateGroup = (ObjectGroupNode)e.Current;
                            break;
                        }
                    }

                    // re-order the tree

                    ArrayList childOrder = new ArrayList();

                    bg.Children.Remove(stateGroup);

                    BranchGroupNode midG = new BranchGroupNode();

                    midG.Children = bg.Children;
                    e             = midG.Children.GetEnumerator();
                    while (e.MoveNext())
                    {
                        ((GroupNode)e.Current).Parent = midG;
                    }

                    bg.Children = new ArrayList();

                    ArrayList dset = (ArrayList)d.ChildSets[0];
                    if (dset.Count > 0)
                    {
                        e = dset.GetEnumerator();
                        while (e.MoveNext())
                        {
                            GroupNode c = (GroupNode)e.Current;

                            c.Parent = bg;

                            midG.Children.Remove(c);
                            bg.Children.Add(c);
                        }
                    }

                    bg.Children.Add(midG);
                    midG.Parent       = bg;
                    stateGroup.Parent = bg;

                    for (int i = 1; i < d.ChildSets.Count; i++)
                    {
                        dset = (ArrayList)d.ChildSets[i];

                        if (dset.Count > 1)
                        {
                            BranchGroupNode newG = new BranchGroupNode();

                            newG.Parent = midG;

                            e = dset.GetEnumerator();
                            while (e.MoveNext())
                            {
                                GroupNode c = (GroupNode)e.Current;

                                c.Parent = newG;

                                midG.Children.Remove(c);
                                newG.Children.Add(c);
                            }

                            childOrder.Insert(i - 1, newG);
                        }
                        else if (dset.Count == 0)
                        {
                            BranchGroupNode newG = new BranchGroupNode();

                            newG.Parent = midG;
                            midG.Children.Add(newG);

                            childOrder.Insert(i - 1, newG);
                        }
                        else
                        {
                            childOrder.Insert(i - 1, dset[0]);
                        }
                    }

                    d.DependencySets.RemoveAt(0);

                    // now create StateValueListNodes from the re-orged group tree
                    // these nodes will be picked up by an additional rule later
                    // in the generation process
                    StateValueListNode newList = null;
                    for (int i = 0; i < childOrder.Count; i++)
                    {
                        GroupNode group   = (GroupNode)childOrder[i];
                        ArrayList aryDeps = (ArrayList)d.DependencySets[i];

                        EqualsDependency eqDep = (EqualsDependency)aryDeps[0];

                        newList = new StateValueListNode(d.State, eqDep.Value);
                        list.Add(newList);

                        group.Decorations.Add(ListNodeDecision.DECISION_KEY, new ListNodeDecision(newList, d));
                    }

                    d.Handled = true;
                }
            }

            return(list);
        }
Exemplo n.º 4
0
        /*
         * Process Method
         */

        public override void Process(GroupNode g, UIGenerator ui)
        {
            // look for MutualExclusionDecisions

            object o = g.Decorations[MutualExclusionDecision.DECISION_KEY];

            if (o != null && o is MutualExclusionDecision)
            {
                MutualExclusionDecision d = (MutualExclusionDecision)o;

                if (!d.Handled &&
                    d.State.Type.ValueSpace is EnumeratedSpace)
                {
                    object          stateval = d.State.Value;
                    EnumeratedSpace espc     = (EnumeratedSpace)d.State.Type.ValueSpace;

                    if (espc.GetItemCount() == (d.DependencySets.Count - 1))
                    {
                        for (int i = 1; i < d.DependencySets.Count; i++)
                        {
                            ArrayList dep = (ArrayList)d.DependencySets[i];

                            if (dep.Count != 1)
                            {
                                // Globals.AddLogLine("size! " + dep.Count );
                                return;
                            }
                            if (!(dep[0] is EqualsDependency))
                            {
                                // Globals.AddLogLine("not equals!");
                                return;
                            }
                        }
                    }
                    else
                    {
                        return;
                    }

                    // we need a pointer to the GroupNode that contains the state
                    // variable that we are looking at (because tree manipulations
                    // will need to use it)

                    ObjectGroupNode stateGroup = null;
                    BranchGroupNode bg         = (BranchGroupNode)g;

                    IEnumerator e = bg.Children.GetEnumerator();
                    while (e.MoveNext())
                    {
                        if (((GroupNode)e.Current).IsObject() &&
                            ((ObjectGroupNode)e.Current).Object == d.State)
                        {
                            stateGroup = (ObjectGroupNode)e.Current;
                            break;
                        }
                    }

                    // re-order the tree

                    ArrayList childOrder = new ArrayList();

                    bg.Children.Remove(stateGroup);

                    BranchGroupNode midG = new BranchGroupNode();

                    midG.Children = bg.Children;
                    e             = midG.Children.GetEnumerator();
                    while (e.MoveNext())
                    {
                        ((GroupNode)e.Current).Parent = midG;
                    }

                    bg.Children = new ArrayList();

                    ArrayList dset = (ArrayList)d.ChildSets[0];
                    if (dset.Count > 0)
                    {
                        e = dset.GetEnumerator();
                        while (e.MoveNext())
                        {
                            GroupNode c = (GroupNode)e.Current;

                            c.Parent = bg;

                            midG.Children.Remove(c);
                            bg.Children.Add(c);
                        }
                    }

                    bg.Children.Add(midG);
                    midG.Parent       = bg;
                    stateGroup.Parent = bg;

                    for (int i = 1; i < d.ChildSets.Count; i++)
                    {
                        dset = (ArrayList)d.ChildSets[i];

                        if (dset.Count > 1)
                        {
                            BranchGroupNode newG = new BranchGroupNode();
                            newG.Parent = midG;

                            e = dset.GetEnumerator();
                            while (e.MoveNext())
                            {
                                GroupNode c = (GroupNode)e.Current;

                                c.Parent = newG;

                                midG.Children.Remove(c);
                                newG.Children.Add(c);
                            }

                            childOrder.Insert(i - 1, newG);
                        }
                        else if (dset.Count == 0)
                        {
                            BranchGroupNode newG = new BranchGroupNode();

                            newG.Parent   = midG;
                            newG.Children = new ArrayList();

                            midG.Children.Add(newG);

                            childOrder.Insert(i - 1, newG);
                        }
                        else
                        {
                            childOrder.Insert(i - 1, dset[0]);
                        }
                    }

                    d.DependencySets.RemoveAt(0);

                    OrganizationDecision newDecision = new TabbedOverlapOrgDecision(d, ui, d.State, childOrder, d.DependencySets, true);
                    midG.Decorations.Add(OrganizationDecision.DECISION_KEY, newDecision);

                    d.Handled = true;
                }
            }
        }