aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/SplitPanel.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/vaadin/ui/SplitPanel.java')
-rw-r--r--src/com/vaadin/ui/SplitPanel.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/vaadin/ui/SplitPanel.java b/src/com/vaadin/ui/SplitPanel.java
index 5e67b93369..1a149d7394 100644
--- a/src/com/vaadin/ui/SplitPanel.java
+++ b/src/com/vaadin/ui/SplitPanel.java
@@ -281,10 +281,11 @@ public class SplitPanel extends AbstractLayout {
* Moves the position of the splitter.
*
* @param pos
- * the new size of the first region in percentage
+ * the new size of the first region in the unit that was last
+ * used (default is percentage)
*/
public void setSplitPosition(int pos) {
- setSplitPosition(pos, UNITS_PERCENTAGE, true);
+ setSplitPosition(pos, posUnit, true);
}
/**
@@ -303,7 +304,7 @@ public class SplitPanel extends AbstractLayout {
* Moves the position of the splitter.
*
* @param pos
- * the new size of the first region in percentage
+ * the new size of the first region
* @param unit
* the unit (from {@link Sizeable}) in which the size is given.
* @param repaintNotNeeded
@@ -312,6 +313,10 @@ public class SplitPanel extends AbstractLayout {
* knows the position.
*/
private void setSplitPosition(int pos, int unit, boolean repaintNeeded) {
+ if (unit != UNITS_PERCENTAGE && unit != UNITS_PIXELS) {
+ throw new IllegalArgumentException(
+ "Only percentage and pixel units are allowed");
+ }
this.pos = pos;
posUnit = unit;
if (repaintNeeded) {
@@ -353,8 +358,7 @@ public class SplitPanel extends AbstractLayout {
if (variables.containsKey("position") && !isLocked()) {
Integer newPos = (Integer) variables.get("position");
- // Client always sends pixel values. Repaint is not needed.
- setSplitPosition(newPos, UNITS_PIXELS, false);
+ setSplitPosition(newPos, posUnit, false);
}
if (variables.containsKey(SPLITTER_CLICK_EVENT)) {