int getDividerLocation(int index) { if (_componentSizes == null) { return -1; } if (index < 0 || (index + 1) << 1 >= _componentSizes.length) return -1; boolean ltr = _target.getComponentOrientation().isLeftToRight(); boolean reversed = !ltr && ((JideSplitPane) _target).getOrientation() == JideSplitPane.HORIZONTAL_SPLIT; int location = 0; if (reversed) { for (int i = _componentSizes.length - 1; i >= (index * 2) + 1; i--) location += _componentSizes[i]; } else { for (int i = 0; i < (index * 2) + 1; i++) location += _componentSizes[i]; } Insets insets = _target.getInsets(); if (insets != null) { if (((JideSplitPane) _target).getOrientation() == JideSplitPane.HORIZONTAL_SPLIT) { location += reversed ? insets.right : insets.left; } else { location += insets.top; } } return location; }
/** * Property change event, presumably from the JideSplitPane, will message updateOrientation if necessary. */ public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == _jideSplitPane) { if (JideSplitPane.ORIENTATION_PROPERTY.equals(e.getPropertyName())) { _orientation = _jideSplitPane.getOrientation(); setCursor((_orientation == JideSplitPane.HORIZONTAL_SPLIT) ? HORIZONTAL_CURSOR : VERTICAL_CURSOR); invalidate(); validate(); } else if (JideSplitPane.ONE_TOUCH_EXPANDABLE_PROPERTY.equals(e.getPropertyName())) { setDividerSize(_jideSplitPane.getDividerSize()); oneTouchExpandableChanged(); } else if (JideSplitPane.DIVIDER_SIZE_PROPERTY.equals(e.getPropertyName())) { setDividerSize(_jideSplitPane.getDividerSize()); } else if (JideSplitPane.GRIPPER_PROPERTY.equals(e.getPropertyName())) { repaint(); } } }
/** * Gets the state set of this object. * * @return an instance of AccessibleState containing the current state of the object * * @see javax.accessibility.AccessibleState */ @Override public AccessibleStateSet getAccessibleStateSet() { AccessibleStateSet states = super.getAccessibleStateSet(); if (getOrientation() == VERTICAL_SPLIT) { states.add(AccessibleState.VERTICAL); } else { states.add(AccessibleState.HORIZONTAL); } return states; }
protected DragController(MouseEvent e) { ComponentOrientation o = getComponentOrientation(); boolean ltr = o.isLeftToRight(); boolean reversed = !ltr && _jideSplitPane.getOrientation() == JideSplitPane.HORIZONTAL_SPLIT; Component leftC = reversed ? getSecondComponent(false) : getFirstComponent(false); Component rightC = reversed ? getFirstComponent(false) : getSecondComponent(false);
return -1; boolean ltr = _target.getComponentOrientation().isLeftToRight(); boolean reversed = !ltr && ((JideSplitPane) _target).getOrientation() == JideSplitPane.HORIZONTAL_SPLIT; int prevIndex = reversed ? 2 * index + 2 : 2 * index; int nextIndex = reversed ? 2 * index : 2 * index + 2; if (((JideSplitPane) _target).getOrientation() == JideSplitPane.HORIZONTAL_SPLIT) { size += _target.getComponent(nextIndex).getMinimumSize().getWidth(); if (((JideSplitPane) _target).getOrientation() == JideSplitPane.HORIZONTAL_SPLIT) { location = Math.min(location, _target.getWidth() - size); if (((JideSplitPane) _target).getOrientation() == JideSplitPane.HORIZONTAL_SPLIT) { size += _target.getComponent(prevIndex).getMinimumSize().getWidth(); if (((JideSplitPane) _target).getOrientation() == JideSplitPane.HORIZONTAL_SPLIT) { for (int changedIndex = 0; changedIndex < _target.getComponentCount(); changedIndex++) { Component component = _target.getComponent(changedIndex);
int dividerThickness = Math.min(4, getDividerSize()); Rectangle convertedRect = SwingUtilities.convertRectangle(this, rect, _layeredPane); if (getOrientation() == HORIZONTAL_SPLIT) { p = SwingUtilities.convertPoint(this, location, rect.y, _layeredPane); p.x += ((getDividerSize() - dividerThickness) >> 1);
/** * Creates an instance of BasicJideSplitPaneDivider. Registers this instance for mouse events and mouse dragged * events. * * @param splitPane the JideSplitPane. */ public JideSplitPaneDivider(JideSplitPane splitPane) { setJideSplitPane(splitPane); _orientation = _jideSplitPane.getOrientation(); // get divider size from JideSplitPane setDividerSize(splitPane.getDividerSize()); setDefaultResizeCursor(); setBackground(UIDefaultsLookup.getColor("JideSplitPaneDivider.background")); setBorder(UIDefaultsLookup.getBorder("JideSplitPaneDivider.border")); if (_jideSplitPane.isOneTouchExpandable()) { oneTouchExpandableChanged(); } _gripperPainter = (Painter) UIDefaultsLookup.get("JideSplitPaneDivider.gripperPainter"); setOpaque(false); setLayout(null); }
Rectangle layeredPaneBounds = SwingUtilities.convertRectangle(this, bounds, _layeredPane); int dividerThickness = Math.min(4, getDividerSize()); if (getOrientation() == HORIZONTAL_SPLIT) { _nonContinuousLayoutDividerWrapper.delegateSetBounds(layeredPaneBounds.x, layeredPaneBounds.y, dividerThickness, layeredPaneBounds.height);
return getOrientation() == HORIZONTAL_SPLIT ? getWidth() - getDividerSize() : getHeight() - getDividerSize();
if (((JideSplitPaneDivider) getAttachedComponent()).getJideSplitPane().getOrientation() == JideSplitPane.HORIZONTAL_SPLIT) { getGlassPane().setCursor(JideCursors.getPredefinedCursor(JideCursors.HORIZONTAL_CURSOR));