/** * Gets the count of panes, regardless of dividers. * * @return the count of panes */ public int getPaneCount() { return (getComponentCount() + 1) >> 1; }
/** * Returns the component at index. * * @param index index * @return the component at the index */ public Component getPaneAt(int index) { if (index < 0 || index << 1 >= getComponentCount()) return null; return getComponent(index << 1); }
/** * Returns the divider at index. * * @param index index * @return the divider at the index */ public JideSplitPaneDivider getDividerAt(int index) { if (index < 0 || index * 2 + 1 >= getComponentCount()) return null; return (JideSplitPaneDivider) getComponent(index * 2 + 1); }
/** * Returns the index of the component. * * @param comp component to get index * @return index of the comp. -1 if comp doesn't exist in this container */ public int indexOf(Component comp) { for (int i = 0; i < getComponentCount(); i++) { if (getComponent(i).equals(comp)) return i; } return -1; }
if (getComponentCount() == 1) { anyVisible = getComponent(0).isVisible(); else if (getComponentCount() > 1) { boolean anyPrevVisible = false; for (int i = 0; i < getComponentCount(); i++) { Component comp = getComponent(i); if (!(comp instanceof JideSplitPaneDivider)) { boolean visibleNext = i + 1 < getComponentCount() && getComponent(i + 1).isVisible(); if (visiblePrev && visibleNext) { comp.setVisible(true);
/** * Gets the second component. This divider is installed between two components. The second component is usually the * one on the right or on the bottom. * * @param ignoreVisibility true to not check if the component is visible. * @return the first component */ public Component getSecondComponent(boolean ignoreVisibility) { int index = _jideSplitPane.indexOf(this); if (index + 1 < _jideSplitPane.getComponentCount()) { for (int i = (index + 1); i >= 0; i++) { if (ignoreVisibility || _jideSplitPane.getComponent(i).isVisible()) { return _jideSplitPane.getComponent(i); } } // return an invisible component in lieu of null return _jideSplitPane.getComponent(index + 1); } else { throw new IndexOutOfBoundsException("There is no component before divider " + index); } }
for (int i = index + 1; i < _jideSplitPane.getComponentCount(); i++) { Component component = _jideSplitPane.getComponent(i); if (component instanceof JideSplitPaneDivider) {
int extra = 0; if (getComponentCount() == 0) { if (_proportions != null) setProportions(null); for (int i = 0; i < getComponentCount(); i++) { Component comp = getComponent(i); if (comp instanceof JideSplitPaneDivider) { if (extra == 1 && getComponent(getComponentCount() - 1) instanceof JideSplitPaneDivider) { // remove last one if it's a divider ((JideSplitPaneDivider) getComponent(getComponentCount() - 1)).setJideSplitPane(null); remove(getComponentCount() - 1); removeProportion((getComponentCount() + 1) / 2); changed = true;
for (int i = index + 1; i < _jideSplitPane.getComponentCount(); i++) { Component component = _jideSplitPane.getComponent(i); if (component instanceof JideSplitPaneDivider) {
/** * Add divider if there are two panes side by side without a divider in between. */ protected void addExtraDividers() { int extra = 0; for (int i = 0; i < getComponentCount(); i++) { Component comp = getComponent(i); if (!(comp instanceof JideSplitPaneDivider)) { extra++; if (extra == 2) { add(createSplitPaneDivider(), JideSplitPaneLayout.FIX, i); if (_proportions != null && getPaneCount() == _proportions.length + 2) addProportion((i + 1) / 2); extra = 0; } } else extra = 0; } }
int location = -1; if (reversed) { if (((index + 1) * 2) + 1 <= getComponentCount()) { for (int i = index + 1; (i * 2) + 1 < getComponentCount(); i++) { if (ignoreVisibility || getDividerAt(i).isVisible()) { if (_orientation == HORIZONTAL_SPLIT) {
int location = -1; if (!reversed) { if (((index + 1) * 2) + 1 <= getComponentCount()) { for (int i = index + 1; (i * 2) + 1 < getComponentCount(); i++) { if (ignoreVisibility || getDividerAt(i).isVisible()) { if (_orientation == HORIZONTAL_SPLIT) {