From: Johannes Dahlström Date: Tue, 19 Jun 2012 10:42:11 +0000 (+0300) Subject: Fix issues caused by 6.8 merge: prevent NPE with componentStyles; ensure split positi... X-Git-Tag: 7.0.0.alpha3~112 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=66e9b8cec5bd22672b8498716015ec3e2dc748aa;p=vaadin-framework.git 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 --- 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();