-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
private boolean locked = false;
+ private boolean positionReversed = false;
+
private String[] componentStyleNames;
private Element draggingCurtain;
setLocked(uidl.getBooleanAttribute("locked"));
+ if (uidl.hasAttribute("reversed")) {
+ setPositionReversed(uidl.getBooleanAttribute("reversed"));
+ }
+
setStylenames();
position = uidl.getStringAttribute("position");
}
}
+ private void setPositionReversed(boolean reversed) {
+ positionReversed = reversed;
+ }
+
private void setSplitPosition(String pos) {
if (pos == null) {
return;
}
if (orientation == ORIENTATION_HORIZONTAL) {
- DOM.setStyleAttribute(splitter, "left", pos);
+ if (positionReversed) {
+ DOM.setStyleAttribute(splitter, "right", pos);
+ } else {
+ DOM.setStyleAttribute(splitter, "left", pos);
+ }
} else {
- DOM.setStyleAttribute(splitter, "top", pos);
+ if (positionReversed) {
+ DOM.setStyleAttribute(splitter, "bottom", pos);
+ } else {
+ DOM.setStyleAttribute(splitter, "top", pos);
+ }
}
iLayout();
pixelPosition = DOM.getElementPropertyInt(splitter, "offsetLeft");
// reposition splitter in case it is out of box
- if (pixelPosition > 0
- && pixelPosition + getSplitterSize() > wholeSize) {
+ if ((pixelPosition > 0 && pixelPosition + getSplitterSize() > wholeSize)
+ || (positionReversed && pixelPosition < 0)) {
pixelPosition = wholeSize - getSplitterSize();
if (pixelPosition < 0) {
pixelPosition = 0;
pixelPosition = DOM.getElementPropertyInt(splitter, "offsetTop");
// reposition splitter in case it is out of box
- if (pixelPosition > 0
- && pixelPosition + getSplitterSize() > wholeSize) {
+ if ((pixelPosition > 0 && pixelPosition + getSplitterSize() > wholeSize)
+ || (positionReversed && pixelPosition < 0)) {
pixelPosition = wholeSize - getSplitterSize();
if (pixelPosition < 0) {
pixelPosition = 0;
if (newX + getSplitterSize() >= getOffsetWidth()) {
pos = getOffsetWidth();
}
- position = pos / getOffsetWidth() * 100 + "%";
+ // Reversed position
+ if (positionReversed) {
+ pos = getOffsetWidth() - pos;
+ }
+ position = (pos / getOffsetWidth() * 100) + "%";
} else {
- position = newX + "px";
+ // Reversed position
+ if (positionReversed) {
+ position = (getOffsetWidth() - newX - getSplitterSize()) + "px";
+ } else {
+ position = newX + "px";
+ }
+ }
+
+ // Reversed position
+ if (positionReversed) {
+ newX = getOffsetWidth() - newX - getSplitterSize();
}
setSplitPosition(newX + "px");
if (newY + getSplitterSize() >= getOffsetHeight()) {
pos = getOffsetHeight();
}
+ // Reversed position
+ if(positionReversed){
+ pos = getOffsetHeight() - pos - getSplitterSize();
+ }
position = pos / getOffsetHeight() * 100 + "%";
} else {
- position = newY + "px";
+ // Reversed position
+ if (positionReversed) {
+ position = (getOffsetHeight() - newY - getSplitterSize())
+ + "px";
+ } else {
+ position = newY + "px";
+ }
+ }
+
+ // Reversed position
+ if (positionReversed) {
+ newY = getOffsetHeight() - newY - getSplitterSize();
}
setSplitPosition(newY + "px");
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
private int posUnit = UNITS_PERCENTAGE;
+ private boolean posReversed = false;
+
private boolean locked = false;
private static final String SPLITTER_CLICK_EVENT = VSplitPanel.SPLITTER_CLICK_EVENT_IDENTIFIER;
if (isLocked()) {
target.addAttribute("locked", true);
}
+
+ if (posReversed) {
+ target.addAttribute("reversed", true);
+ }
if (firstComponent != null) {
firstComponent.paint(target);
* used (default is percentage)
*/
public void setSplitPosition(int pos) {
- setSplitPosition(pos, posUnit, true);
+ setSplitPosition(pos, posUnit, true, false);
+ }
+
+ /**
+ * Moves the position of the splitter.
+ *
+ * @param pos
+ * the new size of the region in the unit that was last used
+ * (default is percentage)
+ * @param reverse
+ * if set to true the split splitter position is measured by the
+ * second region else it is measured by the first region
+ */
+ public void setSplitPosition(int pos, boolean reverse) {
+ setSplitPosition(pos, posUnit, true, reverse);
}
/**
* the unit (from {@link Sizeable}) in which the size is given.
*/
public void setSplitPosition(int pos, int unit) {
- setSplitPosition(pos, unit, true);
+ setSplitPosition(pos, unit, true, false);
+ }
+
+ /**
+ * Moves the position of the splitter with given position and unit.
+ *
+ * @param pos
+ * size of the first region
+ * @param unit
+ * the unit (from {@link Sizeable}) in which the size is given.
+ * @param reverse
+ * if set to true the split splitter position is measured by the
+ * second region else it is measured by the first region
+ *
+ */
+ public void setSplitPosition(int pos, int unit, boolean reverse) {
+ setSplitPosition(pos, unit, true, reverse);
}
/**
* position info has come from the client side, thus it already
* knows the position.
*/
- private void setSplitPosition(int pos, int unit, boolean repaintNeeded) {
+ private void setSplitPosition(int pos, int unit, boolean repaintNeeded,
+ boolean reverse) {
if (unit != UNITS_PERCENTAGE && unit != UNITS_PIXELS) {
throw new IllegalArgumentException(
"Only percentage and pixel units are allowed");
}
this.pos = pos;
posUnit = unit;
+ posReversed = reverse;
if (repaintNeeded) {
requestRepaint();
}