summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/SplitPanel.java
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2010-10-29 07:19:38 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2010-10-29 07:19:38 +0000
commit49b67ef018c03370220857b6d55cbc9f928f7581 (patch)
tree7a876da84c4321d4772077409033307d6138f1e0 /src/com/vaadin/ui/SplitPanel.java
parentccd94db68dffb2e8d4562199b718325298a0e80c (diff)
downloadvaadin-framework-49b67ef018c03370220857b6d55cbc9f928f7581.tar.gz
vaadin-framework-49b67ef018c03370220857b6d55cbc9f928f7581.zip
Adds possibility to set split position from the opposite side in a SplitPanel. #1588
svn changeset:15767/svn branch:6.5
Diffstat (limited to 'src/com/vaadin/ui/SplitPanel.java')
-rw-r--r--src/com/vaadin/ui/SplitPanel.java46
1 files changed, 42 insertions, 4 deletions
diff --git a/src/com/vaadin/ui/SplitPanel.java b/src/com/vaadin/ui/SplitPanel.java
index 2fe5f43d97..27dd8b1c98 100644
--- a/src/com/vaadin/ui/SplitPanel.java
+++ b/src/com/vaadin/ui/SplitPanel.java
@@ -1,4 +1,4 @@
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
@@ -60,6 +60,8 @@ public class SplitPanel extends AbstractLayout {
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;
@@ -269,6 +271,10 @@ public class SplitPanel extends AbstractLayout {
if (isLocked()) {
target.addAttribute("locked", true);
}
+
+ if (posReversed) {
+ target.addAttribute("reversed", true);
+ }
if (firstComponent != null) {
firstComponent.paint(target);
@@ -341,7 +347,21 @@ public class SplitPanel extends AbstractLayout {
* 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);
}
/**
@@ -353,7 +373,23 @@ public class SplitPanel extends AbstractLayout {
* 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);
}
/**
@@ -387,13 +423,15 @@ public class SplitPanel extends AbstractLayout {
* 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();
}