Computes dimensions of the children widgets that are useful for the
group layout managers.
352430
protected DimenInfo computeDimens (Container parent, int type) {
        int count = parent.getComponentCount();
        DimenInfo info = new DimenInfo();
        info.dimens = new Dimension[count];

        for (int i = 0; i < count; i++) {
            Component child = parent.getComponent(i);
            if (!child.isVisible()) {
                continue;
            }

            Dimension csize;
            switch  (type) {
            case MINIMUM:
                csize = child.getMinimumSize();
                break;

            case MAXIMUM:
                csize = child.getMaximumSize();
                break;

            default:
                csize = child.getPreferredSize();
                break;
            }

            info.count++;
            info.totwid += csize.width;
            info.tothei += csize.height;

            if (csize.width > info.maxwid) {
                info.maxwid = csize.width;
            }
            if (csize.height > info.maxhei) {
                info.maxhei = csize.height;
            }

            Constraints c = getConstraints(child);
            if (c.isFixed()) {
                info.fixwid += csize.width;
                info.fixhei += csize.height;
                info.numfix++;

            } else {
                info.totweight += c.getWeight();

                if (csize.width > info.maxfreewid) {
                    info.maxfreewid = csize.width;
                }
                if (csize.height > info.maxfreehei) {
                    info.maxfreehei = csize.height;
                }
            }

            info.dimens[i] = csize;
        }

        return info;
    }
492369
def _do_layout(self):
        """"""

        sizer_csvoptions = wx.FlexGridSizer(5, 4, 5, 5)

        # Adding parameter widgets to sizer_csvoptions
        leftpos = wx.LEFT | wx.ADJUST_MINSIZE
        rightpos = wx.RIGHT | wx.EXPAND

        current_label_margin = 0  # smaller for left column
        other_label_margin = 15

        for label, widget in zip(self.param_labels, self.param_widgets):
            sizer_csvoptions.Add(label, 0, leftpos, current_label_margin)
            sizer_csvoptions.Add(widget, 0, rightpos, current_label_margin)

            current_label_margin, other_label_margin = \
                other_label_margin, current_label_margin

        sizer_csvoptions.AddGrowableCol(1)
        sizer_csvoptions.AddGrowableCol(3)

        self.sizer_csvoptions = sizer_csvoptions
685513
def make_horizontal_box(cls, children, layout=Layout()):
        ""
        return widgets.HBox(children, layout=layout)
232064
def dimensions
      height = self.count
      width = self.collect{|a| a.length}.max
      [width,height]
    end
286002
def autoLayout(self, size):
        
        # update the children alignment
        direction = self.property('direction', QtGui.QBoxLayout.TopToBottom)
        x = 0
        y = 0
        base_off_x = 0
        base_off_y = 0
        
        for i, child in enumerate(self.childItems()):
            off_x = 6 + child.boundingRect().width()
            off_y = 6 + child.boundingRect().height()
            
            if direction == QtGui.QBoxLayout.TopToBottom:
                child.setPos(x, y)
                y += off_y
            
            elif direction == QtGui.QBoxLayout.BottomToTop:
                y -= off_y
                child.setPos(x, y)
                if not base_off_y:
                    base_off_y = off_y
            
            elif direction == QtGui.QBoxLayout.LeftToRight:
                child.setPos(x, y)
                x += off_x
                
            else:
                x -= off_x
                child.setPos(x, y)
                if not base_off_x:
                    base_off_x = off_x
        
        #----------------------------------------------------------------------
        
        pos = self.property('pos')
        align = self.property('align')
        offset = self.property('offset')
        rect = self.boundingRect()
        
        if pos:
            x = pos.x()
            y = pos.y()
        
        elif align == QtCore.Qt.AlignCenter:
            x = (size.width() - rect.width()) / 2.0
            y = (size.height() - rect.height()) / 2.0
        
        else:
            if align & QtCore.Qt.AlignLeft:
                x = 0
            elif align & QtCore.Qt.AlignRight:
                x = (size.width() - rect.width())
            else:
                x = (size.width() - rect.width()) / 2.0
            
            if align & QtCore.Qt.AlignTop:
                y = 0
            elif align & QtCore.Qt.AlignBottom:
                y = (size.height() - rect.height())
            else:
                y = (size.height() - rect.height()) / 2.0
        
        if offset:
            x += offset.x()
            y += offset.y()
        
        x += base_off_x
        y += base_off_y
        
        self.setPos(x, y)
995717
private void updateChildren() {
        axesPanel.setSize(getWidth(), getHeight());
        plotPanel.setSize(getWidth() - X_OFFSET_LEFT - X_OFFSET_RIGHT,
                getHeight() - Y_OFFSET_BOTTOM - Y_OFFSET_TOP);
    }
1119940
def info(self):
        
        names = []
        types = []
        sizes = []
        names.append('WIDGET')
        types.append('-')
        s = 0
        sizes.append(s)
        names.append('METADATA')
        types.append('-')
        s = 0
        for obj in self._rel().values():
            s += getsizeof(obj)
        sizes.append(s)
        for name, obj in self._data().items():
            names.append(name[1:] if name.startswith('_') else name)
            types.append('.'.join((obj.__module__, obj.__class__.__name__)))
            if isinstance(obj, pd.Series):
                sizes.append(obj.memory_usage())
            else:
                sizes.append(obj.memory_usage().sum())
        inf = pd.DataFrame.from_dict({'object': names, 'type': types, 'size': sizes})
        inf.set_index('object', inplace=True)
        return inf.sort_index()
315117
private Dimension layoutSize(Container target, boolean preferred)
	{
	synchronized (target.getTreeLock())
	{
		//  Each row must fit with the width allocated to the containter.
		//  When the container width = 0, the preferred width of the container
		//  has not yet been calculated so lets ask for the maximum.

		int targetWidth = target.getSize().width;
		Container container = target;

		while (container.getSize().width == 0 && container.getParent() != null)
		{
			container = container.getParent();
		}

		targetWidth = container.getSize().width;

		if (targetWidth == 0)
			targetWidth = Integer.MAX_VALUE;

		int hgap = getHgap();
		int vgap = getVgap();
		Insets insets = target.getInsets();
		int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2);
		int maxWidth = targetWidth - horizontalInsetsAndGap;

		//  Fit components into the allowed width

		Dimension dim = new Dimension(0, 0);
		int rowWidth = 0;
		int rowHeight = 0;

		int nmembers = target.getComponentCount();

		for (int i = 0; i < nmembers; i++)
		{
			Component m = target.getComponent(i);

			if (m.isVisible())
			{
				Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize();

				//  Can't add the component to current row. Start a new row.

				if (rowWidth + d.width > maxWidth)
				{
					addRow(dim, rowWidth, rowHeight);
					rowWidth = 0;
					rowHeight = 0;
				}

				//  Add a horizontal gap for all components after the first

				if (rowWidth != 0)
				{
					rowWidth += hgap;
				}

				rowWidth += d.width;
				rowHeight = Math.max(rowHeight, d.height);
			}
		}

		addRow(dim, rowWidth, rowHeight);

		dim.width += horizontalInsetsAndGap;
		dim.height += insets.top + insets.bottom + vgap * 2;

		//	When using a scroll pane or the DecoratedLookAndFeel we need to
		//  make sure the preferred size is less than the size of the
		//  target containter so shrinking the container size works
		//  correctly. Removing the horizontal gap is an easy way to do this.

		Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target);

		if (scrollPane != null && target.isValid())
		{
			dim.width -= (hgap + 1);
		}

		return dim;
	}
	}
962195
public void adjustChildren(int widthMeasureSpec, int heightMeasureSpec) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "adjustChildren: " + mHost + " widthMeasureSpec: "
                    + View.MeasureSpec.toString(widthMeasureSpec) + " heightMeasureSpec: "
                    + View.MeasureSpec.toString(heightMeasureSpec));
        }

        int widthHint = View.MeasureSpec.getSize(widthMeasureSpec);
        int heightHint = View.MeasureSpec.getSize(heightMeasureSpec);
        for (int i = 0, N = mHost.getChildCount(); i < N; i++) {
            View view = mHost.getChildAt(i);
            ViewGroup.LayoutParams params = view.getLayoutParams();
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "should adjust " + view + " " + params);
            }
            if (params instanceof PercentLayoutParams) {
                PercentLayoutInfo info =
                        ((PercentLayoutParams) params).getPercentLayoutInfo();
                if (Log.isLoggable(TAG, Log.DEBUG)) {
                    Log.d(TAG, "using " + info);
                }
                if (info != null) {
                    if (params instanceof ViewGroup.MarginLayoutParams) {
                        info.fillMarginLayoutParams((ViewGroup.MarginLayoutParams) params,
                                widthHint, heightHint);
                    } else {
                        info.fillLayoutParams(params, widthHint, heightHint);
                    }
                }
            }
        }
    }
871179
def dimensions(self):
        
        return (self.xmax - self.xmin, self.ymax - self.ymin)
1356133
def _get_instance_dimensions(self, ds):
        '''
        
        '''
        ret_val = []
        for variable in ds.get_variables_by_attributes(cf_role=lambda x: isinstance(x, basestring)):
            if variable.ndim > 0:
                ret_val.append(variable.dimensions[0])
        return ret_val
1249734
def updateGeometry(self):
        
        WIDGET_BORDER_MARGIN = 5
        SCROLLBAR_WIDTH = 30  # just a guess

        sizeHint = self.sizeHint()
        width = sizeHint.width()
        height = sizeHint.height()

        cursorRect = self._qpart.cursorRect()
        parentSize = self.parentWidget().size()

        spaceBelow = parentSize.height() - cursorRect.bottom() - WIDGET_BORDER_MARGIN
        spaceAbove = cursorRect.top() - WIDGET_BORDER_MARGIN

        if height <= spaceBelow or \
           spaceBelow > spaceAbove:
            yPos = cursorRect.bottom()
            if height > spaceBelow and \
               spaceBelow > self.minimumHeight():
                height = spaceBelow
                width = width + SCROLLBAR_WIDTH
        else:
            if height > spaceAbove and \
               spaceAbove > self.minimumHeight():
                height = spaceAbove
                width = width + SCROLLBAR_WIDTH
            yPos = max(3, cursorRect.top() - height)

        xPos = cursorRect.right() - self._horizontalShift()

        if xPos + width + WIDGET_BORDER_MARGIN > parentSize.width():
            xPos = max(3, parentSize.width() - WIDGET_BORDER_MARGIN - width)

        self.setGeometry(xPos, yPos, width, height)
        self._closeIfNotUpdatedTimer.stop()
815079
private int measureWidth(CmsContextMenuItemWidget item) {

        return item.getOffsetWidth()
            - CmsDomUtil.getCurrentStyleInt(item.getElement(), Style.paddingLeft)
            - CmsDomUtil.getCurrentStyleInt(item.getElement(), Style.paddingRight);
    }
895484
def display_widgets(self):
        
        # All widgets are removed and then recreated to ensure the order they
        # were created is the order they are displayed.

        for child in self.children:

            if child.displayable:

                # forget the widget
                if self.layout != "grid":
                    child.tk.pack_forget()
                else:
                    child.tk.grid_forget()

                # display the widget
                if child.visible:
                    if self.layout != "grid":
                        self._pack_widget(child)
                    else:
                        self._grid_widget(child)
292202
def compute_plot_size(plot):
    
    if isinstance(plot, GridBox):
        ndmapping = NdMapping({(x, y): fig for fig, y, x in plot.children}, kdims=['x', 'y'])
        cols = ndmapping.groupby('x')
        rows = ndmapping.groupby('y')
        width = sum([max([compute_plot_size(f)[0] for f in col]) for col in cols])
        height = sum([max([compute_plot_size(f)[1] for f in row]) for row in rows])
        return width, height
    elif isinstance(plot, (Div, ToolbarBox)):
        # Cannot compute size for Div or ToolbarBox
        return 0, 0
    elif isinstance(plot, (Row, Column, WidgetBox, Tabs)):
        if not plot.children: return 0, 0
        if isinstance(plot, Row) or (isinstance(plot, ToolbarBox) and plot.toolbar_location not in ['right', 'left']):
            w_agg, h_agg = (np.sum, np.max)
        elif isinstance(plot, Tabs):
            w_agg, h_agg = (np.max, np.max)
        else:
            w_agg, h_agg = (np.max, np.sum)
        widths, heights = zip(*[compute_plot_size(child) for child in plot.children])
        return w_agg(widths), h_agg(heights)
    elif isinstance(plot, (Figure, Chart)):
        if plot.plot_width:
            width = plot.plot_width
        else:
            width = plot.frame_width + plot.min_border_right + plot.min_border_left
        if plot.plot_height:
            height = plot.plot_height
        else:
            height = plot.frame_height + plot.min_border_bottom + plot.min_border_top
        return width, height
    elif isinstance(plot, (Plot, DataTable, Spacer)):
        return plot.width, plot.height
    else:
        return 0, 0
1037578
@Override
    public Dimension maximumLayoutSize(Container parent) {
        return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
    }
1049884
def get_group_node_size(node):
    
    # After structural placement, children are sorted
    if( not node.inst.children
        or (not isinstance(node.inst.children[-1], comp.AddressableComponent))
    ):
        # No addressable child exists.
        return 0

    # Current node's size is based on last child
    last_child_node = Node._factory(node.inst.children[-1], node.env, node)
    return(
        last_child_node.inst.addr_offset
        + last_child_node.total_size
    )