@Override protected LayoutManager createLayoutManager() { return new JideBoxLayout(optionPane, JideBoxLayout.Y_AXIS); }
/** * Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. */ public synchronized void invalidateLayout(Container c) { if (isResetWhenInvalidate() || componentCountChanged(c)) { layoutReset(); } }
continue; Dimension preferredSize = getPreferredSizeOf(comp, i); prePrimary += getSizeForPrimaryAxis(preferredSize); int secSize = getSizeForSecondaryAxis(preferredSize); if (secSize > preSecondary) preSecondary = secSize; prePrimary += getSizeForPrimaryAxis(insets, true) + getSizeForPrimaryAxis(insets, false); preSecondary += getSizeForSecondaryAxis(insets, true) + getSizeForSecondaryAxis(insets, false); if (resolveAxis(_axis, o) == X_AXIS) { return new Dimension(prePrimary + getGapSize(), preSecondary); return new Dimension(preSecondary, prePrimary + getGapSize());
private void setComponentSizeByGap(int index, int gap) { if (SystemInfo.isJdk15Above() && _target.getComponent(index).isMinimumSizeSet()) { setComponentSize(index, Math.max(_componentSizes[index] + gap, getSizeForPrimaryAxis(_target.getComponent(index).getMinimumSize()))); } else { setComponentSize(index, _componentSizes[index] + gap); } }
int availableSize = getAvailableSize(containerSize, insets); availableSize -= getGapSize(); if (availableSize <= 0) { return; boolean success = calculateComponentSizes(availableSize, 0, _target.getComponentCount()); if (!success) { if (!isAlwaysLayout() && "false".equals(SecurityUtils.getProperty("JideBoxLayout.alwaysLayout", "false"))) { for (int i = 0; i < _target.getComponentCount(); i++) { Component comp = _target.getComponent(i); setComponentToSize(comp, 0, 0, insets, containerSize); // set size to zero to clear the layout redoLayout(container); boolean containerResized = totalSize + getGapSize() != getSizeForPrimaryAxis(containerSize); if (containerResized) { int availableSize = getAvailableSize(containerSize, insets); availableSize -= getGapSize(); if (availableSize <= 0) { return; boolean success = calculateComponentSizes(availableSize, 0, _target.getComponentCount()); if (!success) { if (!isAlwaysLayout() && "false".equals(SecurityUtils.getProperty("JideBoxLayout.alwaysLayout", "false"))) { for (int i = 0; i < _target.getComponentCount(); i++) { Component comp = _target.getComponent(i); setComponentToSize(comp, 0, 0, insets, containerSize); // set size to zero to clear the layout redoLayout(container);
Dimension minimumSize = comp.getMinimumSize(); if (FIX.equals(constraint)) { minPrimary += getPreferredSizeOfComponent(comp); minPrimary += getSizeForPrimaryAxis(minimumSize); int secSize = getSizeForSecondaryAxis(minimumSize); if (secSize > minSecondary) minSecondary = secSize; minPrimary += getSizeForPrimaryAxis(insets, true) + getSizeForPrimaryAxis(insets, false); minSecondary += getSizeForSecondaryAxis(insets, true) + getSizeForSecondaryAxis(insets, false); if (resolveAxis(_axis, o) == X_AXIS) { return new Dimension(minPrimary + getGapSize(), minSecondary); return new Dimension(minSecondary, minPrimary + getGapSize());
int minimumSize = getSizeForPrimaryAxis(comp.getMinimumSize()); int preferredSize = getSizeForPrimaryAxis(getPreferredSizeOf(comp, i)); if (FIX.equals(constraint)) { availableSizeExcludeFixed -= Math.max(preferredSize, minimumSize); getPreferredSizeOf(comp, i); // there is a bug in jdk1.5 which minimum size returns a large number if preferred size is not call. varMinSize = minimumSize; if (!isAlwaysLayout() && "false".equals(SecurityUtils.getProperty("JideBoxLayout.alwaysLayout", "false")) && availableSizeExcludeFixed - varMinSize < 0) { return false; Component comp = _target.getComponent(i); if (!comp.isVisible()) { setComponentSize(i, 0); int minimumSize = getSizeForPrimaryAxis(comp.getMinimumSize()); int preferredSize = getSizeForPrimaryAxis(getPreferredSizeOf(comp, i)); if (FIX.equals(constraint)) { setComponentSize(i, Math.max(preferredSize, minimumSize)); setComponentSize(i, varMinSize); setComponentSize(i, (int) (preferredSize * resizeRatio)); setComponentSize(i, minimumSize + (int) ((preferredSize - minimumSize) * resizeRatio)); Component comp = _target.getComponent(i); if (!comp.isVisible()) { setComponentSize(i, 0);
setPreferredSize(new Dimension(800, 20)); JideBoxLayout layout = new JideBoxLayout(this, JideBoxLayout.X_AXIS); layout.setGap(3); setLayout(layout);
/** * Returns the left inset, unless the Insets are null in which case 0 is returned. * * @param insets the insets * @return the initial location. */ protected int getInitialLocation(Insets insets) { if (insets != null) return getSizeForPrimaryAxis(insets, true); return 0; }
return super.calculateComponentSizes(availableSize, startIndex, endIndex); if (!super.calculateComponentSizes(availableSize, startIndex, endIndex)) return false;
if (((JideBoxLayout) _jideSplitPane.getLayout()).getConstraintMap().get(component) == JideBoxLayout.FIX) { modelUpHeight += component.getHeight(); if (((JideBoxLayout) _jideSplitPane.getLayout()).getConstraintMap().get(component) == JideBoxLayout.FIX) { modelDownHeight += component.getHeight();
/** * Returns the available width based on the container size and Insets. * * @param containerSize the size of the container * @param insets the insets * @return the available size. */ protected int getAvailableSize(Dimension containerSize, Insets insets) { if (insets == null) return getSizeForPrimaryAxis(containerSize); return (getSizeForPrimaryAxis(containerSize) - (getSizeForPrimaryAxis(insets, true) + getSizeForPrimaryAxis(insets, false))); }
if (((JideBoxLayout) _jideSplitPane.getLayout()).getConstraintMap().get(component) == JideBoxLayout.FIX) { modelLeftWidth += component.getWidth(); if (((JideBoxLayout) _jideSplitPane.getLayout()).getConstraintMap().get(component) == JideBoxLayout.FIX) { modelRightWidth += component.getWidth();
filterPanel.setLayout(new JideBoxLayout(filterPanel, JideBoxLayout.X_AXIS, 5)); sillyPanel.setLayout(new JideBoxLayout(sillyPanel, JideBoxLayout.X_AXIS, 0)); sillyPanel.setPreferredSize(new Dimension(100, 28)); sillyPanel.add(rowCountLabel, JideBoxLayout.VARY);
/** * Returns the width of the passed in Components preferred size. * * @param c the component * @return the preferred size of the component. */ protected int getPreferredSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getPreferredSize()); }
static public JPanel createAutoCompleteForTree() { JPanel panel = new JPanel(); JTree tree = new JTree(); panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS));
/** * Returns the width of the passed in component. * * @param c the component * @return the size of the component. */ protected int getSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getSize()); }
chooser.setLayout(new JideBoxLayout(chooser, JideBoxLayout.Y_AXIS)); chooser.add(toolBarPanel, JideBoxLayout.FIX); chooser.add(holdingPanel, JideBoxLayout.VARY);
/** * Returns the width of the passed in Components minimum size. * * @param c the component * @return the minimum size of the component. */ int getMinimumSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getMinimumSize()); }
@UIHidden private JPanel createPanel1() { JPanel panel = new JPanel(); panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS)); panel.setBorder(BorderFactory.createCompoundBorder(new JideTitledBorder(new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH), "AutoCompletion combo box and text field", JideTitledBorder.LEADING, JideTitledBorder.ABOVE_TOP), BorderFactory.createEmptyBorder(0, 0, 0, 0)));