Ejemplo n.º 1
0
        public override void CalculateMinimumSize(LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            System.Drawing.Size cioSize = stateCIO.GetMinimumSize();

            if (_parent.IsVertical())
            {
                _minSize = cioSize;

                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    System.Drawing.Size labelSize = labelCIO.GetMinimumSize();

                    _minSize.Height += labelSize.Height + vars.RowPadding;
                    _minSize.Width   = Math.Max(_minSize.Width, labelSize.Width);
                }
            }
            else
            {
                _minSize.Height = cioSize.Height;
                _minSize.Width  = vars.RowPadding +
                                  (int)Math.Ceiling(cioSize.Width / (1.0 - vars.OneColLabelPcnt));

                if (labelCIO != null)
                {
                    _minSize.Height = Math.Max(_minSize.Height, labelCIO.GetMinimumSize().Height);
                }
            }
        }
Ejemplo n.º 2
0
        /*
         * Member Methods
         */

        public override void AddComponents(ContainerCIO container, LayoutVariables vars)
        {
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            container.AddCIO(stateCIO);

            _maxTextOffset = stateCIO.GetControlOffset().Y;
            this.CalculateMinimumSize(vars);
            this.CalculatePreferredSize(vars);
        }
Ejemplo n.º 3
0
        public static ControlBasedCIO[] GetArrayFromArrayList(ArrayList cios)
        {
            ControlBasedCIO[] ary = new ControlBasedCIO[cios.Count];
            for (int i = 0; i < cios.Count; i++)
            {
                ary[i] = (ControlBasedCIO)cios[i];
            }

            return(ary);
        }
Ejemplo n.º 4
0
        public override void DoLayout(ContainerCIO container, LayoutVariables vars)
        {
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            System.Windows.Forms.Control control = stateCIO.GetControl();
            control.Bounds = this.GetBounds();

            if (stateCIO is LabelLinkedCIO)
            {
                ((Label)control).TextAlign = System.Drawing.ContentAlignment.TopCenter;
            }
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
        public override void CalculatePreferredSize(LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            PreferredSize cioSize = stateCIO.GetPreferredSize();
            int           prefWidth = cioSize.Width, prefHeight = cioSize.Height;

            if (_parent.IsVertical())
            {
                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    PreferredSize labelSize = labelCIO.GetPreferredSize();

                    if (prefHeight != PreferredSize.INFINITE)
                    {
                        prefHeight += labelSize.Height + vars.RowPadding;
                    }

                    if (prefWidth != PreferredSize.INFINITE)
                    {
                        prefWidth = Math.Max(prefWidth, labelSize.Width);
                    }
                }
            }
            else
            {
                if (prefWidth != PreferredSize.INFINITE)
                {
                    prefWidth = vars.RowPadding +
                                (int)Math.Ceiling(prefWidth / (1.0 - vars.OneColLabelPcnt));
                }

                if (labelCIO != null && prefHeight != PreferredSize.INFINITE)
                {
                    prefHeight = Math.Max(labelCIO.GetPreferredSize().Height, prefHeight);
                }
            }

            _prefSize = new PreferredSize(prefWidth, prefHeight);
        }
Ejemplo n.º 7
0
        /*
         * Member Methods
         */

        public override void AddComponents(ContainerCIO container, LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            container.AddCIO(labelCIO);
            container.AddCIO(stateCIO);

            if (labelCIO != null)
            {
                _maxTextOffset = Math.Max(labelCIO.GetControlOffset().Y, stateCIO.GetControlOffset().Y);
            }
            else
            {
                _maxTextOffset = stateCIO.GetControlOffset().Y;
            }

            this.CalculateMinimumSize(vars);
            this.CalculatePreferredSize(vars);
        }
Ejemplo n.º 8
0
        public TabbedOverlappingPanelsNode(BranchGroupNode g)
        {
            _tabbedPanel = new TabbedPanelsCIO();
            _tabNodes    = new ArrayList();

            _groupToTabMap = new Hashtable();

            IEnumerator e = g.Children.GetEnumerator();

            while (e.MoveNext())
            {
                TabbedPanelCIO p = new TabbedPanelCIO(((GroupNode)e.Current).Labels);
                ((TabbedPanelsCIO)_tabbedPanel).AddTab(p);

                TabPanelNode tp = new TabPanelNode(p, (GroupNode)e.Current);
                _groupToTabMap[e.Current] = tp;
                _tabNodes.Add(tp);
                AddPanel(tp);

                ((GroupNode)e.Current).Decorations[PanelDecision.DECISION_KEY] =
                    new PanelDecision((PanelNode)tp.GetChildNode());
            }
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        public override void CalculatePreferredSize(LayoutVariables vars)
        {
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            this.PreferredSize = stateCIO.GetPreferredSize();
        }
Ejemplo n.º 11
0
        public override void DoLayout(ContainerCIO container, LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            System.Windows.Forms.Label label = null;
            Control control = stateCIO.GetControl();
            int     topY    = 0;

            if (_parent.IsVertical())
            {
                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    label = (Label)labelCIO.GetControl();
                    labelCIO.SetAlignment(System.Drawing.ContentAlignment.TopCenter);
                    label.Size     = new System.Drawing.Size(_bounds.Width, labelCIO.GetMinimumSize().Height);
                    label.Location = new System.Drawing.Point(_bounds.X, _bounds.Y);
                    labelCIO.SetLabelText();

                    topY = label.Size.Height + vars.RowPadding;
                }

                if (stateCIO is LabelLinkedCIO)
                {
                    ((Label)control).TextAlign = System.Drawing.ContentAlignment.TopCenter;
                }

                int[] size = LayoutAlgorithms.AllocateSizeValues(
                    _bounds.Height - topY,
                    new int[1] {
                    stateCIO.GetMinimumSize().Height
                },
                    new int[1] {
                    stateCIO.GetPreferredSize().Height
                },
                    vars.RowPadding);

                control.Size     = new System.Drawing.Size(_bounds.Width, size[0]);
                control.Location = new System.Drawing.Point(_bounds.X, _bounds.Y + topY);
            }
            else
            {
                int labelWidth = (int)Math.Round(vars.OneColLabelPcnt * (_bounds.Width - vars.RowPadding));
                int compWidth  = _bounds.Width - labelWidth - vars.RowPadding;

                int[] textOffsets =
                    LayoutAlgorithms.GetTextHeightOffsets(LayoutAlgorithms.GetArrayFromArrayList(_CIOs));

                control.Size     = new System.Drawing.Size(compWidth, _bounds.Height);
                control.Location = new System.Drawing.Point(_bounds.X + labelWidth + vars.RowPadding,
                                                            _bounds.Y + textOffsets[1]);

                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    label           = (Label)labelCIO.GetControl();
                    label.TextAlign = System.Drawing.ContentAlignment.TopRight;
                    label.Size      = new System.Drawing.Size(labelWidth, _bounds.Height - textOffsets[0]);
                    label.Location  = new System.Drawing.Point(_bounds.X, _bounds.Y + textOffsets[0]);
                    labelCIO.SetLabelText();
                }
            }
        }