diff options
137 files changed, 734 insertions, 525 deletions
diff --git a/WebContent/VAADIN/themes/base/label/label.css b/WebContent/VAADIN/themes/base/label/label.css new file mode 100644 index 0000000000..366dbdf26f --- /dev/null +++ b/WebContent/VAADIN/themes/base/label/label.css @@ -0,0 +1,3 @@ +.v-label { + overflow: hidden; +}
\ No newline at end of file diff --git a/WebContent/VAADIN/themes/base/paintable/paintable.css b/WebContent/VAADIN/themes/base/paintable/paintable.css index c42da19e4f..fbe7275113 100644 --- a/WebContent/VAADIN/themes/base/paintable/paintable.css +++ b/WebContent/VAADIN/themes/base/paintable/paintable.css @@ -1,6 +1,6 @@ -.v-paintable { +.v-connector { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; text-align: left; -}
\ No newline at end of file +} diff --git a/WebContent/VAADIN/themes/chameleon/components/textfield/textfield.css b/WebContent/VAADIN/themes/chameleon/components/textfield/textfield.css index a7601bb649..74882fa693 100644 --- a/WebContent/VAADIN/themes/chameleon/components/textfield/textfield.css +++ b/WebContent/VAADIN/themes/chameleon/components/textfield/textfield.css @@ -25,7 +25,7 @@ input.v-textfield[type="text"] { height: 1.2em; } -input.v-paintable.v-textfield[type="text"], +input.v-connector.v-textfield[type="text"], .v-filterselect { height: 1.6em; } diff --git a/WebContent/VAADIN/themes/reindeer/textfield/textfield.css b/WebContent/VAADIN/themes/reindeer/textfield/textfield.css index dce5dffba0..09c47dc8d4 100644 --- a/WebContent/VAADIN/themes/reindeer/textfield/textfield.css +++ b/WebContent/VAADIN/themes/reindeer/textfield/textfield.css @@ -35,8 +35,8 @@ .v-window textarea.v-textarea { padding: 3px 3px 4px; } -.v-app input.v-textfield.v-paintable, -.v-window input.v-textfield.v-paintable { +.v-app input.v-textfield.v-connector, +.v-window input.v-textfield.v-connector { height: 24px; } .v-app .v-textfield-focus, @@ -66,8 +66,8 @@ textarea.v-textarea-prompt { .v-app textarea.v-textarea-small { font-size: 11px; } -.v-app .v-table input.v-textfield.v-paintable, -.v-window .v-table input.v-textfield.v-paintable { +.v-app .v-table input.v-textfield.v-connector, +.v-window .v-table input.v-textfield.v-connector { padding: 1px 2px; height: auto; line-height: normal; diff --git a/WebContent/VAADIN/themes/reindeer/tree/tree.css b/WebContent/VAADIN/themes/reindeer/tree/tree.css index f72f61c545..9f4083d42e 100644 --- a/WebContent/VAADIN/themes/reindeer/tree/tree.css +++ b/WebContent/VAADIN/themes/reindeer/tree/tree.css @@ -26,9 +26,7 @@ padding-left: 16px; } .v-tree-node-caption.v-tree-node-focused span{ - padding-left: 1px; - padding-top: 0px; - padding-bottom: 0px; + padding: 0 1px; /* Make room for border */ } .v-tree-node-focused span{ border: 1px dotted black; diff --git a/WebContent/VAADIN/themes/runo/tree/tree.css b/WebContent/VAADIN/themes/runo/tree/tree.css index 14061b8afb..e897236587 100644 --- a/WebContent/VAADIN/themes/runo/tree/tree.css +++ b/WebContent/VAADIN/themes/runo/tree/tree.css @@ -34,9 +34,7 @@ outline:none; } .v-tree-node-caption.v-tree-node-focused span{ - padding-left: 1px; - padding-top: 0px; - padding-bottom: 0px; + padding: 0; } .v-tree-node-focused span{ border: 1px dotted black; diff --git a/build/build.xml b/build/build.xml index 21a7b823e1..08423c276b 100644 --- a/build/build.xml +++ b/build/build.xml @@ -178,6 +178,7 @@ <war warfile="${result-path}/${test-war-filename}"> <fileset dir="${output-dir}/WebContent"> + <exclude name="VAADIN/gwt-unitCache" /> <!-- Already in JAR --> <!-- Not excluded because used from WAR by portal integration tests <exclude name="VAADIN/themes/base/**/*" /> diff --git a/src/com/vaadin/Application.java b/src/com/vaadin/Application.java index 448daea4c0..4da1d52c00 100644 --- a/src/com/vaadin/Application.java +++ b/src/com/vaadin/Application.java @@ -40,6 +40,7 @@ import com.vaadin.service.ApplicationContext; import com.vaadin.terminal.AbstractErrorMessage; import com.vaadin.terminal.ApplicationResource; import com.vaadin.terminal.CombinedRequest; +import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.RequestHandler; import com.vaadin.terminal.Terminal; import com.vaadin.terminal.VariableOwner; @@ -343,8 +344,6 @@ public class Application implements Terminal.ErrorListener, Serializable { private final boolean productionMode; - private final ClassLoader classLoader; - /** * @param applicationUrl * the URL the application should respond to. @@ -356,19 +355,14 @@ public class Application implements Terminal.ErrorListener, Serializable { * @param productionMode * flag indicating whether the application is running in * production mode. - * @param classLoader - * class loader to use for loading Root classes, - * <code>null</code> indicates that the default class loader - * should be used. */ public ApplicationStartEvent(URL applicationUrl, Properties applicationProperties, ApplicationContext context, - boolean productionMode, ClassLoader classLoader) { + boolean productionMode) { this.applicationUrl = applicationUrl; this.applicationProperties = applicationProperties; this.context = context; this.productionMode = productionMode; - this.classLoader = classLoader; } /** @@ -417,19 +411,6 @@ public class Application implements Terminal.ErrorListener, Serializable { public boolean isProductionMode() { return productionMode; } - - /** - * Gets the class loader to use for loading Root classes, - * <code>null</code> indicates that the default class loader should be - * used. - * - * @return the class loader, or <code>null</code> if not defined. - * - * @see Application#getClassLoader() - */ - public ClassLoader getClassLoader() { - return classLoader; - } } private final static Logger logger = Logger.getLogger(Application.class @@ -522,11 +503,6 @@ public class Application implements Terminal.ErrorListener, Serializable { private Set<Integer> initedRoots = new HashSet<Integer>(); /** - * The classloader that is used to load {@link Root} classes. - */ - private ClassLoader classLoader; - - /** * Gets the user of the application. * * <p> @@ -640,7 +616,6 @@ public class Application implements Terminal.ErrorListener, Serializable { productionMode = event.isProductionMode(); properties = event.getApplicationProperties(); context = event.getContext(); - classLoader = event.getClassLoader(); init(); applicationIsRunning = true; } @@ -1867,9 +1842,9 @@ public class Application implements Terminal.ErrorListener, Serializable { * The default implementation in {@link Application} creates a new instance * of the Root class returned by {@link #getRootClassName(WrappedRequest)}, * which in turn uses the {@value #ROOT_PARAMETER} parameter from web.xml. - * If {@link #getClassLoader()} returns a {@link ClassLoader}, it is used - * for loading the Root class. Otherwise the {@link ClassLoader} used to - * load this class is used. + * If {@link DeploymentConfiguration#getClassLoader()} for the request + * returns a {@link ClassLoader}, it is used for loading the Root class. + * Otherwise the {@link ClassLoader} used to load this class is used. * </p> * * @param request @@ -1890,7 +1865,8 @@ public class Application implements Terminal.ErrorListener, Serializable { throws RootRequiresMoreInformationException { String rootClassName = getRootClassName(request); try { - ClassLoader classLoader = getClassLoader(); + ClassLoader classLoader = request.getDeploymentConfiguration() + .getClassLoader(); if (classLoader == null) { classLoader = getClass().getClassLoader(); } @@ -1910,16 +1886,6 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Get the class loader to use for loading Root classes. <code>null</code> - * indicates that the default class loader should be used. - * - * @return the class loader to use, or <code>null</code> - */ - protected ClassLoader getClassLoader() { - return classLoader; - } - - /** * Provides the name of the <code>Root</code> class that should be used for * a request. The class must have an accessible no-args constructor. * <p> diff --git a/src/com/vaadin/terminal/DeploymentConfiguration.java b/src/com/vaadin/terminal/DeploymentConfiguration.java index 403a6d68b7..02a3f0200f 100644 --- a/src/com/vaadin/terminal/DeploymentConfiguration.java +++ b/src/com/vaadin/terminal/DeploymentConfiguration.java @@ -74,4 +74,13 @@ public interface DeploymentConfiguration extends Serializable { */ public String getApplicationOrSystemProperty(String propertyName, String defaultValue); + + /** + * Get the class loader to use for loading classes loaded by name, e.g. + * custom Root classes. <code>null</code> indicates that the default class + * loader should be used. + * + * @return the class loader to use, or <code>null</code> + */ + public ClassLoader getClassLoader(); } diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index a2816728f9..5f5ef71c36 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -45,6 +45,7 @@ import com.vaadin.terminal.gwt.client.communication.MethodInvocation; 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.AbstractComponentConnector; import com.vaadin.terminal.gwt.client.ui.VContextMenu; import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager; import com.vaadin.terminal.gwt.client.ui.notification.VNotification; @@ -1212,7 +1213,11 @@ public class ApplicationConnection { VConsole.log(" * Sending state change events"); for (StateChangeEvent sce : pendingStateChangeEvents) { - sce.getConnector().fireEvent(sce); + try { + sce.getConnector().fireEvent(sce); + } catch (final Throwable e) { + VConsole.error(e); + } } } @@ -1335,7 +1340,11 @@ public class ApplicationConnection { VConsole.log(" * Sending hierarchy change events"); for (ConnectorHierarchyChangeEvent event : pendingHierarchyChangeEvents) { - event.getConnector().fireEvent(event); + try { + event.getConnector().fireEvent(event); + } catch (final Throwable e) { + VConsole.error(e); + } } } @@ -2337,7 +2346,29 @@ public class ApplicationConnection { @Deprecated public void handleTooltipEvent(Event event, Widget owner, Object key) { handleTooltipEvent(event, getConnectorMap().getConnector(owner), key); + } + /** + * Method provided for backwards compatibility. Duties previously done by + * this method is now handled by the state change event handler in + * AbstractComponentConnector. The only function this method has is to + * return true if the UIDL is a "cached" update. + * + * @param component + * @param uidl + * @param manageCaption + * @return + */ + @Deprecated + public boolean updateComponent(Widget component, UIDL uidl, + boolean manageCaption) { + ComponentConnector connector = getConnectorMap() + .getConnector(component); + if (!AbstractComponentConnector.isRealUpdate(uidl)) { + return true; + } + + return false; } @Deprecated diff --git a/src/com/vaadin/terminal/gwt/client/LayoutManager.java b/src/com/vaadin/terminal/gwt/client/LayoutManager.java index 22d5286714..a40a2e841f 100644 --- a/src/com/vaadin/terminal/gwt/client/LayoutManager.java +++ b/src/com/vaadin/terminal/gwt/client/LayoutManager.java @@ -31,7 +31,7 @@ public class LayoutManager { private static final boolean debugLogging = false; private ApplicationConnection connection; - private final Set<Element> measuredNonPaintableElements = new HashSet<Element>(); + private final Set<Element> measuredNonConnectorElements = new HashSet<Element>(); private final MeasuredSize nullSize = new MeasuredSize(); private LayoutDependencyTree currentDependencyTree; @@ -70,7 +70,7 @@ public class LayoutManager { public void registerDependency(ManagedLayout owner, Element element) { MeasuredSize measuredSize = ensureMeasured(element); - setNeedsUpdate(owner); + setNeedsLayout(owner); measuredSize.addDependent(owner.getConnectorId()); } @@ -80,7 +80,7 @@ public class LayoutManager { measuredSize = new MeasuredSize(); if (ConnectorMap.get(connection).getConnector(element) == null) { - measuredNonPaintableElements.add(element); + measuredNonConnectorElements.add(element); } setMeasuredSize(element, measuredSize); } @@ -207,7 +207,7 @@ public class LayoutManager { } needsMeasure.clear(); - measureNonPaintables(); + measureNonConnectors(); VConsole.log("Layout init in " + totalDuration.elapsedMillis() + " ms"); @@ -236,7 +236,11 @@ public class LayoutManager { ElementResizeEvent event = new ElementResizeEvent(this, element); for (ElementResizeListener listener : array) { - listener.onElementResize(event); + try { + listener.onElementResize(event); + } catch (RuntimeException e) { + VConsole.error(e); + } } } int measureListenerTime = passDuration.elapsedMillis(); @@ -257,14 +261,22 @@ public class LayoutManager { currentDependencyTree .markAsHorizontallyLayouted(layout); DirectionalManagedLayout cl = (DirectionalManagedLayout) layout; - cl.layoutHorizontally(); + try { + cl.layoutHorizontally(); + } catch (RuntimeException e) { + VConsole.log(e); + } countLayout(layoutCounts, cl); } else { currentDependencyTree .markAsHorizontallyLayouted(layout); currentDependencyTree.markAsVerticallyLayouted(layout); SimpleManagedLayout rr = (SimpleManagedLayout) layout; - rr.layout(); + try { + rr.layout(); + } catch (RuntimeException e) { + VConsole.log(e); + } countLayout(layoutCounts, rr); } if (debugLogging) { @@ -277,14 +289,22 @@ public class LayoutManager { if (layout instanceof DirectionalManagedLayout) { currentDependencyTree.markAsVerticallyLayouted(layout); DirectionalManagedLayout cl = (DirectionalManagedLayout) layout; - cl.layoutVertically(); + try { + cl.layoutVertically(); + } catch (RuntimeException e) { + VConsole.log(e); + } countLayout(layoutCounts, cl); } else { currentDependencyTree .markAsHorizontallyLayouted(layout); currentDependencyTree.markAsVerticallyLayouted(layout); SimpleManagedLayout rr = (SimpleManagedLayout) layout; - rr.layout(); + try { + rr.layout(); + } catch (RuntimeException e) { + VConsole.log(e); + } countLayout(layoutCounts, rr); } if (debugLogging) { @@ -485,12 +505,12 @@ public class LayoutManager { } } - private void measureNonPaintables() { - for (Element element : measuredNonPaintableElements) { + private void measureNonConnectors() { + for (Element element : measuredNonConnectorElements) { measuredAndUpdate(element, getMeasuredSize(element, null)); } - VConsole.log("Measured " + measuredNonPaintableElements.size() - + " non paintable elements"); + VConsole.log("Measured " + measuredNonConnectorElements.size() + + " non connector elements"); } private MeasureResult measuredAndUpdate(Element element, @@ -530,17 +550,17 @@ public class LayoutManager { } } - private static boolean isManagedLayout(ComponentConnector paintable) { - return paintable instanceof ManagedLayout; + private static boolean isManagedLayout(ComponentConnector connector) { + return connector instanceof ManagedLayout; } public void forceLayout() { - ConnectorMap paintableMap = connection.getConnectorMap(); - ComponentConnector[] paintableWidgets = paintableMap + ConnectorMap connectorMap = connection.getConnectorMap(); + ComponentConnector[] componentConnectors = connectorMap .getComponentConnectors(); - for (ComponentConnector connector : paintableWidgets) { + for (ComponentConnector connector : componentConnectors) { if (connector instanceof ManagedLayout) { - setNeedsUpdate((ManagedLayout) connector); + setNeedsLayout((ManagedLayout) connector); } } setEverythingNeedsMeasure(); @@ -548,16 +568,16 @@ public class LayoutManager { } // TODO Rename to setNeedsLayout - public final void setNeedsUpdate(ManagedLayout layout) { - setWidthNeedsUpdate(layout); - setHeightNeedsUpdate(layout); + public final void setNeedsLayout(ManagedLayout layout) { + setNeedsHorizontalLayout(layout); + setNeedsVerticalLayout(layout); } - public final void setWidthNeedsUpdate(ManagedLayout layout) { + public final void setNeedsHorizontalLayout(ManagedLayout layout) { needsHorizontalLayout.add(layout); } - public final void setHeightNeedsUpdate(ManagedLayout layout) { + public final void setNeedsVerticalLayout(ManagedLayout layout) { needsVerticalLayout.add(layout); } @@ -720,7 +740,7 @@ public class LayoutManager { private void stopMeasuringIfUnnecessary(Element element) { if (!needsMeasure(element)) { - measuredNonPaintableElements.remove(element); + measuredNonConnectorElements.remove(element); setMeasuredSize(element, null); } } diff --git a/src/com/vaadin/terminal/gwt/client/NullConsole.java b/src/com/vaadin/terminal/gwt/client/NullConsole.java index 1d9de90118..2d15ffd46c 100644 --- a/src/com/vaadin/terminal/gwt/client/NullConsole.java +++ b/src/com/vaadin/terminal/gwt/client/NullConsole.java @@ -41,7 +41,8 @@ public class NullConsole implements Console { } public void error(Throwable e) { - GWT.log(e.getMessage(), e); + // Borrow exception handling from VDebugConsole + VDebugConsole.handleError(e, this); } public void setQuietMode(boolean quietDebugMode) { diff --git a/src/com/vaadin/terminal/gwt/client/ServerConnector.java b/src/com/vaadin/terminal/gwt/client/ServerConnector.java index 2f9dfa3412..f179b29054 100644 --- a/src/com/vaadin/terminal/gwt/client/ServerConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ServerConnector.java @@ -6,7 +6,7 @@ package com.vaadin.terminal.gwt.client; import java.util.Collection; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerRegistration; +import com.google.web.bindery.event.shared.HandlerRegistration; import com.vaadin.terminal.gwt.client.communication.ClientRpc; import com.vaadin.terminal.gwt.client.communication.SharedState; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler; diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java index e3cacc5870..c2fa4f46bf 100644 --- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java +++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java @@ -626,10 +626,14 @@ public class VDebugConsole extends VOverlay implements Console { } public void error(Throwable e) { + handleError(e, this); + } + + static void handleError(Throwable e, Console target) { if (e instanceof UmbrellaException) { UmbrellaException ue = (UmbrellaException) e; for (Throwable t : ue.getCauses()) { - error(t); + target.error(t); } return; } @@ -638,7 +642,7 @@ public class VDebugConsole extends VOverlay implements Console { if (message != null && message.length() != 0) { exceptionText += ": " + e.getMessage(); } - error(exceptionText); + target.error(exceptionText); GWT.log(e.getMessage(), e); if (!GWT.isProdMode()) { e.printStackTrace(); diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java index f5f177b5d1..2458a27eac 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java @@ -75,6 +75,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector return state; } + @Deprecated public static boolean isRealUpdate(UIDL uidl) { return !uidl.hasAttribute("cached"); } @@ -107,8 +108,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector } // Style names - String styleName = getStyleNames(getWidget().getStylePrimaryName(), - this); + String styleName = getStyleNames(getWidget().getStylePrimaryName()); getWidget().setStyleName(styleName); // Update tooltip @@ -150,14 +150,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector if (newWidth.endsWith("%") != lastKnownWidth.endsWith("%")) { ComponentContainerConnector parent = getParent(); if (parent instanceof ManagedLayout) { - getLayoutManager().setWidthNeedsUpdate((ManagedLayout) parent); + getLayoutManager().setNeedsHorizontalLayout( + (ManagedLayout) parent); } } if (newHeight.endsWith("%") != lastKnownHeight.endsWith("%")) { ComponentContainerConnector parent = getParent(); if (parent instanceof ManagedLayout) { - getLayoutManager().setHeightNeedsUpdate((ManagedLayout) parent); + getLayoutManager().setNeedsVerticalLayout( + (ManagedLayout) parent); } } @@ -220,32 +222,32 @@ public abstract class AbstractComponentConnector extends AbstractConnector /** * Generates the style name for the widget based on the given primary style - * name (typically returned by Widget.getPrimaryStyleName()) and the UIDL - * and shared state of the component. An additional "modified" style name - * can be added if the field parameter is set to true. + * name and the shared state. + * <p> + * This method can be overridden to provide additional style names for the + * component + * </p> * * @param primaryStyleName - * @param uidl - * @param state - * component shared state - * @param field - * @return + * The primary style name to use when generating the final style + * names + * @return The style names, settable using + * {@link Widget#setStyleName(String)} */ - protected static String getStyleNames(String primaryStyleName, - ComponentConnector connector) { - ComponentState state = connector.getState(); + protected String getStyleNames(String primaryStyleName) { + ComponentState state = getState(); - StringBuffer styleBuf = new StringBuffer(); + StringBuilder styleBuf = new StringBuilder(); styleBuf.append(primaryStyleName); - styleBuf.append(" v-paintable"); + styleBuf.append(" v-connector"); // Uses connector methods to enable connectors to take hierarchy or // multiple state variables into account - if (!connector.isEnabled()) { + if (!isEnabled()) { styleBuf.append(" "); styleBuf.append(ApplicationConnection.DISABLED_CLASSNAME); } - if (connector.isReadOnly()) { + if (isReadOnly()) { styleBuf.append(" "); styleBuf.append("v-readonly"); } @@ -263,23 +265,6 @@ public abstract class AbstractComponentConnector extends AbstractConnector } } - if (connector instanceof AbstractFieldConnector) { - // TODO Move to AbstractFieldConnector - AbstractFieldConnector afc = ((AbstractFieldConnector) connector); - if (afc.isModified()) { - // add modified classname to Fields - styleBuf.append(" "); - styleBuf.append(ApplicationConnection.MODIFIED_CLASSNAME); - } - - if (afc.isRequired()) { - // add required classname to required fields - styleBuf.append(" "); - styleBuf.append(primaryStyleName); - styleBuf.append(ApplicationConnection.REQUIRED_CLASSNAME_EXT); - } - } - // add error classname to components w/ error if (null != state.getErrorMessage()) { styleBuf.append(" "); diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java index 330f89fef4..e205723e64 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java @@ -11,7 +11,7 @@ import java.util.Map; import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.HandlerManager; -import com.google.gwt.event.shared.HandlerRegistration; +import com.google.web.bindery.event.shared.HandlerRegistration; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.ServerConnector; import com.vaadin.terminal.gwt.client.Util; diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java index 5e629f2dc9..4be0f02c2a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java @@ -4,6 +4,7 @@ package com.vaadin.terminal.gwt.client.ui; import com.vaadin.terminal.gwt.client.AbstractFieldState; +import com.vaadin.terminal.gwt.client.ApplicationConnection; public abstract class AbstractFieldConnector extends AbstractComponentConnector { @@ -33,4 +34,21 @@ public abstract class AbstractFieldConnector extends AbstractComponentConnector return getState().isRequired() && !isReadOnly(); } + @Override + protected String getStyleNames(String primaryStyleName) { + String styleNames = super.getStyleNames(primaryStyleName); + + if (isModified()) { + // add modified classname to Fields + styleNames += " " + ApplicationConnection.MODIFIED_CLASSNAME; + } + + if (isRequired()) { + // add required classname to Fields + styleNames += " " + primaryStyleName + + ApplicationConnection.REQUIRED_CLASSNAME_EXT; + } + + return styleNames; + } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java index ec9d60d0a0..175e67807f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java @@ -3,7 +3,6 @@ */ package com.vaadin.terminal.gwt.client.ui; - public abstract class AbstractLayoutConnector extends AbstractComponentContainerConnector { diff --git a/src/com/vaadin/terminal/gwt/client/ui/Component.java b/src/com/vaadin/terminal/gwt/client/ui/Connect.java index 56477e6b0d..0581bdb99c 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/Component.java +++ b/src/com/vaadin/terminal/gwt/client/ui/Connect.java @@ -8,16 +8,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.Connector; +import com.vaadin.terminal.gwt.server.ClientConnector; import com.vaadin.terminal.gwt.widgetsetutils.CustomWidgetMapGenerator; import com.vaadin.terminal.gwt.widgetsetutils.EagerWidgetMapGenerator; import com.vaadin.terminal.gwt.widgetsetutils.LazyWidgetMapGenerator; import com.vaadin.terminal.gwt.widgetsetutils.WidgetMapGenerator; /** - * Annotation defining the default server side counterpart in GWT terminal for - * {@link ComponentConnector}. + * Annotation defining the server side connector that this ClientSideConnector + * should connect to. The value must always by a class extending + * {@link ClientConnector}. * <p> * With this annotation client side Vaadin connector is marked to have a server * side counterpart. The value of the annotation is the class of server side @@ -27,7 +28,7 @@ import com.vaadin.terminal.gwt.widgetsetutils.WidgetMapGenerator; */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -public @interface Component { +public @interface Connect { /** * @return the server side counterpart for the annotated component connector @@ -45,7 +46,7 @@ public @interface Component { * is not included in the initial JavaScript application loaded when the * application starts. Instead the implementation is loaded to the client * when it is first needed. Lazy loaded widget can be achieved by giving - * {@link LoadStyle#LAZY} value in {@link Component} annotation. + * {@link LoadStyle#LAZY} value in {@link Connect} annotation. * <p> * Lazy loaded widgets don't stress the size and startup time of the client * side as much as eagerly loaded widgets. On the other hand there is a diff --git a/src/com/vaadin/terminal/gwt/client/ui/HorizontalBoxLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/HorizontalBoxLayoutConnector.java index bdd856537b..20d9ca9d30 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/HorizontalBoxLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/HorizontalBoxLayoutConnector.java @@ -2,10 +2,10 @@ package com.vaadin.terminal.gwt.client.ui; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.UIDL; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.HorizontalLayout; -@Component(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER) +@Connect(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER) public class HorizontalBoxLayoutConnector extends AbstractBoxLayoutConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java index 54e6043f1b..94eff44eee 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java @@ -6,43 +6,14 @@ 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.ApplicationConnection; -import com.vaadin.terminal.gwt.client.Paintable; -import com.vaadin.terminal.gwt.client.UIDL; -import com.vaadin.terminal.gwt.client.VUIDLBrowser; -public class UnknownComponentConnector extends AbstractComponentConnector - implements Paintable { +public class UnknownComponentConnector extends AbstractComponentConnector { @Override public boolean delegateCaptionHandling() { return false; } - public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (!isRealUpdate(uidl)) { - return; - } - getWidget() - .setCaption( - "Widgetset does not contain implementation for " - + getWidget().serverClassName - + ". Check its component connector's @Component mapping, widgetsets " - + "GWT module description file and re-compile your" - + " widgetset. In case you have downloaded a vaadin" - + " add-on package, you might want to refer to " - + "<a href='http://vaadin.com/using-addons'>add-on " - + "instructions</a>. Unrendered UIDL:"); - if (getWidget().uidlTree != null) { - getWidget().uidlTree.removeFromParent(); - } - - getWidget().uidlTree = new VUIDLBrowser(uidl, client.getConfiguration()); - getWidget().uidlTree.open(true); - getWidget().uidlTree.setText("Unrendered UIDL"); - getWidget().panel.add(getWidget().uidlTree); - } - @Override protected Widget createWidget() { return GWT.create(VUnknownComponent.class); @@ -54,6 +25,15 @@ public class UnknownComponentConnector extends AbstractComponentConnector } public void setServerSideClassName(String serverClassName) { - getWidget().setServerSideClassName(serverClassName); + getWidget() + .setCaption( + "Widgetset does not contain implementation for " + + serverClassName + + ". Check its component connector's @Connect mapping, widgetsets " + + "GWT module description file and re-compile your" + + " widgetset. In case you have downloaded a vaadin" + + " add-on package, you might want to refer to " + + "<a href='http://vaadin.com/using-addons'>add-on " + + "instructions</a>."); } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java b/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java index ad702430f6..7bcdcec660 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java @@ -13,7 +13,6 @@ public class VUnknownComponent extends Composite { com.google.gwt.user.client.ui.Label caption = new com.google.gwt.user.client.ui.Label();; SimpleTree uidlTree; protected VerticalPanel panel; - protected String serverClassName = "unkwnown"; public VUnknownComponent() { panel = new VerticalPanel(); @@ -23,10 +22,6 @@ public class VUnknownComponent extends Composite { caption.setStyleName("vaadin-unknown-caption"); } - public void setServerSideClassName(String serverClassName) { - this.serverClassName = serverClassName; - } - public void setCaption(String c) { caption.getElement().setInnerHTML(c); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/Vaadin6Connector.java b/src/com/vaadin/terminal/gwt/client/ui/Vaadin6Connector.java new file mode 100644 index 0000000000..bcee1ff413 --- /dev/null +++ b/src/com/vaadin/terminal/gwt/client/ui/Vaadin6Connector.java @@ -0,0 +1,14 @@ +package com.vaadin.terminal.gwt.client.ui; + +import com.vaadin.terminal.gwt.client.ApplicationConnection; +import com.vaadin.terminal.gwt.client.Paintable; +import com.vaadin.terminal.gwt.client.UIDL; + +public abstract class Vaadin6Connector extends AbstractComponentConnector + implements Paintable { + + public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { + ((Paintable) getWidget()).updateFromUIDL(uidl, client); + } + +} diff --git a/src/com/vaadin/terminal/gwt/client/ui/VerticalBoxLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/VerticalBoxLayoutConnector.java index 80100fc0c7..369afb9e2f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VerticalBoxLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VerticalBoxLayoutConnector.java @@ -2,10 +2,10 @@ package com.vaadin.terminal.gwt.client.ui; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.UIDL; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.VerticalLayout; -@Component(value = VerticalLayout.class, loadStyle = LoadStyle.EAGER) +@Connect(value = VerticalLayout.class, loadStyle = LoadStyle.EAGER) public class VerticalBoxLayoutConnector extends AbstractBoxLayoutConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java index f33d582ef1..2307f67ac5 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java @@ -19,13 +19,13 @@ import com.vaadin.terminal.gwt.client.VCaption; import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler; import com.vaadin.terminal.gwt.client.ui.LayoutClickRPC; import com.vaadin.terminal.gwt.client.ui.absolutelayout.VAbsoluteLayout.AbsoluteWrapper; import com.vaadin.ui.AbsoluteLayout; -@Component(AbsoluteLayout.class) +@Connect(AbsoluteLayout.class) public class AbsoluteLayoutConnector extends AbstractComponentContainerConnector implements DirectionalManagedLayout { diff --git a/src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java b/src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java index 8ab33f615d..a03fa37214 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java @@ -10,14 +10,14 @@ 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.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout; import com.vaadin.terminal.gwt.client.ui.accordion.VAccordion.StackItem; import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren; import com.vaadin.terminal.gwt.client.ui.tabsheet.TabsheetBaseConnector; import com.vaadin.ui.Accordion; -@Component(Accordion.class) +@Connect(Accordion.class) public class AccordionConnector extends TabsheetBaseConnector implements SimpleManagedLayout, MayScrollChildren { diff --git a/src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java b/src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java index bfef73d18a..d55e66dbd5 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java @@ -10,11 +10,11 @@ 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.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.MediaBaseConnector; import com.vaadin.ui.Audio; -@Component(Audio.class) +@Connect(Audio.class) public class AudioConnector extends MediaBaseConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java b/src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java index a04e2482e5..62a5e8ac8b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java @@ -21,12 +21,12 @@ import com.vaadin.terminal.gwt.client.communication.FieldRpc.FocusAndBlurServerR import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.terminal.gwt.client.ui.Icon; import com.vaadin.ui.Button; -@Component(value = Button.class, loadStyle = LoadStyle.EAGER) +@Connect(value = Button.class, loadStyle = LoadStyle.EAGER) public class ButtonConnector extends AbstractComponentConnector implements BlurHandler, FocusHandler, ClickHandler { diff --git a/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java b/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java index 7e0c927ae4..731838371f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java @@ -22,11 +22,11 @@ import com.vaadin.terminal.gwt.client.communication.FieldRpc.FocusAndBlurServerR import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.Icon; import com.vaadin.ui.CheckBox; -@Component(CheckBox.class) +@Connect(CheckBox.class) public class CheckBoxConnector extends AbstractFieldConnector implements FocusHandler, BlurHandler, ClickHandler { diff --git a/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java b/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java index 4a0db6ee5b..ee16d90b12 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java @@ -12,13 +12,13 @@ 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.AbstractFieldConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout; import com.vaadin.terminal.gwt.client.ui.combobox.VFilterSelect.FilterSelectSuggestion; import com.vaadin.terminal.gwt.client.ui.menubar.MenuItem; import com.vaadin.ui.Select; -@Component(Select.class) +@Connect(Select.class) public class ComboBoxConnector extends AbstractFieldConnector implements Paintable, SimpleManagedLayout { diff --git a/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java index 3d20e01b4b..76fb9ab926 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java @@ -18,14 +18,14 @@ import com.vaadin.terminal.gwt.client.VCaption; import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.ui.AbstractLayoutConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler; import com.vaadin.terminal.gwt.client.ui.LayoutClickRPC; import com.vaadin.terminal.gwt.client.ui.VMarginInfo; import com.vaadin.terminal.gwt.client.ui.csslayout.VCssLayout.FlowPane; import com.vaadin.ui.CssLayout; -@Component(CssLayout.class) +@Connect(CssLayout.class) public class CssLayoutConnector extends AbstractLayoutConnector { private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler( diff --git a/src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java index 9c48d2ead4..a65187a461 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java @@ -8,11 +8,11 @@ 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.AbstractComponentContainerConnector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.CustomComponent; -@Component(value = CustomComponent.class, loadStyle = LoadStyle.EAGER) +@Connect(value = CustomComponent.class, loadStyle = LoadStyle.EAGER) public class CustomComponentConnector extends AbstractComponentContainerConnector { diff --git a/src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java index b0328d5bed..a2ba09da43 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java @@ -5,12 +5,12 @@ package com.vaadin.terminal.gwt.client.ui.customfield; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.customcomponent.CustomComponentConnector; import com.vaadin.terminal.gwt.client.ui.customcomponent.VCustomComponent; import com.vaadin.ui.CustomField; -@Component(value = CustomField.class) +@Connect(value = CustomField.class) public class CustomFieldConnector extends CustomComponentConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java index 9d34859cb7..5e8f01258f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java @@ -3,7 +3,6 @@ */ package com.vaadin.terminal.gwt.client.ui.customlayout; - import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.Widget; @@ -11,11 +10,11 @@ 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.AbstractLayoutConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout; import com.vaadin.ui.CustomLayout; -@Component(CustomLayout.class) +@Connect(CustomLayout.class) public class CustomLayoutConnector extends AbstractLayoutConnector implements SimpleManagedLayout { diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java index 561f6fc7b5..8a4840a088 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java @@ -10,12 +10,12 @@ 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.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.datefield.VCalendarPanel.FocusChangeListener; import com.vaadin.terminal.gwt.client.ui.datefield.VCalendarPanel.TimeChangeListener; import com.vaadin.ui.InlineDateField; -@Component(InlineDateField.class) +@Connect(InlineDateField.class) public class InlineDateFieldConnector extends AbstractDateFieldConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java index b28345380e..1bcb40d549 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java @@ -11,12 +11,12 @@ 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.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.datefield.VCalendarPanel.FocusChangeListener; import com.vaadin.terminal.gwt.client.ui.datefield.VCalendarPanel.TimeChangeListener; import com.vaadin.ui.DateField; -@Component(DateField.class) +@Connect(DateField.class) public class PopupDateFieldConnector extends TextualDateConnector { /* @@ -37,8 +37,7 @@ public class PopupDateFieldConnector extends TextualDateConnector { super.updateFromUIDL(uidl, client); - String popupStyleNames = getStyleNames( - VPopupCalendar.POPUP_PRIMARY_STYLE_NAME, this); + String popupStyleNames = getStyleNames(VPopupCalendar.POPUP_PRIMARY_STYLE_NAME); popupStyleNames += " " + VDateField.CLASSNAME + "-" diff --git a/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java index a1ee6605aa..db531ac70f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java @@ -11,11 +11,11 @@ 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.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.customcomponent.CustomComponentConnector; import com.vaadin.ui.DragAndDropWrapper; -@Component(DragAndDropWrapper.class) +@Connect(DragAndDropWrapper.class) public class DragAndDropWrapperConnector extends CustomComponentConnector implements Paintable { diff --git a/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java b/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java index 1a8a54e99d..423aac1974 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java @@ -26,10 +26,10 @@ import com.vaadin.terminal.gwt.client.VTooltip; import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector; import com.vaadin.terminal.gwt.client.ui.ClickEventHandler; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.ui.Embedded; -@Component(Embedded.class) +@Connect(Embedded.class) public class EmbeddedConnector extends AbstractComponentConnector implements Paintable { diff --git a/src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java b/src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java index 11d5385213..82cbc95b2d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java @@ -13,7 +13,7 @@ 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.ui.AbstractComponentContainerConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.Icon; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; import com.vaadin.terminal.gwt.client.ui.layout.ElementResizeEvent; @@ -21,7 +21,7 @@ import com.vaadin.terminal.gwt.client.ui.layout.ElementResizeListener; import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren; import com.vaadin.ui.Form; -@Component(Form.class) +@Connect(Form.class) public class FormConnector extends AbstractComponentContainerConnector implements Paintable, MayScrollChildren { diff --git a/src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java index 258a280ea7..d7774b66ef 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java @@ -10,7 +10,7 @@ import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector; import com.vaadin.terminal.gwt.client.ui.AbstractLayoutConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.VMarginInfo; import com.vaadin.terminal.gwt.client.ui.formlayout.VFormLayout.Caption; import com.vaadin.terminal.gwt.client.ui.formlayout.VFormLayout.ErrorFlag; @@ -18,7 +18,7 @@ import com.vaadin.terminal.gwt.client.ui.formlayout.VFormLayout.VFormLayoutTable import com.vaadin.terminal.gwt.client.ui.orderedlayout.AbstractOrderedLayoutState; import com.vaadin.ui.FormLayout; -@Component(FormLayout.class) +@Connect(FormLayout.class) public class FormLayoutConnector extends AbstractLayoutConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java index 0a26fa020a..82f26383a1 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java @@ -20,7 +20,7 @@ import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector; import com.vaadin.terminal.gwt.client.ui.AlignmentInfo; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler; import com.vaadin.terminal.gwt.client.ui.LayoutClickRPC; import com.vaadin.terminal.gwt.client.ui.VMarginInfo; @@ -28,7 +28,7 @@ import com.vaadin.terminal.gwt.client.ui.gridlayout.VGridLayout.Cell; import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot; import com.vaadin.ui.GridLayout; -@Component(GridLayout.class) +@Connect(GridLayout.class) public class GridLayoutConnector extends AbstractComponentContainerConnector implements Paintable, DirectionalManagedLayout { @@ -160,7 +160,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector updateCaption(child); } } - getLayoutManager().setNeedsUpdate(this); + getLayoutManager().setNeedsLayout(this); } @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java index 6c5d018161..151705b1af 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java @@ -193,6 +193,7 @@ public class VGridLayout extends ComplexPanel { LayoutManager layoutManager = LayoutManager.get(client); Element element = getElement(); int paddingTop = layoutManager.getPaddingTop(element); + int paddingBottom = layoutManager.getPaddingBottom(element); int y = paddingTop; for (int i = 0; i < cells.length; i++) { @@ -200,7 +201,15 @@ public class VGridLayout extends ComplexPanel { for (int j = 0; j < cells[i].length; j++) { Cell cell = cells[i][j]; if (cell != null) { - cell.layoutVertically(y); + int effectivePadding; + if (cell.rowspan + j >= cells[i].length) { + // Make room for layout padding for cells reaching the + // bottom of the layout + effectivePadding = paddingBottom; + } else { + effectivePadding = 0; + } + cell.layoutVertically(y, effectivePadding); } y += rowHeights[j] + verticalSpacing; } @@ -220,12 +229,21 @@ public class VGridLayout extends ComplexPanel { LayoutManager layoutManager = LayoutManager.get(client); Element element = getElement(); int x = layoutManager.getPaddingLeft(element); + int paddingRight = layoutManager.getPaddingRight(element); int horizontalSpacing = getHorizontalSpacing(); for (int i = 0; i < cells.length; i++) { for (int j = 0; j < cells[i].length; j++) { Cell cell = cells[i][j]; if (cell != null) { - cell.layoutHorizontally(x); + int effectivePadding; + // Make room for layout padding for cells reaching the + // right edge of the layout + if (i + cell.colspan >= cells.length) { + effectivePadding = paddingRight; + } else { + effectivePadding = 0; + } + cell.layoutHorizontally(x, effectivePadding); } } x += columnWidths[i] + horizontalSpacing; @@ -489,15 +507,15 @@ public class VGridLayout extends ComplexPanel { return height; } - public void layoutHorizontally(int x) { + public void layoutHorizontally(int x, int paddingRight) { if (slot != null) { - slot.positionHorizontally(x, getAvailableWidth()); + slot.positionHorizontally(x, getAvailableWidth(), paddingRight); } } - public void layoutVertically(int y) { + public void layoutVertically(int y, int paddingBottom) { if (slot != null) { - slot.positionVertically(y, getAvailableHeight()); + slot.positionVertically(y, getAvailableHeight(), paddingBottom); } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java index 203845d157..308a4860b5 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java @@ -12,11 +12,11 @@ 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.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.Label; -@Component(value = Label.class, loadStyle = LoadStyle.EAGER) +@Connect(value = Label.class, loadStyle = LoadStyle.EAGER) public class LabelConnector extends AbstractComponentConnector implements Paintable { diff --git a/src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java b/src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java index c02061a2fe..f44d662e97 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java +++ b/src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java @@ -60,7 +60,7 @@ public abstract class VLayoutSlot { } public void positionHorizontally(double currentLocation, - double allocatedSpace) { + double allocatedSpace, double paddingRight) { Style style = wrapper.getStyle(); double availableWidth = allocatedSpace; @@ -73,21 +73,25 @@ public abstract class VLayoutSlot { boolean captionAboveCompnent; if (caption == null) { captionAboveCompnent = false; - style.clearPaddingRight(); } else { captionAboveCompnent = !caption.shouldBePlacedAfterComponent(); if (!captionAboveCompnent) { - style.setPaddingRight(captionWidth, Unit.PX); availableWidth -= captionWidth; captionStyle.clearLeft(); - captionStyle.setRight(0, Unit.PX); + captionStyle.setRight(paddingRight, Unit.PX); + paddingRight += captionWidth; } else { - style.clearPaddingRight(); captionStyle.setLeft(0, Unit.PX); captionStyle.clearRight(); } } + if (paddingRight > 0) { + style.setPaddingRight(paddingRight, Unit.PX); + } else { + style.clearPaddingRight(); + } + if (isRelativeWidth()) { style.setPropertyPx("width", (int) availableWidth); } else { @@ -137,7 +141,8 @@ public abstract class VLayoutSlot { return Double.parseDouble(size.replaceAll("%", "")); } - public void positionVertically(double currentLocation, double allocatedSpace) { + public void positionVertically(double currentLocation, + double allocatedSpace, double paddingBottom) { Style style = wrapper.getStyle(); double contentHeight = allocatedSpace; @@ -156,6 +161,12 @@ public abstract class VLayoutSlot { style.setPaddingTop(captionHeight, Unit.PX); } + if (paddingBottom > 0) { + style.setPaddingBottom(paddingBottom, Unit.PX); + } else { + style.clearPaddingBottom(); + } + if (isRelativeHeight()) { style.setHeight(contentHeight, Unit.PX); } else { @@ -198,11 +209,11 @@ public abstract class VLayoutSlot { } public void positionInDirection(double currentLocation, - double allocatedSpace, boolean isVertical) { + double allocatedSpace, double endingPadding, boolean isVertical) { if (isVertical) { - positionVertically(currentLocation, allocatedSpace); + positionVertically(currentLocation, allocatedSpace, endingPadding); } else { - positionHorizontally(currentLocation, allocatedSpace); + positionHorizontally(currentLocation, allocatedSpace, endingPadding); } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java b/src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java index 1c083d9566..f74a851d03 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java @@ -11,11 +11,11 @@ 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.ui.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.Icon; import com.vaadin.ui.Link; -@Component(Link.class) +@Connect(Link.class) public class LinkConnector extends AbstractComponentConnector implements Paintable { diff --git a/src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java b/src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java index 0be533f00e..ddaa959560 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java @@ -6,11 +6,11 @@ package com.vaadin.terminal.gwt.client.ui.listselect; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.optiongroup.OptionGroupBaseConnector; import com.vaadin.ui.ListSelect; -@Component(ListSelect.class) +@Connect(ListSelect.class) public class ListSelectConnector extends OptionGroupBaseConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java index ee23e88647..d063c89ca9 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java @@ -14,13 +14,13 @@ 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.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.terminal.gwt.client.ui.Icon; import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout; import com.vaadin.terminal.gwt.client.ui.menubar.VMenuBar.CustomMenuItem; -@Component(value = com.vaadin.ui.MenuBar.class, loadStyle = LoadStyle.LAZY) +@Connect(value = com.vaadin.ui.MenuBar.class, loadStyle = LoadStyle.LAZY) public class MenuBarConnector extends AbstractComponentConnector implements Paintable, SimpleManagedLayout { /** @@ -149,7 +149,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements } }// while - getLayoutManager().setWidthNeedsUpdate(this); + getLayoutManager().setNeedsHorizontalLayout(this); }// updateFromUIDL diff --git a/src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java b/src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java index 042458d701..801c405826 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java @@ -16,13 +16,13 @@ import com.vaadin.terminal.gwt.client.communication.FieldRpc.FocusAndBlurServerR import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.Icon; import com.vaadin.terminal.gwt.client.ui.button.ButtonServerRpc; import com.vaadin.terminal.gwt.client.ui.button.ButtonState; import com.vaadin.ui.NativeButton; -@Component(NativeButton.class) +@Connect(NativeButton.class) public class NativeButtonConnector extends AbstractComponentConnector implements BlurHandler, FocusHandler { diff --git a/src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java b/src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java index 0bc43f3e41..e6264e492f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java @@ -6,11 +6,11 @@ package com.vaadin.terminal.gwt.client.ui.nativeselect; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.optiongroup.OptionGroupBaseConnector; import com.vaadin.ui.NativeSelect; -@Component(NativeSelect.class) +@Connect(NativeSelect.class) public class NativeSelectConnector extends OptionGroupBaseConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java index 57c98978e7..06552a2812 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java @@ -13,10 +13,10 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.EventId; import com.vaadin.terminal.gwt.client.UIDL; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.ui.OptionGroup; -@Component(OptionGroup.class) +@Connect(OptionGroup.class) public class OptionGroupConnector extends OptionGroupBaseConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index 4a9190e0f1..d36046d6cb 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -91,7 +91,7 @@ public abstract class AbstractOrderedLayoutConnector extends caption.updateCaption(); } else { layout.setCaption(component.getWidget(), null); - getLayoutManager().setNeedsUpdate(this); + getLayoutManager().setNeedsLayout(this); } } @@ -137,7 +137,7 @@ public abstract class AbstractOrderedLayoutConnector extends layout.updateSpacingStyleName(getState().isSpacing()); - getLayoutManager().setNeedsUpdate(this); + getLayoutManager().setNeedsLayout(this); } private int getSizeForInnerSize(int size, boolean isVertical) { @@ -178,6 +178,7 @@ public abstract class AbstractOrderedLayoutConnector extends boolean isUndefined = isUndefinedInDirection(isVertical); int startPadding = getStartPadding(isVertical); + int endPadding = getEndPadding(isVertical); int spacingSize = getSpacingInDirection(isVertical); int allocatedSize; @@ -188,7 +189,7 @@ public abstract class AbstractOrderedLayoutConnector extends } allocatedSize = layout.layoutPrimaryDirection(spacingSize, - allocatedSize, startPadding); + allocatedSize, startPadding, endPadding); Style ownStyle = getWidget().getElement().getStyle(); if (isUndefined) { @@ -225,6 +226,7 @@ public abstract class AbstractOrderedLayoutConnector extends boolean isUndefined = isUndefinedInDirection(!isVertical); int startPadding = getStartPadding(!isVertical); + int endPadding = getEndPadding(!isVertical); int allocatedSize; if (isUndefined) { @@ -234,7 +236,7 @@ public abstract class AbstractOrderedLayoutConnector extends } allocatedSize = layout.layoutSecondaryDirection(allocatedSize, - startPadding); + startPadding, endPadding); Style ownStyle = getWidget().getElement().getStyle(); @@ -266,6 +268,15 @@ public abstract class AbstractOrderedLayoutConnector extends } } + private int getEndPadding(boolean isVertical) { + if (isVertical) { + return getLayoutManager() + .getPaddingBottom(getWidget().getElement()); + } else { + return getLayoutManager().getPaddingRight(getWidget().getElement()); + } + } + public void layoutHorizontally() { if (getWidget().isVertical) { layoutSecondaryDirection(); diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java index 74f5906142..a12b41ade7 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java @@ -4,11 +4,11 @@ package com.vaadin.terminal.gwt.client.ui.orderedlayout; import com.google.gwt.core.client.GWT; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.HorizontalLayout; -@Component(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER) +@Connect(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER) public class HorizontalLayoutConnector extends AbstractOrderedLayoutConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VHorizontalLayout.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VHorizontalLayout.java index 4520f2be55..5bf377642e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VHorizontalLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VHorizontalLayout.java @@ -3,7 +3,6 @@ */ package com.vaadin.terminal.gwt.client.ui.orderedlayout; - public class VHorizontalLayout extends VMeasuringOrderedLayout { public static final String CLASSNAME = "v-horizontallayout"; diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java index 03cf1a5dfb..41c48883ec 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java @@ -14,6 +14,7 @@ import com.google.gwt.dom.client.Style.Position; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.ComplexPanel; import com.google.gwt.user.client.ui.Widget; +import com.google.gwt.user.client.ui.WidgetCollection; import com.vaadin.terminal.gwt.client.VCaption; import com.vaadin.terminal.gwt.client.ui.VMarginInfo; import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot; @@ -116,7 +117,7 @@ public class VMeasuringOrderedLayout extends ComplexPanel { } public int layoutPrimaryDirection(int spacingSize, int allocatedSize, - int startPadding) { + int startPadding, int endPadding) { int actuallyAllocated = 0; double totalExpand = 0; @@ -146,7 +147,9 @@ public class VMeasuringOrderedLayout extends ComplexPanel { double currentLocation = startPadding; - for (Widget child : this) { + WidgetCollection children = getChildren(); + for (int i = 0; i < children.size(); i++) { + Widget child = children.get(i); if (child instanceof VCaption) { continue; } @@ -187,7 +190,16 @@ public class VMeasuringOrderedLayout extends ComplexPanel { */ double roundedSpace = Math.round(endLocation) - roundedLocation; - slot.positionInDirection(roundedLocation, roundedSpace, isVertical); + // Reserve room for the padding if we're at the end + double slotEndPadding; + if (i == children.size() - 1) { + slotEndPadding = endPadding; + } else { + slotEndPadding = 0; + } + + slot.positionInDirection(roundedLocation, roundedSpace, + slotEndPadding, isVertical); currentLocation = endLocation + spacingSize; } @@ -195,7 +207,8 @@ public class VMeasuringOrderedLayout extends ComplexPanel { return allocatedSize; } - public int layoutSecondaryDirection(int allocatedSize, int startPadding) { + public int layoutSecondaryDirection(int allocatedSize, int startPadding, + int endPadding) { int maxSize = 0; for (Widget child : this) { if (child instanceof VCaption) { @@ -219,7 +232,8 @@ public class VMeasuringOrderedLayout extends ComplexPanel { } VLayoutSlot slot = getSlotForChild(child); - slot.positionInDirection(startPadding, allocatedSize, !isVertical); + slot.positionInDirection(startPadding, allocatedSize, endPadding, + !isVertical); } return allocatedSize; diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VVerticalLayout.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VVerticalLayout.java index ba5f24fd67..e44c576941 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VVerticalLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VVerticalLayout.java @@ -3,7 +3,6 @@ */ package com.vaadin.terminal.gwt.client.ui.orderedlayout; - public class VVerticalLayout extends VMeasuringOrderedLayout { public static final String CLASSNAME = "v-verticallayout"; diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java index 8e3677ca5f..1e5651ce38 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java @@ -4,11 +4,11 @@ package com.vaadin.terminal.gwt.client.ui.orderedlayout; import com.google.gwt.core.client.GWT; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.VerticalLayout; -@Component(value = VerticalLayout.class, loadStyle = LoadStyle.EAGER) +@Connect(value = VerticalLayout.class, loadStyle = LoadStyle.EAGER) public class VerticalLayoutConnector extends AbstractOrderedLayoutConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java index 43f58c10b8..32cf9cfb2e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java @@ -18,14 +18,14 @@ import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector; import com.vaadin.terminal.gwt.client.ui.ClickEventHandler; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.PostLayoutListener; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout; import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren; import com.vaadin.ui.Panel; -@Component(Panel.class) +@Connect(Panel.class) public class PanelConnector extends AbstractComponentContainerConnector implements Paintable, SimpleManagedLayout, PostLayoutListener, MayScrollChildren { diff --git a/src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java index 088e83c9cc..1d1ec58fbb 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java @@ -8,11 +8,11 @@ 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.UIDL; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.textfield.TextFieldConnector; import com.vaadin.ui.PasswordField; -@Component(PasswordField.class) +@Connect(PasswordField.class) public class PasswordFieldConnector extends TextFieldConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java b/src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java index cd3b1d9f47..4faa6cec86 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java @@ -12,11 +12,11 @@ import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.VCaption; import com.vaadin.terminal.gwt.client.VCaptionWrapper; import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.PostLayoutListener; import com.vaadin.ui.PopupView; -@Component(PopupView.class) +@Connect(PopupView.class) public class PopupViewConnector extends AbstractComponentContainerConnector implements Paintable, PostLayoutListener { diff --git a/src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java b/src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java index 2727c0e305..09fa5fb44e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java @@ -11,10 +11,10 @@ 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.ui.AbstractFieldConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.ui.ProgressIndicator; -@Component(ProgressIndicator.class) +@Connect(ProgressIndicator.class) public class ProgressIndicatorConnector extends AbstractFieldConnector implements Paintable { diff --git a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java index d767dd9805..01e79bc1c3 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java @@ -10,12 +10,12 @@ 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.ui.AbstractFieldConnector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener; import com.vaadin.ui.RichTextArea; -@Component(value = RichTextArea.class, loadStyle = LoadStyle.LAZY) +@Connect(value = RichTextArea.class, loadStyle = LoadStyle.LAZY) public class RichTextAreaConnector extends AbstractFieldConnector implements Paintable, BeforeShortcutActionListener { diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java b/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java index 048e3ee94c..408c15383c 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java @@ -12,7 +12,6 @@ import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.Position; -import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; @@ -20,6 +19,7 @@ import com.google.gwt.user.client.History; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; +import com.google.web.bindery.event.shared.HandlerRegistration; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.ComponentConnector; @@ -35,15 +35,15 @@ import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler; import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector; import com.vaadin.terminal.gwt.client.ui.ClickEventHandler; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren; import com.vaadin.terminal.gwt.client.ui.notification.VNotification; import com.vaadin.terminal.gwt.client.ui.window.WindowConnector; import com.vaadin.ui.Root; -@Component(value = Root.class, loadStyle = LoadStyle.EAGER) +@Connect(value = Root.class, loadStyle = LoadStyle.EAGER) public class RootConnector extends AbstractComponentContainerConnector implements Paintable, MayScrollChildren { diff --git a/src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java b/src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java index 8b2e6501df..9cd3c35fee 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java @@ -11,10 +11,10 @@ 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.ui.AbstractFieldConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.ui.Slider; -@Component(Slider.class) +@Connect(Slider.class) public class SliderConnector extends AbstractFieldConnector implements Paintable { diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java index f8fd2faf41..7340c2cbd9 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -134,7 +134,7 @@ public abstract class AbstractSplitPanelConnector extends // appearing/disappearing scrollbars into account. getConnection().runDescendentsLayout(getWidget()); - getLayoutManager().setNeedsUpdate(this); + getLayoutManager().setNeedsLayout(this); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java index d1a87874dc..7814ab8e13 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java @@ -4,11 +4,11 @@ package com.vaadin.terminal.gwt.client.ui.splitpanel; import com.google.gwt.core.client.GWT; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.HorizontalSplitPanel; -@Component(value = HorizontalSplitPanel.class, loadStyle = LoadStyle.EAGER) +@Connect(value = HorizontalSplitPanel.class, loadStyle = LoadStyle.EAGER) public class HorizontalSplitPanelConnector extends AbstractSplitPanelConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VSplitPanelHorizontal.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VSplitPanelHorizontal.java index e19bc6418b..9048a59d7d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VSplitPanelHorizontal.java +++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VSplitPanelHorizontal.java @@ -4,7 +4,6 @@ package com.vaadin.terminal.gwt.client.ui.splitpanel; - public class VSplitPanelHorizontal extends VAbstractSplitPanel { public VSplitPanelHorizontal() { diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VSplitPanelVertical.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VSplitPanelVertical.java index 0fcb638630..d22ebed5d9 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VSplitPanelVertical.java +++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VSplitPanelVertical.java @@ -4,7 +4,6 @@ package com.vaadin.terminal.gwt.client.ui.splitpanel; - public class VSplitPanelVertical extends VAbstractSplitPanel { public VSplitPanelVertical() { diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java index a9b3e81a1b..83404177c0 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java @@ -4,11 +4,11 @@ package com.vaadin.terminal.gwt.client.ui.splitpanel; import com.google.gwt.core.client.GWT; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.VerticalSplitPanel; -@Component(value = VerticalSplitPanel.class, loadStyle = LoadStyle.EAGER) +@Connect(value = VerticalSplitPanel.class, loadStyle = LoadStyle.EAGER) public class VerticalSplitPanelConnector extends AbstractSplitPanelConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java b/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java index e0cd3dc4c7..f16ee3463f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java @@ -20,12 +20,12 @@ 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.AbstractComponentContainerConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.PostLayoutListener; import com.vaadin.terminal.gwt.client.ui.table.VScrollTable.ContextMenuDetails; import com.vaadin.terminal.gwt.client.ui.table.VScrollTable.VScrollTableBody.VScrollTableRow; -@Component(com.vaadin.ui.Table.class) +@Connect(com.vaadin.ui.Table.class) public class TableConnector extends AbstractComponentContainerConnector implements Paintable, DirectionalManagedLayout, PostLayoutListener { @@ -289,8 +289,10 @@ public class TableConnector extends AbstractComponentContainerConnector Scheduler.get().scheduleFinally(new ScheduledCommand() { public void execute() { getLayoutManager().setNeedsMeasure(TableConnector.this); - getLayoutManager() - .setHeightNeedsUpdate(TableConnector.this); + getLayoutManager().setNeedsMeasure( + TableConnector.this.getParent()); + getLayoutManager().setNeedsVerticalLayout( + TableConnector.this); getLayoutManager().layoutNow(); } }); diff --git a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java index 0518b3a480..7829934f70 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java @@ -9,12 +9,12 @@ 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.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout; import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren; import com.vaadin.ui.TabSheet; -@Component(TabSheet.class) +@Connect(TabSheet.class) public class TabsheetConnector extends TabsheetBaseConnector implements SimpleManagedLayout, MayScrollChildren { diff --git a/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java b/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java index f5ef93a265..0f3ae0ad4f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java @@ -9,11 +9,11 @@ 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.UIDL; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.textfield.TextFieldConnector; import com.vaadin.ui.TextArea; -@Component(TextArea.class) +@Connect(TextArea.class) public class TextAreaConnector extends TextFieldConnector { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java index 806dc8c5dc..7e9e786676 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java @@ -13,12 +13,12 @@ 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.ui.AbstractFieldConnector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener; import com.vaadin.ui.TextField; -@Component(value = TextField.class, loadStyle = LoadStyle.EAGER) +@Connect(value = TextField.class, loadStyle = LoadStyle.EAGER) public class TextFieldConnector extends AbstractFieldConnector implements Paintable, BeforeShortcutActionListener { diff --git a/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java b/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java index f2f5d76d43..ebe5d22e99 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java @@ -14,11 +14,11 @@ import com.vaadin.terminal.gwt.client.Paintable; import com.vaadin.terminal.gwt.client.TooltipInfo; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.tree.VTree.TreeNode; import com.vaadin.ui.Tree; -@Component(Tree.class) +@Connect(Tree.class) public class TreeConnector extends AbstractComponentConnector implements Paintable { diff --git a/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java b/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java index aff2fafdb9..f81771781b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java @@ -7,14 +7,14 @@ 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.UIDL; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.FocusableScrollPanel; import com.vaadin.terminal.gwt.client.ui.table.TableConnector; import com.vaadin.terminal.gwt.client.ui.table.VScrollTable.VScrollTableBody.VScrollTableRow; import com.vaadin.terminal.gwt.client.ui.treetable.VTreeTable.PendingNavigationEvent; import com.vaadin.ui.TreeTable; -@Component(TreeTable.class) +@Connect(TreeTable.class) public class TreeTableConnector extends TableConnector { public static final String ATTRIBUTE_HIERARCHY_COLUMN_INDEX = "hci"; diff --git a/src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java b/src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java index d8ad511d86..328d0fc18b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java @@ -9,11 +9,11 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.DirectionalManagedLayout; import com.vaadin.terminal.gwt.client.UIDL; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.optiongroup.OptionGroupBaseConnector; import com.vaadin.ui.TwinColSelect; -@Component(TwinColSelect.class) +@Connect(TwinColSelect.class) public class TwinColSelectConnector extends OptionGroupBaseConnector implements DirectionalManagedLayout { @@ -23,7 +23,7 @@ public class TwinColSelectConnector extends OptionGroupBaseConnector implements // correctly if (isRealUpdate(uidl)) { getWidget().updateCaptions(uidl); - getLayoutManager().setWidthNeedsUpdate(this); + getLayoutManager().setNeedsHorizontalLayout(this); } super.updateFromUIDL(uidl, client); diff --git a/src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java b/src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java index c8b9fae07a..0a2c0b241e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java @@ -10,11 +10,11 @@ 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.ui.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.ui.Upload; -@Component(value = Upload.class, loadStyle = LoadStyle.LAZY) +@Connect(value = Upload.class, loadStyle = LoadStyle.LAZY) public class UploadConnector extends AbstractComponentConnector implements Paintable { diff --git a/src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java b/src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java index 318a82ddcf..ec763fff07 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java @@ -7,11 +7,11 @@ 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.UIDL; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.MediaBaseConnector; import com.vaadin.ui.Video; -@Component(Video.class) +@Connect(Video.class) public class VideoConnector extends MediaBaseConnector { public static final String ATTR_POSTER = "poster"; diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java index 2c5fadff3b..d08387fc6d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java +++ b/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java @@ -893,9 +893,10 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } private int getDecorationHeight() { - LayoutManager layoutManager = layout.getLayoutManager(); - return layoutManager.getOuterHeight(getElement()) - - layoutManager.getInnerHeight(contentPanel.getElement()); + LayoutManager lm = layout.getLayoutManager(); + int headerHeight = lm.getOuterHeight(header); + int footerHeight = lm.getOuterHeight(footer); + return headerHeight + footerHeight; } public int getMinWidth() { @@ -905,7 +906,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, private int getDecorationWidth() { LayoutManager layoutManager = layout.getLayoutManager(); return layoutManager.getOuterWidth(getElement()) - - layoutManager.getInnerWidth(contentPanel.getElement()); + - contentPanel.getElement().getOffsetWidth(); } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java b/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java index fbb7a3683b..85f4213d3e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java @@ -24,14 +24,14 @@ import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector; import com.vaadin.terminal.gwt.client.ui.ClickEventHandler; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.terminal.gwt.client.ui.PostLayoutListener; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener; import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout; import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren; -@Component(value = com.vaadin.ui.Window.class) +@Connect(value = com.vaadin.ui.Window.class) public class WindowConnector extends AbstractComponentContainerConnector implements Paintable, BeforeShortcutActionListener, SimpleManagedLayout, PostLayoutListener, MayScrollChildren { @@ -46,6 +46,8 @@ public class WindowConnector extends AbstractComponentContainerConnector private WindowServerRPC rpc; + boolean minWidthChecked = false; + @Override public boolean delegateCaptionHandling() { return false; @@ -220,11 +222,16 @@ public class WindowConnector extends AbstractComponentContainerConnector ComponentConnector layout = window.layout; Element contentElement = window.contentPanel.getElement(); - boolean needsMinWidth = !isUndefinedWidth() || layout.isRelativeWidth(); - int minWidth = window.getMinWidth(); - if (needsMinWidth && lm.getInnerWidth(contentElement) < minWidth) { - // Use minimum width if less than a certain size - window.setWidth(minWidth + "px"); + if (!minWidthChecked) { + boolean needsMinWidth = !isUndefinedWidth() + || layout.isRelativeWidth(); + int minWidth = window.getMinWidth(); + if (needsMinWidth && lm.getInnerWidth(contentElement) < minWidth) { + minWidthChecked = true; + // Use minimum width if less than a certain size + window.setWidth(minWidth + "px"); + } + minWidthChecked = true; } boolean needsMinHeight = !isUndefinedHeight() @@ -274,6 +281,7 @@ public class WindowConnector extends AbstractComponentContainerConnector } public void postLayout() { + minWidthChecked = false; VWindow window = getWidget(); if (window.centered) { window.center(); diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java index 72a0432f4b..8235859758 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java @@ -287,6 +287,12 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet return "/html"; } } + + public ClassLoader getClassLoader() { + // Custom class loaders not currently supported in portlets (see + // #8574) + return null; + } }; @Override @@ -857,7 +863,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet application.setLocale(locale); // No application URL when running inside a portlet application.start(new ApplicationStartEvent(null, - applicationProperties, context, isProductionMode(), null)); + applicationProperties, context, isProductionMode())); } } diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java index c295e05ed7..18cc3f97f4 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java @@ -171,6 +171,14 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements public boolean isStandalone(WrappedRequest request) { return true; } + + public ClassLoader getClassLoader() { + try { + return AbstractApplicationServlet.this.getClassLoader(); + } catch (ServletException e) { + throw new RuntimeException(e); + } + } }; static final String UPLOAD_URL_PREFIX = "APP/UPLOAD/"; @@ -1037,7 +1045,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements application.setLocale(locale); application.start(new ApplicationStartEvent(applicationUrl, applicationProperties, webApplicationContext, - isProductionMode(), getClassLoader())); + isProductionMode())); } } diff --git a/src/com/vaadin/terminal/gwt/server/JsonCodec.java b/src/com/vaadin/terminal/gwt/server/JsonCodec.java index 15be2673ba..1824a16fb2 100644 --- a/src/com/vaadin/terminal/gwt/server/JsonCodec.java +++ b/src/com/vaadin/terminal/gwt/server/JsonCodec.java @@ -46,7 +46,7 @@ public class JsonCodec implements Serializable { registerType(Float.class, JsonEncoder.VTYPE_FLOAT); registerType(float.class, JsonEncoder.VTYPE_FLOAT); registerType(Double.class, JsonEncoder.VTYPE_DOUBLE); - registerType(double.class, JsonEncoder.VTYPE_FLOAT); + registerType(double.class, JsonEncoder.VTYPE_DOUBLE); registerType(Long.class, JsonEncoder.VTYPE_LONG); registerType(long.class, JsonEncoder.VTYPE_LONG); // transported as string representation @@ -271,9 +271,9 @@ public class JsonCodec implements Serializable { try { for (PropertyDescriptor pd : Introspector.getBeanInfo( value.getClass()).getPropertyDescriptors()) { - String fieldName = pd.getName(); Class<?> fieldType = pd.getPropertyType(); - if (pd.getReadMethod() == null || pd.getWriteMethod() == null) { + String fieldName = getTransportFieldName(pd); + if (fieldName == null) { continue; } Method getterMethod = pd.getReadMethod(); @@ -288,6 +288,24 @@ public class JsonCodec implements Serializable { return jsonMap; } + /** + * Returns the name that should be used as field name in the JSON. We strip + * "set" from the setter, keeping the result - this is easy to do on both + * server and client, avoiding some issues with cASE. E.g setZIndex() + * becomes "ZIndex". Also ensures that both getter and setter are present, + * returning null otherwise. + * + * @param pd + * @return the name to be used or null if both getter and setter are not + * found. + */ + private static String getTransportFieldName(PropertyDescriptor pd) { + if (pd.getReadMethod() == null || pd.getWriteMethod() == null) { + return null; + } + return pd.getWriteMethod().getName().substring(3); + } + private static Object decodeObject(String type, JSONObject serializedObject, Application application) throws JSONException { @@ -299,11 +317,11 @@ public class JsonCodec implements Serializable { Object decodedObject = cls.newInstance(); for (PropertyDescriptor pd : Introspector.getBeanInfo(cls) .getPropertyDescriptors()) { - if (pd.getReadMethod() == null || pd.getWriteMethod() == null) { + + String fieldName = getTransportFieldName(pd); + if (fieldName == null) { continue; } - - String fieldName = pd.getName(); JSONArray encodedObject = serializedObject .getJSONArray(fieldName); pd.getWriteMethod().invoke(decodedObject, diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java index 9d5f48a276..f0d6f0453b 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java @@ -7,13 +7,13 @@ import java.util.Collection; import java.util.HashSet; import com.vaadin.terminal.gwt.client.ComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; /** * An abstract helper class that can be used to easily build a widgetset with * customized load styles for each components. In three abstract methods one can - * override the default values given in {@link Component} annotations. + * override the default values given in {@link Connect} annotations. * * @see WidgetMapGenerator * @@ -25,7 +25,8 @@ public abstract class CustomWidgetMapGenerator extends WidgetMapGenerator { private Collection<Class<? extends ComponentConnector>> deferredPaintables = new HashSet<Class<? extends ComponentConnector>>(); @Override - protected LoadStyle getLoadStyle(Class<? extends ComponentConnector> connector) { + protected LoadStyle getLoadStyle( + Class<? extends ComponentConnector> connector) { if (eagerPaintables == null) { init(); } diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java index 6e20169c3b..8a1dfee3b5 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java @@ -4,7 +4,7 @@ package com.vaadin.terminal.gwt.widgetsetutils; import com.vaadin.terminal.gwt.client.ComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; /** * WidgetMap generator that builds a widgetset that packs all included widgets @@ -21,10 +21,10 @@ import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; * */ public class EagerWidgetMapGenerator extends WidgetMapGenerator { - - - @Override - protected LoadStyle getLoadStyle(Class<? extends ComponentConnector> connector) { - return LoadStyle.EAGER; + + @Override + protected LoadStyle getLoadStyle( + Class<? extends ComponentConnector> connector) { + return LoadStyle.EAGER; } } diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java index 28f9f8a84f..729a999a21 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java @@ -4,8 +4,7 @@ package com.vaadin.terminal.gwt.widgetsetutils; import com.vaadin.terminal.gwt.client.ComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; - +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; /** * WidgetMap generator that builds a widgetset that optimizes the transferred @@ -17,7 +16,8 @@ import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; */ public class LazyWidgetMapGenerator extends WidgetMapGenerator { @Override - protected LoadStyle getLoadStyle(Class<? extends ComponentConnector> connector) { + protected LoadStyle getLoadStyle( + Class<? extends ComponentConnector> connector) { return LoadStyle.LAZY; } diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java index 3b83edaf25..ad4e513049 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java @@ -53,8 +53,7 @@ public class RpcProxyGenerator extends Generator { + requestedType.getName().replaceAll("[$.]", "_"); JClassType initializableInterface = typeOracle - .findType(InitializableServerRpc.class - .getCanonicalName()); + .findType(InitializableServerRpc.class.getCanonicalName()); ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory( requestedType.getPackage().getName(), generatedClassName); diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java index 43496a5451..d3ed9fe484 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java @@ -130,8 +130,7 @@ public class SerializerGenerator extends Generator { for (JMethod setterMethod : getSetters(beanType)) { String setterName = setterMethod.getName(); - String capitalizedFieldName = setterName.substring(3); - String fieldName = decapitalize(capitalizedFieldName); + String fieldName = setterName.substring(3); // setZindex() -> ZIndex String getterName = findGetter(beanType, setterMethod); if (getterName == null) { @@ -162,15 +161,14 @@ public class SerializerGenerator extends Generator { + beanQualifiedSourceName + ".class);"); for (JMethod method : getSetters(beanType)) { String setterName = method.getName(); - String capitalizedFieldName = setterName.substring(3); - String fieldName = decapitalize(capitalizedFieldName); + String fieldName = setterName.substring(3); // setZIndex() -> ZIndex JType setterParameterType = method.getParameterTypes()[0]; logger.log(Type.DEBUG, "* Processing field " + fieldName + " in " + beanQualifiedSourceName + " (" + beanType.getName() + ")"); - String jsonFieldName = "json" + capitalizedFieldName; - // JSONArray jsonHeight = (JSONArray) jsonValue.get("height"); + String jsonFieldName = "json_" + fieldName; + // JSONArray json_Height = (JSONArray) jsonValue.get("height"); sourceWriter.println("JSONArray " + jsonFieldName + " = (JSONArray) jsonValue.get(\"" + fieldName + "\");"); @@ -209,12 +207,12 @@ public class SerializerGenerator extends Generator { private String findGetter(JClassType beanType, JMethod setterMethod) { JType setterParameterType = setterMethod.getParameterTypes()[0]; - String capitalizedFieldName = setterMethod.getName().substring(3); + String fieldName = setterMethod.getName().substring(3); if (setterParameterType.getQualifiedSourceName().equals( boolean.class.getName())) { - return "is" + capitalizedFieldName; + return "is" + fieldName; } else { - return "get" + capitalizedFieldName; + return "get" + fieldName; } } diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java index 21d081f0a5..e09545962b 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java @@ -18,6 +18,7 @@ import com.google.gwt.core.ext.TreeLogger.Type; import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.JMethod; +import com.google.gwt.core.ext.typeinfo.JParameterizedType; import com.google.gwt.core.ext.typeinfo.JType; import com.google.gwt.core.ext.typeinfo.TypeOracle; import com.google.gwt.json.client.JSONObject; @@ -221,6 +222,13 @@ public class SerializerMapGenerator extends Generator { if (serializableTypes.contains(type)) { return; } + JParameterizedType parametrized = type.isParameterized(); + if (parametrized != null) { + for (JClassType parameterType : parametrized.getTypeArgs()) { + addTypeIfNeeded(serializableTypes, parameterType); + } + } + if (serializationHandledByFramework(type)) { return; } diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java index 2db68ebca2..6d4289b173 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java @@ -24,18 +24,18 @@ import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; import com.google.gwt.user.rebind.SourceWriter; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.Connector; -import com.vaadin.terminal.gwt.client.ui.Component; -import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; -import com.vaadin.terminal.gwt.client.ui.root.RootConnector; +import com.vaadin.terminal.gwt.client.ui.Connect; +import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle; import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector; +import com.vaadin.terminal.gwt.client.ui.root.RootConnector; import com.vaadin.terminal.gwt.server.ClientConnector; /** * WidgetMapGenerator's are GWT generator to build WidgetMapImpl dynamically - * based on {@link Component} annotations available in workspace. By modifying - * the generator it is possible to do some fine tuning for the generated - * widgetset (aka client side engine). The components to be included in the - * client side engine can modified be overriding {@link #getUsedConnectors()}. + * based on {@link Connect} annotations available in workspace. By modifying the + * generator it is possible to do some fine tuning for the generated widgetset + * (aka client side engine). The components to be included in the client side + * engine can modified be overriding {@link #getUsedConnectors()}. * <p> * The generator also decides how the client side component implementations are * loaded to the browser. The default generator is @@ -43,11 +43,11 @@ import com.vaadin.terminal.gwt.server.ClientConnector; * that loads all widget implementation on application initialization. This has * been the only option until Vaadin 6.4. * <p> - * This generator uses the loadStyle hints from the {@link Component} - * annotations. Depending on the {@link LoadStyle} used, the widget may be - * included in the initially loaded JavaScript, loaded when the application has - * started and there is no communication to server or lazy loaded when the - * implementation is absolutely needed. + * This generator uses the loadStyle hints from the {@link Connect} annotations. + * Depending on the {@link LoadStyle} used, the widget may be included in the + * initially loaded JavaScript, loaded when the application has started and + * there is no communication to server or lazy loaded when the implementation is + * absolutely needed. * <p> * The GWT module description file of the widgetset ( * <code>...Widgetset.gwt.xml</code>) can be used to define the @@ -155,14 +155,13 @@ public class WidgetMapGenerator extends Generator { .iterator(); while (iter.hasNext()) { Class<? extends ComponentConnector> connectorClass = iter.next(); - Component annotation = connectorClass - .getAnnotation(Component.class); + Connect annotation = connectorClass.getAnnotation(Connect.class); if (!ClientConnector.class.isAssignableFrom(annotation.value())) { logger.log( Type.WARN, "Connector class " + annotation.value().getName() - + " defined in @Component annotation is not a subclass of " + + " defined in @Connect annotation is not a subclass of " + ClientConnector.class.getName() + ". The component connector " + connectorClass.getName() @@ -215,7 +214,7 @@ public class WidgetMapGenerator extends Generator { .getName()); Collection<Class<? extends ComponentConnector>> connectors = new HashSet<Class<? extends ComponentConnector>>(); for (JClassType jClassType : connectorType.getSubtypes()) { - Component annotation = jClassType.getAnnotation(Component.class); + Connect annotation = jClassType.getAnnotation(Connect.class); if (annotation != null) { try { Class<? extends ComponentConnector> clazz = (Class<? extends ComponentConnector>) Class @@ -232,7 +231,7 @@ public class WidgetMapGenerator extends Generator { /** * Returns true if the widget for given component will be lazy loaded by the * client. The default implementation reads the information from the - * {@link Component} annotation. + * {@link Connect} annotation. * <p> * The method can be overridden to optimize the widget loading mechanism. If * the Widgetset is wanted to be optimized for a network with a high latency @@ -245,7 +244,7 @@ public class WidgetMapGenerator extends Generator { */ protected LoadStyle getLoadStyle( Class<? extends ComponentConnector> connector) { - Component annotation = connector.getAnnotation(Component.class); + Connect annotation = connector.getAnnotation(Connect.class); return annotation.loadStyle(); } @@ -395,7 +394,7 @@ public class WidgetMapGenerator extends Generator { private static Class<? extends ClientConnector> getClientConnectorClass( Class<? extends ComponentConnector> connectorClass) { - Component annotation = connectorClass.getAnnotation(Component.class); + Connect annotation = connectorClass.getAnnotation(Connect.class); return (Class<? extends ClientConnector>) annotation.value(); } } diff --git a/src/com/vaadin/ui/AbstractField.java b/src/com/vaadin/ui/AbstractField.java index 7ad2f20296..4efed11e2c 100644 --- a/src/com/vaadin/ui/AbstractField.java +++ b/src/com/vaadin/ui/AbstractField.java @@ -535,7 +535,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements if (!getType().isAssignableFrom(newFieldValue.getClass())) { throw new Converter.ConversionException("Value of type " + newFieldValue.getClass() + " cannot be assigned to " - + getClass().getName()); + + getType().getName()); } } setValue((T) newFieldValue, false); diff --git a/src/com/vaadin/ui/FormLayout.java b/src/com/vaadin/ui/FormLayout.java index 63a973e30d..c0be784a7b 100644 --- a/src/com/vaadin/ui/FormLayout.java +++ b/src/com/vaadin/ui/FormLayout.java @@ -4,7 +4,6 @@ package com.vaadin.ui; - /** * FormLayout is used by {@link Form} to layout fields. It may also be used * separately without {@link Form}. diff --git a/src/com/vaadin/ui/HorizontalLayout.java b/src/com/vaadin/ui/HorizontalLayout.java index 807704e7cf..b9dc1c13ca 100644 --- a/src/com/vaadin/ui/HorizontalLayout.java +++ b/src/com/vaadin/ui/HorizontalLayout.java @@ -3,7 +3,6 @@ */ package com.vaadin.ui; - /** * Horizontal layout * diff --git a/src/com/vaadin/ui/HorizontalSplitPanel.java b/src/com/vaadin/ui/HorizontalSplitPanel.java index 7ea07cc61c..5bd6c8a075 100644 --- a/src/com/vaadin/ui/HorizontalSplitPanel.java +++ b/src/com/vaadin/ui/HorizontalSplitPanel.java @@ -3,7 +3,6 @@ */ package com.vaadin.ui; - /** * A horizontal split panel contains two components and lays them horizontally. * The first component is on the left side. diff --git a/src/com/vaadin/ui/LoginForm.java b/src/com/vaadin/ui/LoginForm.java index 69c373cc7c..1d5203bc6b 100644 --- a/src/com/vaadin/ui/LoginForm.java +++ b/src/com/vaadin/ui/LoginForm.java @@ -158,11 +158,11 @@ public class LoginForm extends CustomComponent { + "<div>" + usernameCaption + "</div><div >" - + "<input class='v-textfield v-paintable' style='display:block;' type='text' name='username'></div>" + + "<input class='v-textfield v-connector' style='display:block;' type='text' name='username'></div>" + "<div>" + passwordCaption + "</div>" - + "<div><input class='v-textfield v-paintable' style='display:block;' type='password' name='password'></div>" + + "<div><input class='v-textfield v-connector' style='display:block;' type='password' name='password'></div>" + "<div><div onclick=\"document.forms[0].submit();\" tabindex=\"0\" class=\"v-button\" role=\"button\" ><span class=\"v-button-wrap\"><span class=\"v-button-caption\">" + loginButtonCaption + "</span></span></div></div></form></div>" + "</body></html>") diff --git a/src/com/vaadin/ui/NativeButton.java b/src/com/vaadin/ui/NativeButton.java index f14b448674..6eb4379261 100644 --- a/src/com/vaadin/ui/NativeButton.java +++ b/src/com/vaadin/ui/NativeButton.java @@ -3,7 +3,6 @@ */ package com.vaadin.ui; - @SuppressWarnings("serial") public class NativeButton extends Button { diff --git a/src/com/vaadin/ui/VerticalSplitPanel.java b/src/com/vaadin/ui/VerticalSplitPanel.java index 7c4a523ba4..0630240e9c 100644 --- a/src/com/vaadin/ui/VerticalSplitPanel.java +++ b/src/com/vaadin/ui/VerticalSplitPanel.java @@ -3,7 +3,6 @@ */ package com.vaadin.ui; - /** * A vertical split panel contains two components and lays them vertically. The * first component is above the second component. diff --git a/tests/server-side/com/vaadin/data/util/sqlcontainer/DataGenerator.java b/tests/server-side/com/vaadin/data/util/sqlcontainer/DataGenerator.java index 6fa807b007..489f780d61 100644 --- a/tests/server-side/com/vaadin/data/util/sqlcontainer/DataGenerator.java +++ b/tests/server-side/com/vaadin/data/util/sqlcontainer/DataGenerator.java @@ -12,11 +12,12 @@ import com.vaadin.data.util.sqlcontainer.AllTests.DB; import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool; public class DataGenerator { - - @Test - public void testDummy(){ - // Added dummy test so JUnit will not complain about "No runnable methods". - } + + @Test + public void testDummy() { + // Added dummy test so JUnit will not complain about + // "No runnable methods". + } public static void addPeopleToDatabase(JDBCConnectionPool connectionPool) throws SQLException { diff --git a/tests/server-side/com/vaadin/data/util/sqlcontainer/FreeformQueryUtil.java b/tests/server-side/com/vaadin/data/util/sqlcontainer/FreeformQueryUtil.java index 2579a38aa1..b0e2a232ca 100644 --- a/tests/server-side/com/vaadin/data/util/sqlcontainer/FreeformQueryUtil.java +++ b/tests/server-side/com/vaadin/data/util/sqlcontainer/FreeformQueryUtil.java @@ -11,11 +11,12 @@ import com.vaadin.data.util.sqlcontainer.query.generator.filter.QueryBuilder; public class FreeformQueryUtil { - @Test - public void testDummy(){ - // Added dummy test so JUnit will not complain about "No runnable methods". - } - + @Test + public void testDummy() { + // Added dummy test so JUnit will not complain about + // "No runnable methods". + } + public static StatementHelper getQueryWithFilters(List<Filter> filters, int offset, int limit) { StatementHelper sh = new StatementHelper(); @@ -30,8 +31,7 @@ public class FreeformQueryUtil { query.append(") AS rownum, * FROM \"PEOPLE\""); if (!filters.isEmpty()) { - query.append(QueryBuilder.getWhereStringForFilters( - filters, sh)); + query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); } query.append(") AS a WHERE a.rownum BETWEEN ").append(offset) .append(" AND ").append(Integer.toString(offset + limit)); @@ -46,8 +46,7 @@ public class FreeformQueryUtil { query.append("SELECT * FROM (SELECT x.*, ROWNUM AS " + "\"rownum\" FROM (SELECT * FROM \"PEOPLE\""); if (!filters.isEmpty()) { - query.append(QueryBuilder.getWhereStringForFilters( - filters, sh)); + query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); } query.append(") x) WHERE \"rownum\" BETWEEN ? AND ?"); sh.addParameterValue(offset); @@ -57,8 +56,7 @@ public class FreeformQueryUtil { } else { StringBuilder query = new StringBuilder("SELECT * FROM people"); if (!filters.isEmpty()) { - query.append(QueryBuilder.getWhereStringForFilters( - filters, sh)); + query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); } if (limit != 0 || offset != 0) { query.append(" LIMIT ? OFFSET ?"); diff --git a/tests/server-side/com/vaadin/data/util/sqlcontainer/UtilTest.java b/tests/server-side/com/vaadin/data/util/sqlcontainer/UtilTest.java index d6a6a72300..31bdf2b81b 100644 --- a/tests/server-side/com/vaadin/data/util/sqlcontainer/UtilTest.java +++ b/tests/server-side/com/vaadin/data/util/sqlcontainer/UtilTest.java @@ -21,7 +21,7 @@ public class UtilTest { @Test public void escapeSQL_severalQuotes_returnsEscapedString() { Assert.assertEquals("asdf''ghjk''qwerty", - SQLUtil.escapeSQL("asdf'ghjk'qwerty")); + SQLUtil.escapeSQL("asdf'ghjk'qwerty")); } @Test @@ -32,12 +32,13 @@ public class UtilTest { @Test public void escapeSQL_multipleDoubleQuotes_returnsEscapedString() { Assert.assertEquals("asdf\\\"foo\\\"bar", - SQLUtil.escapeSQL("asdf\"foo\"bar")); + SQLUtil.escapeSQL("asdf\"foo\"bar")); } @Test public void escapeSQL_backslashes_returnsEscapedString() { - Assert.assertEquals("foo\\\\nbar\\\\r", SQLUtil.escapeSQL("foo\\nbar\\r")); + Assert.assertEquals("foo\\\\nbar\\\\r", + SQLUtil.escapeSQL("foo\\nbar\\r")); } @Test diff --git a/tests/server-side/com/vaadin/data/util/sqlcontainer/connection/MockInitialContextFactory.java b/tests/server-side/com/vaadin/data/util/sqlcontainer/connection/MockInitialContextFactory.java index 19019eed0b..3ee260245a 100644 --- a/tests/server-side/com/vaadin/data/util/sqlcontainer/connection/MockInitialContextFactory.java +++ b/tests/server-side/com/vaadin/data/util/sqlcontainer/connection/MockInitialContextFactory.java @@ -11,11 +11,12 @@ import org.junit.Test; */ public class MockInitialContextFactory implements InitialContextFactory { private static Context mockCtx = null; - + @Test - public void testDummy(){ - // Added dummy test so JUnit will not complain about "No runnable methods". - } + public void testDummy() { + // Added dummy test so JUnit will not complain about + // "No runnable methods". + } public static void setMockContext(Context ctx) { mockCtx = ctx; diff --git a/tests/server-side/com/vaadin/tests/server/TestAbstractBeanContainerListeners.java b/tests/server-side/com/vaadin/tests/server/TestAbstractBeanContainerListeners.java index d6598a3b62..0d8433d1c6 100644 --- a/tests/server-side/com/vaadin/tests/server/TestAbstractBeanContainerListeners.java +++ b/tests/server-side/com/vaadin/tests/server/TestAbstractBeanContainerListeners.java @@ -5,7 +5,8 @@ import com.vaadin.data.Container.PropertySetChangeListener; import com.vaadin.data.util.BeanItemContainer; import com.vaadin.tests.server.component.AbstractListenerMethodsTest; -public class TestAbstractBeanContainerListeners extends AbstractListenerMethodsTest { +public class TestAbstractBeanContainerListeners extends + AbstractListenerMethodsTest { public void testPropertySetChangeListenerAddGetRemove() throws Exception { testListenerAddGetRemove(BeanItemContainer.class, PropertySetChangeEvent.class, PropertySetChangeListener.class, diff --git a/tests/server-side/com/vaadin/tests/server/TestAbstractInMemoryContainerListeners.java b/tests/server-side/com/vaadin/tests/server/TestAbstractInMemoryContainerListeners.java index 4be4e35554..a8e2a4aa2a 100644 --- a/tests/server-side/com/vaadin/tests/server/TestAbstractInMemoryContainerListeners.java +++ b/tests/server-side/com/vaadin/tests/server/TestAbstractInMemoryContainerListeners.java @@ -5,7 +5,8 @@ import com.vaadin.data.Container.ItemSetChangeListener; import com.vaadin.data.util.IndexedContainer; import com.vaadin.tests.server.component.AbstractListenerMethodsTest; -public class TestAbstractInMemoryContainerListeners extends AbstractListenerMethodsTest { +public class TestAbstractInMemoryContainerListeners extends + AbstractListenerMethodsTest { public void testItemSetChangeListenerAddGetRemove() throws Exception { testListenerAddGetRemove(IndexedContainer.class, ItemSetChangeEvent.class, ItemSetChangeListener.class); diff --git a/tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java b/tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java index 91e36b5caa..48c60c83c4 100644 --- a/tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java +++ b/tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java @@ -27,6 +27,7 @@ public class TestPropertyFormatter extends TestCase { return getExpectedClass().newInstance(); } }; + @SuppressWarnings("rawtypes") private Class expectedClass; @@ -34,36 +35,41 @@ public class TestPropertyFormatter extends TestCase { private Class getExpectedClass() { return expectedClass; } - + /** * The object passed to format should be same as property's type. - * @throws IllegalAccessException - * @throws InstantiationException + * + * @throws IllegalAccessException + * @throws InstantiationException */ @Test @SuppressWarnings({ "rawtypes" }) - public void testCorrectTypeForFormat() throws InstantiationException, IllegalAccessException { - Class[] testedTypes = new Class[] {Integer.class, Boolean.class, Double.class, String.class, Date.class}; - Object[] testValues = new Object[] {new Integer(3), Boolean.FALSE, new Double(3.3), "bar", new Date()}; - + public void testCorrectTypeForFormat() throws InstantiationException, + IllegalAccessException { + Class[] testedTypes = new Class[] { Integer.class, Boolean.class, + Double.class, String.class, Date.class }; + Object[] testValues = new Object[] { new Integer(3), Boolean.FALSE, + new Double(3.3), "bar", new Date() }; + int i = 0; for (Class class1 : testedTypes) { expectedClass = class1; - + TestFormatter formatter = new TestFormatter(); - + // Should just return null, without formatting Object value = formatter.getValue(); - + // test with property which value is null - formatter.setPropertyDataSource(new ObjectProperty(null, expectedClass)); + formatter.setPropertyDataSource(new ObjectProperty(null, + expectedClass)); formatter.getValue(); // calls format - + // test with a value - formatter.setPropertyDataSource(new ObjectProperty(testValues[i++], expectedClass)); + formatter.setPropertyDataSource(new ObjectProperty(testValues[i++], + expectedClass)); formatter.getValue(); // calls format } - } } diff --git a/tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java b/tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java index e430cb6103..8cc26a5c7f 100644 --- a/tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java +++ b/tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java @@ -73,7 +73,7 @@ public class TransactionListenersConcurrency extends TestCase { app.start(new ApplicationStartEvent(new URL( "http://localhost/"), new Properties(), - context, true, null)); + context, true)); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/tests/server-side/com/vaadin/tests/server/component/AbstractListenerMethodsTest.java b/tests/server-side/com/vaadin/tests/server/component/AbstractListenerMethodsTest.java index 355f5167d7..e189ffc77d 100644 --- a/tests/server-side/com/vaadin/tests/server/component/AbstractListenerMethodsTest.java +++ b/tests/server-side/com/vaadin/tests/server/component/AbstractListenerMethodsTest.java @@ -48,11 +48,14 @@ public abstract class AbstractListenerMethodsTest extends TestCase { System.out.println("package " + packageName + ";"); System.out.println("import " - + AbstractListenerMethodsTest.class.getName() + ";"); + + AbstractListenerMethodsTest.class.getName() + + ";"); System.out.println("import " + c.getName() + ";"); - System.out.println("public class " + c.getSimpleName() + System.out.println("public class " + + c.getSimpleName() + "Listeners extends " - + AbstractListenerMethodsTest.class.getSimpleName() + " {"); + + AbstractListenerMethodsTest.class + .getSimpleName() + " {"); } String listenerClassName = m.getParameterTypes()[0] diff --git a/tests/server-side/com/vaadin/tests/server/component/abstractcomponentcontainer/TestAbstractComponentContainerListeners.java b/tests/server-side/com/vaadin/tests/server/component/abstractcomponentcontainer/TestAbstractComponentContainerListeners.java index 6a8267f296..f9f170eb2a 100644 --- a/tests/server-side/com/vaadin/tests/server/component/abstractcomponentcontainer/TestAbstractComponentContainerListeners.java +++ b/tests/server-side/com/vaadin/tests/server/component/abstractcomponentcontainer/TestAbstractComponentContainerListeners.java @@ -8,7 +8,8 @@ import com.vaadin.ui.ComponentContainer.ComponentDetachListener; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.VerticalLayout; -public class TestAbstractComponentContainerListeners extends AbstractListenerMethodsTest { +public class TestAbstractComponentContainerListeners extends + AbstractListenerMethodsTest { public void testComponentDetachListenerAddGetRemove() throws Exception { testListenerAddGetRemove(HorizontalLayout.class, ComponentDetachEvent.class, ComponentDetachListener.class); diff --git a/tests/server-side/com/vaadin/tests/server/component/abstractorderedlayout/TestAbstractOrderedLayoutListeners.java b/tests/server-side/com/vaadin/tests/server/component/abstractorderedlayout/TestAbstractOrderedLayoutListeners.java index 02143a2796..a0b34aca78 100644 --- a/tests/server-side/com/vaadin/tests/server/component/abstractorderedlayout/TestAbstractOrderedLayoutListeners.java +++ b/tests/server-side/com/vaadin/tests/server/component/abstractorderedlayout/TestAbstractOrderedLayoutListeners.java @@ -5,7 +5,8 @@ import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.tests.server.component.AbstractListenerMethodsTest; import com.vaadin.ui.VerticalLayout; -public class TestAbstractOrderedLayoutListeners extends AbstractListenerMethodsTest { +public class TestAbstractOrderedLayoutListeners extends + AbstractListenerMethodsTest { public void testLayoutClickListenerAddGetRemove() throws Exception { testListenerAddGetRemove(VerticalLayout.class, LayoutClickEvent.class, LayoutClickListener.class); diff --git a/tests/server-side/com/vaadin/tests/server/component/abstractsplitpanel/TestAbstractSplitPanelListeners.java b/tests/server-side/com/vaadin/tests/server/component/abstractsplitpanel/TestAbstractSplitPanelListeners.java index 5e9556c182..2b6cdaa6cc 100644 --- a/tests/server-side/com/vaadin/tests/server/component/abstractsplitpanel/TestAbstractSplitPanelListeners.java +++ b/tests/server-side/com/vaadin/tests/server/component/abstractsplitpanel/TestAbstractSplitPanelListeners.java @@ -5,7 +5,8 @@ import com.vaadin.ui.AbstractSplitPanel.SplitterClickEvent; import com.vaadin.ui.AbstractSplitPanel.SplitterClickListener; import com.vaadin.ui.HorizontalSplitPanel; -public class TestAbstractSplitPanelListeners extends AbstractListenerMethodsTest { +public class TestAbstractSplitPanelListeners extends + AbstractListenerMethodsTest { public void testSplitterClickListenerAddGetRemove() throws Exception { testListenerAddGetRemove(HorizontalSplitPanel.class, SplitterClickEvent.class, SplitterClickListener.class); diff --git a/tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java b/tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java index 99b77b0d29..aa9753ebcc 100644 --- a/tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java +++ b/tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java @@ -6,9 +6,12 @@ import java.util.Properties; import junit.framework.TestCase; +import org.easymock.EasyMock; + import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.RootRequiresMoreInformationException; +import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.WrappedRequest; import com.vaadin.ui.Root; @@ -50,12 +53,28 @@ public class CustomRootClassLoader extends TestCase { public void testWithNullClassLoader() throws Exception { Application application = createStubApplication(); application.start(new ApplicationStartEvent(null, new Properties(), - null, false, null)); + null, false)); - Root root = application.getRootForRequest(null); + Root root = application.getRootForRequest(createRequestMock(null)); assertTrue(root instanceof MyRoot); } + private static WrappedRequest createRequestMock(ClassLoader classloader) { + // Mock a DeploymentConfiguration to give the passed classloader + DeploymentConfiguration configurationMock = EasyMock + .createMock(DeploymentConfiguration.class); + EasyMock.expect(configurationMock.getClassLoader()).andReturn( + classloader); + + // Mock a WrappedRequest to give the mocked deployment configuration + WrappedRequest requestMock = EasyMock.createMock(WrappedRequest.class); + EasyMock.expect(requestMock.getDeploymentConfiguration()).andReturn( + configurationMock); + + EasyMock.replay(configurationMock, requestMock); + return requestMock; + } + /** * Tests that the ClassLoader passed in the ApplicationStartEvent is used to * load Root classes. @@ -68,9 +87,10 @@ public class CustomRootClassLoader extends TestCase { Application application = createStubApplication(); application.start(new ApplicationStartEvent(null, new Properties(), - null, false, loggingClassLoader)); + null, false)); - Root root = application.getRootForRequest(null); + Root root = application + .getRootForRequest(createRequestMock(loggingClassLoader)); assertTrue(root instanceof MyRoot); assertEquals(1, loggingClassLoader.requestedClasses.size()); assertEquals(MyRoot.class.getName(), diff --git a/tests/server-side/com/vaadin/tests/server/component/table/TableListeners.java b/tests/server-side/com/vaadin/tests/server/component/table/TableListeners.java index 6d9c7ed0eb..6cc522f8c7 100644 --- a/tests/server-side/com/vaadin/tests/server/component/table/TableListeners.java +++ b/tests/server-side/com/vaadin/tests/server/component/table/TableListeners.java @@ -20,7 +20,8 @@ public class TableListeners extends AbstractListenerMethodsTest { } public void testItemClickListenerAddGetRemove() throws Exception { - testListenerAddGetRemove(Table.class, ItemClickEvent.class, ItemClickListener.class); + testListenerAddGetRemove(Table.class, ItemClickEvent.class, + ItemClickListener.class); } public void testFooterClickListenerAddGetRemove() throws Exception { diff --git a/tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java b/tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java index 1832d1bd95..85c88e29bb 100644 --- a/tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java +++ b/tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java @@ -120,5 +120,5 @@ public class TestTabSheet { assertEquals(tab2, tabSheet.getTab(1)); assertEquals(tab3, tabSheet.getTab(2)); } - + } diff --git a/tests/server-side/com/vaadin/tests/server/component/window/AttachDetachWindow.java b/tests/server-side/com/vaadin/tests/server/component/window/AttachDetachWindow.java index a67c7bb387..7423ba8669 100644 --- a/tests/server-side/com/vaadin/tests/server/component/window/AttachDetachWindow.java +++ b/tests/server-side/com/vaadin/tests/server/component/window/AttachDetachWindow.java @@ -206,7 +206,7 @@ public class AttachDetachWindow { */ private void assertAttached(TestContainer win) { TestContent testContent = win.getTestContent(); - + assertTrue("window attach not called", win.attachCalled()); assertTrue("window content attach not called", testContent.contentAttachCalled); diff --git a/tests/testbench/com/vaadin/tests/TestForChildComponentRendering.java b/tests/testbench/com/vaadin/tests/TestForChildComponentRendering.java index eb18f70e2f..e90231eefd 100644 --- a/tests/testbench/com/vaadin/tests/TestForChildComponentRendering.java +++ b/tests/testbench/com/vaadin/tests/TestForChildComponentRendering.java @@ -66,7 +66,12 @@ public class TestForChildComponentRendering extends CustomComponent { }); main.addComponent(b); - b = new Button("remove randomly one component", new Button.ClickListener() { public void buttonClick(ClickEvent event) { removeRandomComponent();}}); + b = new Button("remove randomly one component", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + removeRandomComponent(); + } + }); main.addComponent(b); } diff --git a/tests/testbench/com/vaadin/tests/components/LayoutAttachListenerInfo.java b/tests/testbench/com/vaadin/tests/components/LayoutAttachListenerInfo.java index 671958383f..dc07c35f62 100644 --- a/tests/testbench/com/vaadin/tests/components/LayoutAttachListenerInfo.java +++ b/tests/testbench/com/vaadin/tests/components/LayoutAttachListenerInfo.java @@ -84,9 +84,9 @@ public class LayoutAttachListenerInfo extends TestBase { })); } - private void testOrderedLayout(){ + private void testOrderedLayout() { content.removeAllComponents(); - + final VerticalLayout v = new VerticalLayout(); v.setWidth("300px"); v.setHeight("300px"); diff --git a/tests/testbench/com/vaadin/tests/components/button/ShortCutListenerModification.java b/tests/testbench/com/vaadin/tests/components/button/ShortCutListenerModification.java index f338b1ac90..295c04fc0c 100644 --- a/tests/testbench/com/vaadin/tests/components/button/ShortCutListenerModification.java +++ b/tests/testbench/com/vaadin/tests/components/button/ShortCutListenerModification.java @@ -6,6 +6,7 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Component; import com.vaadin.ui.Notification; import com.vaadin.ui.Window; @@ -36,9 +37,6 @@ public class ShortCutListenerModification extends TestBase implements Button button1 = new Button("b1 (CTRL-C)"); Button button2 = new Button("b2 (CTRL-V)"); - button1.setData(window); - button2.setData(window); - button1.addListener(this); button2.addListener(this); @@ -63,8 +61,12 @@ public class ShortCutListenerModification extends TestBase implements } public void buttonClick(ClickEvent event) { - Window window2 = (Window) event.getButton().getData(); - window2.close(); + Component c = event.getButton(); + while (!(c instanceof Window)) { + c = c.getParent(); + } + ((Window) c).close(); + Button prev = (Button) event.getButton().getData(); if (prev != null) { prev.focus(); diff --git a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxTextFieldEventOrder.java b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxTextFieldEventOrder.java index d92a1872b8..6f6e550ab4 100644 --- a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxTextFieldEventOrder.java +++ b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxTextFieldEventOrder.java @@ -1,4 +1,5 @@ package com.vaadin.tests.components.combobox; + import java.util.Arrays; import com.vaadin.data.Property.ValueChangeEvent; diff --git a/tests/testbench/com/vaadin/tests/components/customcomponent/CustomLayoutUsingTemplate.java b/tests/testbench/com/vaadin/tests/components/customcomponent/CustomLayoutUsingTemplate.java index 5bd2dc6c4f..2dc3063b0c 100644 --- a/tests/testbench/com/vaadin/tests/components/customcomponent/CustomLayoutUsingTemplate.java +++ b/tests/testbench/com/vaadin/tests/components/customcomponent/CustomLayoutUsingTemplate.java @@ -23,7 +23,8 @@ public class CustomLayoutUsingTemplate extends TestBase implements thisPackage = thisPackage.replaceAll( CustomLayoutUsingTemplate.class.getSimpleName() + "$", ""); String template = thisPackage + "template.htm"; - InputStream is = getClassLoader().getResourceAsStream(template); + InputStream is = getClass().getClassLoader().getResourceAsStream( + template); try { layout = new CustomLayout(is); layout.addComponent(new Button( diff --git a/tests/testbench/com/vaadin/tests/components/form/FormClearDatasourceRepaint.java b/tests/testbench/com/vaadin/tests/components/form/FormClearDatasourceRepaint.java index 39305d5638..5255b97ffa 100644 --- a/tests/testbench/com/vaadin/tests/components/form/FormClearDatasourceRepaint.java +++ b/tests/testbench/com/vaadin/tests/components/form/FormClearDatasourceRepaint.java @@ -37,7 +37,6 @@ public class FormClearDatasourceRepaint extends TestBase { @Override protected void setup() { - final Form form = new Form(); form.setItemDataSource(new BeanItem<MySecondBean>(new MySecondBean())); addComponent(form); @@ -50,10 +49,10 @@ public class FormClearDatasourceRepaint extends TestBase { addComponent(new Button("Change data source", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { + public void buttonClick(ClickEvent event) { form.setItemDataSource(new BeanItem<MyBean>( new MyBean())); - } + } })); } diff --git a/tests/testbench/com/vaadin/tests/components/form/FormDescription.java b/tests/testbench/com/vaadin/tests/components/form/FormDescription.java index d05d179ac8..63369413f6 100644 --- a/tests/testbench/com/vaadin/tests/components/form/FormDescription.java +++ b/tests/testbench/com/vaadin/tests/components/form/FormDescription.java @@ -10,11 +10,11 @@ public class FormDescription extends TestBase { @Override protected void setup() { - final Form form = new Form(); - form.setDescription("Some description"); + final Form form = new Form(); + form.setDescription("Some description"); form.addField("AAAA", new TextField()); - addComponent(form); - + addComponent(form); + addComponent(new Button("Toggle description", new Button.ClickListener() { public void buttonClick(ClickEvent event) { @@ -25,7 +25,6 @@ public class FormDescription extends TestBase { } } })); - } diff --git a/tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java b/tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java index eba570c490..b803f8667f 100644 --- a/tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java +++ b/tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java @@ -28,8 +28,8 @@ public class FormWithPropertyFormatterConnected extends TestBase { @Override public Object parse(String formattedValue) throws Exception { - String str = formattedValue - .replaceAll("[^0-9.]", ""); + String str = formattedValue.replaceAll("[^0-9.]", + ""); if (formattedValue.toLowerCase().contains("months")) { return Double.parseDouble(str) / 12; } @@ -40,7 +40,7 @@ public class FormWithPropertyFormatterConnected extends TestBase { public String format(Object value) { Double dValue = (Double) value; if (dValue < 1) { - return ((int)(dValue * 12)) + " months"; + return ((int) (dValue * 12)) + " months"; } return dValue + " years"; } @@ -51,7 +51,7 @@ public class FormWithPropertyFormatterConnected extends TestBase { } }); form2.setItemDataSource(createItem()); - + addComponent(form2); addComponent(new Button("B")); } diff --git a/tests/testbench/com/vaadin/tests/components/gridlayout/MarginsInLabels.java b/tests/testbench/com/vaadin/tests/components/gridlayout/MarginsInLabels.java new file mode 100644 index 0000000000..1cbed2a17d --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/gridlayout/MarginsInLabels.java @@ -0,0 +1,50 @@ +package com.vaadin.tests.components.gridlayout; + +import com.vaadin.terminal.WrappedRequest; +import com.vaadin.tests.components.AbstractTestRoot; +import com.vaadin.ui.AbstractLayout; +import com.vaadin.ui.Accordion; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Label.ContentMode; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.VerticalLayout; + +public class MarginsInLabels extends AbstractTestRoot { + + @Override + protected void setup(WrappedRequest request) { + AbstractLayout layout = new VerticalLayout(); + layout.addComponent(new Label("<h1>Vertical layout</h1>", + ContentMode.XHTML)); + layout.addComponent(new Label("Next row")); + addComponent(layout); + + layout = new GridLayout(1, 2); + layout.setWidth("100%"); + layout.addComponent(new Label("<h1>Grid layout</h1>", ContentMode.XHTML)); + layout.addComponent(new Label("Next row")); + addComponent(layout); + + TabSheet tabSheet = new TabSheet(); + tabSheet.addTab(new Label("<h1>Tabsheet</h1>", ContentMode.XHTML), + "Label"); + addComponent(tabSheet); + + Accordion accordion = new Accordion(); + accordion.addTab(new Label("<h1>Accordion</h1>", ContentMode.XHTML), + "Label"); + addComponent(accordion); + } + + @Override + protected String getTestDescription() { + return "Margins inside labels should not be allowed to collapse out of the label as it causes problems with layotus measuring the label."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(8671); + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/menubar/MenuBarInSplitPanel.java b/tests/testbench/com/vaadin/tests/components/menubar/MenuBarInSplitPanel.java index e73d31bf04..2a6f952c0a 100644 --- a/tests/testbench/com/vaadin/tests/components/menubar/MenuBarInSplitPanel.java +++ b/tests/testbench/com/vaadin/tests/components/menubar/MenuBarInSplitPanel.java @@ -22,8 +22,8 @@ public class MenuBarInSplitPanel extends AbstractTestCase { @Override public void init() { - LegacyWindow mainWindow = new LegacyWindow( - "MenuBar in SplitPanel", new HorizontalSplitPanel()); + LegacyWindow mainWindow = new LegacyWindow("MenuBar in SplitPanel", + new HorizontalSplitPanel()); VerticalLayout left = new VerticalLayout(); mainWindow.addComponent(left); left.setSizeFull(); diff --git a/tests/testbench/com/vaadin/tests/components/select/TwinColSelectTest.java b/tests/testbench/com/vaadin/tests/components/select/TwinColSelectTest.java index fef9c4172d..031a7e9d3d 100644 --- a/tests/testbench/com/vaadin/tests/components/select/TwinColSelectTest.java +++ b/tests/testbench/com/vaadin/tests/components/select/TwinColSelectTest.java @@ -32,7 +32,6 @@ public class TwinColSelectTest extends AbstractSelectTestCase<TwinColSelect> { } }; - @Override protected Class<TwinColSelect> getTestClass() { return TwinColSelect.class; diff --git a/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java index 4db9b69070..07925db05c 100644 --- a/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java +++ b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java @@ -12,23 +12,22 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; public class LongMultiselect extends TestBase { - + private enum ItemProperty { - COLUMN1, - COLUMN2 + COLUMN1, COLUMN2 } - + @Override protected void setup() { - VerticalLayout layout = generateLayout(); - addComponent(layout); - layout.setSizeFull(); + VerticalLayout layout = generateLayout(); + addComponent(layout); + layout.setSizeFull(); } - private VerticalLayout generateLayout() { - VerticalLayout layout = new VerticalLayout(); + private VerticalLayout generateLayout() { + VerticalLayout layout = new VerticalLayout(); - final Table table = new Table("Ticket #8264 table"); + final Table table = new Table("Ticket #8264 table"); layout.addComponent(table); table.setWidth("200px"); table.setHeight("170px"); @@ -39,17 +38,18 @@ public class LongMultiselect extends TestBase { // Create example data table.addContainerProperty(ItemProperty.COLUMN1, String.class, null); table.addContainerProperty(ItemProperty.COLUMN2, String.class, null); - for (int i=1;i<100;i++) { - table.addItem(new String[]{"Item " + i, null}, i); + for (int i = 1; i < 100; i++) { + table.addItem(new String[] { "Item " + i, null }, i); } - //Add action button + // Add action button layout.addComponent(new Button("Do It", new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { // Set ItemProperty.COLUMN2 for all selected values of table - Collection selectedIds = (Collection)table.getValue(); + Collection selectedIds = (Collection) table.getValue(); for (final Object itemId : selectedIds) { - final Property p = table.getItem(itemId).getItemProperty(ItemProperty.COLUMN2); + final Property p = table.getItem(itemId).getItemProperty( + ItemProperty.COLUMN2); if (p.getValue() instanceof String) { p.setValue(null); } else { @@ -58,17 +58,17 @@ public class LongMultiselect extends TestBase { } } })); - + return layout; - } + } - @Override - protected String getDescription() { - return "Multiselecting 94 rows (from \"item 5\" to \"item 98\") and modifying second column of each row selected (press Do It). This should work (update the 2nd column) and not cause JS exception."; - } + @Override + protected String getDescription() { + return "Multiselecting 94 rows (from \"item 5\" to \"item 98\") and modifying second column of each row selected (press Do It). This should work (update the 2nd column) and not cause JS exception."; + } - @Override - protected Integer getTicketNumber() { - return 8264; - } + @Override + protected Integer getTicketNumber() { + return 8264; + } } diff --git a/tests/testbench/com/vaadin/tests/components/table/TablePageLengthUpdate.java b/tests/testbench/com/vaadin/tests/components/table/TablePageLengthUpdate.java index 2ba1475cc8..c7f138ea8f 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TablePageLengthUpdate.java +++ b/tests/testbench/com/vaadin/tests/components/table/TablePageLengthUpdate.java @@ -60,7 +60,8 @@ public class TablePageLengthUpdate extends TestBase { } public String getTableHeight() { - return "" + (int) table.getHeight() + table.getHeightUnits().getSymbol(); + return "" + (int) table.getHeight() + + table.getHeightUnits().getSymbol(); } public void setTableHeight(String height) { diff --git a/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.java b/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.java index c106144144..5ae9e69975 100644 --- a/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.java +++ b/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetIndexOperations.java @@ -14,16 +14,17 @@ public class TabSheetIndexOperations extends TestBase { @Override protected void setup() { final TabSheet tabs = new TabSheet(); - + // Add some tabs tabs.addTab(new Label("Content 1"), "Tab 1", null); tabs.addTab(new Label("Content 2"), "Tab 2", null); tabs.addTab(new Label("Content 3"), "Tab 3", null); - + addComponent(tabs); - - Button addTab = new Button("Add tab at index 2", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { + + Button addTab = new Button("Add tab at index 2", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { tabs.addTab(new Label("Content " + tabCounter), "Added Tab " + tabCounter, null, 2); tabCounter++; @@ -37,8 +38,8 @@ public class TabSheetIndexOperations extends TestBase { Tab tab = tabs.getTab(2); tab.setCaption(new StringBuffer(tab.getCaption()) .reverse().toString()); - } - }); + } + }); addComponent(setCaption); Button move = new Button("Move selected tab to index 2", @@ -49,16 +50,17 @@ public class TabSheetIndexOperations extends TestBase { } }); addComponent(move); - - Button getIndex = new Button("Get selected tab index", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { + + Button getIndex = new Button("Get selected tab index", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { getMainWindow().showNotification( "Index: " + tabs.getTabPosition(tabs.getTab(tabs .getSelectedTab()))); - - } - }); + + } + }); addComponent(getIndex); } diff --git a/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetTabTheming.java b/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetTabTheming.java index 7d9a65b868..a2c75d6e79 100644 --- a/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetTabTheming.java +++ b/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetTabTheming.java @@ -1,4 +1,5 @@ package com.vaadin.tests.components.tabsheet; + import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet; diff --git a/tests/testbench/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java b/tests/testbench/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java index af380275e3..8a3678ab62 100644 --- a/tests/testbench/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java +++ b/tests/testbench/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java @@ -10,12 +10,12 @@ import com.vaadin.ui.TextField; public class TextChangeListenerChangingNonTextProperties extends TestBase { int index = 0; - String[] styles = {"red","green","blue","cyan", "magenta"}; - + String[] styles = { "red", "green", "blue", "cyan", "magenta" }; + private String getNextStyle() { - return styles[++index%styles.length]; + return styles[++index % styles.length]; } - + @Override protected void setup() { final TextField tf2 = new TextField("Updates width") { @@ -35,7 +35,7 @@ public class TextChangeListenerChangingNonTextProperties extends TestBase { tf2.setStyleName(getNextStyle()); } - }) ; + }); tf2.setImmediate(true); addComponent(tf2); @@ -50,6 +50,5 @@ public class TextChangeListenerChangingNonTextProperties extends TestBase { protected Integer getTicketNumber() { return Integer.valueOf(6588); } - } diff --git a/tests/testbench/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java b/tests/testbench/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java index d1f856f40c..2f0c54ee39 100644 --- a/tests/testbench/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java +++ b/tests/testbench/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java @@ -23,15 +23,15 @@ public class TextChangeTimeoutAfterDetach extends TestBase { } }); addComponent(field); - + Button detachBtn = new Button("detach field", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { + public void buttonClick(ClickEvent event) { removeComponent(field); getLayout().addComponentAsFirst( new Label("Field detached!")); - } - }); + } + }); addComponent(detachBtn); } diff --git a/tests/testbench/com/vaadin/tests/components/textfield/TextFieldWithProperty.java b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldWithProperty.java index 7d0bd12359..b753978666 100644 --- a/tests/testbench/com/vaadin/tests/components/textfield/TextFieldWithProperty.java +++ b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldWithProperty.java @@ -12,23 +12,24 @@ public class TextFieldWithProperty extends TestBase { @Override protected void setup() { - + final TextField tf1 = new TextField(); - + final ObjectProperty<String> op = new ObjectProperty<String>("FOO"); - + tf1.setPropertyDataSource(op); addComponent(tf1); - Button b = new Button("Set BAR to underlaying property (should propagate to UI)"); + Button b = new Button( + "Set BAR to underlaying property (should propagate to UI)"); b.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { op.setValue("BAR"); } }); - addComponent(b ); - + addComponent(b); + } @Override diff --git a/tests/testbench/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.java b/tests/testbench/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.java index 1525d43ede..dca2d96628 100644 --- a/tests/testbench/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.java +++ b/tests/testbench/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.java @@ -115,5 +115,4 @@ public class TreeDragAndDropFromTable extends TestBase { return 7687; } - } diff --git a/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java b/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java index dbe5eda9af..60f0c598ae 100644 --- a/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java +++ b/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java @@ -33,13 +33,12 @@ public class SubWindowWithUndefinedHeight extends TestBase { table.setCaption("tab 2"); table.setWidth("100%"); table.setHeight("100%"); - + final TabSheet tabsheet = new TabSheet(); tabsheet.addComponent(tabButton); tabsheet.addComponent(table); tabsheet.addListener(new TabSheet.SelectedTabChangeListener() { - public void selectedTabChange( - TabSheet.SelectedTabChangeEvent event) { + public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) { if (tabsheet.getSelectedTab() == tabButton) { tabsheet.setSizeUndefined(); subwindow.getContent().setSizeUndefined(); diff --git a/tests/testbench/com/vaadin/tests/converter/StringToDoubleConverterWithThreeFractionDigits.java b/tests/testbench/com/vaadin/tests/converter/StringToDoubleConverterWithThreeFractionDigits.java index dc5abcb9f6..23c22a7026 100644 --- a/tests/testbench/com/vaadin/tests/converter/StringToDoubleConverterWithThreeFractionDigits.java +++ b/tests/testbench/com/vaadin/tests/converter/StringToDoubleConverterWithThreeFractionDigits.java @@ -5,7 +5,8 @@ import java.util.Locale; import com.vaadin.data.util.converter.StringToDoubleConverter; -public class StringToDoubleConverterWithThreeFractionDigits extends StringToDoubleConverter { +public class StringToDoubleConverterWithThreeFractionDigits extends + StringToDoubleConverter { @Override protected NumberFormat getFormat(Locale locale) { diff --git a/tests/testbench/com/vaadin/tests/dd/ActiveDragSourceClassName.java b/tests/testbench/com/vaadin/tests/dd/ActiveDragSourceClassName.java index 889c6bb47b..93e99274bb 100644 --- a/tests/testbench/com/vaadin/tests/dd/ActiveDragSourceClassName.java +++ b/tests/testbench/com/vaadin/tests/dd/ActiveDragSourceClassName.java @@ -25,25 +25,26 @@ public class ActiveDragSourceClassName extends TestBase { protected void setup() { TestUtils.injectCSS(getMainWindow(), GREENBOXES + HIDEDRAGSOURCE); - + VerticalLayout l = new VerticalLayout(); l.setWidth("400px"); l.setHeight("100px"); DragAndDropWrapper pane = new DragAndDropWrapper(cssLayout); pane.setSizeFull(); l.addComponent(pane); - + addComponent(l); - + for (int i = 0; i < 4; i++) { cssLayout.addComponent(new WrappedLabel("Block")); } - + } - + static int count; - private CssLayout cssLayout = new CssLayout() {}; + private CssLayout cssLayout = new CssLayout() { + }; class WrappedLabel extends DragAndDropWrapper { diff --git a/tests/testbench/com/vaadin/tests/dd/DragAndDropFiles.java b/tests/testbench/com/vaadin/tests/dd/DragAndDropFiles.java index ad23338bbf..4b4ec75f0e 100644 --- a/tests/testbench/com/vaadin/tests/dd/DragAndDropFiles.java +++ b/tests/testbench/com/vaadin/tests/dd/DragAndDropFiles.java @@ -67,8 +67,7 @@ public class DragAndDropFiles extends TestBase { return true; } - public void onProgress( - StreamingProgressEvent event) { + public void onProgress(StreamingProgressEvent event) { System.err.println("Progress" + event.getBytesReceived()); } diff --git a/tests/testbench/com/vaadin/tests/dd/MyDragSourceConnector.java b/tests/testbench/com/vaadin/tests/dd/MyDragSourceConnector.java index 6076657708..c94ac05ea2 100644 --- a/tests/testbench/com/vaadin/tests/dd/MyDragSourceConnector.java +++ b/tests/testbench/com/vaadin/tests/dd/MyDragSourceConnector.java @@ -9,10 +9,10 @@ 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.ui.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.tests.dd.CustomDDImplementation.MyDragSource; -@Component(MyDragSource.class) +@Connect(MyDragSource.class) public class MyDragSourceConnector extends AbstractComponentConnector implements Paintable { diff --git a/tests/testbench/com/vaadin/tests/dd/MyDropTargetConnector.java b/tests/testbench/com/vaadin/tests/dd/MyDropTargetConnector.java index 02ed47ec05..0021cbf7ea 100644 --- a/tests/testbench/com/vaadin/tests/dd/MyDropTargetConnector.java +++ b/tests/testbench/com/vaadin/tests/dd/MyDropTargetConnector.java @@ -9,10 +9,10 @@ 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.ui.AbstractComponentConnector; -import com.vaadin.terminal.gwt.client.ui.Component; +import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.tests.dd.CustomDDImplementation.MyDropTarget; -@Component(MyDropTarget.class) +@Connect(MyDropTarget.class) public class MyDropTargetConnector extends AbstractComponentConnector implements Paintable { |