diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2021-07-23 15:41:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-23 15:41:25 +0300 |
commit | 7f537988d31b22ee40fb0ee4b55e5b29708259d4 (patch) | |
tree | 789aca473df208fa5f16009a2f8ad1b5661dda51 | |
parent | 73a2f6e18b0eb2d46cf6ed92ea57ed5431340d40 (diff) | |
download | vaadin-framework-7f537988d31b22ee40fb0ee4b55e5b29708259d4.tar.gz vaadin-framework-7f537988d31b22ee40fb0ee4b55e5b29708259d4.zip |
Checkstyle fixes (#12347)
- Added, completed, and corrected JavaDocs.
- Added an assert to enforce a condition that has always been required.
- Added default sections to switch blocks.
- Added wildcards.
- Deprecated unused methods and variables.
- Removed inner assignments.
- Removed unused private variables and calls that do nothing.
- Updated deprecated calls to use currently recommended versions.
- Updated warning suppressions.
- ...and some auto-formatting.
85 files changed, 1667 insertions, 141 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java index 3beac5c62e..425fce1a48 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java @@ -62,6 +62,11 @@ import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.TabIndexState; import com.vaadin.shared.ui.ui.UIState; +/** + * Base class for component connectors. + * + * @author Vaadin Ltd + */ public abstract class AbstractComponentConnector extends AbstractConnector implements HasErrorIndicator { @@ -90,6 +95,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector private int touchStartY; private boolean preventNextTouchEnd = false; + /** Default threshold for determining whether touch move is significant. */ protected int SIGNIFICANT_MOVE_THRESHOLD = 20; // pixels // long touch event delay @@ -269,6 +275,12 @@ public abstract class AbstractComponentConnector extends AbstractConnector }, TouchEndEvent.getType()); } + /** + * Checks whether a long tap needs handling. + * + * @return {@code true} if long tap handling is needed, {@code false} + * otherwise + */ protected boolean shouldHandleLongTap() { return BrowserInfo.get().isTouchDevice(); } @@ -314,7 +326,9 @@ public abstract class AbstractComponentConnector extends AbstractConnector * * @since 7.6 * @param details + * the mouse event details * @param eventTarget + * the target of the event */ protected void sendContextClickEvent(MouseEventDetails details, EventTarget eventTarget) { @@ -380,6 +394,14 @@ public abstract class AbstractComponentConnector extends AbstractConnector return widget; } + /** + * Checks whether the update is 'real' or contains cached information. + * + * @param uidl + * the UIDL to check + * @return {@code true} if doesn't have "cached" attribute, {@code false} + * otherwise + */ @Deprecated public static boolean isRealUpdate(UIDL uidl) { return !uidl.hasAttribute("cached"); @@ -717,6 +739,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector * {@link com.vaadin.client.ui.datefield.TextualDateConnector#setWidgetStyleNameWithPrefix(String, String, boolean)} * </p> * + * @param prefix + * the prefix for the style name * @param styleName * the style name to be added or removed * @param add diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java index 0683f864a9..9531de5ac7 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java @@ -186,6 +186,8 @@ public abstract class AbstractConnector /** * Unregisters an implementation for a server to client RPC interface. * + * @param <T> + * The type of the RPC interface that is being unregistered * @param rpcInterface * RPC interface * @param implementation @@ -211,6 +213,7 @@ public abstract class AbstractConnector * @return A proxy object which can be used to invoke the RPC method on the * server. */ + @SuppressWarnings("unchecked") protected <T extends ServerRpc> T getRpcProxy(Class<T> rpcInterface) { String name = rpcInterface.getName(); if (!rpcProxyMap.containsKey(name)) { @@ -219,6 +222,7 @@ public abstract class AbstractConnector return (T) rpcProxyMap.get(name); } + @SuppressWarnings("unchecked") @Override public <T extends ClientRpc> Collection<T> getRpcImplementations( String rpcInterfaceId) { @@ -260,6 +264,12 @@ public abstract class AbstractConnector } + /** + * Ensure there is a handler manager. If one doesn't exist before this + * method is called, it gets created. + * + * @return the handler manager + */ protected HandlerManager ensureHandlerManager() { if (handlerManager == null) { handlerManager = new HandlerManager(this); @@ -402,6 +412,13 @@ public abstract class AbstractConnector } + /** + * Find the type of the state for the given connector. + * + * @param connector + * the connector whose state type to find + * @return the state type + */ public static Type getStateType(ServerConnector connector) { try { return TypeData.getType(connector.getClass()).getMethod("getState") @@ -506,6 +523,7 @@ public abstract class AbstractConnector } private static class FullStateChangeEvent extends StateChangeEvent { + @SuppressWarnings("deprecation") public FullStateChangeEvent(ServerConnector connector) { super(connector, FastStringSet.create()); } diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractFieldConnector.java index 32bf5588d8..a76333e408 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractFieldConnector.java @@ -18,6 +18,11 @@ package com.vaadin.client.ui; import com.vaadin.client.StyleConstants; import com.vaadin.shared.AbstractFieldState; +/** + * Base class for field connectors. + * + * @author Vaadin Ltd + */ public abstract class AbstractFieldConnector extends AbstractComponentConnector implements HasRequiredIndicator { @@ -31,6 +36,7 @@ public abstract class AbstractFieldConnector extends AbstractComponentConnector return getState().required && !isReadOnly(); } + @SuppressWarnings("deprecation") @Override protected void updateWidgetStyleNames() { super.updateWidgetStyleNames(); diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractHasComponentsConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractHasComponentsConnector.java index 094fba58db..57a1da689b 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractHasComponentsConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractHasComponentsConnector.java @@ -24,6 +24,11 @@ import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler; import com.vaadin.client.HasComponentsConnector; +/** + * Base class for component connectors whose widget is a component container. + * + * @author Vaadin Ltd + */ public abstract class AbstractHasComponentsConnector extends AbstractComponentConnector implements HasComponentsConnector, ConnectorHierarchyChangeHandler { diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractLayoutConnector.java index f716318d24..8ebd4de3d9 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractLayoutConnector.java @@ -17,6 +17,11 @@ package com.vaadin.client.ui; import com.vaadin.shared.ui.AbstractLayoutState; +/** + * Base class for layout connectors. + * + * @author Vaadin Ltd + */ public abstract class AbstractLayoutConnector extends AbstractComponentContainerConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/JavaScriptComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/JavaScriptComponentConnector.java index 19b0f25c41..13f8b53062 100644 --- a/client/src/main/java/com/vaadin/client/ui/JavaScriptComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/JavaScriptComponentConnector.java @@ -24,6 +24,11 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.JavaScriptComponentState; import com.vaadin.ui.AbstractJavaScriptComponent; +/** + * A connector class for JavaScript components. + * + * @author Vaadin Ltd + */ @Connect(AbstractJavaScriptComponent.class) public final class JavaScriptComponentConnector extends AbstractComponentConnector implements HasJavaScriptConnectorHelper { diff --git a/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java index b9474bda9d..1b53b728f4 100644 --- a/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java @@ -22,6 +22,11 @@ import com.vaadin.shared.ui.AbstractMediaState; import com.vaadin.shared.ui.MediaControl; import com.vaadin.shared.ui.PreloadMode; +/** + * Base class for media component connectors. + * + * @author Vaadin Ltd + */ public abstract class MediaBaseConnector extends AbstractComponentConnector { @Override diff --git a/client/src/main/java/com/vaadin/client/ui/UnknownComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/UnknownComponentConnector.java index 9b1e4b8111..27f6d36054 100644 --- a/client/src/main/java/com/vaadin/client/ui/UnknownComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/UnknownComponentConnector.java @@ -18,6 +18,12 @@ package com.vaadin.client.ui; import com.google.gwt.core.client.GWT; +/** + * A placeholder connector class for when a component's connector cannot be + * determined. + * + * @author Vaadin Ltd + */ public class UnknownComponentConnector extends AbstractComponentConnector { @Override @@ -30,10 +36,26 @@ public class UnknownComponentConnector extends AbstractComponentConnector { return (VUnknownComponent) super.getWidget(); } + /** + * Updates the placeholder widget's caption to mention the component whose + * connector cannot be determined. + * + * @param serverClassName + * the class name of the component + */ public void setServerSideClassName(String serverClassName) { getWidget().setCaption(createMessage(serverClassName)); } + /** + * Creates a message that warns about the issue with the named component and + * gives debugging hints. + * + * @param serverClassName + * the class name of the component whose connector cannot be + * determined. + * @return the warning message + */ public static String createMessage(String serverClassName) { return "Widgetset '" + GWT.getModuleName() + "' does not contain an implementation for " + serverClassName diff --git a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java index 5022049e48..7f6acbfcd3 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java @@ -48,6 +48,7 @@ import com.vaadin.client.WidgetUtil; */ public class VCustomLayout extends ComplexPanel { + /** The default classname for this widget. */ public static final String CLASSNAME = "v-customlayout"; /** Location-name to containing element in DOM map */ @@ -84,6 +85,10 @@ public class VCustomLayout extends ComplexPanel { private String width = ""; + /** + * Constructs a widget for a custom layout. + */ + @SuppressWarnings("deprecation") public VCustomLayout() { setElement(DOM.createDiv()); // Clear any unwanted styling @@ -152,7 +157,14 @@ public class VCustomLayout extends ComplexPanel { locationToWidget.put(location, widget); } - /** Initialize HTML-layout. */ + /** + * Initialize HTML-layout. + * + * @param template + * original HTML-template + * @param themeUri + * URI to the current theme + */ public void initializeHTML(String template, String themeUri) { // Connect body of the template to DOM @@ -202,7 +214,11 @@ public class VCustomLayout extends ComplexPanel { return false; }-*/; - /** For internal use only. May be removed or replaced in the future. */ + /** + * For internal use only. May be removed or replaced in the future. + * + * @return {@code true} if has template contents, {@code false} otherwise + */ public boolean hasTemplate() { return htmlInitialized; } @@ -229,6 +245,9 @@ public class VCustomLayout extends ComplexPanel { * Evaluate given script in browser document. * <p> * For internal use only. May be removed or replaced in the future. + * + * @param script + * the script to evaluate */ public static native void eval(String script) /*-{ @@ -280,7 +299,8 @@ public class VCustomLayout extends ComplexPanel { scriptStart = lc.indexOf(">", scriptStart); final int j = lc.indexOf("</script>", scriptStart); scripts += html.substring(scriptStart + 1, j) + ";"; - nextPosToCheck = endOfPrevScript = j + "</script>".length(); + endOfPrevScript = j + "</script>".length(); + nextPosToCheck = endOfPrevScript; scriptStart = lc.indexOf("<script", nextPosToCheck); } res += html.substring(endOfPrevScript); @@ -307,6 +327,9 @@ public class VCustomLayout extends ComplexPanel { /** * Update caption for the given child connector. + * + * @param childConnector + * the child connector whose caption should be updated */ public void updateCaption(ComponentConnector childConnector) { Widget widget = childConnector.getWidget(); @@ -338,7 +361,13 @@ public class VCustomLayout extends ComplexPanel { } } - /** Get the location of an widget. */ + /** + * Get the location of an widget. + * + * @param w + * the widget whose location to check + * @return location name, or {@code null} if not found + */ public String getLocation(Widget w) { for (final String location : locationToWidget.keySet()) { if (locationToWidget.get(location) == w) { @@ -383,9 +412,12 @@ public class VCustomLayout extends ComplexPanel { * This method is published to JS side with the same name into first DOM * node of custom layout. This way if one implements some resizeable * containers in custom layout he/she can notify children after resize. + * + * @deprecated this method has done absolutely nothing since Vaadin 7.0 and + * should not be used, before that forced a recursive re-layout */ + @Deprecated public void notifyChildrenOfSizeChange() { - client.runDescendentsLayout(this); } @Override @@ -427,6 +459,7 @@ public class VCustomLayout extends ComplexPanel { * @return true if layout function exists and was run successfully, else * false. */ + @SuppressWarnings("deprecation") public native boolean iLayoutJS(com.google.gwt.user.client.Element el) /*-{ if (el && el.iLayoutJS) { @@ -441,6 +474,7 @@ public class VCustomLayout extends ComplexPanel { } }-*/; + @SuppressWarnings("deprecation") @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); diff --git a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java index dd489436a2..e0d485910d 100644 --- a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java +++ b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java @@ -33,7 +33,13 @@ import com.vaadin.client.Util; import com.vaadin.client.WidgetUtil; import com.vaadin.shared.ui.embedded.EmbeddedState; +/** + * A widget class for the Embedded component. + * + * @author Vaadin Ltd + */ public class VEmbedded extends HTML { + /** The default classname for this widget. */ public static String CLASSNAME = "v-embedded"; /** For internal use only. May be removed or replaced in the future. */ @@ -48,6 +54,9 @@ public class VEmbedded extends HTML { /** For internal use only. May be removed or replaced in the future. */ public ApplicationConnection client; + /** + * Constructs a widget for an Embedded component. + */ public VEmbedded() { setStyleName(CLASSNAME); } @@ -189,7 +198,8 @@ public class VEmbedded extends HTML { * For internal use only. May be removed or replaced in the future. * * @param uidl - * @return + * the UIDL to map + * @return the parameter map */ public static Map<String, String> getParameters(UIDL uidl) { Map<String, String> parameters = new HashMap<>(); @@ -218,7 +228,8 @@ public class VEmbedded extends HTML { * @param src * the src attribute * @param client - * @return + * the communication engine for this UI + * @return the translated src-attribute or an empty String if not found */ public String getSrc(String src, ApplicationConnection client) { String url = client.translateVaadinUri(src); @@ -239,14 +250,15 @@ public class VEmbedded extends HTML { * enough to overcome a bug when detaching an iframe with a pdf * loaded in IE9. about:blank seems to cause the adobe reader * plugin to unload properly before the iframe is removed. See - * #7855 + * https://dev.vaadin.com/ticket/7855 */ - DOM.setElementAttribute(browserElement, "src", "about:blank"); + browserElement.setAttribute("src", "about:blank"); } } super.onDetach(); } + @SuppressWarnings("deprecation") @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); diff --git a/client/src/main/java/com/vaadin/client/ui/VUnknownComponent.java b/client/src/main/java/com/vaadin/client/ui/VUnknownComponent.java index d62f0b2b9a..b37b885e12 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUnknownComponent.java +++ b/client/src/main/java/com/vaadin/client/ui/VUnknownComponent.java @@ -20,12 +20,24 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.VerticalPanel; import com.vaadin.client.SimpleTree; +/** + * A placeholder widget class for when a component's connector cannot be + * determined and a placeholder connector is used instead. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("deprecation") public class VUnknownComponent extends Composite { com.google.gwt.user.client.ui.Label caption = new com.google.gwt.user.client.ui.Label(); + /** Unused. Only here for historical reasons. */ SimpleTree uidlTree; + /** The base widget of this composite. */ protected VerticalPanel panel; + /** + * Constructs a placeholder widget. + */ public VUnknownComponent() { panel = new VerticalPanel(); panel.add(caption); @@ -34,6 +46,12 @@ public class VUnknownComponent extends Composite { caption.setStyleName("vaadin-unknown-caption"); } + /** + * Sets the content text for this placeholder. Can contain HTML. + * + * @param c + * the content text to set + */ public void setCaption(String c) { caption.getElement().setInnerHTML(c); } diff --git a/client/src/main/java/com/vaadin/client/ui/VUpload.java b/client/src/main/java/com/vaadin/client/ui/VUpload.java index 98cdeb6799..43171037a8 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUpload.java +++ b/client/src/main/java/com/vaadin/client/ui/VUpload.java @@ -44,6 +44,7 @@ import com.vaadin.shared.EventId; import com.vaadin.shared.ui.upload.UploadServerRpc; /** + * Widget class for the Upload component. * * Note, we are not using GWT FormPanel as we want to listen submitcomplete * events even though the upload component is already detached. @@ -74,6 +75,9 @@ public class VUpload extends SimplePanel { } } + /** + * Default classname for this widget. + */ public static final String CLASSNAME = "v-upload"; /** @@ -142,6 +146,9 @@ public class VUpload extends SimplePanel { /** For internal use only. May be removed or replaced in the future. */ public int nextUploadId; + /** + * Constructs the widget. + */ public VUpload() { super(com.google.gwt.dom.client.Document.get().createFormElement()); @@ -401,7 +408,7 @@ public class VUpload extends SimplePanel { } // flush possibly pending variable changes, so they will be handled // before upload - client.sendPendingVariableChanges(); + client.getServerRpcQueue().flush(); // This is done as deferred because sendPendingVariableChanges is also // deferred and we want to start the upload only after the changes have @@ -409,7 +416,14 @@ public class VUpload extends SimplePanel { Scheduler.get().scheduleDeferred(startUploadCmd); } - /** For internal use only. May be removed or replaced in the future. */ + /** + * For internal use only. May be removed or replaced in the future. + * + * @param disable + * {@code true} if the built-in browser-dependent tooltip should + * be hidden in favor of a Vaadin tooltip, {@code false} + * otherwise + */ public void disableTitle(boolean disable) { if (disable) { // Disable title attribute for upload element. @@ -480,6 +494,16 @@ public class VUpload extends SimplePanel { return Logger.getLogger(VUpload.class.getName()); } + /** + * Sets accepted mime types. If no mime types are given, all types should be + * accepted. + * + * @param acceptMimeTypes + * a comma-separated list of content types that this component + * will handle correctly, {@code null} or an empty String if all + * types should be accepted + * @since 8.5.0 + */ public void setAcceptMimeTypes(String acceptMimeTypes) { if (acceptMimeTypes == null || acceptMimeTypes.isEmpty()) { InputElement.as(fu.getElement()).setAccept(null); diff --git a/client/src/main/java/com/vaadin/client/ui/VWindow.java b/client/src/main/java/com/vaadin/client/ui/VWindow.java index fb383359ce..b0a22af515 100644 --- a/client/src/main/java/com/vaadin/client/ui/VWindow.java +++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java @@ -75,6 +75,7 @@ import com.vaadin.shared.ui.window.WindowRole; * * @author Vaadin Ltd */ +@SuppressWarnings("deprecation") public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, ScrollHandler, KeyDownHandler, FocusHandler, BlurHandler, Focusable { @@ -85,12 +86,14 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, private static boolean orderingDefered; + /** The default classname for this widget. */ public static final String CLASSNAME = "v-window"; private static final String MODAL_WINDOW_OPEN_CLASSNAME = "v-modal-window-open"; private static final int STACKING_OFFSET_PIXELS = 15; + /** The default z-index value from where all windows start up from. */ public static final int Z_INDEX = 10000; /** For internal use only. May be removed or replaced in the future. */ @@ -208,6 +211,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, private VLazyExecutor delayedContentsSizeUpdater = new VLazyExecutor(200, () -> updateContentsSize()); + /** + * Constructs a widget for a sub-window. + */ public VWindow() { super(false, false); // no autohide, not modal @@ -296,6 +302,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } } + /** + * Rearranges the window order to place this one on the top. + */ public void bringToFront() { bringToFront(true); } @@ -367,9 +376,12 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } /** - * Returns window position in list of opened and shown windows. + * Returns window position in list of opened and shown windows. The highest + * index indicates the window that is on top. * * @since 8.0 + * + * @return the position index */ public final int getWindowOrder() { return windowOrder.indexOf(this); @@ -383,6 +395,12 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } } + /** + * Returns the modality curtain element. If one doesn't exist before this + * method is called, the element is created. + * + * @return the modality curtain element + */ protected com.google.gwt.user.client.Element getModalityCurtain() { if (modalityCurtain == null) { modalityCurtain = DOM.createDiv(); @@ -391,37 +409,39 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, return DOM.asOld(modalityCurtain); } + /** + * Constructs the DOM structure for this widget. + */ protected void constructDOM() { setStyleName(CLASSNAME); topTabStop = DOM.createDiv(); - DOM.setElementAttribute(topTabStop, "tabindex", "0"); + topTabStop.setAttribute("tabindex", "0"); header = DOM.createDiv(); - DOM.setElementProperty(header, "className", CLASSNAME + "-outerheader"); + header.setPropertyString("className", CLASSNAME + "-outerheader"); headerText = DOM.createDiv(); - DOM.setElementProperty(headerText, "className", CLASSNAME + "-header"); + headerText.setPropertyString("className", CLASSNAME + "-header"); contents = DOM.createDiv(); - DOM.setElementProperty(contents, "className", CLASSNAME + "-contents"); + contents.setPropertyString("className", CLASSNAME + "-contents"); footer = DOM.createDiv(); - DOM.setElementProperty(footer, "className", CLASSNAME + "-footer"); + footer.setPropertyString("className", CLASSNAME + "-footer"); resizeBox = DOM.createDiv(); - DOM.setElementProperty(resizeBox, "className", - CLASSNAME + "-resizebox"); + resizeBox.setPropertyString("className", CLASSNAME + "-resizebox"); closeBox = DOM.createDiv(); maximizeRestoreBox = DOM.createDiv(); - DOM.setElementProperty(maximizeRestoreBox, "className", + maximizeRestoreBox.setPropertyString("className", CLASSNAME + "-maximizebox"); - DOM.setElementAttribute(maximizeRestoreBox, "tabindex", "0"); - DOM.setElementProperty(closeBox, "className", CLASSNAME + "-closebox"); - DOM.setElementAttribute(closeBox, "tabindex", "0"); + maximizeRestoreBox.setAttribute("tabindex", "0"); + closeBox.setPropertyString("className", CLASSNAME + "-closebox"); + closeBox.setAttribute("tabindex", "0"); DOM.appendChild(footer, resizeBox); bottomTabStop = DOM.createDiv(); - DOM.setElementAttribute(bottomTabStop, "tabindex", "0"); + bottomTabStop.setAttribute("tabindex", "0"); wrapper = DOM.createDiv(); - DOM.setElementProperty(wrapper, "className", CLASSNAME + "-wrap"); + wrapper.setPropertyString("className", CLASSNAME + "-wrap"); DOM.appendChild(wrapper, topTabStop); DOM.appendChild(wrapper, header); @@ -651,7 +671,13 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } } - /** For internal use only. May be removed or replaced in the future. */ + /** + * For internal use only. May be removed or replaced in the future. + * + * @param draggable + * {@code true} if this window should be draggable, {@code false} + * otherwise + */ public void setDraggable(boolean draggable) { if (this.draggable == draggable) { return; @@ -686,12 +712,11 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, this.closable = closable; if (closable) { - DOM.setElementProperty(closeBox, "className", - CLASSNAME + "-closebox"); + closeBox.setPropertyString("className", CLASSNAME + "-closebox"); } else { - DOM.setElementProperty(closeBox, "className", CLASSNAME - + "-closebox " + CLASSNAME + "-closebox-disabled"); + closeBox.setPropertyString("className", CLASSNAME + "-closebox " + + CLASSNAME + "-closebox-disabled"); } @@ -748,7 +773,13 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, fireOrderEvent(update); } - /** For internal use only. May be removed or replaced in the future. */ + /** + * For internal use only. May be removed or replaced in the future. + * + * @param modality + * {@code true} if this window should be modal, {@code false} + * otherwise + */ public void setVaadinModality(boolean modality) { vaadinModality = modality; if (vaadinModality) { @@ -858,21 +889,36 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, return curtain; } - /** For internal use only. May be removed or replaced in the future. */ + /** + * For internal use only. May be removed or replaced in the future. + * + * @param resizability + * {@code true} if this window should be resizable, {@code false} + * otherwise + */ public void setResizable(boolean resizability) { resizable = resizability; if (resizability) { - DOM.setElementProperty(footer, "className", CLASSNAME + "-footer"); - DOM.setElementProperty(resizeBox, "className", - CLASSNAME + "-resizebox"); + footer.setPropertyString("className", CLASSNAME + "-footer"); + resizeBox.setPropertyString("className", CLASSNAME + "-resizebox"); } else { - DOM.setElementProperty(footer, "className", + footer.setPropertyString("className", CLASSNAME + "-footer " + CLASSNAME + "-footer-noresize"); - DOM.setElementProperty(resizeBox, "className", CLASSNAME - + "-resizebox " + CLASSNAME + "-resizebox-disabled"); + resizeBox.setPropertyString("className", CLASSNAME + "-resizebox " + + CLASSNAME + "-resizebox-disabled"); } } + /** + * Updates the visibility and styles for the element that doubles up as the + * maximize and the restore button depending on the mode. + * + * @param visible + * {@code true} if the button should be visible, {@code false} + * otherwise + * @param windowMode + * current mode for this window + */ public void updateMaximizeRestoreClassName(boolean visible, WindowMode windowMode) { String className; @@ -887,8 +933,17 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, maximizeRestoreBox.setClassName(className); } - // TODO this will eventually be removed, currently used to avoid updating to - // server side. + /** + * Sets the popup's position relative to the browser's client area. + * + * TODO this will eventually be removed, currently used to avoid updating to + * server side. + * + * @param left + * the left position, in pixels + * @param top + * the top position, in pixels + */ public void setPopupPositionNoUpdate(int left, int top) { if (top < 0) { // ensure window is not moved out of browser window from top of the @@ -916,14 +971,40 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } } + /** + * Sets the caption for this window. + * + * @param c + * the caption to set + */ public void setCaption(String c) { setCaption(c, null); } + /** + * Sets the caption and the caption icon for this window. + * + * @param c + * the caption to set + * @param iconURL + * the URL for the icon to set + */ public void setCaption(String c, String iconURL) { setCaption(c, iconURL, false); } + /** + * Sets the caption and the caption icon for this window, and determines + * whether the caption should be displayed as HTML or as plain text. + * + * @param c + * the caption to set + * @param iconURL + * the URL for the icon to set + * @param asHtml + * {@code true} if displayed as HTML, {@code false} if displayed + * as plain text + */ public void setCaption(String c, String iconURL, boolean asHtml) { String html; if (asHtml) { @@ -1043,7 +1124,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, headerDragPending = event; bubble = false; - } else if ((type == Event.ONMOUSEMOVE || type == Event.ONTOUCHMOVE) + } else if ((type == Event.ONMOUSEMOVE + || type == Event.ONTOUCHMOVE) && headerDragPending != null) { // ie won't work unless this is set here dragging = true; @@ -1051,7 +1133,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, onDragEvent(event); headerDragPending = null; bubble = false; - } else if (type != Event.ONMOUSEMOVE && type != Event.ONTOUCHMOVE) { + } else if (type != Event.ONMOUSEMOVE + && type != Event.ONTOUCHMOVE) { // The event can propagate to the parent in case it is a // mouse move event. This is needed for tooltips to work in // header and footer, see Ticket #19073 @@ -1228,6 +1311,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } } + /** + * Relayouts this window and its contents. + */ public void updateContentsSize() { LayoutManager layoutManager = getLayoutManager(); layoutManager.setNeedsMeasureRecursively( @@ -1551,7 +1637,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, * * @since 7.1.9 * - * @return {@link HandlerRegistration} used to remove the handler + * @param handler + * the handler to add + * @return registration object that can be used to deregister the handler */ public HandlerRegistration addMoveHandler(WindowMoveHandler handler) { return addHandler(handler, WindowMoveEvent.getType()); @@ -1562,7 +1650,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, * * @since 8.0 * - * @return registration object to deregister the handler + * @param handler + * the handler to add + * @return registration object that can be used to deregister the handler */ public static HandlerRegistration addWindowOrderHandler( WindowOrderHandler handler) { diff --git a/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java index 7ff3de1d98..3de90224f5 100644 --- a/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java @@ -46,6 +46,7 @@ public class AbsoluteLayoutConnector extends AbstractComponentContainerConnector private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler( this) { + @SuppressWarnings("deprecation") @Override protected ComponentConnector getChildComponent( com.google.gwt.user.client.Element element) { diff --git a/client/src/main/java/com/vaadin/client/ui/accordion/AccordionConnector.java b/client/src/main/java/com/vaadin/client/ui/accordion/AccordionConnector.java index 014163ea13..3fb5390ce3 100644 --- a/client/src/main/java/com/vaadin/client/ui/accordion/AccordionConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/accordion/AccordionConnector.java @@ -28,6 +28,11 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.accordion.AccordionState; import com.vaadin.ui.Accordion; +/** + * A connector class for the Accordion component. + * + * @author Vaadin Ltd + */ @Connect(Accordion.class) public class AccordionConnector extends TabsheetBaseConnector implements SimpleManagedLayout, MayScrollChildren { diff --git a/client/src/main/java/com/vaadin/client/ui/audio/AudioConnector.java b/client/src/main/java/com/vaadin/client/ui/audio/AudioConnector.java index a66e71d42f..2577dfc864 100644 --- a/client/src/main/java/com/vaadin/client/ui/audio/AudioConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/audio/AudioConnector.java @@ -27,6 +27,11 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.audio.AudioState; import com.vaadin.ui.Audio; +/** + * A connector class for the Audio component. + * + * @author Vaadin Ltd + */ @Connect(Audio.class) public class AudioConnector extends MediaBaseConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/browserframe/BrowserFrameConnector.java b/client/src/main/java/com/vaadin/client/ui/browserframe/BrowserFrameConnector.java index 9eb4ac3fd0..2fcf69f175 100644 --- a/client/src/main/java/com/vaadin/client/ui/browserframe/BrowserFrameConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/browserframe/BrowserFrameConnector.java @@ -22,6 +22,11 @@ import com.vaadin.shared.ui.AbstractEmbeddedState; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.browserframe.BrowserFrameState; +/** + * A connector class for the BrowserFrame component. + * + * @author Vaadin Ltd + */ @Connect(com.vaadin.ui.BrowserFrame.class) public class BrowserFrameConnector extends AbstractComponentConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/button/ButtonConnector.java b/client/src/main/java/com/vaadin/client/ui/button/ButtonConnector.java index 1078026c93..dd7b1a7b3c 100644 --- a/client/src/main/java/com/vaadin/client/ui/button/ButtonConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/button/ButtonConnector.java @@ -32,6 +32,11 @@ import com.vaadin.shared.ui.button.ButtonServerRpc; import com.vaadin.shared.ui.button.ButtonState; import com.vaadin.ui.Button; +/** + * A connector class for the Button component. Eagerly loaded. + * + * @author Vaadin Ltd + */ @Connect(value = Button.class, loadStyle = LoadStyle.EAGER) public class ButtonConnector extends AbstractComponentConnector implements ClickHandler { diff --git a/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java index 8c5e488913..a28d77c1b0 100644 --- a/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java @@ -145,7 +145,7 @@ public class CheckBoxConnector extends AbstractFieldConnector getWidget().getElement()); getRpcProxy(CheckBoxServerRpc.class).setChecked(getState().checked, details); - getConnection().sendPendingVariableChanges(); + getConnection().getServerRpcQueue().flush(); } } diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java index 3d9cf3c31e..ed711935cd 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java @@ -75,7 +75,7 @@ public abstract class AbstractColorPickerConnector /** * Get caption for the color picker widget. * - * @return + * @return the caption */ protected String getCaption() { if (getState().showDefaultCaption && (getState().caption == null @@ -102,6 +102,7 @@ public abstract class AbstractColorPickerConnector * Set caption of the color picker widget. * * @param caption + * the caption to set */ protected abstract void setCaption(String caption); diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java index e82fc67f5f..bf7dc5f642 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java @@ -36,13 +36,22 @@ import com.vaadin.client.ui.SubPartAware; public class VColorPickerGradient extends FocusPanel implements MouseDownHandler, MouseUpHandler, MouseMoveHandler, SubPartAware { - /** Set the CSS class name to allow styling. */ + /** Default class name for this widget. */ public static final String CLASSNAME = "v-colorpicker-gradient"; + /** + * Default class name for the container sub-element that contains all other + * sub-elements within this widget. + */ + public static final String CLASSNAME_CONTAINER = CLASSNAME + "-container"; + /** Default class name for the background element within this widget. */ public static final String CLASSNAME_BACKGROUND = CLASSNAME + "-background"; + /** Default class name for the foreground element within this widget. */ public static final String CLASSNAME_FOREGROUND = CLASSNAME + "-foreground"; + /** Default class name for the lowerbox element within this widget. */ public static final String CLASSNAME_LOWERBOX = CLASSNAME + "-lowerbox"; + /** Default class name for the higherbox element within this widget. */ public static final String CLASSNAME_HIGHERBOX = CLASSNAME + "-higherbox"; - public static final String CLASSNAME_CONTAINER = CLASSNAME + "-container"; + /** Default class name for the clicklayer element within this widget. */ public static final String CLASSNAME_CLICKLAYER = CLASSNAME + "-clicklayer"; private static final String CLICKLAYER_ID = "clicklayer"; @@ -106,6 +115,8 @@ public class VColorPickerGradient extends FocusPanel implements /** * Returns the latest x-coordinate for pressed-down mouse cursor. + * + * @return the latest x-coordinate */ public int getCursorX() { return cursorX; @@ -113,6 +124,8 @@ public class VColorPickerGradient extends FocusPanel implements /** * Returns the latest y-coordinate for pressed-down mouse cursor. + * + * @return the latest y-coordinate */ public int getCursorY() { return cursorY; @@ -122,6 +135,7 @@ public class VColorPickerGradient extends FocusPanel implements * Sets the given css color as the background. * * @param bgColor + * the color to set */ public void setBGColor(String bgColor) { if (bgColor == null) { @@ -163,7 +177,9 @@ public class VColorPickerGradient extends FocusPanel implements * cross elements. * * @param x + * x-coordinate * @param y + * y-coordinate */ public void setCursor(int x, int y) { cursorX = x; @@ -192,6 +208,7 @@ public class VColorPickerGradient extends FocusPanel implements } } + @SuppressWarnings("deprecation") @Override public com.google.gwt.user.client.Element getSubPartElement( String subPart) { @@ -202,6 +219,7 @@ public class VColorPickerGradient extends FocusPanel implements return null; } + @SuppressWarnings("deprecation") @Override public String getSubPartName( com.google.gwt.user.client.Element subElement) { diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGrid.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGrid.java index eb86dfc808..bde6bae442 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGrid.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGrid.java @@ -72,7 +72,9 @@ public class VColorPickerGrid extends AbsolutePanel * For internal use only. May be renamed or removed in a future release. * * @param rowCount + * how many rows the grid should have * @param columnCount + * how many columns the grid should have */ public void updateGrid(int rowCount, int columnCount) { rows = rowCount; @@ -89,8 +91,11 @@ public class VColorPickerGrid extends AbsolutePanel * For internal use only. May be renamed or removed in a future release. * * @param changedColor + * the changed colors * @param changedX + * the x-coordinates for the changed colors * @param changedY + * the y-coordinates for the changed colors */ public void updateColor(String[] changedColor, String[] changedX, String[] changedY) { @@ -112,6 +117,8 @@ public class VColorPickerGrid extends AbsolutePanel /** * Returns currently selected x-coordinate of the grid. + * + * @return the selected x-coordinate */ public int getSelectedX() { return selectedX; @@ -119,16 +126,20 @@ public class VColorPickerGrid extends AbsolutePanel /** * Returns currently selected y-coordinate of the grid. + * + * @return the selected y-coordinate */ public int getSelectedY() { return selectedY; } /** - * Returns true if the colors have been successfully updated at least once, - * false otherwise. + * Checks whether the colors have been successfully updated at least once. * <p> * For internal use only. May be renamed or removed in a future release. + * + * @return {@code true} if the colors have been successfully updated at + * least once, {@code false} otherwise */ public boolean isGridLoaded() { return gridLoaded; diff --git a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java index e6609f79a4..632f09c58f 100644 --- a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -42,6 +42,11 @@ import com.vaadin.ui.ComboBox; import elemental.json.JsonObject; +/** + * A connector class for the ComboBox component. + * + * @author Vaadin Ltd + */ @Connect(ComboBox.class) public class ComboBoxConnector extends AbstractListingConnector implements SimpleManagedLayout { diff --git a/client/src/main/java/com/vaadin/client/ui/composite/CompositeConnector.java b/client/src/main/java/com/vaadin/client/ui/composite/CompositeConnector.java index f9a3692615..0ae849f603 100644 --- a/client/src/main/java/com/vaadin/client/ui/composite/CompositeConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/composite/CompositeConnector.java @@ -31,7 +31,7 @@ import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.ui.Composite; /** - * Connector for the Composite component. + * Connector for the Composite component. Eagerly loaded. * * @author Vaadin Ltd * @since 8.1 diff --git a/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java index a00d69784f..040ab2047f 100644 --- a/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java @@ -45,6 +45,7 @@ public class CssLayoutConnector extends AbstractLayoutConnector { private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler( this) { + @SuppressWarnings("deprecation") @Override protected ComponentConnector getChildComponent( com.google.gwt.user.client.Element element) { diff --git a/client/src/main/java/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java index 7a2a78a71f..1a5c193025 100644 --- a/client/src/main/java/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java @@ -23,6 +23,11 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.ui.CustomComponent; +/** + * A connector class for the CustomComponent component base. Eagerly loaded. + * + * @author Vaadin Ltd + */ @Connect(value = CustomComponent.class, loadStyle = LoadStyle.EAGER) public class CustomComponentConnector extends AbstractHasComponentsConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/customfield/CustomFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/customfield/CustomFieldConnector.java index 17ffbd2016..33d49e47cc 100644 --- a/client/src/main/java/com/vaadin/client/ui/customfield/CustomFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/customfield/CustomFieldConnector.java @@ -33,6 +33,11 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.customfield.CustomFieldState; import com.vaadin.ui.CustomField; +/** + * A connector class for the CustomField component. + * + * @author Vaadin Ltd + */ @Connect(value = CustomField.class) public class CustomFieldConnector extends AbstractFieldConnector implements HasComponentsConnector, ConnectorHierarchyChangeHandler { diff --git a/client/src/main/java/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java index 7ef5e04c61..f02b4b1361 100644 --- a/client/src/main/java/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java @@ -32,6 +32,12 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.customlayout.CustomLayoutState; import com.vaadin.ui.CustomLayout; +/** + * A connector class for CustomLayout. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("deprecation") @Connect(CustomLayout.class) public class CustomLayoutConnector extends AbstractLayoutConnector implements SimpleManagedLayout, Paintable { diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java index d341af120c..32c53e7044 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java @@ -34,6 +34,14 @@ import com.vaadin.shared.ui.datefield.AbstractDateFieldServerRpc; import com.vaadin.shared.ui.datefield.AbstractDateFieldState; import com.vaadin.shared.ui.datefield.AbstractDateFieldState.AccessibleElement; +/** + * Base class for various DateField connectors. + * + * @author Vaadin Ltd + * + * @param <R> + * the resolution type which this field is based on (day, month, ...) + */ public abstract class AbstractDateFieldConnector<R extends Enum<R>> extends AbstractFieldConnector { @@ -137,6 +145,7 @@ public abstract class AbstractDateFieldConnector<R extends Enum<R>> widget.setDefaultDate(getDefaultValues()); } + @SuppressWarnings("rawtypes") @OnStateChange("assistiveLabels") private void updateAssistiveLabels() { if (getWidget() instanceof VAbstractPopupCalendar) { @@ -153,6 +162,7 @@ public abstract class AbstractDateFieldConnector<R extends Enum<R>> * the calendar panel for which to set the assistive labels * @since 8.4 */ + @SuppressWarnings("rawtypes") protected void setAndUpdateAssistiveLabels( VAbstractCalendarPanel calendar) { calendar.setAssistiveLabelPreviousMonth(getState().assistiveLabels diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/DateFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/DateFieldConnector.java index 22352cb0bd..0836ff24eb 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/DateFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/DateFieldConnector.java @@ -23,6 +23,8 @@ import com.vaadin.shared.ui.datefield.LocalDateFieldState; import com.vaadin.ui.AbstractLocalDateField; /** + * A connector class for the abstract AbstractLocalDateField component. + * * @author Vaadin Ltd * */ diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/DateTimeFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/DateTimeFieldConnector.java index 4be0ae7937..c30ddee5c2 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/DateTimeFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/DateTimeFieldConnector.java @@ -51,6 +51,7 @@ public class DateTimeFieldConnector extends return (LocalDateTimeFieldState) super.getState(); } + @SuppressWarnings("deprecation") @Override protected void updateListeners() { super.updateListeners(); diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/InlineDateTimeFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/InlineDateTimeFieldConnector.java index 31e8800dba..399ebfb87c 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/InlineDateTimeFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/InlineDateTimeFieldConnector.java @@ -45,6 +45,7 @@ public class InlineDateTimeFieldConnector extends return (VDateTimeFieldCalendar) super.getWidget(); } + @SuppressWarnings("deprecation") @Override protected void updateListeners() { super.updateListeners(); diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/TextualDateConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/TextualDateConnector.java index 4eb2769340..edba677062 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/TextualDateConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/TextualDateConnector.java @@ -78,6 +78,7 @@ public abstract class TextualDateConnector<PANEL extends VAbstractCalendarPanel< * {@link #updateFromUIDL(UIDL, ApplicationConnection)} method as is and * customizing only listeners logic. */ + @SuppressWarnings("deprecation") protected void updateListeners() { FocusChangeListener listener; if (isResolutionMonthOrHigher()) { @@ -104,6 +105,7 @@ public abstract class TextualDateConnector<PANEL extends VAbstractCalendarPanel< */ protected abstract boolean isResolutionMonthOrHigher(); + @SuppressWarnings("unchecked") @Override public VAbstractPopupCalendar<PANEL, R> getWidget() { return (VAbstractPopupCalendar<PANEL, R>) super.getWidget(); @@ -179,7 +181,14 @@ public abstract class TextualDateConnector<PANEL extends VAbstractCalendarPanel< getWidget().popup.setStyleName(styleName, add); } + /** + * {@inheritDoc} + * + * @deprecated This will be removed once styles are no longer added with + * prefixes. + */ @Override + @Deprecated protected void setWidgetStyleNameWithPrefix(String prefix, String styleName, boolean add) { super.setWidgetStyleNameWithPrefix(prefix, styleName, add); diff --git a/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java b/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java index 5409c2691c..cfb067ca87 100644 --- a/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java @@ -39,6 +39,11 @@ import com.vaadin.shared.ui.embedded.EmbeddedServerRpc; import com.vaadin.shared.ui.embedded.EmbeddedState; import com.vaadin.ui.Embedded; +/** + * A connector class for the Embedded component. + * + * @author Vaadin Ltd + */ @Connect(Embedded.class) public class EmbeddedConnector extends AbstractComponentConnector { @@ -46,6 +51,7 @@ public class EmbeddedConnector extends AbstractComponentConnector { private ObjectElement objectElement; private String resourceUrl; + @SuppressWarnings("deprecation") @Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); @@ -243,6 +249,7 @@ public class EmbeddedConnector extends AbstractComponentConnector { return (EmbeddedState) super.getState(); } + /** Click event handler for sending click data to the server. */ protected final ClickEventHandler clickEventHandler = new ClickEventHandler( this) { diff --git a/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java index 328f15762d..c61c02470d 100644 --- a/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java @@ -43,6 +43,11 @@ import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutServerRpc; import com.vaadin.shared.ui.orderedlayout.FormLayoutState; import com.vaadin.ui.FormLayout; +/** + * A connector class for FormLayout. + * + * @author Vaadin Ltd + */ @Connect(FormLayout.class) public class FormLayoutConnector extends AbstractLayoutConnector implements PostLayoutListener { @@ -54,6 +59,7 @@ public class FormLayoutConnector extends AbstractLayoutConnector private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler( this) { + @SuppressWarnings("deprecation") @Override protected ComponentConnector getChildComponent( com.google.gwt.user.client.Element element) { @@ -154,6 +160,7 @@ public class FormLayoutConnector extends AbstractLayoutConnector return (FormLayoutState) super.getState(); } + @SuppressWarnings("deprecation") @Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); diff --git a/client/src/main/java/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java index 6172070f73..79f214bb4f 100644 --- a/client/src/main/java/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java @@ -37,6 +37,11 @@ import com.vaadin.shared.ui.gridlayout.GridLayoutState; import com.vaadin.shared.ui.gridlayout.GridLayoutState.ChildComponentData; import com.vaadin.ui.GridLayout; +/** + * A connector class for the GridLayout component. + * + * @author Vaadin Ltd + */ @Connect(GridLayout.class) public class GridLayoutConnector extends AbstractComponentContainerConnector implements DirectionalManagedLayout { @@ -46,6 +51,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler( this) { + @SuppressWarnings("deprecation") @Override protected ComponentConnector getChildComponent( com.google.gwt.user.client.Element element) { @@ -109,6 +115,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector return (GridLayoutState) super.getState(); } + @SuppressWarnings("deprecation") @Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); diff --git a/client/src/main/java/com/vaadin/client/ui/image/ImageConnector.java b/client/src/main/java/com/vaadin/client/ui/image/ImageConnector.java index 1ff80bb2b6..bd906ed2be 100644 --- a/client/src/main/java/com/vaadin/client/ui/image/ImageConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/image/ImageConnector.java @@ -27,6 +27,11 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.image.ImageServerRpc; import com.vaadin.shared.ui.image.ImageState; +/** + * A connector class for the Image component. + * + * @author Vaadin Ltd + */ @Connect(com.vaadin.ui.Image.class) public class ImageConnector extends AbstractComponentConnector { @@ -63,6 +68,7 @@ public class ImageConnector extends AbstractComponentConnector { getWidget().setAltText(alt != null ? alt : ""); } + /** Click event handler for sending click data to the server. */ protected final ClickEventHandler clickEventHandler = new ClickEventHandler( this) { diff --git a/client/src/main/java/com/vaadin/client/ui/label/LabelConnector.java b/client/src/main/java/com/vaadin/client/ui/label/LabelConnector.java index ddd62bc9a5..9b0d68682c 100644 --- a/client/src/main/java/com/vaadin/client/ui/label/LabelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/label/LabelConnector.java @@ -27,6 +27,11 @@ import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.shared.ui.label.LabelState; import com.vaadin.ui.Label; +/** + * A connector class for the Label component. Eagerly loaded. + * + * @author Vaadin Ltd + */ @Connect(value = Label.class, loadStyle = LoadStyle.EAGER) public class LabelConnector extends AbstractComponentConnector { @@ -59,6 +64,10 @@ public class LabelConnector extends AbstractComponentConnector { sinkOnloads = true; widget.setHTML(getState().text); break; + default: + throw new IllegalStateException( + "A new content mode has been added without configuring handling for it: " + + getState().contentMode.name()); } Profiler.leave("LabelConnector.onStateChanged update content"); diff --git a/client/src/main/java/com/vaadin/client/ui/layout/ComponentConnectorLayoutSlot.java b/client/src/main/java/com/vaadin/client/ui/layout/ComponentConnectorLayoutSlot.java index 2a01fba81e..6fab19511c 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/ComponentConnectorLayoutSlot.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/ComponentConnectorLayoutSlot.java @@ -20,11 +20,27 @@ import com.vaadin.client.LayoutManager; import com.vaadin.client.VCaption; import com.vaadin.client.ui.ManagedLayout; +/** + * A slot class implementation for ManagedLayout cells. + * + * @author Vaadin Ltd + */ public class ComponentConnectorLayoutSlot extends VLayoutSlot { final ComponentConnector child; final ManagedLayout layout; + /** + * Constructs a slot instance for a ManagedLayout cell. + * + * @param baseClassName + * the base class name of the layout + * @param child + * the connector of the child component whose widget should be + * set to this slot, should not be {@code null} + * @param layout + * the managed layout that contains this slot + */ public ComponentConnectorLayoutSlot(String baseClassName, ComponentConnector child, ManagedLayout layout) { super(baseClassName, child.getWidget()); @@ -32,6 +48,12 @@ public class ComponentConnectorLayoutSlot extends VLayoutSlot { this.layout = layout; } + /** + * Returns the connector of the child component that has been assigned to + * this slot. + * + * @return the content connector + */ public ComponentConnector getChild() { return child; } @@ -52,6 +74,11 @@ public class ComponentConnectorLayoutSlot extends VLayoutSlot { : 0; } + /** + * Returns the layout manager for the managed layout. + * + * @return layout manager + */ public LayoutManager getLayoutManager() { return layout.getLayoutManager(); } @@ -70,11 +97,25 @@ public class ComponentConnectorLayoutSlot extends VLayoutSlot { } } + /** + * Reports the expected outer height to the LayoutManager. + * + * @param allocatedHeight + * the height to set (including margins, borders and paddings) in + * pixels + */ @Override protected void reportActualRelativeHeight(int allocatedHeight) { getLayoutManager().reportOuterHeight(child, allocatedHeight); } + /** + * Reports the expected outer width to the LayoutManager. + * + * @param allocatedWidth + * the width to set (including margins, borders and paddings) in + * pixels + */ @Override protected void reportActualRelativeWidth(int allocatedWidth) { getLayoutManager().reportOuterWidth(child, allocatedWidth); diff --git a/client/src/main/java/com/vaadin/client/ui/layout/ElementResizeEvent.java b/client/src/main/java/com/vaadin/client/ui/layout/ElementResizeEvent.java index 09727382de..a24051b184 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/ElementResizeEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/ElementResizeEvent.java @@ -18,19 +18,42 @@ package com.vaadin.client.ui.layout; import com.google.gwt.dom.client.Element; import com.vaadin.client.LayoutManager; +/** + * Event for an element resize. + * + * @author Vaadin Ltd + */ public class ElementResizeEvent { private final Element element; private final LayoutManager layoutManager; + /** + * Constructs an element resize event. + * + * @param layoutManager + * current layout manager + * @param element + * the resized element + */ public ElementResizeEvent(LayoutManager layoutManager, Element element) { this.layoutManager = layoutManager; this.element = element; } + /** + * Returns the resized element. + * + * @return the element + */ public Element getElement() { return element; } + /** + * Returns the current layout manager. + * + * @return the layout manager + */ public LayoutManager getLayoutManager() { return layoutManager; } diff --git a/client/src/main/java/com/vaadin/client/ui/layout/ElementResizeListener.java b/client/src/main/java/com/vaadin/client/ui/layout/ElementResizeListener.java index efa93db890..6173fabe1f 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/ElementResizeListener.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/ElementResizeListener.java @@ -16,6 +16,18 @@ package com.vaadin.client.ui.layout; +/** + * Event listener for element resize events. + * + * @author Vaadin Ltd + */ public interface ElementResizeListener { - public void onElementResize(ElementResizeEvent e); + + /** + * Perform actions after element resize. + * + * @param event + * the element resize event + */ + public void onElementResize(ElementResizeEvent event); } diff --git a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java index a2c30b6992..aa1c5f1b11 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java @@ -414,10 +414,33 @@ public class LayoutDependencyTree { private final ApplicationConnection connection; + /** + * Constructs a layout dependency helper class. + * + * @param connection + * the current application connection instance, should not be + * {@code null} + * + * @see LayoutDependencyTree + */ public LayoutDependencyTree(ApplicationConnection connection) { this.connection = connection; } + /** + * Informs this LayoutDependencyTree that the size of a component might have + * changed and it needs measuring in both directions, or that the measuring + * is no longer necessary. If there are blockers, measuring will be delayed + * and cannot be disabled before the blockers have been removed. + * + * @param connector + * the connector of the component whose size might have changed, + * should not be {@code null} + * @param needsMeasure + * {@code true} if measuring should be enabled, {@code false} if + * measuring should be disabled (disabling is only effective if + * there are no blockers) + */ public void setNeedsMeasure(ComponentConnector connector, boolean needsMeasure) { setNeedsHorizontalMeasure(connector, needsMeasure); @@ -426,7 +449,12 @@ public class LayoutDependencyTree { /** * @param connectorId + * the connector id of the component whose size might have + * changed * @param needsMeasure + * {@code true} if measuring should be enabled, {@code false} if + * measuring should be disabled (disabling is only effective if + * there are no blockers) * * @deprecated As of 7.4.2, use * {@link #setNeedsMeasure(ComponentConnector, boolean)} for @@ -443,12 +471,40 @@ public class LayoutDependencyTree { setNeedsMeasure(connector, needsMeasure); } + /** + * Informs this LayoutDependencyTree that the horizontal size of a component + * might have changed and it needs measuring, or that the measuring is no + * longer necessary. If there are blockers, measuring will be delayed and + * cannot be disabled before the blockers have been removed. + * + * @param connector + * the connector of the component whose horizontal size might + * have changed, should not be {@code null} + * @param needsMeasure + * {@code true} if measuring should be enabled, {@code false} if + * measuring should be disabled (disabling is only effective if + * there are no blockers) + */ public void setNeedsHorizontalMeasure(ComponentConnector connector, boolean needsMeasure) { LayoutDependency dependency = getDependency(connector, HORIZONTAL); dependency.setNeedsMeasure(needsMeasure); } + /** + * @param connectorId + * the connector id of the component whose horizontal size might + * have changed + * @param needsMeasure + * {@code true} if measuring should be enabled, {@code false} if + * measuring should be disabled (disabling is only effective if + * there are no blockers) + * + * @deprecated Use + * {@link #setNeedsHorizontalMeasure(ComponentConnector, boolean)} + * for improved performance. + */ + @Deprecated public void setNeedsHorizontalMeasure(String connectorId, boolean needsMeasure) { // Ensure connector exists @@ -461,12 +517,40 @@ public class LayoutDependencyTree { setNeedsHorizontalMeasure(connector, needsMeasure); } + /** + * Informs this LayoutDependencyTree that the vertical size of a component + * might have changed and it needs measuring, or that the measuring is no + * longer necessary. If there are blockers, measuring will be delayed and + * cannot be disabled before the blockers have been removed. + * + * @param connector + * the connector of the component whose vertical size might have + * changed, should not be {@code null} + * @param needsMeasure + * {@code true} if measuring should be enabled, {@code false} if + * measuring should be disabled (disabling is only effective if + * there are no blockers) + */ public void setNeedsVerticalMeasure(ComponentConnector connector, boolean needsMeasure) { LayoutDependency dependency = getDependency(connector, VERTICAL); dependency.setNeedsMeasure(needsMeasure); } + /** + * @param connectorId + * the connector id of the component whose vertical size might + * have changed + * @param needsMeasure + * {@code true} if measuring should be enabled, {@code false} if + * measuring should be disabled (disabling is only effective if + * there are no blockers) + * + * @deprecated Use + * {@link #setNeedsVerticalMeasure(ComponentConnector, boolean)} + * for improved performance. + */ + @Deprecated public void setNeedsVerticalMeasure(String connectorId, boolean needsMeasure) { // Ensure connector exists @@ -518,7 +602,12 @@ public class LayoutDependencyTree { /** * @param layout + * the managed layout whose horizontal size might have changed, + * should not be {@code null} * @param needsLayout + * {@code true} if layouting should be enabled, {@code false} if + * layouting should be disabled (disabling is only effective if + * there are no blockers) * * @deprecated As of 7.0.1, use * {@link #setNeedsHorizontalLayout(String, boolean)} for @@ -530,6 +619,21 @@ public class LayoutDependencyTree { setNeedsHorizontalLayout(layout.getConnectorId(), needsLayout); } + /** + * Informs this LayoutDependencyTree that the horizontal size of a managed + * layout might have changed and it needs layouting, or that the layouting + * is no longer necessary. If there are blockers, layouting will be delayed + * and cannot be disabled before the blockers have been removed. Logs a + * warning if no dependency is found. + * + * @param connectorId + * the connector id of the managed layout whose horizontal size + * might have changed + * @param needsLayout + * {@code true} if layouting should be enabled, {@code false} if + * layouting should be disabled (disabling is only effective if + * there are no blockers) + */ public void setNeedsHorizontalLayout(String connectorId, boolean needsLayout) { LayoutDependency dependency = getDependency(connectorId, HORIZONTAL); @@ -543,7 +647,12 @@ public class LayoutDependencyTree { /** * @param layout + * the managed layout whose vertical size might have changed, + * should not be {@code null} * @param needsLayout + * {@code true} if layouting should be enabled, {@code false} if + * layouting should be disabled (disabling is only effective if + * there are no blockers) * * @deprecated As of 7.0.1, use * {@link #setNeedsVerticalLayout(String, boolean)} for improved @@ -555,6 +664,21 @@ public class LayoutDependencyTree { setNeedsVerticalLayout(layout.getConnectorId(), needsLayout); } + /** + * Informs this LayoutDependencyTree that the vertical size of a managed + * layout might have changed and it needs layouting, or that the layouting + * is no longer necessary. If there are blockers, layouting will be delayed + * and cannot be disabled before the blockers have been removed. Logs a + * warning if no dependency is found. + * + * @param connectorId + * the connector id of the managed layout whose vertical size + * might have changed + * @param needsLayout + * {@code true} if layouting should be enabled, {@code false} if + * layouting should be disabled (disabling is only effective if + * there are no blockers) + */ public void setNeedsVerticalLayout(String connectorId, boolean needsLayout) { LayoutDependency dependency = getDependency(connectorId, VERTICAL); @@ -567,24 +691,68 @@ public class LayoutDependencyTree { } + /** + * Marks the managed layout as layouted horizontally and propagates the need + * of horizontal measuring for any components that might have got their size + * changed as a result. If there are blockers, nothing is done. + * + * @param layout + * the managed layout whose horizontal layouting has been done, + * should not be {@code null} + */ public void markAsHorizontallyLayouted(ManagedLayout layout) { LayoutDependency dependency = getDependency(layout.getConnectorId(), HORIZONTAL); dependency.markAsLayouted(); } + /** + * Marks the managed layout as layouted vertically and propagates the need + * of vertical measuring for any components that might have got their size + * changed as a result. If there are blockers, nothing is done. + * + * @param layout + * the managed layout whose vertical layouting has been done, + * should not be {@code null} + */ public void markAsVerticallyLayouted(ManagedLayout layout) { LayoutDependency dependency = getDependency(layout.getConnectorId(), VERTICAL); dependency.markAsLayouted(); } + /** + * Marks the component's height as changed. Iterates through all components + * whose vertical size depends on this component's size. If the dependent is + * a managed layout triggers need for vertical layouting, otherwise triggers + * need for vertical measuring for any dependent components of that + * component in turn. Finally triggers horizontal measuring for the + * scrolling boundary, in case vertical scrollbar has appeared or + * disappeared due the height change. + * + * @param connector + * the connector of the component whose height has changed, + * should not be {@code null} + */ public void markHeightAsChanged(ComponentConnector connector) { LayoutDependency dependency = getDependency(connector.getConnectorId(), VERTICAL); dependency.markSizeAsChanged(); } + /** + * Marks the component's width as changed. Iterates through all components + * whose horizontal size depends on this component's size. If the dependent + * is a managed layout triggers need for horizontal layouting, otherwise + * triggers need for horizontal measuring for any dependent components of + * that component in turn. Finally triggers vertical measuring for the + * scrolling boundary, in case horizontal scrollbar has appeared or + * disappeared due the width change. + * + * @param connector + * the connector of the component whose width has changed, should + * not be {@code null} + */ public void markWidthAsChanged(ComponentConnector connector) { LayoutDependency dependency = getDependency(connector.getConnectorId(), HORIZONTAL); @@ -641,21 +809,42 @@ public class LayoutDependencyTree { return b.toString(); } + /** + * Returns whether there are any components waiting for either horizontal or + * vertical measuring. + * + * @return {@code true} if either measure queue contains anything, + * {@code false} otherwise + */ public boolean hasConnectorsToMeasure() { return !measureQueueInDirection[HORIZONTAL].isEmpty() || !measureQueueInDirection[VERTICAL].isEmpty(); } + /** + * Returns whether there are any managed layouts waiting for horizontal + * layouting. + * + * @return {@code true} if horizontal layouting queue is not empty, + * {@code false} otherwise + */ public boolean hasHorizontalConnectorToLayout() { return !getLayoutQueue(HORIZONTAL).isEmpty(); } + /** + * Returns whether there are any managed layouts waiting for vertical + * layouting. + * + * @return {@code true} if vertical layouting queue is not empty, + * {@code false} otherwise + */ public boolean hasVerticaConnectorToLayout() { return !getLayoutQueue(VERTICAL).isEmpty(); } /** - * @return + * @return array of managed layouts waiting for horizontal layouting * @deprecated As of 7.0.1, use {@link #getHorizontalLayoutTargetsJsArray()} * for improved performance. */ @@ -665,7 +854,7 @@ public class LayoutDependencyTree { } /** - * @return + * @return array of managed layouts waiting for vertical layouting * @deprecated As of 7.0.1, use {@link #getVerticalLayoutTargetsJsArray()} * for improved performance. */ @@ -686,16 +875,28 @@ public class LayoutDependencyTree { return result; } + /** + * Returns a JsArrayString array of connectorIds for managed layouts that + * are waiting for horizontal layouting. + * + * @return JsArrayString of connectorIds + */ public JsArrayString getHorizontalLayoutTargetsJsArray() { return getLayoutQueue(HORIZONTAL).dump(); } + /** + * Returns a JsArrayString array of connectorIds for managed layouts that + * are waiting for vertical layouting. + * + * @return JsArrayString of connectorIds + */ public JsArrayString getVerticalLayoutTargetsJsArray() { return getLayoutQueue(VERTICAL).dump(); } /** - * @return + * @return connectors that are waiting for measuring * @deprecated As of 7.0.1, use {@link #getMeasureTargetsJsArray()} for * improved performance. */ @@ -713,6 +914,12 @@ public class LayoutDependencyTree { return targets; } + /** + * Returns a JsArrayString array of connectorIds for components that are + * waiting for either horizontal or vertical measuring. + * + * @return JsArrayString of connectorIds + */ public JsArrayString getMeasureTargetsJsArray() { FastStringSet allMeasuredTargets = FastStringSet.create(); allMeasuredTargets.addAll(getMeasureQueue(HORIZONTAL)); @@ -720,6 +927,13 @@ public class LayoutDependencyTree { return allMeasuredTargets.dump(); } + /** + * Logs horizontal and vertical {@link LayoutDependency} state for the given + * connector. + * + * @param connector + * the connector whose state to log, should not be {@code null} + */ public void logDependencyStatus(ComponentConnector connector) { getLogger().info("===="); String connectorId = connector.getConnectorId(); @@ -727,6 +941,15 @@ public class LayoutDependencyTree { getLogger().info(getDependency(connectorId, VERTICAL).toString()); } + /** + * Returns whether all required layouting and measuring has been done for + * this component to both directions and there are no more blockers waiting + * for handling. + * + * @param connector + * the connector to check, should not be {@code null} + * @return {@code true} if nothing is pending, {@code false} otherwise + */ public boolean noMoreChangesExpected(ComponentConnector connector) { return getDependency(connector.getConnectorId(), HORIZONTAL) .noMoreChangesExpected() @@ -734,6 +957,16 @@ public class LayoutDependencyTree { .noMoreChangesExpected(); } + /** + * Returns the scrolling boundary for this component. If a cached value is + * available, the check isn't performed again. If no cached value exists, + * iterates through the component hierarchy until the closest parent that + * implements {@link MayScrollChildren} has been found. + * + * @param connector + * the connector to check, should not be {@code null} + * @return the closest scrolling parent or {@code null} if not found + */ public ComponentConnector getScrollingBoundary( ComponentConnector connector) { LayoutDependency dependency = getDependency(connector.getConnectorId(), diff --git a/client/src/main/java/com/vaadin/client/ui/layout/Margins.java b/client/src/main/java/com/vaadin/client/ui/layout/Margins.java index 7bbb43e278..ce9cfe1261 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/Margins.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/Margins.java @@ -15,6 +15,11 @@ */ package com.vaadin.client.ui.layout; +/** + * A class for storing margin data. + * + * @author Vaadin Ltd + */ public class Margins { private int marginTop; @@ -25,6 +30,18 @@ public class Margins { private int horizontal = 0; private int vertical = 0; + /** + * Constructs an instance for storing margin data. + * + * @param marginTop + * top margin (in pixels) + * @param marginBottom + * bottom margin (in pixels) + * @param marginLeft + * left margin (in pixels) + * @param marginRight + * right margin (in pixels) + */ public Margins(int marginTop, int marginBottom, int marginLeft, int marginRight) { super(); @@ -37,54 +54,114 @@ public class Margins { updateVertical(); } + /** + * Returns the height of the top margin. + * + * @return top margin (in pixels) + */ public int getMarginTop() { return marginTop; } + /** + * Returns the height of the bottom margin. + * + * @return bottom margin (in pixels) + */ public int getMarginBottom() { return marginBottom; } + /** + * Returns the width of the left margin. + * + * @return left margin (in pixels) + */ public int getMarginLeft() { return marginLeft; } + /** + * Returns the width of the right margin. + * + * @return right margin (in pixels) + */ public int getMarginRight() { return marginRight; } + /** + * Returns the combined width of the left and the right margins. + * + * @return the sum of the left and the right margins (in pixels) + */ public int getHorizontal() { return horizontal; } + /** + * Returns the combined height of the top and the bottom margins. + * + * @return the sum of the top and the bottom margins (in pixels) + */ public int getVertical() { return vertical; } + /** + * Sets the height of the top margin. + * + * @param marginTop + * the top margin to set (in pixels) + */ public void setMarginTop(int marginTop) { this.marginTop = marginTop; updateVertical(); } + /** + * Sets the height of the bottom margin. + * + * @param marginBottom + * the bottom margin to set (in pixels) + */ public void setMarginBottom(int marginBottom) { this.marginBottom = marginBottom; updateVertical(); } + /** + * Sets the width of the left margin. + * + * @param marginLeft + * the left margin to set (in pixels) + */ public void setMarginLeft(int marginLeft) { this.marginLeft = marginLeft; updateHorizontal(); } + /** + * Sets the width of the right margin. + * + * @param marginRight + * the right margin to set (in pixels) + */ public void setMarginRight(int marginRight) { this.marginRight = marginRight; updateHorizontal(); } + /** + * Updates the combined height of the top and the bottom margins. + */ private void updateVertical() { vertical = marginTop + marginBottom; } + /** + * Updates the combined width of the left and the right margins. + */ private void updateHorizontal() { horizontal = marginLeft + marginRight; } diff --git a/client/src/main/java/com/vaadin/client/ui/layout/MayScrollChildren.java b/client/src/main/java/com/vaadin/client/ui/layout/MayScrollChildren.java index 3442f1a6a1..d6ca6f0046 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/MayScrollChildren.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/MayScrollChildren.java @@ -17,6 +17,12 @@ package com.vaadin.client.ui.layout; import com.vaadin.client.HasComponentsConnector; +/** + * An interface that indicates that the associated component or layout can have + * scrollbars if the child contents won't fit otherwise. + * + * @author Vaadin Ltd + */ public interface MayScrollChildren extends HasComponentsConnector { } diff --git a/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java b/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java index a6d43a847f..f2ff78ef3d 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java @@ -25,6 +25,11 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.VCaption; import com.vaadin.shared.ui.AlignmentInfo; +/** + * An abstract slot class for ManagedLayout cells. + * + * @author Vaadin Ltd + */ public abstract class VLayoutSlot { private final Element wrapper = Document.get().createDivElement(); @@ -35,16 +40,37 @@ public abstract class VLayoutSlot { private double expandRatio; + /** + * Constructs a slot instance for a ManagedLayout cell. + * + * @param baseClassName + * the base class name of the layout + * @param widget + * the widget that should be set to this slot, should not be + * {@code null} + */ public VLayoutSlot(String baseClassName, Widget widget) { + assert widget != null : "The slot must contain a widget!"; this.widget = widget; wrapper.setClassName(baseClassName + "-slot"); } + /** + * Returns the caption element for this slot. + * + * @return the caption element, can be {@code null} + */ public VCaption getCaption() { return caption; } + /** + * Sets the caption element for this slot. + * + * @param caption + * the caption element, can be {@code null} + */ public void setCaption(VCaption caption) { if (this.caption != null) { this.caption.removeFromParent(); @@ -60,14 +86,30 @@ public abstract class VLayoutSlot { } } + /** + * Returns the alignment data for this slot. + * + * @return the alignment data, can be {@code null} + */ public AlignmentInfo getAlignment() { return alignment; } + /** + * Returns the widget that this slot contains. + * + * @return the child widget, cannot be {@code null} + */ public Widget getWidget() { return widget; } + /** + * Sets the alignment data for this slot. + * + * @param alignment + * the alignment data, can be {@code null} + */ public void setAlignment(AlignmentInfo alignment) { this.alignment = alignment; // if alignment is something other than topLeft then we need to align @@ -77,6 +119,16 @@ public abstract class VLayoutSlot { } } + /** + * Position the slot horizontally and set the width and the right margin. + * + * @param currentLocation + * the left position for this slot + * @param allocatedSpace + * how much horizontal space is available for this slot + * @param marginRight + * the right margin this slot should have (removed if negative) + */ public void positionHorizontally(double currentLocation, double allocatedSpace, double marginRight) { Style style = wrapper.getStyle(); @@ -160,6 +212,16 @@ public abstract class VLayoutSlot { return Double.parseDouble(size.replaceAll("%", "")); } + /** + * Position the slot vertically and set the height and the bottom margin. + * + * @param currentLocation + * the top position for this slot + * @param allocatedSpace + * how much vertical space is available for this slot + * @param marginBottom + * the bottom margin this slot should have (removed if negative) + */ public void positionVertically(double currentLocation, double allocatedSpace, double marginBottom) { Style style = wrapper.getStyle(); @@ -229,14 +291,48 @@ public abstract class VLayoutSlot { } } + /** + * Override this method to report the expected outer height to the + * LayoutManager. By default does nothing. + * + * @param allocatedHeight + * the height to set (including margins, borders and paddings) in + * pixels + */ protected void reportActualRelativeHeight(int allocatedHeight) { // Default implementation does nothing } + /** + * Override this method to report the expected outer width to the + * LayoutManager. By default does nothing. + * + * @param allocatedWidth + * the width to set (including margins, borders and paddings) in + * pixels + */ protected void reportActualRelativeWidth(int allocatedWidth) { // Default implementation does nothing } + /** + * Position the slot vertically and set the height and the bottom margin, or + * horizontally and set the width and the right margin, depending on the + * indicated direction. + * + * @param currentLocation + * the top position or the left position for this slot depending + * on the indicated direction + * @param allocatedSpace + * how much space is available for this slot in the indicated + * direction + * @param endingMargin + * the bottom margin or the right margin this slot should have + * depending on the indicated direction (removed if negative) + * @param isVertical + * {@code true} if the positioning should be done vertically, + * {@code false} if horizontally + */ public void positionInDirection(double currentLocation, double allocatedSpace, double endingMargin, boolean isVertical) { if (isVertical) { @@ -246,10 +342,24 @@ public abstract class VLayoutSlot { } } + /** + * Returns the widget's height if the indicated direction is vertical, and + * width if horizontal. + * + * @param isVertical + * {@code true} if the requested dimension is height, + * {@code false} if width + * @return the widget height or width depending on the indicated direction + */ public int getWidgetSizeInDirection(boolean isVertical) { return isVertical ? getWidgetHeight() : getWidgetWidth(); } + /** + * Returns how much horizontal space the widget and its caption use. + * + * @return the width of the contents in pixels + */ public int getUsedWidth() { int widgetWidth = getWidgetWidth(); if (caption == null) { @@ -261,6 +371,11 @@ public abstract class VLayoutSlot { } } + /** + * Returns how much vertical space the widget and its caption use. + * + * @return the height of the contents in pixels + */ public int getUsedHeight() { int widgetHeight = getWidgetHeight(); if (caption == null) { @@ -272,42 +387,142 @@ public abstract class VLayoutSlot { } } + /** + * Returns how much vertical or horizontal space the widget and its caption + * use depending on the indicated direction. + * + * @param isVertical + * {@code true} if the requested dimension is height, + * {@code false} if width + * @return the height or the width of the contents in pixels + */ public int getUsedSizeInDirection(boolean isVertical) { return isVertical ? getUsedHeight() : getUsedWidth(); } + /** + * Returns the height of the caption, or zero if there is no caption. + * + * @return the height of the caption, or zero if not found + */ protected abstract int getCaptionHeight(); + /** + * Returns the width of the caption, or zero if there is no caption. + * + * @return the width of the caption, or zero if not found + */ protected abstract int getCaptionWidth(); + /** + * Returns the height of the widget, or zero if there is no caption. + * + * @return the height of the widget, or zero if not found + */ public abstract int getWidgetHeight(); + /** + * Returns the width of the widget, or zero if there is no caption. + * + * @return the width of the widget, or zero if not found + */ public abstract int getWidgetWidth(); + /** + * Returns whether the height of the widget has been set as undefined. + * + * @return {@code true} if the widget height is undefined, {@code false} + * otherwise + */ public abstract boolean isUndefinedHeight(); + /** + * Returns whether the width of the widget has been set as undefined. + * + * @return {@code true} if the widget width is undefined, {@code false} + * otherwise + */ public abstract boolean isUndefinedWidth(); + /** + * Returns whether the height or the width of the widget has been set as + * undefined depending on the indicated direction. + * + * @param isVertical + * {@code true} if the requested dimension check is about height, + * {@code false} if about width + * @return {@code true} if the widget height or the widget width is + * undefined depending on the indicated direction, {@code false} + * otherwise + */ public boolean isUndefinedInDirection(boolean isVertical) { return isVertical ? isUndefinedHeight() : isUndefinedWidth(); } + /** + * Returns whether the height of the widget has been set as relative. + * + * @return {@code true} if the widget height is relative, {@code false} + * otherwise + */ public abstract boolean isRelativeHeight(); + /** + * Returns whether the width of the widget has been set as relative. + * + * @return {@code true} if the widget width is relative, {@code false} + * otherwise + */ public abstract boolean isRelativeWidth(); + /** + * Returns whether the height or the width of the widget has been set as + * relative depending on the indicated direction. + * + * @param isVertical + * {@code true} if the requested dimension check is about height, + * {@code false} if about width + * @return {@code true} if the widget height or the widget width is relative + * depending on the indicated direction, {@code false} otherwise + */ public boolean isRelativeInDirection(boolean isVertical) { return isVertical ? isRelativeHeight() : isRelativeWidth(); } + /** + * Returns the wrapper element for the contents of this slot. + * + * @return the wrapper element + */ + @SuppressWarnings("deprecation") public com.google.gwt.user.client.Element getWrapperElement() { return DOM.asOld(wrapper); } + /** + * Set how the slot should be expanded relative to the other slots. + * + * @param expandRatio + * The ratio of the space the slot should occupy + * + * @deprecated this value isn't used for anything by default + */ + @Deprecated public void setExpandRatio(double expandRatio) { this.expandRatio = expandRatio; } + /** + * Get the expand ratio for the slot. The expand ratio describes how the + * slot should be resized compared to other slots in the layout. + * + * @return the expand ratio of the slot + * + * @see #setExpandRatio(double) + * + * @deprecated this value isn't used for anything by default + */ + @Deprecated public double getExpandRatio() { return expandRatio; } diff --git a/client/src/main/java/com/vaadin/client/ui/link/LinkConnector.java b/client/src/main/java/com/vaadin/client/ui/link/LinkConnector.java index 049fc4e5d9..75e7b424e9 100644 --- a/client/src/main/java/com/vaadin/client/ui/link/LinkConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/link/LinkConnector.java @@ -26,6 +26,11 @@ import com.vaadin.shared.ui.link.LinkConstants; import com.vaadin.shared.ui.link.LinkState; import com.vaadin.ui.Link; +/** + * A connector class for the Link component. + * + * @author Vaadin Ltd + */ @Connect(Link.class) public class LinkConnector extends AbstractComponentConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/loginform/LoginFormConnector.java b/client/src/main/java/com/vaadin/client/ui/loginform/LoginFormConnector.java index e1e813c59b..63d056bfe9 100644 --- a/client/src/main/java/com/vaadin/client/ui/loginform/LoginFormConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/loginform/LoginFormConnector.java @@ -21,7 +21,6 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; -import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.FocusWidget; import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorHierarchyChangeEvent; @@ -37,6 +36,11 @@ import com.vaadin.shared.ui.loginform.LoginFormConstants; import com.vaadin.shared.ui.loginform.LoginFormRpc; import com.vaadin.shared.ui.loginform.LoginFormState; +/** + * A connector class for the LoginForm component. + * + * @author Vaadin Ltd + */ @Connect(com.vaadin.ui.LoginForm.class) public class LoginFormConnector extends AbstractSingleComponentContainerConnector { @@ -111,8 +115,8 @@ public class LoginFormConnector || externalId.startsWith("gwt-")) { element.setId(id); } - DOM.setElementAttribute(element, "name", id); - DOM.setElementAttribute(element, "autocomplete", "on"); + element.setAttribute("name", id); + element.setAttribute("autocomplete", "on"); return textField; } else { diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java index 523dcf8b11..410eac2237 100644 --- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java @@ -234,27 +234,25 @@ public class MenuBar extends Widget implements PopupListener { final MenuItem item = findItem(DOM.eventGetTarget(event)); switch (DOM.eventGetType(event)) { - case Event.ONCLICK: { + case Event.ONCLICK: // Fire an item's command when the user clicks on it. if (item != null) { doItemAction(item, true); } break; - } - - case Event.ONMOUSEOVER: { + case Event.ONMOUSEOVER: if (item != null) { itemOver(item); } break; - } - - case Event.ONMOUSEOUT: { + case Event.ONMOUSEOUT: if (item != null) { itemOver(null); } break; - } + default: + // NOP + break; } } @@ -383,15 +381,17 @@ public class MenuBar extends Widget implements PopupListener { } } - /* + /** * Performs the action associated with the given menu item. If the item has * a popup associated with it, the popup will be shown. If it has a command * associated with it, and 'fireCommand' is true, then the command will be * fired. Popups associated with other items will be hidden. * - * @param item the item whose popup is to be shown. @param fireCommand - * <code>true</code> if the item's command should be fired, - * <code>false</code> otherwise. + * @param item + * the item whose popup is to be shown. + * @param fireCommand + * <code>true</code> if the item's command should be fired, + * <code>false</code> otherwise. */ protected void doItemAction(final MenuItem item, boolean fireCommand) { // If the given item is already showing its menu, we're done. @@ -450,6 +450,9 @@ public class MenuBar extends Widget implements PopupListener { return false; } break; + default: + // NOP + break; } return super.onEventPreview(event); @@ -498,6 +501,14 @@ public class MenuBar extends Widget implements PopupListener { } } + /** + * Moves the selection to the given item and scrolls it into view. If the + * given item is {@code null}, previous selection is removed but no + * scrolling will happen. + * + * @param item + * the item to select + */ public void selectItem(MenuItem item) { if (item == selectedItem) { scrollItemIntoView(item); @@ -578,6 +589,8 @@ public class MenuBar extends Widget implements PopupListener { * Gets the preferred height of the menu. * * @since 7.2.6 + * + * @return the preferred height */ protected int getPreferredHeight() { return table.getOffsetHeight(); diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java index 89f05de07d..6114f29f01 100644 --- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java @@ -37,6 +37,12 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.menubar.MenuBarConstants; import com.vaadin.shared.ui.menubar.MenuBarState; +/** + * A connector class for the MenuBar component. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("deprecation") @Connect(com.vaadin.ui.MenuBar.class) public class MenuBarConnector extends AbstractComponentConnector implements Paintable, SimpleManagedLayout { @@ -59,12 +65,13 @@ public class MenuBarConnector extends AbstractComponentConnector .hasAttribute(MenuBarConstants.HTML_CONTENT_ALLOWED); if (BrowserInfo.get().isAndroid() || BrowserInfo.get().isIOS()) { - // disable the auto-open on hover on devices that don't support hover. + // disable the auto-open on hover on devices that don't support + // hover. // fixes https://github.com/vaadin/framework/issues/5873 widget.openRootOnHover = false; } else { - widget.openRootOnHover = uidl - .getBooleanAttribute(MenuBarConstants.OPEN_ROOT_MENU_ON_HOWER); + widget.openRootOnHover = uidl.getBooleanAttribute( + MenuBarConstants.OPEN_ROOT_MENU_ON_HOWER); } widget.enabled = isEnabled(); @@ -148,7 +155,7 @@ public class MenuBarConnector extends AbstractComponentConnector String domId = getState().id; if (domId != null && !domId.isEmpty()) { - currentItem.getElement().setId(domId+"-"+itemId); + currentItem.getElement().setId(domId + "-" + itemId); } if (item.getChildCount() > 0) { diff --git a/client/src/main/java/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java b/client/src/main/java/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java index 3b7dc2fc1d..33f8e401aa 100644 --- a/client/src/main/java/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java @@ -30,6 +30,11 @@ import com.vaadin.shared.ui.button.ButtonServerRpc; import com.vaadin.shared.ui.button.NativeButtonState; import com.vaadin.ui.NativeButton; +/** + * A connector class for the NativeButton component. + * + * @author Vaadin Ltd + */ @Connect(NativeButton.class) public class NativeButtonConnector extends AbstractComponentConnector implements ClickHandler { diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index 3a1bcc8cf9..87473b690f 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -60,6 +60,7 @@ public abstract class AbstractOrderedLayoutConnector private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler( this) { + @SuppressWarnings("deprecation") @Override protected ComponentConnector getChildComponent( com.google.gwt.user.client.Element element) { @@ -236,6 +237,7 @@ public abstract class AbstractOrderedLayoutConnector updateInternalState(); } + @SuppressWarnings("deprecation") private void updateCaptionInternal(ComponentConnector child) { Slot slot = getWidget().getSlot(child.getWidget()); @@ -360,6 +362,7 @@ public abstract class AbstractOrderedLayoutConnector * com.vaadin.client.ui.AbstractComponentConnector#onStateChanged(com.vaadin * .client.communication.StateChangeEvent) */ + @SuppressWarnings("deprecation") @Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/CaptionPosition.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/CaptionPosition.java index 4097c95527..5cc78546b5 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/CaptionPosition.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/CaptionPosition.java @@ -20,5 +20,12 @@ package com.vaadin.client.ui.orderedlayout; * Defines where the caption should be placed. */ public enum CaptionPosition { - TOP, RIGHT, BOTTOM, LEFT + /** Caption placed to top. */ + TOP, + /** Caption placed to right. */ + RIGHT, + /** Caption placed to bottom. */ + BOTTOM, + /** Caption placed to left. */ + LEFT } diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/HorizontalLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/HorizontalLayoutConnector.java index fee7b90892..470f3b892c 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/HorizontalLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/HorizontalLayoutConnector.java @@ -23,7 +23,9 @@ import com.vaadin.ui.HorizontalLayout; /** * Connects the client widget {@link VHorizontalLayout} with the Vaadin server - * side counterpart {@link HorizontalLayout}. + * side counterpart {@link HorizontalLayout}. Eagerly loaded. + * + * @author Vaadin Ltd */ @Connect(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER) public class HorizontalLayoutConnector extends AbstractOrderedLayoutConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java index d9ae985141..420421aaaa 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java @@ -50,6 +50,7 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { // this must be set at construction time and not changed afterwards private VAbstractOrderedLayout layout; + /** The default classname for this widget. */ public static final String SLOT_CLASSNAME = "v-slot"; private Element spacer; @@ -189,10 +190,22 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { } } + /** + * Returns the caption resize listener for this slot if one has been set. + * + * @return the listener or {@code null} if not set + */ public ElementResizeListener getCaptionResizeListener() { return captionResizeListener; } + /** + * Sets the caption resize listener for this slot. + * + * @param captionResizeListener + * the listener to set, or {@code null} to remove a previously + * set listener + */ public void setCaptionResizeListener( ElementResizeListener captionResizeListener) { detachListeners(); @@ -200,10 +213,22 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { attachListeners(); } + /** + * Returns the widget resize listener for this slot if one has been set. + * + * @return the listener or {@code null} if not set + */ public ElementResizeListener getWidgetResizeListener() { return widgetResizeListener; } + /** + * Sets the widget resize listener for this slot. + * + * @param widgetResizeListener + * the listener to set, or {@code null} to remove a previously + * set listener + */ public void setWidgetResizeListener( ElementResizeListener widgetResizeListener) { detachListeners(); @@ -211,10 +236,23 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { attachListeners(); } + /** + * Returns the spacing element resize listener for this slot if one has been + * set. + * + * @return the listener or {@code null} if not set + */ public ElementResizeListener getSpacingResizeListener() { return spacingResizeListener; } + /** + * Sets the spacing element resize listener for this slot. + * + * @param spacingResizeListener + * the listener to set, or {@code null} to remove a previously + * set listener + */ public void setSpacingResizeListener( ElementResizeListener spacingResizeListener) { detachListeners(); @@ -225,6 +263,7 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { /** * Returns the alignment for the slot. * + * @return the alignment */ public AlignmentInfo getAlignment() { return alignment; @@ -339,14 +378,17 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { /** * Get the element which is added to make the spacing. * - * @return + * @return the spacing element */ + @SuppressWarnings("deprecation") public com.google.gwt.user.client.Element getSpacingElement() { return DOM.asOld(spacer); } /** * Does the slot have spacing. + * + * @return {@code true} if the slot has spacing, {@code false} otherwise */ public boolean hasSpacing() { return getSpacingElement() != null; @@ -354,6 +396,9 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { /** * Get the vertical amount in pixels of the spacing. + * + * @return the height of the spacing element or zero if this slot doesn't + * have spacing */ protected int getVerticalSpacing() { if (spacer == null) { @@ -367,7 +412,8 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { /** * Get the horizontal amount of pixels of the spacing. * - * @return + * @return the width of the spacing element or zero if this slot doesn't + * have spacing */ protected int getHorizontalSpacing() { if (spacer == null) { @@ -405,6 +451,8 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { /** * Get the position of the caption relative to the slot. + * + * @return the position */ public CaptionPosition getCaptionPosition() { return captionPosition; @@ -686,6 +734,8 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { /** * Does the slot have a caption. + * + * @return {@code true} if the slot has a caption, {@code false} otherwise */ public boolean hasCaption() { return caption != null; @@ -693,7 +743,10 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { /** * Get the slots caption element. + * + * @return the caption element or {@code null} if there is no caption */ + @SuppressWarnings("deprecation") public com.google.gwt.user.client.Element getCaptionElement() { return DOM.asOld(caption); } @@ -712,6 +765,12 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { updateRelativeSize(relativeWidth, "width"); } + /** + * Returns whether the slot's width is relative. + * + * @return {@code true} if the slot uses relative width, {@code false} if + * the slot has a static width + */ public boolean hasRelativeWidth() { return relativeWidth; } @@ -730,6 +789,12 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { updateRelativeSize(relativeHeight, "height"); } + /** + * Returns whether the slot's height is relative. + * + * @return {@code true} if the slot uses relative height, {@code false} if + * the slot has a static height + */ public boolean hasRelativeHeight() { return relativeHeight; } @@ -789,6 +854,7 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { * * @see com.google.gwt.user.client.ui.SimplePanel#getContainerElement() */ + @SuppressWarnings("deprecation") @Override protected com.google.gwt.user.client.Element getContainerElement() { if (captionWrap == null) { @@ -824,6 +890,15 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { } } + /** + * Returns whether this slot has relative size in the indicated direction. + * + * @param vertical + * {@code true} if the height should be checked, {@code false} if + * the width should be checked + * @return {@code true} if the slot's indicated dimension is relative, + * {@code false} otherwise + */ public boolean isRelativeInDirection(boolean vertical) { if (vertical) { return hasRelativeHeight(); diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index b4ccab5d77..bce175b840 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -41,11 +41,13 @@ import com.vaadin.shared.ui.MarginInfo; */ public class VAbstractOrderedLayout extends FlowPanel { + /** Spacing state. */ protected boolean spacing = false; /** For internal use only. May be removed or replaced in the future. */ public boolean vertical = true; + /** Defined height state. */ protected boolean definedHeight = false; private Map<Widget, Slot> widgetToSlot = new HashMap<>(); @@ -60,6 +62,13 @@ public class VAbstractOrderedLayout extends FlowPanel { */ private int lastExpandSize = -1; + /** + * Constructs an ordered layout widget with the indicated orientation. + * + * @param vertical + * {@code true} if the widget should be vertically oriented, + * {@code false} for horizontally oriented + */ public VAbstractOrderedLayout(boolean vertical) { this.vertical = vertical; } @@ -210,7 +219,7 @@ public class VAbstractOrderedLayout extends FlowPanel { * Remove a slot from the layout. * * @param widget - * @return + * the widget whose slot to remove */ public void removeWidget(Widget widget) { Slot slot = widgetToSlot.remove(widget); @@ -241,7 +250,7 @@ public class VAbstractOrderedLayout extends FlowPanel { * @param widget * The widget whose slot you want to get * - * @return + * @return the slot */ public Slot getSlot(Widget widget) { Slot slot = widgetToSlot.get(widget); @@ -277,7 +286,7 @@ public class VAbstractOrderedLayout extends FlowPanel { * * @param widgetElement * The element of the widget ( Same as getWidget().getElement() ) - * @return + * @return the slot, or {@code null} if not found * @deprecated As of 7.2, call or override {@link #getSlot(Element)} instead */ @Deprecated @@ -296,7 +305,7 @@ public class VAbstractOrderedLayout extends FlowPanel { * * @param widgetElement * The element of the widget ( Same as getWidget().getElement() ) - * @return + * @return the slot, or {@code null} if not found * * @since 7.2 */ @@ -317,6 +326,7 @@ public class VAbstractOrderedLayout extends FlowPanel { /** * Get the layout manager used by this layout. * + * @return the layout manager */ public LayoutManager getLayoutManager() { return layoutManager; @@ -720,9 +730,11 @@ public class VAbstractOrderedLayout extends FlowPanel { } /** - * Sets the slots style names. The style names will be prefixed with the + * Sets the slot's style names. The style names will be prefixed with the * v-slot prefix. * + * @param widget + * the widget whose slot to style * @param stylenames * The style names of the slot. */ diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VerticalLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VerticalLayoutConnector.java index d118962221..72a414937c 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VerticalLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VerticalLayoutConnector.java @@ -23,7 +23,9 @@ import com.vaadin.ui.VerticalLayout; /** * Connects the client widget {@link VVerticalLayout} with the Vaadin server - * side counterpart {@link VerticalLayout}. + * side counterpart {@link VerticalLayout}. Eagerly loaded. + * + * @author Vaadin Ltd */ @Connect(value = VerticalLayout.class, loadStyle = LoadStyle.EAGER) public class VerticalLayoutConnector extends AbstractOrderedLayoutConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java index 74b70ffd3e..7d628d1a38 100644 --- a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java @@ -39,6 +39,12 @@ import com.vaadin.shared.ui.panel.PanelServerRpc; import com.vaadin.shared.ui.panel.PanelState; import com.vaadin.ui.Panel; +/** + * A connector class for the Panel component. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("deprecation") @Connect(Panel.class) public class PanelConnector extends AbstractSingleComponentContainerConnector implements Paintable, SimpleManagedLayout, PostLayoutListener, diff --git a/client/src/main/java/com/vaadin/client/ui/passwordfield/PasswordFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/passwordfield/PasswordFieldConnector.java index c8f4612df6..ef9f952f48 100644 --- a/client/src/main/java/com/vaadin/client/ui/passwordfield/PasswordFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/passwordfield/PasswordFieldConnector.java @@ -21,6 +21,11 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.passwordfield.PasswordFieldState; import com.vaadin.ui.PasswordField; +/** + * A connector class for the PasswordField component. + * + * @author Vaadin Ltd + */ @Connect(PasswordField.class) public class PasswordFieldConnector extends TextFieldConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java b/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java index ec138d4ba5..fc459a4a49 100644 --- a/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java @@ -35,6 +35,12 @@ import com.vaadin.shared.ui.popupview.PopupViewServerRpc; import com.vaadin.shared.ui.popupview.PopupViewState; import com.vaadin.ui.PopupView; +/** + * A connector class for the PopupView component. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("deprecation") @Connect(PopupView.class) public class PopupViewConnector extends AbstractHasComponentsConnector implements PostLayoutListener, VisibilityChangeHandler { diff --git a/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java b/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java index 6a13ff4fd8..38ceb1328a 100644 --- a/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java @@ -17,16 +17,32 @@ package com.vaadin.client.ui.popupview; import com.google.gwt.event.shared.GwtEvent; +/** + * Event for popup visibility changes. + * + * @author Vaadin Ltd + */ public class VisibilityChangeEvent extends GwtEvent<VisibilityChangeHandler> { private static Type<VisibilityChangeHandler> type; private boolean visible; + /** + * Constructs a visibility change event. + * + * @param visible + * {@code true} if the popup was made visible + */ public VisibilityChangeEvent(final boolean visible) { this.visible = visible; } + /** + * Returns whether the popup is now visible or not. + * + * @return {@code true} if the popup is visible, {@code false} otherwise + */ public boolean isVisible() { return visible; } @@ -36,6 +52,11 @@ public class VisibilityChangeEvent extends GwtEvent<VisibilityChangeHandler> { return getType(); } + /** + * Returns the {@link Type} used to register this event. + * + * @return the type + */ public static Type<VisibilityChangeHandler> getType() { if (type == null) { type = new Type<>(); diff --git a/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeHandler.java b/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeHandler.java index ab653f8744..0be0da9402 100644 --- a/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeHandler.java @@ -17,7 +17,18 @@ package com.vaadin.client.ui.popupview; import com.google.gwt.event.shared.EventHandler; +/** + * Event handler for popup visibility change events. + * + * @author Vaadin Ltd + */ public interface VisibilityChangeHandler extends EventHandler { + /** + * Handle popup visibility change. + * + * @param event + * the visibility change event + */ void onVisibilityChange(VisibilityChangeEvent event); } diff --git a/client/src/main/java/com/vaadin/client/ui/progressbar/ProgressBarConnector.java b/client/src/main/java/com/vaadin/client/ui/progressbar/ProgressBarConnector.java index 8bdc9975dd..31b177ca64 100644 --- a/client/src/main/java/com/vaadin/client/ui/progressbar/ProgressBarConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/progressbar/ProgressBarConnector.java @@ -31,6 +31,9 @@ import com.vaadin.ui.ProgressBar; @Connect(ProgressBar.class) public class ProgressBarConnector extends AbstractFieldConnector { + /** + * Constructs a connector for a ProgressBar component. + */ public ProgressBarConnector() { super(); } diff --git a/client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java b/client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java index 7a79c0b42e..3daed74731 100644 --- a/client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java +++ b/client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java @@ -63,40 +63,58 @@ public class VRichTextToolbar extends Composite { */ public interface Images extends ClientBundle { + /** @return the icon for bold */ ImageResource bold(); + /** @return the icon for link creation */ ImageResource createLink(); + /** @return the icon for horizontal break */ ImageResource hr(); + /** @return the icon for indent */ ImageResource indent(); + /** @return the icon for image insert */ ImageResource insertImage(); + /** @return the icon for italic */ ImageResource italic(); + /** @return the icon for center-justification */ ImageResource justifyCenter(); + /** @return the icon for left-justification */ ImageResource justifyLeft(); + /** @return the icon for right-justification */ ImageResource justifyRight(); + /** @return the icon for ordered list */ ImageResource ol(); + /** @return the icon for indent removal */ ImageResource outdent(); + /** @return the icon for formating removal */ ImageResource removeFormat(); + /** @return the icon for link removal */ ImageResource removeLink(); + /** @return the icon for strike-through */ ImageResource strikeThrough(); + /** @return the icon for subscript */ ImageResource subscript(); + /** @return the icon for superscript */ ImageResource superscript(); + /** @return the icon for unordered list */ ImageResource ul(); + /** @return the icon for underlining */ ImageResource underline(); } @@ -106,74 +124,109 @@ public class VRichTextToolbar extends Composite { */ public interface Strings extends Constants { + /** @return the constant for black */ String black(); + /** @return the constant for blue */ String blue(); + /** @return the constant for bold */ String bold(); + /** @return the constant for color */ String color(); + /** @return the constant for link creation */ String createLink(); + /** @return the constant for font */ String font(); + /** @return the constant for green */ String green(); + /** @return the constant for horizontal break */ String hr(); + /** @return the constant for indent */ String indent(); + /** @return the constant for image insert */ String insertImage(); + /** @return the constant for italic */ String italic(); + /** @return the constant for center-justification */ String justifyCenter(); + /** @return the constant for left-justification */ String justifyLeft(); + /** @return the constant for right-justification */ String justifyRight(); + /** @return the constant for large */ String large(); + /** @return the constant for medium */ String medium(); + /** @return the constant for normal */ String normal(); + /** @return the constant for ordered list */ String ol(); + /** @return the constant for indent removal */ String outdent(); + /** @return the constant for red */ String red(); + /** @return the constant for formating removal */ String removeFormat(); + /** @return the constant for link removal */ String removeLink(); + /** @return the constant for size */ String size(); + /** @return the constant for small */ String small(); + /** @return the constant for strike-through */ String strikeThrough(); + /** @return the constant for subscript */ String subscript(); + /** @return the constant for superscript */ String superscript(); + /** @return the constant for unordered list */ String ul(); + /** @return the constant for underline */ String underline(); + /** @return the constant for white */ String white(); + /** @return the constant for extra-large */ String xlarge(); + /** @return the constant for extra-small */ String xsmall(); + /** @return the constant for extra-extra-large */ String xxlarge(); + /** @return the constant for extra-extra-small */ String xxsmall(); + /** @return the constant for yellow */ String yellow(); } @@ -274,6 +327,7 @@ public class VRichTextToolbar extends Composite { } } + @SuppressWarnings("deprecation") private native void createLinkViaJSNI( RichTextArea.ExtendedFormatter formatter, String url) /*-{ @@ -283,7 +337,7 @@ public class VRichTextToolbar extends Composite { if (wnd.getSelection) { selectedText = wnd.getSelection().toString(); } - + wnd.focus(); if (selectedText) { // Add url as the href property of the highlighted text @@ -351,6 +405,10 @@ public class VRichTextToolbar extends Composite { @SuppressWarnings("deprecation") public VRichTextToolbar(RichTextArea richText) { this.richText = richText; + // NOTE: by default there is only one formatter anymore since the + // difference was only needed to support older versions of Safari. These + // deprecated methods are only called in order to support any extended + // versions that do still implement separate formatters for some reason. basic = richText.getBasicFormatter(); extended = richText.getExtendedFormatter(); @@ -363,49 +421,67 @@ public class VRichTextToolbar extends Composite { setStyleName("gwt-RichTextToolbar"); if (basic != null) { - topPanel.add( - bold = createToggleButton(images.bold(), strings.bold())); - topPanel.add(italic = createToggleButton(images.italic(), - strings.italic())); - topPanel.add(underline = createToggleButton(images.underline(), - strings.underline())); - topPanel.add(subscript = createToggleButton(images.subscript(), - strings.subscript())); - topPanel.add(superscript = createToggleButton(images.superscript(), - strings.superscript())); - topPanel.add(justifyLeft = createPushButton(images.justifyLeft(), - strings.justifyLeft())); - topPanel.add(justifyCenter = createPushButton( - images.justifyCenter(), strings.justifyCenter())); - topPanel.add(justifyRight = createPushButton(images.justifyRight(), - strings.justifyRight())); + bold = createToggleButton(images.bold(), strings.bold()); + italic = createToggleButton(images.italic(), strings.italic()); + underline = createToggleButton(images.underline(), + strings.underline()); + subscript = createToggleButton(images.subscript(), + strings.subscript()); + superscript = createToggleButton(images.superscript(), + strings.superscript()); + justifyLeft = createPushButton(images.justifyLeft(), + strings.justifyLeft()); + justifyCenter = createPushButton(images.justifyCenter(), + strings.justifyCenter()); + justifyRight = createPushButton(images.justifyRight(), + strings.justifyRight()); + topPanel.add(bold); + topPanel.add(italic); + topPanel.add(underline); + topPanel.add(subscript); + topPanel.add(superscript); + topPanel.add(justifyLeft); + topPanel.add(justifyCenter); + topPanel.add(justifyRight); } if (extended != null) { - topPanel.add(strikethrough = createToggleButton( - images.strikeThrough(), strings.strikeThrough())); - topPanel.add(indent = createPushButton(images.indent(), - strings.indent())); - topPanel.add(outdent = createPushButton(images.outdent(), - strings.outdent())); - topPanel.add(hr = createPushButton(images.hr(), strings.hr())); - topPanel.add(ol = createPushButton(images.ol(), strings.ol())); - topPanel.add(ul = createPushButton(images.ul(), strings.ul())); - topPanel.add(insertImage = createPushButton(images.insertImage(), - strings.insertImage())); - topPanel.add(createLink = createPushButton(images.createLink(), - strings.createLink())); - topPanel.add(removeLink = createPushButton(images.removeLink(), - strings.removeLink())); - topPanel.add(removeFormat = createPushButton(images.removeFormat(), - strings.removeFormat())); + strikethrough = createToggleButton(images.strikeThrough(), + strings.strikeThrough()); + indent = createPushButton(images.indent(), strings.indent()); + outdent = createPushButton(images.outdent(), strings.outdent()); + hr = createPushButton(images.hr(), strings.hr()); + ol = createPushButton(images.ol(), strings.ol()); + ul = createPushButton(images.ul(), strings.ul()); + insertImage = createPushButton(images.insertImage(), + strings.insertImage()); + createLink = createPushButton(images.createLink(), + strings.createLink()); + removeLink = createPushButton(images.removeLink(), + strings.removeLink()); + removeFormat = createPushButton(images.removeFormat(), + strings.removeFormat()); + topPanel.add(strikethrough); + topPanel.add(indent); + topPanel.add(outdent); + topPanel.add(hr); + topPanel.add(ol); + topPanel.add(ul); + topPanel.add(insertImage); + topPanel.add(createLink); + topPanel.add(removeLink); + topPanel.add(removeFormat); } if (basic != null) { - bottomPanel.add(backColors = createColorList("Background")); - bottomPanel.add(foreColors = createColorList("Foreground")); - bottomPanel.add(fonts = createFontList()); - bottomPanel.add(fontSizes = createFontSizes()); + backColors = createColorList("Background"); + foreColors = createColorList("Foreground"); + fonts = createFontList(); + fontSizes = createFontSizes(); + bottomPanel.add(backColors); + bottomPanel.add(foreColors); + bottomPanel.add(fonts); + bottomPanel.add(fontSizes); // We only use these handlers for updating status, so don't hook // them up unless at least basic editing is supported. diff --git a/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java b/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java index 8885790f45..514b4dd360 100644 --- a/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java @@ -27,10 +27,18 @@ import com.vaadin.shared.ui.slider.SliderServerRpc; import com.vaadin.shared.ui.slider.SliderState; import com.vaadin.ui.Slider; +/** + * A connector class for the Slider component. + * + * @author Vaadin Ltd + */ @Connect(Slider.class) public class SliderConnector extends AbstractFieldConnector implements ValueChangeHandler<Double> { + /** + * RPC instance for Slider's client-to-server calls. + */ protected SliderServerRpc rpc = RpcProxy.create(SliderServerRpc.class, this); diff --git a/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java b/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java index a83be30ef1..2023b29e4d 100644 --- a/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -42,6 +42,11 @@ import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelRpc; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState.SplitterState; +/** + * An abstract connector class for the SplitPanel components. + * + * @author Vaadin Ltd + */ public abstract class AbstractSplitPanelConnector extends AbstractComponentContainerConnector implements SimpleManagedLayout { @@ -99,6 +104,7 @@ public abstract class AbstractSplitPanelConnector extends return super.shouldFireEvent(event); } + @SuppressWarnings("deprecation") @Override protected com.google.gwt.user.client.Element getRelativeToElement() { return DOM.asOld(getWidget().splitter); @@ -145,10 +151,6 @@ public abstract class AbstractSplitPanelConnector extends panel.setLocked(splitterState.locked); - // This is needed at least for cases like #3458 to take - // appearing/disappearing scrollbars into account. - getConnection().runDescendentsLayout(panel); - getLayoutManager().setNeedsLayout(this); panel.makeScrollable(); diff --git a/client/src/main/java/com/vaadin/client/ui/splitpanel/HorizontalSplitPanelConnector.java b/client/src/main/java/com/vaadin/client/ui/splitpanel/HorizontalSplitPanelConnector.java index 08e53db58e..7ff1e222c5 100644 --- a/client/src/main/java/com/vaadin/client/ui/splitpanel/HorizontalSplitPanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/splitpanel/HorizontalSplitPanelConnector.java @@ -21,6 +21,11 @@ import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.shared.ui.splitpanel.HorizontalSplitPanelState; import com.vaadin.ui.HorizontalSplitPanel; +/** + * A connector class for the HorizontalSplitPanel component. Eagerly loaded. + * + * @author Vaadin Ltd + */ @Connect(value = HorizontalSplitPanel.class, loadStyle = LoadStyle.EAGER) public class HorizontalSplitPanelConnector extends AbstractSplitPanelConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/splitpanel/VerticalSplitPanelConnector.java b/client/src/main/java/com/vaadin/client/ui/splitpanel/VerticalSplitPanelConnector.java index 000eb23cda..3bd1ae5812 100644 --- a/client/src/main/java/com/vaadin/client/ui/splitpanel/VerticalSplitPanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/splitpanel/VerticalSplitPanelConnector.java @@ -21,6 +21,11 @@ import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.shared.ui.splitpanel.VerticalSplitPanelState; import com.vaadin.ui.VerticalSplitPanel; +/** + * A connector class for the VerticalSplitPanel component. Eagerly loaded. + * + * @author Vaadin Ltd + */ @Connect(value = VerticalSplitPanel.class, loadStyle = LoadStyle.EAGER) public class VerticalSplitPanelConnector extends AbstractSplitPanelConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java index 5679701692..64315d2961 100644 --- a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java @@ -27,6 +27,12 @@ import com.vaadin.client.ui.VTabsheetBase; import com.vaadin.shared.ui.tabsheet.TabState; import com.vaadin.shared.ui.tabsheet.TabsheetState; +/** + * An abstract connector class for components that share features with a + * TabSheet. + * + * @author Vaadin Ltd + */ public abstract class TabsheetBaseConnector extends AbstractComponentContainerConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetConnector.java b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetConnector.java index 9e585c25ae..5cae1a5f76 100644 --- a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetConnector.java @@ -29,10 +29,18 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.tabsheet.TabsheetClientRpc; import com.vaadin.ui.TabSheet; +/** + * A connector class for the TabSheet component. + * + * @author Vaadin Ltd + */ @Connect(TabSheet.class) public class TabsheetConnector extends TabsheetBaseConnector implements SimpleManagedLayout, MayScrollChildren { + /** + * Constructs a connector for a TabSheet component. + */ public TabsheetConnector() { registerRpc(TabsheetClientRpc.class, () -> { for (int i = 0; i < getState().tabs.size(); ++i) { diff --git a/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java b/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java index 3504fb9dd8..b0d3adc54c 100644 --- a/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java @@ -27,6 +27,11 @@ import com.vaadin.shared.ui.textarea.TextAreaServerRpc; import com.vaadin.shared.ui.textarea.TextAreaState; import com.vaadin.ui.TextArea; +/** + * A connector class for the TextArea component. + * + * @author Vaadin Ltd + */ @Connect(TextArea.class) public class TextAreaConnector extends AbstractTextFieldConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java index 3d2dd6c3c6..52e553658e 100644 --- a/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java @@ -82,6 +82,11 @@ public abstract class AbstractTextFieldConnector extends AbstractFieldConnector } } + /** + * Returns the internal value change handler. + * + * @return the value change handler + */ protected ValueChangeHandler getValueChangeHandler() { return valueChangeHandler; } diff --git a/client/src/main/java/com/vaadin/client/ui/textfield/TextFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/textfield/TextFieldConnector.java index 6f05377159..93503de3cd 100644 --- a/client/src/main/java/com/vaadin/client/ui/textfield/TextFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/textfield/TextFieldConnector.java @@ -23,7 +23,9 @@ import com.vaadin.shared.ui.textfield.TextFieldState; import com.vaadin.ui.TextField; /** - * Connector class for TextField. + * Connector class for TextField. Eagerly loaded. + * + * @author Vaadin Ltd */ @Connect(value = TextField.class, loadStyle = LoadStyle.EAGER) public class TextFieldConnector extends AbstractTextFieldConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java b/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java index cb04519fde..7c2475dd09 100644 --- a/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java @@ -63,6 +63,9 @@ public class TreeGridConnector extends GridConnector { NONE, COLLAPSE, EXPAND } + /** + * Constructs a connector for a TreeGrid component. + */ public TreeGridConnector() { registerRpc(FocusRpc.class, (rowIndex, cellIndex) -> getWidget() .focusCell(rowIndex, cellIndex)); @@ -94,6 +97,7 @@ public class TreeGridConnector extends GridConnector { * of the column is set in a state change handler, and might not be * available when this method is executed. */ + @SuppressWarnings("unchecked") @OnStateChange("hierarchyColumnId") void updateHierarchyColumn() { if (hierarchyColumnUpdateScheduled) { @@ -398,6 +402,9 @@ public class TreeGridConnector extends GridConnector { setCollapsed(cell.getRowIndex(), true); } break; + default: + // NOP + break; } } @@ -410,7 +417,7 @@ public class TreeGridConnector extends GridConnector { } private void checkExpand() { - Range cache = ((AbstractRemoteDataSource) getDataSource()) + Range cache = ((AbstractRemoteDataSource<?>) getDataSource()) .getCachedRange(); checkExpand(cache.getStart(), cache.length()); } diff --git a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java index 93ccb44008..414fa6e97c 100644 --- a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java @@ -104,6 +104,12 @@ import com.vaadin.ui.UI; import elemental.client.Browser; +/** + * A connector class for the UI component. Eagerly loaded. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("deprecation") @Connect(value = UI.class, loadStyle = LoadStyle.EAGER) public class UIConnector extends AbstractSingleComponentContainerConnector implements Paintable, MayScrollChildren { @@ -653,6 +659,11 @@ public class UIConnector extends AbstractSingleComponentContainerConnector return connector; } + /** + * Ensure the position is calculated correctly. This method should be called + * whenever the content's height changes for any reason, in case the change + * has been between a relative and non-relative height to either direction. + */ protected void onChildSizeChange() { ComponentConnector child = getContent(); if (child == null) { @@ -674,12 +685,14 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } /** - * Checks if the given sub window is a child of this UI Connector. + * Checks if the given sub-window is a child of this UI Connector. * * @deprecated Should be replaced by a more generic mechanism for getting * non-ComponentConnector children * @param wc - * @return + * the connector of the sub-window + * @return {@code true} if the connector is found among the sub-windows, + * {@code false} otherwise */ @Deprecated public boolean hasSubWindow(WindowConnector wc) { @@ -687,10 +700,10 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } /** - * Return an iterator for current subwindows. This method is meant for - * testing purposes only. + * Return a list of current sub-windows. This method is meant for testing + * purposes only. * - * @return + * @return a list of sub-windows */ public List<WindowConnector> getSubWindows() { List<WindowConnector> windows = new ArrayList<>(); @@ -1111,8 +1124,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector .removeClassName(activeTheme); } - String oldThemeBase = getConnection().translateVaadinUri("theme://"); - activeTheme = newTheme; if (newTheme != null) { @@ -1134,11 +1145,14 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } /** - * Force a full recursive recheck of every connector's state variables. + * Force a full recursive re-check of every connector's state variables. * * @see #forceStateChange() * * @since 7.3 + * + * @param connector + * the connector which should get recursive forced state change */ protected static void forceStateChangeRecursively( AbstractConnector connector) { diff --git a/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java b/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java index 1165a1e879..ba3e03ba62 100644 --- a/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java @@ -28,10 +28,19 @@ import com.vaadin.shared.ui.upload.UploadClientRpc; import com.vaadin.shared.ui.upload.UploadState; import com.vaadin.ui.Upload; +/** + * A connector class for the Upload component. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("deprecation") @Connect(Upload.class) public class UploadConnector extends AbstractComponentConnector implements Paintable { + /** + * Constructs a connector for an Upload component. + */ public UploadConnector() { registerRpc(UploadClientRpc.class, () -> getWidget().submit()); } diff --git a/client/src/main/java/com/vaadin/client/ui/upload/UploadIFrameOnloadStrategy.java b/client/src/main/java/com/vaadin/client/ui/upload/UploadIFrameOnloadStrategy.java index c241cf9d32..dcfed73d29 100644 --- a/client/src/main/java/com/vaadin/client/ui/upload/UploadIFrameOnloadStrategy.java +++ b/client/src/main/java/com/vaadin/client/ui/upload/UploadIFrameOnloadStrategy.java @@ -17,8 +17,21 @@ package com.vaadin.client.ui.upload; import com.vaadin.client.ui.VUpload; +/** + * An IFrame onload strategy class for an Upload component. + * + * @author Vaadin Ltd + */ public class UploadIFrameOnloadStrategy { + /** + * Hooks the events to the given IFrame's onLoad event. + * + * @param iframe + * the iframe whose onLoad event should be connected + * @param upload + * the upload widget + */ public native void hookEvents(com.google.gwt.dom.client.Element iframe, VUpload upload) /*-{ diff --git a/client/src/main/java/com/vaadin/client/ui/video/VideoConnector.java b/client/src/main/java/com/vaadin/client/ui/video/VideoConnector.java index 720ce7ef26..f75afd1f54 100644 --- a/client/src/main/java/com/vaadin/client/ui/video/VideoConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/video/VideoConnector.java @@ -23,6 +23,11 @@ import com.vaadin.shared.ui.video.VideoConstants; import com.vaadin.shared.ui.video.VideoState; import com.vaadin.ui.Video; +/** + * A connector class for the Video component. + * + * @author Vaadin Ltd + */ @Connect(Video.class) public class VideoConnector extends MediaBaseConnector { diff --git a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java index d28cc77ea7..25cf4610e3 100644 --- a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java @@ -54,6 +54,12 @@ import com.vaadin.shared.ui.window.WindowMode; import com.vaadin.shared.ui.window.WindowServerRpc; import com.vaadin.shared.ui.window.WindowState; +/** + * A connector class for the Window component. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("deprecation") @Connect(value = com.vaadin.ui.Window.class) public class WindowConnector extends AbstractSingleComponentContainerConnector implements Paintable, SimpleManagedLayout, PostLayoutListener, @@ -458,6 +464,9 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector } } + /** + * Initializes or updates position from state. + */ protected void updateWindowPosition() { VWindow window = getWidget(); WindowState state = getState(); @@ -475,6 +484,9 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector } } + /** + * Updates the window state to match the current mode. + */ protected void updateWindowMode() { VWindow window = getWidget(); WindowState state = getState(); @@ -492,6 +504,9 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector window.updateContentsSize(); } + /** + * Maximizes or restores the window depending on the current mode. + */ protected void onMaximizeRestore() { WindowState state = getState(); if (state.resizable) { diff --git a/client/src/main/java/com/vaadin/client/widget/treegrid/TreeGrid.java b/client/src/main/java/com/vaadin/client/widget/treegrid/TreeGrid.java index 898a3ec02e..b9ada1ff02 100644 --- a/client/src/main/java/com/vaadin/client/widget/treegrid/TreeGrid.java +++ b/client/src/main/java/com/vaadin/client/widget/treegrid/TreeGrid.java @@ -55,7 +55,8 @@ public class TreeGrid extends Grid<JsonObject> { * Body updater that adds additional style to each row containing depth * information inside the hierarchy. */ - protected class BodyUpdater extends Grid.BodyUpdater { + protected class BodyUpdater extends Grid<JsonObject>.BodyUpdater { + @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void update(Row row, Iterable cellsToUpdate) { super.update(row, cellsToUpdate); @@ -99,6 +100,11 @@ public class TreeGrid extends Grid<JsonObject> { /** * Method for accessing the private {@link Grid#focusCell(int, int)} method * from this package. + * + * @param rowIndex + * index of row to focus + * @param columnIndex + * index (excluding hidden columns) of cell to focus */ public native void focusCell(int rowIndex, int columnIndex) /*-{ @@ -108,6 +114,11 @@ public class TreeGrid extends Grid<JsonObject> { /** * Method for accessing the private * {@link Grid#isElementInChildWidget(Element)} method from this package. + * + * @param e + * the element to check + * @return {@code true} if the element is located within a child widget of + * this TreeGrid, {@code false} otherwise. */ public native boolean isElementInChildWidget(Element e) /*-{ diff --git a/client/src/main/java/com/vaadin/client/widget/treegrid/events/TreeGridClickEvent.java b/client/src/main/java/com/vaadin/client/widget/treegrid/events/TreeGridClickEvent.java index 017a23f378..9a1e1b4398 100644 --- a/client/src/main/java/com/vaadin/client/widget/treegrid/events/TreeGridClickEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/treegrid/events/TreeGridClickEvent.java @@ -36,6 +36,7 @@ import com.vaadin.client.widgets.Grid; */ public class TreeGridClickEvent extends GridClickEvent { + /** DOM event type. */ public static final Type<GridClickHandler> TYPE = new Type<GridClickHandler>( BrowserEvents.CLICK, new TreeGridClickEvent()); diff --git a/client/src/main/java/com/vaadin/client/widget/treegrid/events/TreeGridDoubleClickEvent.java b/client/src/main/java/com/vaadin/client/widget/treegrid/events/TreeGridDoubleClickEvent.java index c6b1fe2aa6..defbe1f814 100644 --- a/client/src/main/java/com/vaadin/client/widget/treegrid/events/TreeGridDoubleClickEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/treegrid/events/TreeGridDoubleClickEvent.java @@ -36,6 +36,7 @@ import com.vaadin.client.widgets.Grid; */ public class TreeGridDoubleClickEvent extends GridDoubleClickEvent { + /** DOM event type. */ public static final Type<GridDoubleClickHandler> TYPE = new Type<>( BrowserEvents.DBLCLICK, new TreeGridDoubleClickEvent()); diff --git a/client/src/main/java/com/vaadin/client/widgets/Overlay.java b/client/src/main/java/com/vaadin/client/widgets/Overlay.java index 331165fb63..d9c2bd01c2 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Overlay.java +++ b/client/src/main/java/com/vaadin/client/widgets/Overlay.java @@ -64,9 +64,24 @@ public class Overlay extends PopupPanel { super.onAttach(); } + /** + * Data object for storing position and size information. + */ public static class PositionAndSize { private int left, top, width, height; + /** + * Constructs a data object for storing position and size information. + * + * @param left + * pixel value for left css property + * @param top + * pixel value for top css property + * @param width + * pixel value for width css property + * @param height + * pixel value for height css property + */ public PositionAndSize(int left, int top, int width, int height) { super(); setLeft(left); @@ -75,26 +90,59 @@ public class Overlay extends PopupPanel { setHeight(height); } + /** + * Returns the pixel value for left css property. + * + * @return left value + */ public int getLeft() { return left; } + /** + * Sets the pixel value for left css property. + * + * @param left + * value to set + */ public void setLeft(int left) { this.left = left; } + /** + * Returns the pixel value for top css property. + * + * @return top value + */ public int getTop() { return top; } + /** + * Sets the pixel value for top css property. + * + * @param top + * value to set + */ public void setTop(int top) { this.top = top; } + /** + * Returns the pixel value for width css property. + * + * @return width value + */ public int getWidth() { return width; } + /** + * Sets the pixel value for width css property. + * + * @param width + * value to set + */ public void setWidth(int width) { if (width < 0) { width = 0; @@ -103,10 +151,21 @@ public class Overlay extends PopupPanel { this.width = width; } + /** + * Returns the pixel value for height css property. + * + * @return height value + */ public int getHeight() { return height; } + /** + * Sets the pixel value for height css property. + * + * @param height + * value to set + */ public void setHeight(int height) { if (height < 0) { height = 0; @@ -115,6 +174,17 @@ public class Overlay extends PopupPanel { this.height = height; } + /** + * Offset the set values from center by given progress to create the + * state of a single animation frame. Each frame needs to be initialized + * from the beginning, since calling this method for a second time + * without resetting the size and position values would lead to + * incorrect end results. + * + * @param progress + * A value between 0.0 and 1.0, indicating the progress of + * the animation (0=start, 1=end). + */ public void setAnimationFromCenterProgress(double progress) { left += (int) (width * (1.0 - progress) / 2.0); top += (int) (height * (1.0 - progress) / 2.0); @@ -123,7 +193,7 @@ public class Overlay extends PopupPanel { } } - /* + /** * The z-index value from where all overlays live. This can be overridden in * any extending class. */ @@ -177,21 +247,55 @@ public class Overlay extends PopupPanel { private List<Command> runOnClose = new ArrayList<>(); + /** + * Constructs a floating popup overlay element. + * + * @see Overlay + */ public Overlay() { super(); adjustZIndex(); } + /** + * Constructs a floating popup overlay element. + * + * @param autoHide + * {@code true} if the overlay should be automatically hidden + * when the user clicks outside of it or the history token + * changes. + * + * @see Overlay + */ public Overlay(boolean autoHide) { super(autoHide); adjustZIndex(); } + /** + * Constructs a floating popup overlay element. + * + * @param autoHide + * {@code true} if the overlay should be automatically hidden + * when the user clicks outside of it or the history token + * changes. + * @param modal + * {@code true} if keyboard or mouse events that do not target + * the Overlay or its children should be ignored + * + * @see Overlay + */ public Overlay(boolean autoHide, boolean modal) { super(autoHide, modal); adjustZIndex(); } + /** + * Is there a shim iframe behind the overlay, allowing PDFs and applets to + * be covered by overlays. + * + * @return {@code true} if a shim element exists, {@code false} otherwise + */ protected boolean isShimElementEnabled() { return shimElement != null; } @@ -362,7 +466,7 @@ public class Overlay extends PopupPanel { return leftFix; } - /* + /** * A "thread local" of sorts, set temporarily so that OverlayImpl knows * which Overlay is using it, so that it can be attached to the correct * overlay container. @@ -560,6 +664,9 @@ public class Overlay extends PopupPanel { e.getStyle().setHeight(positionAndSize.getHeight(), Unit.PX); } + /** + * An {@link Animation} class for overlay resizing needs. + */ protected class ResizeAnimation extends Animation { @Override protected void onUpdate(double progress) { diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index 137f947401..0a13bab427 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -632,6 +632,14 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, return (AbstractGridExtensionState) super.getState(markAsDirty); } + /** + * Returns the internal id for given column. This id should not be + * confused with the user-defined identifier. + * + * @param column + * the column + * @return internal id of given column + */ protected String getInternalIdForColumn(Column<T, ?> column) { return getParent().getInternalIdForColumn(column); } @@ -2761,6 +2769,20 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, return beanType; } + /** + * Sends a {@link ColumnVisibilityChangeEvent} to all listeners. + * + * @param <V> + * the column value type + * @param column + * the column that changed its visibility + * @param hidden + * {@code true} if the column was hidden, {@code false} if it + * became visible + * @param userOriginated + * {@code true} if the event was triggered by an UI interaction, + * {@code false} otherwise + */ public <V> void fireColumnVisibilityChangeEvent(Column<T, V> column, boolean hidden, boolean userOriginated) { fireEvent(new ColumnVisibilityChangeEvent(this, column, hidden, diff --git a/server/src/main/java/com/vaadin/ui/TreeGrid.java b/server/src/main/java/com/vaadin/ui/TreeGrid.java index 97200ab974..c94cd3a795 100644 --- a/server/src/main/java/com/vaadin/ui/TreeGrid.java +++ b/server/src/main/java/com/vaadin/ui/TreeGrid.java @@ -164,6 +164,8 @@ public class TreeGrid<T> extends Grid<T> * @see TreeGrid#TreeGrid() * @see TreeGrid#TreeGrid(Class) * + * @param <BEAN> + * the tree grid bean type * @param propertySet * the property set implementation to use, not {@code null} * @return a new tree grid using the provided property set, not {@code null} @@ -202,7 +204,7 @@ public class TreeGrid<T> extends Grid<T> /** * This method is inherited from Grid but should never be called directly - * with a TreeGrid + * with a TreeGrid. */ @Override @Deprecated @@ -212,7 +214,7 @@ public class TreeGrid<T> extends Grid<T> /** * This method is inherited from Grid but should never be called directly - * with a TreeGrid + * with a TreeGrid. */ @Deprecated @Override @@ -344,6 +346,7 @@ public class TreeGrid<T> extends Grid<T> * @param items * the items to expand */ + @SuppressWarnings("unchecked") public void expand(T... items) { expand(Arrays.asList(items)); } @@ -434,6 +437,7 @@ public class TreeGrid<T> extends Grid<T> * @param items * the collection of items to collapse */ + @SuppressWarnings("unchecked") public void collapse(T... items) { collapse(Arrays.asList(items)); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCaptionAlignment.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCaptionAlignment.java index d9cf2bc886..dd40ca9018 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCaptionAlignment.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutCaptionAlignment.java @@ -6,6 +6,7 @@ import com.vaadin.ui.Alignment; import com.vaadin.ui.GridLayout; import com.vaadin.v7.ui.TextField; +@SuppressWarnings("deprecation") public class GridLayoutCaptionAlignment extends AbstractReindeerTestUI { @Override |