From 66e9b8cec5bd22672b8498716015ec3e2dc748aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Tue, 19 Jun 2012 13:42:11 +0300 Subject: [PATCH] Fix issues caused by 6.8 merge: prevent NPE with componentStyles; ensure split position limits are properly set; ensure panels are scrollable after state change --- .../ui/splitpanel/AbstractSplitPanelConnector.java | 1 + .../gwt/client/ui/splitpanel/VAbstractSplitPanel.java | 10 +++++++++- src/com/vaadin/ui/AbstractSplitPanel.java | 9 +++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java index b5cedc42d4..892ce0c35f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -144,6 +144,7 @@ public abstract class AbstractSplitPanelConnector extends getLayoutManager().setNeedsLayout(this); + getWidget().ensureScrollable(); } @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java index e112fac304..988ddf02ca 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java @@ -4,6 +4,7 @@ package com.vaadin.terminal.gwt.client.ui.splitpanel; +import java.util.Collections; import java.util.List; import com.google.gwt.dom.client.Node; @@ -77,7 +78,7 @@ public class VAbstractSplitPanel extends ComplexPanel { private boolean positionReversed = false; - List componentStyleNames; + List componentStyleNames = Collections.emptyList(); private Element draggingCurtain; @@ -760,4 +761,11 @@ public class VAbstractSplitPanel extends ComplexPanel { return enabled; } + /** + * Ensures the panels are still scrollable eg. after style sheet changes + */ + void ensureScrollable() { + touchScrollHandler.setElements(firstContainer, secondContainer); + } + } diff --git a/src/com/vaadin/ui/AbstractSplitPanel.java b/src/com/vaadin/ui/AbstractSplitPanel.java index 6a7099ba9d..45656901bd 100644 --- a/src/com/vaadin/ui/AbstractSplitPanel.java +++ b/src/com/vaadin/ui/AbstractSplitPanel.java @@ -33,8 +33,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { // TODO use Unit in AbstractSplitPanelState and remove these private Unit posUnit; - private Unit posMinUnit = Unit.PERCENTAGE; - private Unit posMaxUnit = Unit.PERCENTAGE; + private Unit posMinUnit; + private Unit posMaxUnit; private AbstractSplitPanelRpc rpc = new AbstractSplitPanelRpc() { @@ -53,6 +53,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { public AbstractSplitPanel() { registerRpc(rpc); setSplitPosition(50, Unit.PERCENTAGE, false); + setSplitPositionLimits(0, Unit.PERCENTAGE, 100, Unit.PERCENTAGE); } /** @@ -430,11 +431,11 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { SplitterState state = getSplitterState(); state.setMinPosition(minPos); - state.setMinPositionUnit("" + minPosUnit); + state.setMinPositionUnit(minPosUnit.getSymbol()); posMinUnit = minPosUnit; state.setMaxPosition(maxPos); - state.setMaxPositionUnit("" + maxPosUnit); + state.setMaxPositionUnit(maxPosUnit.getSymbol()); posMaxUnit = maxPosUnit; requestRepaint(); -- 2.39.5