aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTapio Aali <tapio@vaadin.com>2012-05-31 05:30:06 +0000
committerTapio Aali <tapio@vaadin.com>2012-05-31 05:30:06 +0000
commit2e581760d056ad7038bfa5c04c6fd17c883a7d32 (patch)
tree6e768f9069df7527a7b34a6156c4ad75685c62f1 /src
parente978b997047573b1497a07f77f730195e3ea467a (diff)
downloadvaadin-framework-2e581760d056ad7038bfa5c04c6fd17c883a7d32.tar.gz
vaadin-framework-2e581760d056ad7038bfa5c04c6fd17c883a7d32.zip
Optimized network usage of the split position limits of the SplitPanel (#8880).
svn changeset:23857/svn branch:6.8
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java22
-rw-r--r--src/com/vaadin/ui/AbstractSplitPanel.java8
2 files changed, 18 insertions, 12 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java
index 613ec47f57..00d76e3a45 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java
@@ -147,9 +147,9 @@ public class VSplitPanel extends ComplexPanel implements Container,
/* The current position of the split handle in either percentages or pixels */
private String position;
- private String maximumPosition;
+ private String maximumPosition = null;
- private String minimumPosition;
+ private String minimumPosition = null;
private final TouchScrollHandler touchScrollHandler;
@@ -277,8 +277,10 @@ public class VSplitPanel extends ComplexPanel implements Container,
position = uidl.getStringAttribute("position");
- minimumPosition = uidl.getStringAttribute("minimumPosition");
- maximumPosition = uidl.getStringAttribute("maximumPosition");
+ minimumPosition = uidl.hasAttribute("minimumPosition") ? uidl
+ .getStringAttribute("minimumPosition") : null;
+ maximumPosition = uidl.hasAttribute("maximumPosition") ? uidl
+ .getStringAttribute("maximumPosition") : null;
setSplitPosition(position);
@@ -404,12 +406,12 @@ public class VSplitPanel extends ComplexPanel implements Container,
private String checkSplitPositionLimits(String pos) {
float positionAsFloat = convertToPixels(pos);
- float maximumAsFloat = convertToPixels(maximumPosition);
- float minimumAsFloat = convertToPixels(minimumPosition);
- if (maximumAsFloat < positionAsFloat) {
+ if (maximumPosition != null
+ && convertToPixels(maximumPosition) < positionAsFloat) {
pos = maximumPosition;
- } else if (minimumAsFloat > positionAsFloat) {
+ } else if (minimumPosition != null
+ && convertToPixels(minimumPosition) > positionAsFloat) {
pos = minimumPosition;
}
return pos;
@@ -870,8 +872,8 @@ public class VSplitPanel extends ComplexPanel implements Container,
if (position.indexOf("%") > 0) {
pos = Float.valueOf(position.substring(0, position.length() - 1));
} else {
- pos = Integer
- .parseInt(position.substring(0, position.length() - 2));
+ pos = Math.round(Float.parseFloat(position.substring(0,
+ position.length() - 2)));
}
client.updateVariable(id, "position", pos, immediate);
}
diff --git a/src/com/vaadin/ui/AbstractSplitPanel.java b/src/com/vaadin/ui/AbstractSplitPanel.java
index ebdee17de2..586dbc81fe 100644
--- a/src/com/vaadin/ui/AbstractSplitPanel.java
+++ b/src/com/vaadin/ui/AbstractSplitPanel.java
@@ -222,8 +222,12 @@ public abstract class AbstractSplitPanel extends AbstractLayout {
final String maximumPosition = posMax + UNIT_SYMBOLS[posMaxUnit];
target.addAttribute("position", position);
- target.addAttribute("minimumPosition", minimumPosition);
- target.addAttribute("maximumPosition", maximumPosition);
+ if (minimumPosition != "0%") {
+ target.addAttribute("minimumPosition", minimumPosition);
+ }
+ if (maximumPosition != "100%") {
+ target.addAttribute("maximumPosition", maximumPosition);
+ }
if (isLocked()) {
target.addAttribute("locked", true);