import com.vaadin.client.ui.VAbstractSplitPanel.SplitterMoveHandler.SplitterMoveEvent;
import com.vaadin.shared.ui.Orientation;
-public class VAbstractSplitPanel extends ComplexPanel {
+public abstract class VAbstractSplitPanel extends ComplexPanel {
private boolean enabled = false;
}
break;
case Event.ONCLICK:
+ stopResize();
resizing = false;
break;
}
}
final Element trg = event.getEventTarget().cast();
if (trg == splitter || trg == DOM.getChild(splitter, 0)) {
+ startResize();
resizing = true;
DOM.setCapture(getElement());
origX = DOM.getElementPropertyInt(splitter, "offsetLeft");
}
}
+ /**
+ * Called when starting drag resize
+ *
+ * @since
+ */
+ abstract protected void startResize();
+
+ /**
+ * Called when stopping drag resize
+ *
+ * @since
+ */
+ abstract protected void stopResize();
+
+ /**
+ * Gets the first container
+ *
+ * @since
+ * @return the firstContainer
+ */
+ protected Element getFirstContainer() {
+ return firstContainer;
+ }
+
+ /**
+ * Gets the second container
+ *
+ * @since
+ * @return the secondContainer
+ */
+ protected Element getSecondContainer() {
+ return secondContainer;
+ }
+
public void onMouseMove(Event event) {
switch (orientation) {
case HORIZONTAL:
public void onMouseUp(Event event) {
DOM.releaseCapture(getElement());
hideDraggingCurtain();
+ stopResize();
resizing = false;
if (!WidgetUtil.isTouchEvent(event)) {
onMouseMove(event);
package com.vaadin.client.ui;
+import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.user.client.ui.Widget;
import com.vaadin.shared.ui.Orientation;
public class VSplitPanelHorizontal extends VAbstractSplitPanel {
public VSplitPanelHorizontal() {
super(Orientation.HORIZONTAL);
}
+
+ @Override
+ protected void startResize() {
+ if (isWidgetFullWidth(getFirstWidget())) {
+ getFirstContainer().getStyle().setOverflow(Overflow.HIDDEN);
+ }
+
+ if (isWidgetFullWidth(getSecondWidget())) {
+ getSecondContainer().getStyle().setOverflow(Overflow.HIDDEN);
+ }
+ }
+
+ @Override
+ protected void stopResize() {
+ getFirstContainer().getStyle().clearOverflow();
+ getSecondContainer().getStyle().clearOverflow();
+ }
+
+ private boolean isWidgetFullWidth(Widget w) {
+ return w.getElement().getStyle().getWidth().equals("100%");
+ }
}
package com.vaadin.client.ui;
+import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.user.client.ui.Widget;
import com.vaadin.shared.ui.Orientation;
public class VSplitPanelVertical extends VAbstractSplitPanel {
public VSplitPanelVertical() {
super(Orientation.VERTICAL);
}
+
+ @Override
+ protected void startResize() {
+ if (isWidgetFullHeight(getFirstWidget())) {
+ getFirstContainer().getStyle().setOverflow(Overflow.HIDDEN);
+ }
+
+ if (isWidgetFullHeight(getSecondWidget())) {
+ getSecondContainer().getStyle().setOverflow(Overflow.HIDDEN);
+ }
+ }
+
+ @Override
+ protected void stopResize() {
+ getFirstContainer().getStyle().clearOverflow();
+ getSecondContainer().getStyle().clearOverflow();
+ }
+
+ private boolean isWidgetFullHeight(Widget w) {
+ return w.getElement().getStyle().getHeight().equals("100%");
+ }
}