From: Artur Signell
Date: Wed, 11 Apr 2012 16:58:26 +0000 (+0300)
Subject: Moved each component to its own package on client side
X-Git-Tag: 7.0.0.alpha2~82
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=429aeadef913b1d5f3cc932c70b54afa2a57275c;p=vaadin-framework.git
Moved each component to its own package on client side
Class loaders have problems with referring to static inner classes (e.g.
state classes) when they cannot load the declaring class. To deal with
this the components have been moved to their own packages and state/rpc
classes will be defined in their own Java files.
---
diff --git a/src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml b/src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml
index 82c9f2cf90..3627fa2192 100644
--- a/src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml
+++ b/src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml
@@ -6,27 +6,27 @@
+ class="com.vaadin.terminal.gwt.client.ui.upload.UploadIFrameOnloadStrategy">
+ class="com.vaadin.terminal.gwt.client.ui.upload.UploadIFrameOnloadStrategy" />
+ class="com.vaadin.terminal.gwt.client.ui.upload.UploadIFrameOnloadStrategyIE">
+ com.vaadin.terminal.gwt.client.ui.upload.UploadIFrameOnloadStrategytrategy" />
-
-
+
+
-
-
+
+
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index 6f3ff6db45..555112a636 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -46,11 +46,11 @@ import com.vaadin.terminal.gwt.client.communication.RpcManager;
import com.vaadin.terminal.gwt.client.communication.SharedState;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.VContextMenu;
-import com.vaadin.terminal.gwt.client.ui.VNotification;
-import com.vaadin.terminal.gwt.client.ui.VNotification.HideEvent;
-import com.vaadin.terminal.gwt.client.ui.WindowConnector;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
+import com.vaadin.terminal.gwt.client.ui.notification.VNotification;
+import com.vaadin.terminal.gwt.client.ui.notification.VNotification.HideEvent;
import com.vaadin.terminal.gwt.client.ui.root.RootConnector;
+import com.vaadin.terminal.gwt.client.ui.window.WindowConnector;
import com.vaadin.terminal.gwt.server.AbstractCommunicationManager;
/**
diff --git a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
index 8226860533..d847d49e6f 100644
--- a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
+++ b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
@@ -13,12 +13,12 @@ import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ui.SubPartAware;
-import com.vaadin.terminal.gwt.client.ui.VGridLayout;
-import com.vaadin.terminal.gwt.client.ui.VMeasuringOrderedLayout;
-import com.vaadin.terminal.gwt.client.ui.VTabsheetPanel;
-import com.vaadin.terminal.gwt.client.ui.VWindow;
-import com.vaadin.terminal.gwt.client.ui.WindowConnector;
+import com.vaadin.terminal.gwt.client.ui.gridlayout.VGridLayout;
+import com.vaadin.terminal.gwt.client.ui.orderedlayout.VMeasuringOrderedLayout;
import com.vaadin.terminal.gwt.client.ui.root.VRoot;
+import com.vaadin.terminal.gwt.client.ui.tabsheet.VTabsheetPanel;
+import com.vaadin.terminal.gwt.client.ui.window.VWindow;
+import com.vaadin.terminal.gwt.client.ui.window.WindowConnector;
/**
* ComponentLocator provides methods for generating a String locator for a given
diff --git a/src/com/vaadin/terminal/gwt/client/DateTimeService.java b/src/com/vaadin/terminal/gwt/client/DateTimeService.java
index c0151d2819..45ba4a7452 100644
--- a/src/com/vaadin/terminal/gwt/client/DateTimeService.java
+++ b/src/com/vaadin/terminal/gwt/client/DateTimeService.java
@@ -8,7 +8,7 @@ import java.util.Date;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.LocaleInfo;
-import com.vaadin.terminal.gwt.client.ui.VDateField;
+import com.vaadin.terminal.gwt.client.ui.datefield.VDateField;
/**
* This class provides date/time parsing services to all components on the
diff --git a/src/com/vaadin/terminal/gwt/client/LayoutManager.java b/src/com/vaadin/terminal/gwt/client/LayoutManager.java
index 78709a7134..60a2d3543a 100644
--- a/src/com/vaadin/terminal/gwt/client/LayoutManager.java
+++ b/src/com/vaadin/terminal/gwt/client/LayoutManager.java
@@ -12,7 +12,7 @@ import com.google.gwt.dom.client.Element;
import com.vaadin.terminal.gwt.client.ui.ManagedLayout;
import com.vaadin.terminal.gwt.client.ui.PostLayoutListener;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
-import com.vaadin.terminal.gwt.client.ui.VNotification;
+import com.vaadin.terminal.gwt.client.ui.notification.VNotification;
public class LayoutManager {
private static final String LOOP_ABORT_MESSAGE = "Aborting layout after 100 passes. This would probably be an infinite loop.";
diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
index ddf007ef37..e3cacc5870 100644
--- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
+++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
@@ -53,10 +53,10 @@ import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ui.VLazyExecutor;
-import com.vaadin.terminal.gwt.client.ui.VNotification;
import com.vaadin.terminal.gwt.client.ui.VOverlay;
-import com.vaadin.terminal.gwt.client.ui.WindowConnector;
+import com.vaadin.terminal.gwt.client.ui.notification.VNotification;
import com.vaadin.terminal.gwt.client.ui.root.RootConnector;
+import com.vaadin.terminal.gwt.client.ui.window.WindowConnector;
/**
* A helper console for client side development. The debug console can also be
diff --git a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
index bd79e5f9c6..9fa973dc29 100644
--- a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
+++ b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
@@ -25,7 +25,7 @@ import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector;
-import com.vaadin.terminal.gwt.client.ui.VWindow;
+import com.vaadin.terminal.gwt.client.ui.window.VWindow;
public class VUIDLBrowser extends SimpleTree {
private static final String HELP = "Shift click handle to open recursively. Click components to hightlight them on client side. Shift click components to highlight them also on the server side.";
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java
deleted file mode 100644
index 7e1683934c..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
-import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.AbstractLayoutConnector.AbstractLayoutState;
-import com.vaadin.terminal.gwt.client.ui.VAbsoluteLayout.AbsoluteWrapper;
-import com.vaadin.ui.AbsoluteLayout;
-
-@Component(AbsoluteLayout.class)
-public class AbsoluteLayoutConnector extends
- AbstractComponentContainerConnector implements DirectionalManagedLayout {
-
- public static class AbsoluteLayoutState extends AbstractLayoutState {
- // Maps each component to a position
- private Map connectorToCssPosition = new HashMap();
-
- public String getConnectorPosition(Connector connector) {
- return connectorToCssPosition.get(connector.getConnectorId());
- }
-
- public Map getConnectorToCssPosition() {
- return connectorToCssPosition;
- }
-
- public void setConnectorToCssPosition(
- Map componentToCssPosition) {
- connectorToCssPosition = componentToCssPosition;
- }
-
- }
-
- public interface AbsoluteLayoutServerRPC extends LayoutClickRPC, ServerRpc {
-
- }
-
- private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
- this) {
-
- @Override
- protected ComponentConnector getChildComponent(Element element) {
- return getConnectorForElement(element);
- }
-
- @Override
- protected LayoutClickRPC getLayoutClickRPC() {
- return rpc;
- };
-
- };
-
- private AbsoluteLayoutServerRPC rpc;
-
- private Map connectorIdToComponentWrapper = new HashMap();
-
- @Override
- protected void init() {
- super.init();
- rpc = RpcProxy.create(AbsoluteLayoutServerRPC.class, this);
- }
-
- /**
- * Returns the deepest nested child component which contains "element". The
- * child component is also returned if "element" is part of its caption.
- *
- * @param element
- * An element that is a nested sub element of the root element in
- * this layout
- * @return The Paintable which the element is a part of. Null if the element
- * belongs to the layout and not to a child.
- */
- protected ComponentConnector getConnectorForElement(Element element) {
- return Util.getConnectorForElement(getConnection(), getWidget(),
- element);
- }
-
- public void updateCaption(ComponentConnector component) {
- VAbsoluteLayout absoluteLayoutWidget = getWidget();
- AbsoluteWrapper componentWrapper = getWrapper(component);
-
- boolean captionIsNeeded = VCaption.isNeeded(component.getState());
-
- VCaption caption = componentWrapper.getCaption();
-
- if (captionIsNeeded) {
- if (caption == null) {
- caption = new VCaption(component, getConnection());
- absoluteLayoutWidget.add(caption);
- componentWrapper.setCaption(caption);
- }
- caption.updateCaption();
- componentWrapper.updateCaptionPosition();
- } else {
- if (caption != null) {
- caption.removeFromParent();
- }
- }
-
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VAbsoluteLayout.class);
- }
-
- @Override
- public VAbsoluteLayout getWidget() {
- return (VAbsoluteLayout) super.getWidget();
- }
-
- @Override
- public AbsoluteLayoutState getState() {
- return (AbsoluteLayoutState) super.getState();
- }
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
- clickEventHandler.handleEventHandlerRegistration();
-
- // TODO Margin handling
-
- for (ComponentConnector child : getChildren()) {
- getWrapper(child).setPosition(
- getState().getConnectorPosition(child));
- }
- };
-
- private AbsoluteWrapper getWrapper(ComponentConnector child) {
- String childId = child.getConnectorId();
- AbsoluteWrapper wrapper = connectorIdToComponentWrapper.get(childId);
- if (wrapper != null) {
- return wrapper;
- }
-
- wrapper = new AbsoluteWrapper(child.getWidget());
- connectorIdToComponentWrapper.put(childId, wrapper);
- getWidget().add(wrapper);
- return wrapper;
-
- }
-
- @Override
- public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- super.onConnectorHierarchyChange(event);
-
- for (ComponentConnector child : getChildren()) {
- getWrapper(child);
- }
-
- for (ComponentConnector oldChild : event.getOldChildren()) {
- if (oldChild.getParent() != this) {
- String connectorId = oldChild.getConnectorId();
- AbsoluteWrapper absoluteWrapper = connectorIdToComponentWrapper
- .remove(connectorId);
- absoluteWrapper.destroy();
- }
- }
- }
-
- public void layoutVertically() {
- VAbsoluteLayout layout = getWidget();
- for (ComponentConnector paintable : getChildren()) {
- Widget widget = paintable.getWidget();
- AbsoluteWrapper wrapper = (AbsoluteWrapper) widget.getParent();
- Style wrapperStyle = wrapper.getElement().getStyle();
-
- if (paintable.isRelativeHeight()) {
- int h;
- if (wrapper.top != null && wrapper.bottom != null) {
- h = wrapper.getOffsetHeight();
- } else if (wrapper.bottom != null) {
- // top not defined, available space 0... bottom of
- // wrapper
- h = wrapper.getElement().getOffsetTop()
- + wrapper.getOffsetHeight();
- } else {
- // top defined or both undefined, available space ==
- // canvas - top
- h = layout.canvas.getOffsetHeight()
- - wrapper.getElement().getOffsetTop();
- }
- wrapperStyle.setHeight(h, Unit.PX);
- } else {
- wrapperStyle.clearHeight();
- }
-
- wrapper.updateCaptionPosition();
- }
- }
-
- public void layoutHorizontally() {
- VAbsoluteLayout layout = getWidget();
- for (ComponentConnector paintable : getChildren()) {
- AbsoluteWrapper wrapper = getWrapper(paintable);
- Style wrapperStyle = wrapper.getElement().getStyle();
-
- if (paintable.isRelativeWidth()) {
- int w;
- if (wrapper.left != null && wrapper.right != null) {
- w = wrapper.getOffsetWidth();
- } else if (wrapper.right != null) {
- // left == null
- // available width == right edge == offsetleft + width
- w = wrapper.getOffsetWidth()
- + wrapper.getElement().getOffsetLeft();
- } else {
- // left != null && right == null || left == null &&
- // right == null
- // available width == canvas width - offset left
- w = layout.canvas.getOffsetWidth()
- - wrapper.getElement().getOffsetLeft();
- }
- wrapperStyle.setWidth(w, Unit.PX);
- } else {
- wrapperStyle.clearWidth();
- }
-
- wrapper.updateCaptionPosition();
- }
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractDateFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractDateFieldConnector.java
deleted file mode 100644
index 7497dc3d35..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractDateFieldConnector.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.Date;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.LocaleNotLoadedException;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VConsole;
-
-public class AbstractDateFieldConnector extends AbstractFieldConnector
- implements Paintable {
-
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- // Save details
- getWidget().client = client;
- getWidget().paintableId = uidl.getId();
- getWidget().immediate = getState().isImmediate();
-
- getWidget().readonly = isReadOnly();
- getWidget().enabled = isEnabled();
-
- if (uidl.hasAttribute("locale")) {
- final String locale = uidl.getStringAttribute("locale");
- try {
- getWidget().dts.setLocale(locale);
- getWidget().currentLocale = locale;
- } catch (final LocaleNotLoadedException e) {
- getWidget().currentLocale = getWidget().dts.getLocale();
- VConsole.error("Tried to use an unloaded locale \"" + locale
- + "\". Using default locale ("
- + getWidget().currentLocale + ").");
- VConsole.error(e);
- }
- }
-
- // We show week numbers only if the week starts with Monday, as ISO 8601
- // specifies
- getWidget().showISOWeekNumbers = uidl
- .getBooleanAttribute(VDateField.WEEK_NUMBERS)
- && getWidget().dts.getFirstDayOfWeek() == 1;
-
- int newResolution;
- if (uidl.hasVariable("sec")) {
- newResolution = VDateField.RESOLUTION_SEC;
- } else if (uidl.hasVariable("min")) {
- newResolution = VDateField.RESOLUTION_MIN;
- } else if (uidl.hasVariable("hour")) {
- newResolution = VDateField.RESOLUTION_HOUR;
- } else if (uidl.hasVariable("day")) {
- newResolution = VDateField.RESOLUTION_DAY;
- } else if (uidl.hasVariable("month")) {
- newResolution = VDateField.RESOLUTION_MONTH;
- } else {
- newResolution = VDateField.RESOLUTION_YEAR;
- }
-
- getWidget().currentResolution = newResolution;
-
- // Add stylename that indicates current resolution
- getWidget()
- .addStyleName(
- VDateField.CLASSNAME
- + "-"
- + VDateField
- .resolutionToString(getWidget().currentResolution));
-
- final int year = uidl.getIntVariable("year");
- final int month = (getWidget().currentResolution >= VDateField.RESOLUTION_MONTH) ? uidl
- .getIntVariable("month") : -1;
- final int day = (getWidget().currentResolution >= VDateField.RESOLUTION_DAY) ? uidl
- .getIntVariable("day") : -1;
- final int hour = (getWidget().currentResolution >= VDateField.RESOLUTION_HOUR) ? uidl
- .getIntVariable("hour") : 0;
- final int min = (getWidget().currentResolution >= VDateField.RESOLUTION_MIN) ? uidl
- .getIntVariable("min") : 0;
- final int sec = (getWidget().currentResolution >= VDateField.RESOLUTION_SEC) ? uidl
- .getIntVariable("sec") : 0;
-
- // Construct new date for this datefield (only if not null)
- if (year > -1) {
- getWidget().setCurrentDate(
- new Date((long) getWidget().getTime(year, month, day, hour,
- min, sec, 0)));
- } else {
- getWidget().setCurrentDate(null);
- }
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VDateField.class);
- }
-
- @Override
- public VDateField getWidget() {
- return (VDateField) super.getWidget();
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java
deleted file mode 100644
index 0866a3007b..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.List;
-
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
-import com.vaadin.terminal.gwt.client.LayoutManager;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.ValueMap;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.layout.ComponentConnectorLayoutSlot;
-import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
-
-public abstract class AbstractOrderedLayoutConnector extends
- AbstractLayoutConnector implements Paintable, DirectionalManagedLayout {
-
- public static class AbstractOrderedLayoutState extends AbstractLayoutState {
- private boolean spacing = false;
-
- public boolean isSpacing() {
- return spacing;
- }
-
- public void setSpacing(boolean spacing) {
- this.spacing = spacing;
- }
-
- }
-
- public interface AbstractOrderedLayoutServerRPC extends LayoutClickRPC,
- ServerRpc {
-
- }
-
- AbstractOrderedLayoutServerRPC rpc;
-
- private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
- this) {
-
- @Override
- protected ComponentConnector getChildComponent(Element element) {
- return Util.getConnectorForElement(getConnection(), getWidget(),
- element);
- }
-
- @Override
- protected LayoutClickRPC getLayoutClickRPC() {
- return rpc;
- };
-
- };
-
- @Override
- public void init() {
- rpc = RpcProxy.create(AbstractOrderedLayoutServerRPC.class, this);
- getLayoutManager().registerDependency(this,
- getWidget().spacingMeasureElement);
- }
-
- @Override
- public AbstractOrderedLayoutState getState() {
- return (AbstractOrderedLayoutState) super.getState();
- }
-
- public void updateCaption(ComponentConnector component) {
- VMeasuringOrderedLayout layout = getWidget();
- if (VCaption.isNeeded(component.getState())) {
- VLayoutSlot layoutSlot = layout.getSlotForChild(component
- .getWidget());
- VCaption caption = layoutSlot.getCaption();
- if (caption == null) {
- caption = new VCaption(component, getConnection());
-
- Widget widget = component.getWidget();
-
- layout.setCaption(widget, caption);
- }
- caption.updateCaption();
- } else {
- layout.setCaption(component.getWidget(), null);
- getLayoutManager().setNeedsUpdate(this);
- }
- }
-
- @Override
- public VMeasuringOrderedLayout getWidget() {
- return (VMeasuringOrderedLayout) super.getWidget();
- }
-
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (!isRealUpdate(uidl)) {
- return;
- }
- clickEventHandler.handleEventHandlerRegistration();
-
- VMeasuringOrderedLayout layout = getWidget();
-
- ValueMap expandRatios = uidl.getMapAttribute("expandRatios");
- ValueMap alignments = uidl.getMapAttribute("alignments");
-
- for (ComponentConnector child : getChildren()) {
- VLayoutSlot slot = layout.getSlotForChild(child.getWidget());
- String pid = child.getConnectorId();
-
- AlignmentInfo alignment;
- if (alignments.containsKey(pid)) {
- alignment = new AlignmentInfo(alignments.getInt(pid));
- } else {
- alignment = AlignmentInfo.TOP_LEFT;
- }
- slot.setAlignment(alignment);
-
- double expandRatio;
- if (expandRatios.containsKey(pid)) {
- expandRatio = expandRatios.getRawNumber(pid);
- } else {
- expandRatio = 0;
- }
- slot.setExpandRatio(expandRatio);
- }
-
- layout.updateMarginStyleNames(new VMarginInfo(getState()
- .getMarginsBitmask()));
-
- layout.updateSpacingStyleName(getState().isSpacing());
-
- getLayoutManager().setNeedsUpdate(this);
- }
-
- private int getSizeForInnerSize(int size, boolean isVertical) {
- LayoutManager layoutManager = getLayoutManager();
- Element element = getWidget().getElement();
- if (isVertical) {
- return size + layoutManager.getBorderHeight(element)
- + layoutManager.getPaddingHeight(element);
- } else {
- return size + layoutManager.getBorderWidth(element)
- + layoutManager.getPaddingWidth(element);
- }
- }
-
- private static String getSizeProperty(boolean isVertical) {
- return isVertical ? "height" : "width";
- }
-
- private boolean isUndefinedInDirection(boolean isVertical) {
- if (isVertical) {
- return isUndefinedHeight();
- } else {
- return isUndefinedWidth();
- }
- }
-
- private int getInnerSizeInDirection(boolean isVertical) {
- if (isVertical) {
- return getLayoutManager().getInnerHeight(getWidget().getElement());
- } else {
- return getLayoutManager().getInnerWidth(getWidget().getElement());
- }
- }
-
- private void layoutPrimaryDirection() {
- VMeasuringOrderedLayout layout = getWidget();
- boolean isVertical = layout.isVertical;
- boolean isUndefined = isUndefinedInDirection(isVertical);
-
- int startPadding = getStartPadding(isVertical);
- int spacingSize = getSpacingInDirection(isVertical);
- int allocatedSize;
-
- if (isUndefined) {
- allocatedSize = -1;
- } else {
- allocatedSize = getInnerSizeInDirection(isVertical);
- }
-
- allocatedSize = layout.layoutPrimaryDirection(spacingSize,
- allocatedSize, startPadding);
-
- Style ownStyle = getWidget().getElement().getStyle();
- if (isUndefined) {
- ownStyle.setPropertyPx(getSizeProperty(isVertical),
- getSizeForInnerSize(allocatedSize, isVertical));
- } else {
- ownStyle.setProperty(getSizeProperty(isVertical),
- getDefinedSize(isVertical));
- }
- }
-
- private int getSpacingInDirection(boolean isVertical) {
- if (isVertical) {
- return getLayoutManager().getOuterHeight(
- getWidget().spacingMeasureElement);
- } else {
- return getLayoutManager().getOuterWidth(
- getWidget().spacingMeasureElement);
- }
- }
-
- private void layoutSecondaryDirection() {
- VMeasuringOrderedLayout layout = getWidget();
- boolean isVertical = layout.isVertical;
- boolean isUndefined = isUndefinedInDirection(!isVertical);
-
- int startPadding = getStartPadding(!isVertical);
-
- int allocatedSize;
- if (isUndefined) {
- allocatedSize = -1;
- } else {
- allocatedSize = getInnerSizeInDirection(!isVertical);
- }
-
- allocatedSize = layout.layoutSecondaryDirection(allocatedSize,
- startPadding);
-
- Style ownStyle = getWidget().getElement().getStyle();
-
- if (isUndefined) {
- ownStyle.setPropertyPx(getSizeProperty(!getWidget().isVertical),
- getSizeForInnerSize(allocatedSize, !getWidget().isVertical));
- } else {
- ownStyle.setProperty(getSizeProperty(!getWidget().isVertical),
- getDefinedSize(!getWidget().isVertical));
- }
- }
-
- private String getDefinedSize(boolean isVertical) {
- if (isVertical) {
- return getState().getHeight();
- } else {
- return getState().getWidth();
- }
- }
-
- private int getStartPadding(boolean isVertical) {
- if (isVertical) {
- return getLayoutManager().getPaddingTop(getWidget().getElement());
- } else {
- return getLayoutManager().getPaddingLeft(getWidget().getElement());
- }
- }
-
- public void layoutHorizontally() {
- if (getWidget().isVertical) {
- layoutSecondaryDirection();
- } else {
- layoutPrimaryDirection();
- }
- }
-
- public void layoutVertically() {
- if (getWidget().isVertical) {
- layoutPrimaryDirection();
- } else {
- layoutSecondaryDirection();
- }
- }
-
- @Override
- public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- super.onConnectorHierarchyChange(event);
- List previousChildren = event.getOldChildren();
- int currentIndex = 0;
- VMeasuringOrderedLayout layout = getWidget();
-
- for (ComponentConnector child : getChildren()) {
- Widget childWidget = child.getWidget();
- VLayoutSlot slot = layout.getSlotForChild(childWidget);
-
- if (childWidget.getParent() != layout) {
- // If the child widget was previously attached to another
- // AbstractOrderedLayout a slot might be found that belongs to
- // another AbstractOrderedLayout. In this case we discard it and
- // create a new slot.
- slot = new ComponentConnectorLayoutSlot(getWidget()
- .getStylePrimaryName(), child, this);
- }
- layout.addOrMove(slot, currentIndex++);
- }
-
- for (ComponentConnector child : previousChildren) {
- if (child.getParent() != this) {
- // Remove slot if the connector is no longer a child of this
- // layout
- layout.removeSlotForWidget(child.getWidget());
- }
- }
-
- };
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractSplitPanelConnector.java
deleted file mode 100644
index 59c524bd1f..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractSplitPanelConnector.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.LinkedList;
-
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.event.dom.client.DomEvent;
-import com.google.gwt.event.dom.client.DomEvent.Type;
-import com.google.gwt.event.shared.EventHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.VAbstractSplitPanel.SplitterMoveHandler;
-import com.vaadin.terminal.gwt.client.ui.VAbstractSplitPanel.SplitterMoveHandler.SplitterMoveEvent;
-
-public abstract class AbstractSplitPanelConnector extends
- AbstractComponentContainerConnector implements SimpleManagedLayout {
-
- public interface AbstractSplitPanelRPC extends ServerRpc {
-
- /**
- * Called when the position has been updated by the user.
- *
- * @param position
- * The new position in % if the current unit is %, in px
- * otherwise
- */
- public void setSplitterPosition(float position);
-
- /**
- * Called when a click event has occurred on the splitter.
- *
- * @param mouseDetails
- * Details about the mouse when the event took place
- */
- public void splitterClick(MouseEventDetails mouseDetails);
-
- }
-
- public static class SplitterState {
- private float position;
- private String positionUnit;
- private boolean positionReversed = false;
- private boolean locked = false;
-
- public float getPosition() {
- return position;
- }
-
- public void setPosition(float position) {
- this.position = position;
- }
-
- public String getPositionUnit() {
- return positionUnit;
- }
-
- public void setPositionUnit(String positionUnit) {
- this.positionUnit = positionUnit;
- }
-
- public boolean isPositionReversed() {
- return positionReversed;
- }
-
- public void setPositionReversed(boolean positionReversed) {
- this.positionReversed = positionReversed;
- }
-
- public boolean isLocked() {
- return locked;
- }
-
- public void setLocked(boolean locked) {
- this.locked = locked;
- }
-
- }
-
- public static class AbstractSplitPanelState extends ComponentState {
- private Connector firstChild = null;
- private Connector secondChild = null;
- private SplitterState splitterState = new SplitterState();
-
- public boolean hasFirstChild() {
- return firstChild != null;
- }
-
- public boolean hasSecondChild() {
- return secondChild != null;
- }
-
- public Connector getFirstChild() {
- return firstChild;
- }
-
- public void setFirstChild(Connector firstChild) {
- this.firstChild = firstChild;
- }
-
- public Connector getSecondChild() {
- return secondChild;
- }
-
- public void setSecondChild(Connector secondChild) {
- this.secondChild = secondChild;
- }
-
- public SplitterState getSplitterState() {
- return splitterState;
- }
-
- public void setSplitterState(SplitterState splitterState) {
- this.splitterState = splitterState;
- }
-
- }
-
- private AbstractSplitPanelRPC rpc;
-
- @Override
- protected void init() {
- super.init();
- rpc = RpcProxy.create(AbstractSplitPanelRPC.class, this);
- // TODO Remove
- getWidget().client = getConnection();
-
- getWidget().addHandler(new SplitterMoveHandler() {
-
- public void splitterMoved(SplitterMoveEvent event) {
- String position = getWidget().getSplitterPosition();
- float pos = 0;
- if (position.indexOf("%") > 0) {
- // 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));
- }
-
- rpc.setSplitterPosition(pos);
- }
-
- }, SplitterMoveEvent.TYPE);
- }
-
- public void updateCaption(ComponentConnector component) {
- // TODO Implement caption handling
- }
-
- ClickEventHandler clickEventHandler = new ClickEventHandler(this) {
-
- @Override
- protected HandlerRegistration registerHandler(
- H handler, Type type) {
- if ((Event.getEventsSunk(getWidget().splitter) & Event
- .getTypeInt(type.getName())) != 0) {
- // If we are already sinking the event for the splitter we do
- // not want to additionally sink it for the root element
- return getWidget().addHandler(handler, type);
- } else {
- return getWidget().addDomHandler(handler, type);
- }
- }
-
- @Override
- protected boolean shouldFireEvent(DomEvent> event) {
- Element target = event.getNativeEvent().getEventTarget().cast();
- if (!getWidget().splitter.isOrHasChild(target)) {
- return false;
- }
-
- return super.shouldFireEvent(event);
- };
-
- @Override
- protected Element getRelativeToElement() {
- return getWidget().splitter;
- };
-
- @Override
- protected void fireClick(NativeEvent event,
- MouseEventDetails mouseDetails) {
- rpc.splitterClick(mouseDetails);
- }
-
- };
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
-
- getWidget().immediate = getState().isImmediate();
-
- getWidget().setEnabled(isEnabled());
-
- clickEventHandler.handleEventHandlerRegistration();
-
- if (getState().hasStyles()) {
- getWidget().componentStyleNames = getState().getStyles();
- } else {
- getWidget().componentStyleNames = new LinkedList();
- }
-
- // Splitter updates
- SplitterState splitterState = getState().getSplitterState();
-
- getWidget().setLocked(splitterState.isLocked());
- getWidget().setPositionReversed(splitterState.isPositionReversed());
-
- getWidget().setStylenames();
-
- getWidget().position = splitterState.getPosition()
- + splitterState.getPositionUnit();
-
- // This is needed at least for cases like #3458 to take
- // appearing/disappearing scrollbars into account.
- getConnection().runDescendentsLayout(getWidget());
-
- getLayoutManager().setNeedsUpdate(this);
-
- }
-
- public void layout() {
- VAbstractSplitPanel splitPanel = getWidget();
- splitPanel.setSplitPosition(splitPanel.position);
- splitPanel.updateSizes();
- }
-
- @Override
- public VAbstractSplitPanel getWidget() {
- return (VAbstractSplitPanel) super.getWidget();
- }
-
- @Override
- protected abstract VAbstractSplitPanel createWidget();
-
- @Override
- public AbstractSplitPanelState getState() {
- return (AbstractSplitPanelState) super.getState();
- }
-
- private ComponentConnector getFirstChild() {
- return (ComponentConnector) getState().getFirstChild();
- }
-
- private ComponentConnector getSecondChild() {
- return (ComponentConnector) getState().getSecondChild();
- }
-
- @Override
- public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- super.onConnectorHierarchyChange(event);
-
- Widget newFirstChildWidget = null;
- if (getFirstChild() != null) {
- newFirstChildWidget = getFirstChild().getWidget();
- }
- getWidget().setFirstWidget(newFirstChildWidget);
-
- Widget newSecondChildWidget = null;
- if (getSecondChild() != null) {
- newSecondChildWidget = getSecondChild().getWidget();
- }
- getWidget().setSecondWidget(newSecondChildWidget);
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AccordionConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AccordionConnector.java
deleted file mode 100644
index e54f078a94..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AccordionConnector.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.Iterator;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.VAccordion.StackItem;
-import com.vaadin.ui.Accordion;
-
-@Component(Accordion.class)
-public class AccordionConnector extends TabsheetBaseConnector implements
- SimpleManagedLayout {
-
- @Override
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- getWidget().selectedUIDLItemIndex = -1;
- super.updateFromUIDL(uidl, client);
- /*
- * Render content after all tabs have been created and we know how large
- * the content area is
- */
- if (getWidget().selectedUIDLItemIndex >= 0) {
- StackItem selectedItem = getWidget().getStackItem(
- getWidget().selectedUIDLItemIndex);
- UIDL selectedTabUIDL = getWidget().lazyUpdateMap
- .remove(selectedItem);
- getWidget().open(getWidget().selectedUIDLItemIndex);
-
- selectedItem.setContent(selectedTabUIDL);
- } else if (isRealUpdate(uidl) && getWidget().openTab != null) {
- getWidget().close(getWidget().openTab);
- }
-
- getWidget().iLayout();
- // finally render possible hidden tabs
- if (getWidget().lazyUpdateMap.size() > 0) {
- for (Iterator iterator = getWidget().lazyUpdateMap.keySet()
- .iterator(); iterator.hasNext();) {
- StackItem item = (StackItem) iterator.next();
- item.setContent(getWidget().lazyUpdateMap.get(item));
- }
- getWidget().lazyUpdateMap.clear();
- }
-
- }
-
- @Override
- public VAccordion getWidget() {
- return (VAccordion) super.getWidget();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VAccordion.class);
- }
-
- public void updateCaption(ComponentConnector component) {
- /* Accordion does not render its children's captions */
- }
-
- public void layout() {
- VAccordion accordion = getWidget();
-
- accordion.updateOpenTabSize();
-
- if (isUndefinedHeight()) {
- accordion.openTab.setHeightFromWidget();
- }
- accordion.iLayout();
-
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AudioConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AudioConnector.java
deleted file mode 100644
index c3c14449c0..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AudioConnector.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.BrowserInfo;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.ui.Audio;
-
-@Component(Audio.class)
-public class AudioConnector extends MediaBaseConnector {
-
- @Override
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- super.updateFromUIDL(uidl, client);
- if (!isRealUpdate(uidl)) {
- return;
- }
- Style style = getWidget().getElement().getStyle();
-
- // Make sure that the controls are not clipped if visible.
- if (shouldShowControls(uidl)
- && (style.getHeight() == null || "".equals(style.getHeight()))) {
- if (BrowserInfo.get().isChrome()) {
- style.setHeight(32, Unit.PX);
- } else {
- style.setHeight(25, Unit.PX);
- }
- }
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VAudio.class);
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java b/src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java
deleted file mode 100644
index 9d8838751f..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.BlurEvent;
-import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.EventHelper;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.communication.FieldRpc.FocusAndBlurServerRpc;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle;
-import com.vaadin.ui.Button;
-
-@Component(value = Button.class, loadStyle = LoadStyle.EAGER)
-public class ButtonConnector extends AbstractComponentConnector implements
- BlurHandler, FocusHandler {
-
- /**
- * RPC interface for calls from client to server.
- *
- * @since 7.0
- */
- public interface ButtonServerRpc extends ServerRpc {
- /**
- * Button click event.
- *
- * @param mouseEventDetails
- * serialized mouse event details
- */
- public void click(MouseEventDetails mouseEventDetails);
-
- /**
- * Indicate to the server that the client has disabled the button as a
- * result of a click.
- */
- public void disableOnClick();
- }
-
- private ButtonServerRpc rpc = RpcProxy.create(ButtonServerRpc.class, this);
- private FocusAndBlurServerRpc focusBlurProxy = RpcProxy.create(
- FocusAndBlurServerRpc.class, this);
-
- private HandlerRegistration focusHandlerRegistration = null;
- private HandlerRegistration blurHandlerRegistration = null;
-
- @Override
- public boolean delegateCaptionHandling() {
- return false;
- }
-
- @Override
- public void init() {
- super.init();
- getWidget().buttonRpcProxy = rpc;
- getWidget().client = getConnection();
- getWidget().paintableId = getConnectorId();
- }
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
- focusHandlerRegistration = EventHelper.updateFocusHandler(this,
- focusHandlerRegistration);
- blurHandlerRegistration = EventHelper.updateBlurHandler(this,
- blurHandlerRegistration);
- // Set text
- getWidget().setText(getState().getCaption());
-
- getWidget().disableOnClick = getState().isDisableOnClick();
-
- // handle error
- if (null != getState().getErrorMessage()) {
- if (getWidget().errorIndicatorElement == null) {
- getWidget().errorIndicatorElement = DOM.createSpan();
- getWidget().errorIndicatorElement
- .setClassName("v-errorindicator");
- }
- getWidget().wrapper.insertBefore(getWidget().errorIndicatorElement,
- getWidget().captionElement);
-
- } else if (getWidget().errorIndicatorElement != null) {
- getWidget().wrapper.removeChild(getWidget().errorIndicatorElement);
- getWidget().errorIndicatorElement = null;
- }
-
- if (getState().getIcon() != null) {
- if (getWidget().icon == null) {
- getWidget().icon = new Icon(getConnection());
- getWidget().wrapper.insertBefore(getWidget().icon.getElement(),
- getWidget().captionElement);
- }
- getWidget().icon.setUri(getState().getIcon().getURL());
- } else {
- if (getWidget().icon != null) {
- getWidget().wrapper.removeChild(getWidget().icon.getElement());
- getWidget().icon = null;
- }
- }
-
- getWidget().clickShortcut = getState().getClickShortcutKeyCode();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VButton.class);
- }
-
- @Override
- public VButton getWidget() {
- return (VButton) super.getWidget();
- }
-
- @Override
- public ButtonState getState() {
- return (ButtonState) super.getState();
- }
-
- public void onFocus(FocusEvent event) {
- // EventHelper.updateFocusHandler ensures that this is called only when
- // there is a listener on server side
- focusBlurProxy.focus();
- }
-
- public void onBlur(BlurEvent event) {
- // EventHelper.updateFocusHandler ensures that this is called only when
- // there is a listener on server side
- focusBlurProxy.blur();
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ButtonState.java b/src/com/vaadin/terminal/gwt/client/ui/ButtonState.java
deleted file mode 100644
index 7786f4ca87..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/ButtonState.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.ui.Button;
-
-/**
- * Shared state for Button and NativeButton.
- *
- * @see ComponentState
- *
- * @since 7.0
- */
-public class ButtonState extends ComponentState {
- private boolean disableOnClick = false;
- private int clickShortcutKeyCode = 0;
-
- /**
- * Checks whether the button should be disabled on the client side on next
- * click.
- *
- * @return true if the button should be disabled on click
- */
- public boolean isDisableOnClick() {
- return disableOnClick;
- }
-
- /**
- * Sets whether the button should be disabled on the client side on next
- * click.
- *
- * @param disableOnClick
- * true if the button should be disabled on click
- */
- public void setDisableOnClick(boolean disableOnClick) {
- this.disableOnClick = disableOnClick;
- }
-
- /**
- * Returns the key code for activating the button via a keyboard shortcut.
- *
- * See {@link Button#setClickShortcut(int, int...)} for more information.
- *
- * @return key code or 0 for none
- */
- public int getClickShortcutKeyCode() {
- return clickShortcutKeyCode;
- }
-
- /**
- * Sets the key code for activating the button via a keyboard shortcut.
- *
- * See {@link Button#setClickShortcut(int, int...)} for more information.
- *
- * @param clickShortcutKeyCode
- * key code or 0 for none
- */
- public void setClickShortcutKeyCode(int clickShortcutKeyCode) {
- this.clickShortcutKeyCode = clickShortcutKeyCode;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java b/src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java
deleted file mode 100644
index f32980c636..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.BlurEvent;
-import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
-import com.vaadin.terminal.gwt.client.EventHelper;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
-import com.vaadin.terminal.gwt.client.VTooltip;
-import com.vaadin.terminal.gwt.client.communication.FieldRpc.FocusAndBlurServerRpc;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.ui.CheckBox;
-
-@Component(CheckBox.class)
-public class CheckBoxConnector extends AbstractFieldConnector implements
- FocusHandler, BlurHandler, ClickHandler {
-
- public interface CheckBoxServerRpc extends ServerRpc {
- public void setChecked(boolean checked,
- MouseEventDetails mouseEventDetails);
- }
-
- public static class CheckBoxState extends AbstractFieldState {
- private boolean checked = false;
-
- public boolean isChecked() {
- return checked;
- }
-
- public void setChecked(boolean checked) {
- this.checked = checked;
- }
-
- }
-
- private HandlerRegistration focusHandlerRegistration;
- private HandlerRegistration blurHandlerRegistration;
-
- private CheckBoxServerRpc rpc = RpcProxy.create(CheckBoxServerRpc.class,
- this);
- private FocusAndBlurServerRpc focusBlurRpc = RpcProxy.create(
- FocusAndBlurServerRpc.class, this);
-
- @Override
- public boolean delegateCaptionHandling() {
- return false;
- }
-
- @Override
- protected void init() {
- super.init();
- getWidget().addClickHandler(this);
- getWidget().client = getConnection();
- getWidget().id = getConnectorId();
-
- }
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
-
- focusHandlerRegistration = EventHelper.updateFocusHandler(this,
- focusHandlerRegistration);
- blurHandlerRegistration = EventHelper.updateBlurHandler(this,
- blurHandlerRegistration);
-
- if (null != getState().getErrorMessage()) {
- if (getWidget().errorIndicatorElement == null) {
- getWidget().errorIndicatorElement = DOM.createSpan();
- getWidget().errorIndicatorElement.setInnerHTML(" ");
- DOM.setElementProperty(getWidget().errorIndicatorElement,
- "className", "v-errorindicator");
- DOM.appendChild(getWidget().getElement(),
- getWidget().errorIndicatorElement);
- DOM.sinkEvents(getWidget().errorIndicatorElement,
- VTooltip.TOOLTIP_EVENTS | Event.ONCLICK);
- } else {
- DOM.setStyleAttribute(getWidget().errorIndicatorElement,
- "display", "");
- }
- } else if (getWidget().errorIndicatorElement != null) {
- DOM.setStyleAttribute(getWidget().errorIndicatorElement, "display",
- "none");
- }
-
- if (isReadOnly()) {
- getWidget().setEnabled(false);
- }
-
- if (getState().getIcon() != null) {
- if (getWidget().icon == null) {
- getWidget().icon = new Icon(getConnection());
- DOM.insertChild(getWidget().getElement(),
- getWidget().icon.getElement(), 1);
- getWidget().icon.sinkEvents(VTooltip.TOOLTIP_EVENTS);
- getWidget().icon.sinkEvents(Event.ONCLICK);
- }
- getWidget().icon.setUri(getState().getIcon().getURL());
- } else if (getWidget().icon != null) {
- // detach icon
- DOM.removeChild(getWidget().getElement(),
- getWidget().icon.getElement());
- getWidget().icon = null;
- }
-
- // Set text
- getWidget().setText(getState().getCaption());
- getWidget().setValue(getState().isChecked());
- getWidget().immediate = getState().isImmediate();
- }
-
- @Override
- public CheckBoxState getState() {
- return (CheckBoxState) super.getState();
- }
-
- @Override
- public VCheckBox getWidget() {
- return (VCheckBox) super.getWidget();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VCheckBox.class);
- }
-
- public void onFocus(FocusEvent event) {
- // EventHelper.updateFocusHandler ensures that this is called only when
- // there is a listener on server side
- focusBlurRpc.focus();
- }
-
- public void onBlur(BlurEvent event) {
- // EventHelper.updateFocusHandler ensures that this is called only when
- // there is a listener on server side
- focusBlurRpc.blur();
- }
-
- public void onClick(ClickEvent event) {
- if (!isEnabled()) {
- return;
- }
-
- // Add mouse details
- MouseEventDetails details = MouseEventDetailsBuilder
- .buildMouseEventDetails(event.getNativeEvent(), getWidget()
- .getElement());
- rpc.setChecked(getWidget().getValue(), details);
-
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ComboBoxConnector.java b/src/com/vaadin/terminal/gwt/client/ui/ComboBoxConnector.java
deleted file mode 100644
index bc73146965..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/ComboBoxConnector.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.Iterator;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.ui.VFilterSelect.FilterSelectSuggestion;
-import com.vaadin.ui.Select;
-
-@Component(Select.class)
-public class ComboBoxConnector extends AbstractFieldConnector implements
- Paintable, SimpleManagedLayout {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal
- * .gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection)
- */
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- // Save details
- getWidget().client = client;
- getWidget().paintableId = uidl.getId();
-
- getWidget().readonly = isReadOnly();
- getWidget().enabled = isEnabled();
-
- getWidget().tb.setEnabled(getWidget().enabled);
- getWidget().updateReadOnly();
-
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- // Inverse logic here to make the default case (text input enabled)
- // work without additional UIDL messages
- boolean noTextInput = uidl
- .hasAttribute(VFilterSelect.ATTR_NO_TEXT_INPUT)
- && uidl.getBooleanAttribute(VFilterSelect.ATTR_NO_TEXT_INPUT);
- getWidget().setTextInputEnabled(!noTextInput);
-
- // not a FocusWidget -> needs own tabindex handling
- if (uidl.hasAttribute("tabindex")) {
- getWidget().tb.setTabIndex(uidl.getIntAttribute("tabindex"));
- }
-
- if (uidl.hasAttribute("filteringmode")) {
- getWidget().filteringmode = uidl.getIntAttribute("filteringmode");
- }
-
- getWidget().immediate = getState().isImmediate();
-
- getWidget().nullSelectionAllowed = uidl.hasAttribute("nullselect");
-
- getWidget().nullSelectItem = uidl.hasAttribute("nullselectitem")
- && uidl.getBooleanAttribute("nullselectitem");
-
- getWidget().currentPage = uidl.getIntVariable("page");
-
- if (uidl.hasAttribute("pagelength")) {
- getWidget().pageLength = uidl.getIntAttribute("pagelength");
- }
-
- if (uidl.hasAttribute(VFilterSelect.ATTR_INPUTPROMPT)) {
- // input prompt changed from server
- getWidget().inputPrompt = uidl
- .getStringAttribute(VFilterSelect.ATTR_INPUTPROMPT);
- } else {
- getWidget().inputPrompt = "";
- }
-
- getWidget().suggestionPopup.updateStyleNames(uidl, getState());
-
- getWidget().allowNewItem = uidl.hasAttribute("allownewitem");
- getWidget().lastNewItemString = null;
-
- getWidget().currentSuggestions.clear();
- if (!getWidget().waitingForFilteringResponse) {
- /*
- * Clear the current suggestions as the server response always
- * includes the new ones. Exception is when filtering, then we need
- * to retain the value if the user does not select any of the
- * options matching the filter.
- */
- getWidget().currentSuggestion = null;
- /*
- * Also ensure no old items in menu. Unless cleared the old values
- * may cause odd effects on blur events. Suggestions in menu might
- * not necessary exist in select at all anymore.
- */
- getWidget().suggestionPopup.menu.clearItems();
-
- }
-
- final UIDL options = uidl.getChildUIDL(0);
- if (uidl.hasAttribute("totalMatches")) {
- getWidget().totalMatches = uidl.getIntAttribute("totalMatches");
- } else {
- getWidget().totalMatches = 0;
- }
-
- // used only to calculate minimum popup width
- String captions = Util.escapeHTML(getWidget().inputPrompt);
-
- for (final Iterator> i = options.getChildIterator(); i.hasNext();) {
- final UIDL optionUidl = (UIDL) i.next();
- final FilterSelectSuggestion suggestion = getWidget().new FilterSelectSuggestion(
- optionUidl);
- getWidget().currentSuggestions.add(suggestion);
- if (optionUidl.hasAttribute("selected")) {
- if (!getWidget().waitingForFilteringResponse
- || getWidget().popupOpenerClicked) {
- String newSelectedOptionKey = Integer.toString(suggestion
- .getOptionKey());
- if (!newSelectedOptionKey
- .equals(getWidget().selectedOptionKey)
- || suggestion.getReplacementString().equals(
- getWidget().tb.getText())) {
- // Update text field if we've got a new selection
- // Also update if we've got the same text to retain old
- // text selection behavior
- getWidget().setPromptingOff(
- suggestion.getReplacementString());
- getWidget().selectedOptionKey = newSelectedOptionKey;
- }
- }
- getWidget().currentSuggestion = suggestion;
- getWidget().setSelectedItemIcon(suggestion.getIconUri());
- }
-
- // Collect captions so we can calculate minimum width for textarea
- if (captions.length() > 0) {
- captions += "|";
- }
- captions += Util.escapeHTML(suggestion.getReplacementString());
- }
-
- if ((!getWidget().waitingForFilteringResponse || getWidget().popupOpenerClicked)
- && uidl.hasVariable("selected")
- && uidl.getStringArrayVariable("selected").length == 0) {
- // select nulled
- if (!getWidget().waitingForFilteringResponse
- || !getWidget().popupOpenerClicked) {
- if (!getWidget().focused) {
- /*
- * client.updateComponent overwrites all styles so we must
- * ALWAYS set the prompting style at this point, even though
- * we think it has been set already...
- */
- getWidget().prompting = false;
- getWidget().setPromptingOn();
- } else {
- // we have focus in field, prompting can't be set on,
- // instead just clear the input
- getWidget().tb.setValue("");
- }
- }
- getWidget().setSelectedItemIcon(null);
- getWidget().selectedOptionKey = null;
- }
-
- if (getWidget().waitingForFilteringResponse
- && getWidget().lastFilter.toLowerCase().equals(
- uidl.getStringVariable("filter"))) {
- getWidget().suggestionPopup.showSuggestions(
- getWidget().currentSuggestions, getWidget().currentPage,
- getWidget().totalMatches);
- getWidget().waitingForFilteringResponse = false;
- if (!getWidget().popupOpenerClicked
- && getWidget().selectPopupItemWhenResponseIsReceived != VFilterSelect.Select.NONE) {
- // we're paging w/ arrows
- if (getWidget().selectPopupItemWhenResponseIsReceived == VFilterSelect.Select.LAST) {
- getWidget().suggestionPopup.menu.selectLastItem();
- } else {
- getWidget().suggestionPopup.menu.selectFirstItem();
- }
-
- // This is used for paging so we update the keyboard selection
- // variable as well.
- MenuItem activeMenuItem = getWidget().suggestionPopup.menu
- .getSelectedItem();
- getWidget().suggestionPopup.menu
- .setKeyboardSelectedItem(activeMenuItem);
-
- // Update text field to contain the correct text
- getWidget().setTextboxText(activeMenuItem.getText());
- getWidget().tb.setSelectionRange(
- getWidget().lastFilter.length(),
- activeMenuItem.getText().length()
- - getWidget().lastFilter.length());
-
- getWidget().selectPopupItemWhenResponseIsReceived = VFilterSelect.Select.NONE; // reset
- }
- if (getWidget().updateSelectionWhenReponseIsReceived) {
- getWidget().suggestionPopup.menu
- .doPostFilterSelectedItemAction();
- }
- }
-
- // Calculate minumum textarea width
- getWidget().suggestionPopupMinWidth = getWidget().minWidth(captions);
-
- getWidget().popupOpenerClicked = false;
-
- if (!getWidget().initDone) {
- getWidget().updateRootWidth();
- }
-
- // Focus dependent style names are lost during the update, so we add
- // them here back again
- if (getWidget().focused) {
- getWidget().addStyleDependentName("focus");
- }
-
- getWidget().initDone = true;
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VFilterSelect.class);
- }
-
- @Override
- public VFilterSelect getWidget() {
- return (VFilterSelect) super.getWidget();
- }
-
- public void layout() {
- VFilterSelect widget = getWidget();
- if (widget.initDone) {
- widget.updateRootWidth();
- }
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/CssLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/CssLayoutConnector.java
deleted file mode 100644
index 554cec0d36..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/CssLayoutConnector.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.BrowserInfo;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.VCssLayout.FlowPane;
-import com.vaadin.ui.CssLayout;
-
-@Component(CssLayout.class)
-public class CssLayoutConnector extends AbstractLayoutConnector {
-
- public static class CssLayoutState extends AbstractLayoutState {
- private Map childCss = new HashMap();
-
- public Map getChildCss() {
- return childCss;
- }
-
- public void setChildCss(Map childCss) {
- this.childCss = childCss;
- }
-
- }
-
- private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
- this) {
-
- @Override
- protected ComponentConnector getChildComponent(Element element) {
- return Util.getConnectorForElement(getConnection(), getWidget(),
- element);
- }
-
- @Override
- protected LayoutClickRPC getLayoutClickRPC() {
- return rpc;
- };
- };
-
- public interface CssLayoutServerRPC extends LayoutClickRPC, ServerRpc {
-
- }
-
- private CssLayoutServerRPC rpc;
-
- private Map childToCaption = new HashMap();
-
- @Override
- protected void init() {
- super.init();
- rpc = RpcProxy.create(CssLayoutServerRPC.class, this);
- }
-
- @Override
- public CssLayoutState getState() {
- return (CssLayoutState) super.getState();
- }
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
-
- getWidget().setMarginStyles(
- new VMarginInfo(getState().getMarginsBitmask()));
-
- for (ComponentConnector child : getChildren()) {
- if (!getState().getChildCss().containsKey(child)) {
- continue;
- }
- String css = getState().getChildCss().get(child);
- Style style = child.getWidget().getElement().getStyle();
- // should we remove styles also? How can we know what we have added
- // as it is added directly to the child component?
- String[] cssRules = css.split(";");
- for (String cssRule : cssRules) {
- String parts[] = cssRule.split(":");
- if (parts.length == 2) {
- style.setProperty(makeCamelCase(parts[0].trim()),
- parts[1].trim());
- }
- }
- }
-
- }
-
- @Override
- public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- super.onConnectorHierarchyChange(event);
-
- clickEventHandler.handleEventHandlerRegistration();
-
- int index = 0;
- FlowPane cssLayoutWidgetContainer = getWidget().panel;
- for (ComponentConnector child : getChildren()) {
- VCaption childCaption = childToCaption.get(child);
- if (childCaption != null) {
- cssLayoutWidgetContainer.addOrMove(childCaption, index++);
- }
- cssLayoutWidgetContainer.addOrMove(child.getWidget(), index++);
- }
-
- // Detach old child widgets and possibly their caption
- for (ComponentConnector child : event.getOldChildren()) {
- if (child.getParent() == this) {
- // Skip current children
- continue;
- }
- cssLayoutWidgetContainer.remove(child.getWidget());
- VCaption vCaption = childToCaption.remove(child);
- if (vCaption != null) {
- cssLayoutWidgetContainer.remove(vCaption);
- }
- }
- }
-
- private static final String makeCamelCase(String cssProperty) {
- // TODO this might be cleaner to implement with regexp
- while (cssProperty.contains("-")) {
- int indexOf = cssProperty.indexOf("-");
- cssProperty = cssProperty.substring(0, indexOf)
- + String.valueOf(cssProperty.charAt(indexOf + 1))
- .toUpperCase() + cssProperty.substring(indexOf + 2);
- }
- if ("float".equals(cssProperty)) {
- if (BrowserInfo.get().isIE()) {
- return "styleFloat";
- } else {
- return "cssFloat";
- }
- }
- return cssProperty;
- }
-
- @Override
- public VCssLayout getWidget() {
- return (VCssLayout) super.getWidget();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VCssLayout.class);
- }
-
- public void updateCaption(ComponentConnector child) {
- Widget childWidget = child.getWidget();
- FlowPane cssLayoutWidgetContainer = getWidget().panel;
- int widgetPosition = cssLayoutWidgetContainer
- .getWidgetIndex(childWidget);
-
- VCaption caption = childToCaption.get(child);
- if (VCaption.isNeeded(child.getState())) {
- if (caption == null) {
- caption = new VCaption(child, getConnection());
- childToCaption.put(child, caption);
- }
- if (!caption.isAttached()) {
- // Insert caption at widget index == before widget
- cssLayoutWidgetContainer.insert(caption, widgetPosition);
- }
- caption.updateCaption();
- } else if (caption != null) {
- childToCaption.remove(child);
- cssLayoutWidgetContainer.remove(caption);
- }
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/CustomComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/CustomComponentConnector.java
deleted file mode 100644
index 68980ef027..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/CustomComponentConnector.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle;
-import com.vaadin.ui.CustomComponent;
-
-@Component(value = CustomComponent.class, loadStyle = LoadStyle.EAGER)
-public class CustomComponentConnector extends
- AbstractComponentContainerConnector {
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VCustomComponent.class);
- }
-
- @Override
- public VCustomComponent getWidget() {
- return (VCustomComponent) super.getWidget();
- }
-
- public void updateCaption(ComponentConnector component) {
- // NOP, custom component dont render composition roots caption
- }
-
- @Override
- public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- super.onConnectorHierarchyChange(event);
-
- ComponentConnector newChild = null;
- if (getChildren().size() == 1) {
- newChild = getChildren().get(0);
- }
-
- VCustomComponent customComponent = getWidget();
- customComponent.setWidget(newChild.getWidget());
-
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/CustomFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/CustomFieldConnector.java
deleted file mode 100644
index 477a4b496a..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/CustomFieldConnector.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.ui.CustomField;
-
-@Component(value = CustomField.class)
-public class CustomFieldConnector extends CustomComponentConnector {
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VCustomComponent.class);
- }
-
- @Override
- public VCustomComponent getWidget() {
- return super.getWidget();
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/CustomLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/CustomLayoutConnector.java
deleted file mode 100644
index f0fb1b7e6f..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/CustomLayoutConnector.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.ui.CustomLayout;
-
-@Component(CustomLayout.class)
-public class CustomLayoutConnector extends AbstractLayoutConnector implements
- SimpleManagedLayout {
-
- public static class CustomLayoutState extends AbstractLayoutState {
- Map childLocations = new HashMap();
- private String templateContents;
- private String templateName;
-
- public String getTemplateContents() {
- return templateContents;
- }
-
- public void setTemplateContents(String templateContents) {
- this.templateContents = templateContents;
- }
-
- public String getTemplateName() {
- return templateName;
- }
-
- public void setTemplateName(String templateName) {
- this.templateName = templateName;
- }
-
- public Map getChildLocations() {
- return childLocations;
- }
-
- public void setChildLocations(Map childLocations) {
- this.childLocations = childLocations;
- }
-
- }
-
- @Override
- public CustomLayoutState getState() {
- return (CustomLayoutState) super.getState();
- }
-
- @Override
- protected void init() {
- super.init();
- getWidget().client = getConnection();
- getWidget().pid = getConnectorId();
-
- }
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
-
- // Evaluate scripts
- VCustomLayout.eval(getWidget().scripts);
- getWidget().scripts = null;
-
- }
-
- private void updateHtmlTemplate() {
- if (getWidget().hasTemplate()) {
- // We (currently) only do this once. You can't change the template
- // later on.
- return;
- }
- String templateName = getState().getTemplateName();
- String templateContents = getState().getTemplateContents();
-
- if (templateName != null) {
- // Get the HTML-template from client. Overrides templateContents
- // (even though both can never be given at the same time)
- templateContents = getConnection().getResource(
- "layouts/" + templateName + ".html");
- if (templateContents == null) {
- templateContents = "Layout file layouts/"
- + templateName
- + ".html is missing. Components will be drawn for debug purposes.";
- }
- }
-
- getWidget().initializeHTML(templateContents,
- getConnection().getThemeUri());
- }
-
- @Override
- public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- super.onConnectorHierarchyChange(event);
-
- // Must do this once here so the HTML has been set up before we start
- // adding child widgets.
-
- updateHtmlTemplate();
-
- // For all contained widgets
- for (ComponentConnector child : getChildren()) {
- String location = getState().getChildLocations().get(child);
- try {
- getWidget().setWidget(child.getWidget(), location);
- } catch (final IllegalArgumentException e) {
- // If no location is found, this component is not visible
- }
- }
- for (ComponentConnector oldChild : event.getOldChildren()) {
- if (oldChild.getParent() == this) {
- // Connector still a child of this
- continue;
- }
- Widget oldChildWidget = oldChild.getWidget();
- if (oldChildWidget.isAttached()) {
- // slot of this widget is emptied, remove it
- getWidget().remove(oldChildWidget);
- }
- }
-
- }
-
- @Override
- public VCustomLayout getWidget() {
- return (VCustomLayout) super.getWidget();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VCustomLayout.class);
- }
-
- public void updateCaption(ComponentConnector paintable) {
- getWidget().updateCaption(paintable);
- }
-
- public void layout() {
- getWidget().iLayoutJS(DOM.getFirstChild(getWidget().getElement()));
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/DragAndDropWrapperConnector.java b/src/com/vaadin/terminal/gwt/client/ui/DragAndDropWrapperConnector.java
deleted file mode 100644
index d8cec83612..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/DragAndDropWrapperConnector.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.HashMap;
-import java.util.Set;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.ui.DragAndDropWrapper;
-
-@Component(DragAndDropWrapper.class)
-public class DragAndDropWrapperConnector extends CustomComponentConnector
- implements Paintable {
-
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- getWidget().client = client;
- if (isRealUpdate(uidl) && !uidl.hasAttribute("hidden")) {
- UIDL acceptCrit = uidl.getChildByTagName("-ac");
- if (acceptCrit == null) {
- getWidget().dropHandler = null;
- } else {
- if (getWidget().dropHandler == null) {
- getWidget().dropHandler = getWidget().new CustomDropHandler();
- }
- getWidget().dropHandler.updateAcceptRules(acceptCrit);
- }
-
- Set variableNames = uidl.getVariableNames();
- for (String fileId : variableNames) {
- if (fileId.startsWith("rec-")) {
- String receiverUrl = uidl.getStringVariable(fileId);
- fileId = fileId.substring(4);
- if (getWidget().fileIdToReceiver == null) {
- getWidget().fileIdToReceiver = new HashMap();
- }
- if ("".equals(receiverUrl)) {
- Integer id = Integer.parseInt(fileId);
- int indexOf = getWidget().fileIds.indexOf(id);
- if (indexOf != -1) {
- getWidget().files.remove(indexOf);
- getWidget().fileIds.remove(indexOf);
- }
- } else {
- getWidget().fileIdToReceiver.put(fileId, receiverUrl);
- }
- }
- }
- getWidget().startNextUpload();
-
- getWidget().dragStartMode = uidl
- .getIntAttribute(VDragAndDropWrapper.DRAG_START_MODE);
- getWidget().initDragStartMode();
- getWidget().html5DataFlavors = uidl
- .getMapAttribute(VDragAndDropWrapper.HTML5_DATA_FLAVORS);
- }
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VDragAndDropWrapper.class);
- }
-
- @Override
- public VDragAndDropWrapper getWidget() {
- return (VDragAndDropWrapper) super.getWidget();
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/EmbeddedConnector.java b/src/com/vaadin/terminal/gwt/client/ui/EmbeddedConnector.java
deleted file mode 100644
index b716b7637f..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/EmbeddedConnector.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.Map;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.dom.client.Node;
-import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.dom.client.ObjectElement;
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VTooltip;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.ui.Embedded;
-
-@Component(Embedded.class)
-public class EmbeddedConnector extends AbstractComponentConnector implements
- Paintable {
-
- public interface EmbeddedServerRPC extends ClickRPC, ServerRpc {
- }
-
- public static final String ALTERNATE_TEXT = "alt";
-
- EmbeddedServerRPC rpc;
-
- @Override
- protected void init() {
- super.init();
- rpc = RpcProxy.create(EmbeddedServerRPC.class, this);
- }
-
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- // Save details
- getWidget().client = client;
-
- boolean clearBrowserElement = true;
-
- clickEventHandler.handleEventHandlerRegistration();
-
- if (uidl.hasAttribute("type")) {
- getWidget().type = uidl.getStringAttribute("type");
- if (getWidget().type.equals("image")) {
- getWidget().addStyleName(VEmbedded.CLASSNAME + "-image");
- Element el = null;
- boolean created = false;
- NodeList nodes = getWidget().getElement().getChildNodes();
- if (nodes != null && nodes.getLength() == 1) {
- Node n = nodes.getItem(0);
- if (n.getNodeType() == Node.ELEMENT_NODE) {
- Element e = (Element) n;
- if (e.getTagName().equals("IMG")) {
- el = e;
- }
- }
- }
- if (el == null) {
- getWidget().setHTML("");
- el = DOM.createImg();
- created = true;
- DOM.sinkEvents(el, Event.ONLOAD);
- }
-
- // Set attributes
- Style style = el.getStyle();
- style.setProperty("width", getState().getWidth());
- style.setProperty("height", getState().getHeight());
-
- DOM.setElementProperty(el, "src",
- getWidget().getSrc(uidl, client));
-
- if (uidl.hasAttribute(ALTERNATE_TEXT)) {
- el.setPropertyString(ALTERNATE_TEXT,
- uidl.getStringAttribute(ALTERNATE_TEXT));
- }
-
- if (created) {
- // insert in dom late
- getWidget().getElement().appendChild(el);
- }
-
- /*
- * Sink tooltip events so tooltip is displayed when hovering the
- * image.
- */
- getWidget().sinkEvents(VTooltip.TOOLTIP_EVENTS);
-
- } else if (getWidget().type.equals("browser")) {
- getWidget().addStyleName(VEmbedded.CLASSNAME + "-browser");
- if (getWidget().browserElement == null) {
- getWidget().setHTML(
- "");
- getWidget().browserElement = DOM.getFirstChild(getWidget()
- .getElement());
- }
- DOM.setElementAttribute(getWidget().browserElement, "src",
- getWidget().getSrc(uidl, client));
- clearBrowserElement = false;
- } else {
- VConsole.log("Unknown Embedded type '" + getWidget().type + "'");
- }
- } else if (uidl.hasAttribute("mimetype")) {
- final String mime = uidl.getStringAttribute("mimetype");
- if (mime.equals("application/x-shockwave-flash")) {
- // Handle embedding of Flash
- getWidget().addStyleName(VEmbedded.CLASSNAME + "-flash");
- getWidget().setHTML(getWidget().createFlashEmbed(uidl));
-
- } else if (mime.equals("image/svg+xml")) {
- getWidget().addStyleName(VEmbedded.CLASSNAME + "-svg");
- String data;
- Map parameters = VEmbedded.getParameters(uidl);
- if (parameters.get("data") == null) {
- data = getWidget().getSrc(uidl, client);
- } else {
- data = "data:image/svg+xml," + parameters.get("data");
- }
- getWidget().setHTML("");
- ObjectElement obj = Document.get().createObjectElement();
- obj.setType(mime);
- obj.setData(data);
- if (!isUndefinedWidth()) {
- obj.getStyle().setProperty("width", "100%");
- }
- if (!isUndefinedHeight()) {
- obj.getStyle().setProperty("height", "100%");
- }
- if (uidl.hasAttribute("classid")) {
- obj.setAttribute("classid",
- uidl.getStringAttribute("classid"));
- }
- if (uidl.hasAttribute("codebase")) {
- obj.setAttribute("codebase",
- uidl.getStringAttribute("codebase"));
- }
- if (uidl.hasAttribute("codetype")) {
- obj.setAttribute("codetype",
- uidl.getStringAttribute("codetype"));
- }
- if (uidl.hasAttribute("archive")) {
- obj.setAttribute("archive",
- uidl.getStringAttribute("archive"));
- }
- if (uidl.hasAttribute("standby")) {
- obj.setAttribute("standby",
- uidl.getStringAttribute("standby"));
- }
- getWidget().getElement().appendChild(obj);
- if (uidl.hasAttribute(ALTERNATE_TEXT)) {
- obj.setInnerText(uidl.getStringAttribute(ALTERNATE_TEXT));
- }
- } else {
- VConsole.log("Unknown Embedded mimetype '" + mime + "'");
- }
- } else {
- VConsole.log("Unknown Embedded; no type or mimetype attribute");
- }
-
- if (clearBrowserElement) {
- getWidget().browserElement = null;
- }
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VEmbedded.class);
- }
-
- @Override
- public VEmbedded getWidget() {
- return (VEmbedded) super.getWidget();
- }
-
- protected final ClickEventHandler clickEventHandler = new ClickEventHandler(
- this) {
-
- @Override
- protected void fireClick(NativeEvent event,
- MouseEventDetails mouseDetails) {
- rpc.click(mouseDetails);
- }
-
- };
-
-}
\ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java b/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java
deleted file mode 100644
index 8e05522eb5..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.dom.client.KeyDownEvent;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.LayoutManager;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.ui.Form;
-
-@Component(Form.class)
-public class FormConnector extends AbstractComponentContainerConnector
- implements Paintable, SimpleManagedLayout {
-
- public static class FormState extends AbstractFieldState {
- private Connector layout;
- private Connector footer;
-
- public Connector getLayout() {
- return layout;
- }
-
- public void setLayout(Connector layout) {
- this.layout = layout;
- }
-
- public Connector getFooter() {
- return footer;
- }
-
- public void setFooter(Connector footer) {
- this.footer = footer;
- }
-
- }
-
- @Override
- public void init() {
- VForm form = getWidget();
- getLayoutManager().registerDependency(this, form.footerContainer);
- }
-
- @Override
- public boolean delegateCaptionHandling() {
- return false;
- }
-
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- getWidget().client = client;
- getWidget().id = uidl.getId();
-
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- boolean legendEmpty = true;
- if (getState().getCaption() != null) {
- getWidget().caption.setInnerText(getState().getCaption());
- legendEmpty = false;
- } else {
- getWidget().caption.setInnerText("");
- }
- if (getState().getIcon() != null) {
- if (getWidget().icon == null) {
- getWidget().icon = new Icon(client);
- getWidget().legend.insertFirst(getWidget().icon.getElement());
- }
- getWidget().icon.setUri(getState().getIcon().getURL());
- legendEmpty = false;
- } else {
- if (getWidget().icon != null) {
- getWidget().legend.removeChild(getWidget().icon.getElement());
- }
- }
- if (legendEmpty) {
- getWidget().addStyleDependentName("nocaption");
- } else {
- getWidget().removeStyleDependentName("nocaption");
- }
-
- if (null != getState().getErrorMessage()) {
- getWidget().errorMessage
- .updateMessage(getState().getErrorMessage());
- getWidget().errorMessage.setVisible(true);
- } else {
- getWidget().errorMessage.setVisible(false);
- }
-
- if (getState().hasDescription()) {
- getWidget().desc.setInnerHTML(getState().getDescription());
- if (getWidget().desc.getParentElement() == null) {
- getWidget().fieldSet.insertAfter(getWidget().desc,
- getWidget().legend);
- }
- } else {
- getWidget().desc.setInnerHTML("");
- if (getWidget().desc.getParentElement() != null) {
- getWidget().fieldSet.removeChild(getWidget().desc);
- }
- }
-
- // first render footer so it will be easier to handle relative height of
- // main layout
- if (getState().getFooter() != null) {
- // render footer
- ComponentConnector newFooter = (ComponentConnector) getState()
- .getFooter();
- Widget newFooterWidget = newFooter.getWidget();
- if (getWidget().footer == null) {
- getWidget().add(newFooter.getWidget(),
- getWidget().footerContainer);
- getWidget().footer = newFooterWidget;
- } else if (newFooter != getWidget().footer) {
- getWidget().remove(getWidget().footer);
- getWidget().add(newFooter.getWidget(),
- getWidget().footerContainer);
- }
- getWidget().footer = newFooterWidget;
- } else {
- if (getWidget().footer != null) {
- getWidget().remove(getWidget().footer);
- }
- }
-
- ComponentConnector newLayout = (ComponentConnector) getState()
- .getLayout();
- Widget newLayoutWidget = newLayout.getWidget();
- if (getWidget().lo == null) {
- // Layout not rendered before
- getWidget().lo = newLayoutWidget;
- getWidget().add(newLayoutWidget, getWidget().fieldContainer);
- } else if (getWidget().lo != newLayoutWidget) {
- // Layout has changed
- getWidget().remove(getWidget().lo);
- getWidget().lo = newLayoutWidget;
- getWidget().add(newLayoutWidget, getWidget().fieldContainer);
- }
-
- // also recalculates size of the footer if undefined size form - see
- // #3710
- client.runDescendentsLayout(getWidget());
-
- // We may have actions attached
- if (uidl.getChildCount() >= 1) {
- UIDL childUidl = uidl.getChildByTagName("actions");
- if (childUidl != null) {
- if (getWidget().shortcutHandler == null) {
- getWidget().shortcutHandler = new ShortcutActionHandler(
- getConnectorId(), client);
- getWidget().keyDownRegistration = getWidget()
- .addDomHandler(getWidget(), KeyDownEvent.getType());
- }
- getWidget().shortcutHandler.updateActionMap(childUidl);
- }
- } else if (getWidget().shortcutHandler != null) {
- getWidget().keyDownRegistration.removeHandler();
- getWidget().shortcutHandler = null;
- getWidget().keyDownRegistration = null;
- }
- }
-
- public void updateCaption(ComponentConnector component) {
- // NOP form don't render caption for neither field layout nor footer
- // layout
- }
-
- @Override
- public VForm getWidget() {
- return (VForm) super.getWidget();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VForm.class);
- }
-
- public void layout() {
- VForm form = getWidget();
-
- LayoutManager lm = getLayoutManager();
- int footerHeight = lm.getOuterHeight(form.footerContainer)
- - lm.getMarginTop(form.footerContainer);
-
- form.fieldContainer.getStyle().setPaddingBottom(footerHeight, Unit.PX);
- form.footerContainer.getStyle().setMarginTop(-footerHeight, Unit.PX);
- }
-
- @Override
- public boolean isReadOnly() {
- return super.isReadOnly() || getState().isPropertyReadOnly();
- }
-
- @Override
- public FormState getState() {
- return (FormState) super.getState();
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/FormLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/FormLayoutConnector.java
deleted file mode 100644
index 2b2f129246..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/FormLayoutConnector.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.AbstractOrderedLayoutConnector.AbstractOrderedLayoutState;
-import com.vaadin.terminal.gwt.client.ui.VFormLayout.Caption;
-import com.vaadin.terminal.gwt.client.ui.VFormLayout.ErrorFlag;
-import com.vaadin.terminal.gwt.client.ui.VFormLayout.VFormLayoutTable;
-import com.vaadin.ui.FormLayout;
-
-@Component(FormLayout.class)
-public class FormLayoutConnector extends AbstractLayoutConnector {
-
- @Override
- public AbstractOrderedLayoutState getState() {
- return (AbstractOrderedLayoutState) super.getState();
- }
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
-
- VFormLayoutTable formLayoutTable = getWidget().table;
-
- formLayoutTable.setMargins(new VMarginInfo(getState()
- .getMarginsBitmask()));
- formLayoutTable.setSpacing(getState().isSpacing());
-
- }
-
- @Override
- public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- super.onConnectorHierarchyChange(event);
-
- VFormLayout formLayout = getWidget();
- VFormLayoutTable formLayoutTable = getWidget().table;
-
- int childId = 0;
-
- formLayoutTable.setRowCount(getChildren().size());
-
- for (ComponentConnector child : getChildren()) {
- Widget childWidget = child.getWidget();
-
- Caption caption = formLayoutTable.getCaption(childWidget);
- if (caption == null) {
- caption = formLayout.new Caption(child);
- caption.addClickHandler(formLayoutTable);
- }
-
- ErrorFlag error = formLayoutTable.getError(childWidget);
- if (error == null) {
- error = formLayout.new ErrorFlag(child);
- }
-
- formLayoutTable.setChild(childId, childWidget, caption, error);
- childId++;
- }
-
- for (ComponentConnector oldChild : event.getOldChildren()) {
- if (oldChild.getParent() == this) {
- continue;
- }
-
- formLayoutTable.cleanReferences(oldChild.getWidget());
- }
-
- }
-
- public void updateCaption(ComponentConnector component) {
- getWidget().table.updateCaption(component.getWidget(),
- component.getState(), component.isEnabled());
- boolean hideErrors = false;
-
- // FIXME This incorrectly depends on AbstractFieldConnector
- if (component instanceof AbstractFieldConnector) {
- hideErrors = ((AbstractFieldConnector) component).getState()
- .isHideErrors();
- }
-
- getWidget().table.updateError(component.getWidget(), component
- .getState().getErrorMessage(), hideErrors);
- }
-
- @Override
- public VFormLayout getWidget() {
- return (VFormLayout) super.getWidget();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VFormLayout.class);
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/GridLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/GridLayoutConnector.java
deleted file mode 100644
index 4b37d2c407..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/GridLayoutConnector.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.Iterator;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.terminal.gwt.client.ConnectorMap;
-import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.AbstractLayoutConnector.AbstractLayoutState;
-import com.vaadin.terminal.gwt.client.ui.VGridLayout.Cell;
-import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
-import com.vaadin.ui.GridLayout;
-
-@Component(GridLayout.class)
-public class GridLayoutConnector extends AbstractComponentContainerConnector
- implements Paintable, DirectionalManagedLayout {
-
- public static class GridLayoutState extends AbstractLayoutState {
- private boolean spacing = false;
- private int rows = 0;
- private int columns = 0;
-
- public boolean isSpacing() {
- return spacing;
- }
-
- public void setSpacing(boolean spacing) {
- this.spacing = spacing;
- }
-
- public int getRows() {
- return rows;
- }
-
- public void setRows(int rows) {
- this.rows = rows;
- }
-
- public int getColumns() {
- return columns;
- }
-
- public void setColumns(int cols) {
- columns = cols;
- }
-
- }
-
- private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
- this) {
-
- @Override
- protected ComponentConnector getChildComponent(Element element) {
- return getWidget().getComponent(element);
- }
-
- @Override
- protected LayoutClickRPC getLayoutClickRPC() {
- return rpc;
- };
-
- };
-
- public interface GridLayoutServerRPC extends LayoutClickRPC, ServerRpc {
-
- }
-
- private GridLayoutServerRPC rpc;
- private boolean needCaptionUpdate = false;
-
- @Override
- public void init() {
- rpc = RpcProxy.create(GridLayoutServerRPC.class, this);
- getLayoutManager().registerDependency(this,
- getWidget().spacingMeasureElement);
- }
-
- @Override
- public GridLayoutState getState() {
- return (GridLayoutState) super.getState();
- }
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
-
- clickEventHandler.handleEventHandlerRegistration();
-
- }
-
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- VGridLayout layout = getWidget();
- layout.client = client;
-
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- int cols = getState().getColumns();
- int rows = getState().getRows();
-
- layout.columnWidths = new int[cols];
- layout.rowHeights = new int[rows];
-
- layout.setSize(rows, cols);
-
- final int[] alignments = uidl.getIntArrayAttribute("alignments");
- int alignmentIndex = 0;
-
- for (final Iterator> i = uidl.getChildIterator(); i.hasNext();) {
- final UIDL r = (UIDL) i.next();
- if ("gr".equals(r.getTag())) {
- for (final Iterator> j = r.getChildIterator(); j.hasNext();) {
- final UIDL cellUidl = (UIDL) j.next();
- if ("gc".equals(cellUidl.getTag())) {
- int row = cellUidl.getIntAttribute("y");
- int col = cellUidl.getIntAttribute("x");
-
- Widget previousWidget = null;
-
- Cell cell = layout.getCell(row, col);
- if (cell != null && cell.slot != null) {
- // This is an update. Track if the widget changes
- // and update the caption if that happens. This
- // workaround can be removed once the DOM update is
- // done in onContainerHierarchyChange
- previousWidget = cell.slot.getWidget();
- }
-
- cell = layout.createCell(row, col);
-
- cell.updateFromUidl(cellUidl);
-
- if (cell.hasContent()) {
- cell.setAlignment(new AlignmentInfo(
- alignments[alignmentIndex++]));
- if (cell.slot.getWidget() != previousWidget) {
- // Widget changed or widget moved from another
- // slot. Update its caption as the widget might
- // have called updateCaption when the widget was
- // still in its old slot. This workaround can be
- // removed once the DOM update
- // is done in onContainerHierarchyChange
- updateCaption(ConnectorMap.get(getConnection())
- .getConnector(cell.slot.getWidget()));
- }
- }
- }
- }
- }
- }
-
- layout.colExpandRatioArray = uidl.getIntArrayAttribute("colExpand");
- layout.rowExpandRatioArray = uidl.getIntArrayAttribute("rowExpand");
-
- layout.updateMarginStyleNames(new VMarginInfo(getState()
- .getMarginsBitmask()));
-
- layout.updateSpacingStyleName(getState().isSpacing());
-
- if (needCaptionUpdate) {
- needCaptionUpdate = false;
-
- for (ComponentConnector child : getChildren()) {
- updateCaption(child);
- }
- }
- getLayoutManager().setNeedsUpdate(this);
- }
-
- @Override
- public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- super.onConnectorHierarchyChange(event);
-
- VGridLayout layout = getWidget();
-
- // clean non rendered components
- for (ComponentConnector oldChild : event.getOldChildren()) {
- if (oldChild.getParent() == this) {
- continue;
- }
-
- Widget childWidget = oldChild.getWidget();
- layout.remove(childWidget);
-
- Cell cell = layout.widgetToCell.remove(childWidget);
- cell.slot.setCaption(null);
- cell.slot.getWrapperElement().removeFromParent();
- cell.slot = null;
- }
-
- }
-
- public void updateCaption(ComponentConnector childConnector) {
- if (!childConnector.delegateCaptionHandling()) {
- // Check not required by interface but by workarounds in this class
- // when updateCaption is explicitly called for all children.
- return;
- }
-
- VGridLayout layout = getWidget();
- Cell cell = layout.widgetToCell.get(childConnector.getWidget());
- if (cell == null) {
- // workaround before updateFromUidl is removed. We currently update
- // the captions at the end of updateFromUidl instead of immediately
- // because the DOM has not been set up at this point (as it is done
- // in updateFromUidl)
- needCaptionUpdate = true;
- return;
- }
- if (VCaption.isNeeded(childConnector.getState())) {
- VLayoutSlot layoutSlot = cell.slot;
- VCaption caption = layoutSlot.getCaption();
- if (caption == null) {
- caption = new VCaption(childConnector, getConnection());
-
- Widget widget = childConnector.getWidget();
-
- layout.setCaption(widget, caption);
- }
- caption.updateCaption();
- } else {
- layout.setCaption(childConnector.getWidget(), null);
- }
- }
-
- @Override
- public VGridLayout getWidget() {
- return (VGridLayout) super.getWidget();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VGridLayout.class);
- }
-
- public void layoutVertically() {
- getWidget().updateHeight();
- }
-
- public void layoutHorizontally() {
- getWidget().updateWidth();
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/HorizontalLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/HorizontalLayoutConnector.java
deleted file mode 100644
index da1ea99f28..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/HorizontalLayoutConnector.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle;
-import com.vaadin.ui.HorizontalLayout;
-
-@Component(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER)
-public class HorizontalLayoutConnector extends AbstractOrderedLayoutConnector {
-
- @Override
- public VHorizontalLayout getWidget() {
- return (VHorizontalLayout) super.getWidget();
- }
-
- @Override
- protected VHorizontalLayout createWidget() {
- return GWT.create(VHorizontalLayout.class);
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/HorizontalSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/HorizontalSplitPanelConnector.java
deleted file mode 100644
index 4f441b2d04..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/HorizontalSplitPanelConnector.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle;
-import com.vaadin.ui.HorizontalSplitPanel;
-
-@Component(value = HorizontalSplitPanel.class, loadStyle = LoadStyle.EAGER)
-public class HorizontalSplitPanelConnector extends AbstractSplitPanelConnector {
-
- @Override
- protected VAbstractSplitPanel createWidget() {
- return GWT.create(VSplitPanelHorizontal.class);
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/InlineDateFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/InlineDateFieldConnector.java
deleted file mode 100644
index 31ffe199d8..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/InlineDateFieldConnector.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.Date;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.DateTimeService;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.FocusChangeListener;
-import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.TimeChangeListener;
-import com.vaadin.ui.InlineDateField;
-
-@Component(InlineDateField.class)
-public class InlineDateFieldConnector extends AbstractDateFieldConnector {
-
- @Override
- @SuppressWarnings("deprecation")
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- super.updateFromUIDL(uidl, client);
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- getWidget().calendarPanel.setShowISOWeekNumbers(getWidget()
- .isShowISOWeekNumbers());
- getWidget().calendarPanel.setDateTimeService(getWidget()
- .getDateTimeService());
- getWidget().calendarPanel.setResolution(getWidget()
- .getCurrentResolution());
- Date currentDate = getWidget().getCurrentDate();
- if (currentDate != null) {
- getWidget().calendarPanel.setDate(new Date(currentDate.getTime()));
- } else {
- getWidget().calendarPanel.setDate(null);
- }
-
- if (getWidget().currentResolution > VDateField.RESOLUTION_DAY) {
- getWidget().calendarPanel
- .setTimeChangeListener(new TimeChangeListener() {
- public void changed(int hour, int min, int sec, int msec) {
- Date d = getWidget().getDate();
- if (d == null) {
- // date currently null, use the value from
- // calendarPanel
- // (~ client time at the init of the widget)
- d = (Date) getWidget().calendarPanel.getDate()
- .clone();
- }
- d.setHours(hour);
- d.setMinutes(min);
- d.setSeconds(sec);
- DateTimeService.setMilliseconds(d, msec);
-
- // Always update time changes to the server
- getWidget().calendarPanel.setDate(d);
- getWidget().updateValueFromPanel();
- }
- });
- }
-
- if (getWidget().currentResolution <= VDateField.RESOLUTION_MONTH) {
- getWidget().calendarPanel
- .setFocusChangeListener(new FocusChangeListener() {
- public void focusChanged(Date date) {
- Date date2 = new Date();
- if (getWidget().calendarPanel.getDate() != null) {
- date2.setTime(getWidget().calendarPanel
- .getDate().getTime());
- }
- /*
- * Update the value of calendarPanel
- */
- date2.setYear(date.getYear());
- date2.setMonth(date.getMonth());
- getWidget().calendarPanel.setDate(date2);
- /*
- * Then update the value from panel to server
- */
- getWidget().updateValueFromPanel();
- }
- });
- } else {
- getWidget().calendarPanel.setFocusChangeListener(null);
- }
-
- // Update possible changes
- getWidget().calendarPanel.renderCalendar();
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VDateFieldCalendar.class);
- }
-
- @Override
- public VDateFieldCalendar getWidget() {
- return (VDateFieldCalendar) super.getWidget();
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java b/src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java
deleted file mode 100644
index 715e902b24..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.ui.Link;
-
-@Component(Link.class)
-public class LinkConnector extends AbstractComponentConnector implements
- Paintable {
-
- @Override
- public boolean delegateCaptionHandling() {
- return false;
- }
-
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
-
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- getWidget().client = client;
-
- getWidget().enabled = isEnabled();
-
- if (uidl.hasAttribute("name")) {
- getWidget().target = uidl.getStringAttribute("name");
- getWidget().anchor.setAttribute("target", getWidget().target);
- }
- if (uidl.hasAttribute("src")) {
- getWidget().src = client.translateVaadinUri(uidl
- .getStringAttribute("src"));
- getWidget().anchor.setAttribute("href", getWidget().src);
- }
-
- if (uidl.hasAttribute("border")) {
- if ("none".equals(uidl.getStringAttribute("border"))) {
- getWidget().borderStyle = VLink.BORDER_STYLE_NONE;
- } else {
- getWidget().borderStyle = VLink.BORDER_STYLE_MINIMAL;
- }
- } else {
- getWidget().borderStyle = VLink.BORDER_STYLE_DEFAULT;
- }
-
- getWidget().targetHeight = uidl.hasAttribute("targetHeight") ? uidl
- .getIntAttribute("targetHeight") : -1;
- getWidget().targetWidth = uidl.hasAttribute("targetWidth") ? uidl
- .getIntAttribute("targetWidth") : -1;
-
- // Set link caption
- getWidget().captionElement.setInnerText(getState().getCaption());
-
- // handle error
- if (null != getState().getErrorMessage()) {
- if (getWidget().errorIndicatorElement == null) {
- getWidget().errorIndicatorElement = DOM.createDiv();
- DOM.setElementProperty(getWidget().errorIndicatorElement,
- "className", "v-errorindicator");
- }
- DOM.insertChild(getWidget().getElement(),
- getWidget().errorIndicatorElement, 0);
- } else if (getWidget().errorIndicatorElement != null) {
- DOM.setStyleAttribute(getWidget().errorIndicatorElement, "display",
- "none");
- }
-
- if (getState().getIcon() != null) {
- if (getWidget().icon == null) {
- getWidget().icon = new Icon(client);
- getWidget().anchor.insertBefore(getWidget().icon.getElement(),
- getWidget().captionElement);
- }
- getWidget().icon.setUri(getState().getIcon().getURL());
- }
-
- }
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VLink.class);
- }
-
- @Override
- public VLink getWidget() {
- return (VLink) super.getWidget();
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ListSelectConnector.java b/src/com/vaadin/terminal/gwt/client/ui/ListSelectConnector.java
deleted file mode 100644
index ce9fb91f9a..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/ListSelectConnector.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.ui.ListSelect;
-
-@Component(ListSelect.class)
-public class ListSelectConnector extends OptionGroupBaseConnector {
-
- @Override
- protected Widget createWidget() {
- return GWT.create(VListSelect.class);
- }
-
- @Override
- public VListSelect getWidget() {
- return (VListSelect) super.getWidget();
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/MenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/MenuBar.java
deleted file mode 100644
index f0857f48c1..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/MenuBar.java
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-// COPIED HERE DUE package privates in GWT
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.PopupListener;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * A standard menu bar widget. A menu bar can contain any number of menu items,
- * each of which can either fire a {@link com.google.gwt.user.client.Command} or
- * open a cascaded menu bar.
- *
- *
- *
- *
- *
- * CSS Style Rules
- *
- * - .gwt-MenuBar { the menu bar itself }
- * - .gwt-MenuBar .gwt-MenuItem { menu items }
- * -
- * .gwt-MenuBar .gwt-MenuItem-selected { selected menu items }
- *
- *
- *
- *
Example
- * {@example com.google.gwt.examples.MenuBarExample}
- *
- *
- * @deprecated
- */
-@Deprecated
-public class MenuBar extends Widget implements PopupListener {
-
- private final Element body;
- private final ArrayList