summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-04-11 09:32:59 +0300
committerLeif Åstrand <leif@vaadin.com>2012-04-11 09:32:59 +0300
commit4205cb35885e7c33613351ee7ca0a6e949b312d7 (patch)
treee3c7e1627315603b4dd5a999118908a0fda1d547 /src
parenta7a0d2fae2b007afdbed01b9bd96029be9bc9011 (diff)
parentbd927f09ed2b73215527bd2e2b5d96eb5d1140f0 (diff)
downloadvaadin-framework-4205cb35885e7c33613351ee7ca0a6e949b312d7.tar.gz
vaadin-framework-4205cb35885e7c33613351ee7ca0a6e949b312d7.zip
Merge branch 'master' into layoutgraph
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConnection.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractSplitPanelConnector.java21
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanel.java2
-rw-r--r--src/com/vaadin/ui/AbsoluteLayout.java3
-rw-r--r--src/com/vaadin/ui/AbstractSplitPanel.java28
6 files changed, 37 insertions, 24 deletions
diff --git a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
index 854464f1ee..f65b4c51e7 100644
--- a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
+++ b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
@@ -37,7 +37,7 @@
</replace-with>
<generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.WidgetMapGenerator">
+ class="com.vaadin.terminal.gwt.widgetsetutils.EagerWidgetMapGenerator">
<when-type-is class="com.vaadin.terminal.gwt.client.WidgetMap" />
</generate-with>
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index f693e8c203..df67bcd1e1 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -961,7 +961,7 @@ public class ApplicationConnection {
return;
}
- MultiStepDuration handleUIDLDuration = new MultiStepDuration();
+ final MultiStepDuration handleUIDLDuration = new MultiStepDuration();
// Get security key
if (json.containsKey(UIDL_SECURITY_TOKEN_ID)) {
@@ -1002,6 +1002,9 @@ public class ApplicationConnection {
Command c = new Command() {
public void execute() {
+ handleUIDLDuration.logDuration(" * Loading widgets completed",
+ 10);
+
MultiStepDuration updateDuration = new MultiStepDuration();
if (debugLogging) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractSplitPanelConnector.java
index 823d05d50b..1a1cbaea6a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractSplitPanelConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractSplitPanelConnector.java
@@ -37,7 +37,7 @@ public abstract class AbstractSplitPanelConnector extends
* The new position in % if the current unit is %, in px
* otherwise
*/
- public void setSplitterPosition(int position);
+ public void setSplitterPosition(float position);
/**
* Called when a click event has occurred on the splitter.
@@ -50,16 +50,16 @@ public abstract class AbstractSplitPanelConnector extends
}
public static class SplitterState {
- private int position;
+ private float position;
private String positionUnit;
- private boolean positionReversed;
- private boolean locked;
+ private boolean positionReversed = false;
+ private boolean locked = false;
- public int getPosition() {
+ public float getPosition() {
return position;
}
- public void setPosition(int position) {
+ public void setPosition(float position) {
this.position = position;
}
@@ -141,10 +141,13 @@ public abstract class AbstractSplitPanelConnector extends
public void splitterMoved(SplitterMoveEvent event) {
String position = getWidget().getSplitterPosition();
- int pos = 0;
+ float pos = 0;
if (position.indexOf("%") > 0) {
- pos = Math.round(Float.valueOf(position.substring(0,
- position.length() - 1)));
+ // Send % values as a fraction to avoid that the splitter
+ // "jumps" when server responds with the integer pct value
+ // (e.g. dragged 16.6% -> should not jump to 17%)
+ pos = Float.valueOf(position.substring(0,
+ position.length() - 1));
} else {
pos = Integer.parseInt(position.substring(0,
position.length() - 2));
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanel.java
index f08cbf58e9..578b731388 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanel.java
@@ -486,7 +486,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
}
// Reversed position
if (positionReversed) {
- pos = getOffsetWidth() - pos;
+ pos = getOffsetWidth() - pos - getSplitterSize();
}
position = (pos / getOffsetWidth() * 100) + "%";
} else {
diff --git a/src/com/vaadin/ui/AbsoluteLayout.java b/src/com/vaadin/ui/AbsoluteLayout.java
index d347b74829..a65b20a54e 100644
--- a/src/com/vaadin/ui/AbsoluteLayout.java
+++ b/src/com/vaadin/ui/AbsoluteLayout.java
@@ -15,7 +15,6 @@ import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
import com.vaadin.terminal.Sizeable;
import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.ui.AbsoluteLayoutConnector;
import com.vaadin.terminal.gwt.client.ui.AbsoluteLayoutConnector.AbsoluteLayoutServerRPC;
import com.vaadin.terminal.gwt.client.ui.AbsoluteLayoutConnector.AbsoluteLayoutState;
import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
@@ -179,8 +178,8 @@ public class AbsoluteLayout extends AbstractLayout implements
*/
@Override
public void removeComponent(Component c) {
- super.removeComponent(c);
internalRemoveComponent(c);
+ super.removeComponent(c);
requestRepaint();
}
diff --git a/src/com/vaadin/ui/AbstractSplitPanel.java b/src/com/vaadin/ui/AbstractSplitPanel.java
index 3ab80444c2..166467ca24 100644
--- a/src/com/vaadin/ui/AbstractSplitPanel.java
+++ b/src/com/vaadin/ui/AbstractSplitPanel.java
@@ -40,7 +40,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
mouseDetails));
}
- public void setSplitterPosition(int position) {
+ public void setSplitterPosition(float position) {
getState().getSplitterState().setPosition(position);
}
};
@@ -241,9 +241,10 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
*
* @param pos
* the new size of the first region in the unit that was last
- * used (default is percentage)
+ * used (default is percentage). Fractions are only allowed when
+ * unit is percentage.
*/
- public void setSplitPosition(int pos) {
+ public void setSplitPosition(float pos) {
setSplitPosition(pos, posUnit, false);
}
@@ -252,12 +253,14 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
*
* @param pos
* the new size of the region in the unit that was last used
- * (default is percentage)
+ * (default is percentage). Fractions are only allowed when unit
+ * 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) {
+ public void setSplitPosition(float pos, boolean reverse) {
setSplitPosition(pos, posUnit, reverse);
}
@@ -265,11 +268,12 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* Moves the position of the splitter with given position and unit.
*
* @param pos
- * size of the first region
+ * the new size of the first region. Fractions are only allowed
+ * when unit is percentage.
* @param unit
* the unit (from {@link Sizeable}) in which the size is given.
*/
- public void setSplitPosition(int pos, Unit unit) {
+ public void setSplitPosition(float pos, Unit unit) {
setSplitPosition(pos, unit, false);
}
@@ -277,7 +281,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* Moves the position of the splitter with given position and unit.
*
* @param pos
- * size of the first region
+ * the new size of the first region. Fractions are only allowed
+ * when unit is percentage.
* @param unit
* the unit (from {@link Sizeable}) in which the size is given.
* @param reverse
@@ -285,11 +290,14 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* second region else it is measured by the first region
*
*/
- public void setSplitPosition(int pos, Unit unit, boolean reverse) {
+ public void setSplitPosition(float pos, Unit unit, boolean reverse) {
if (unit != Unit.PERCENTAGE && unit != Unit.PIXELS) {
throw new IllegalArgumentException(
"Only percentage and pixel units are allowed");
}
+ if (unit != Unit.PERCENTAGE) {
+ pos = Math.round(pos);
+ }
SplitterState splitterState = getState().getSplitterState();
splitterState.setPosition(pos);
splitterState.setPositionUnit(unit.getSymbol());
@@ -305,7 +313,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
*
* @return position of the splitter
*/
- public int getSplitPosition() {
+ public float getSplitPosition() {
return getState().getSplitterState().getPosition();
}