From 7f537988d31b22ee40fb0ee4b55e5b29708259d4 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Fri, 23 Jul 2021 15:41:25 +0300 Subject: 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. --- .../client/ui/AbstractComponentConnector.java | 24 +++ .../com/vaadin/client/ui/AbstractConnector.java | 18 ++ .../vaadin/client/ui/AbstractFieldConnector.java | 6 + .../client/ui/AbstractHasComponentsConnector.java | 5 + .../vaadin/client/ui/AbstractLayoutConnector.java | 5 + .../client/ui/JavaScriptComponentConnector.java | 5 + .../com/vaadin/client/ui/MediaBaseConnector.java | 5 + .../client/ui/UnknownComponentConnector.java | 22 ++ .../java/com/vaadin/client/ui/VCustomLayout.java | 44 +++- .../main/java/com/vaadin/client/ui/VEmbedded.java | 20 +- .../com/vaadin/client/ui/VUnknownComponent.java | 18 ++ .../main/java/com/vaadin/client/ui/VUpload.java | 28 ++- .../main/java/com/vaadin/client/ui/VWindow.java | 156 +++++++++++--- .../ui/absolutelayout/AbsoluteLayoutConnector.java | 1 + .../client/ui/accordion/AccordionConnector.java | 5 + .../com/vaadin/client/ui/audio/AudioConnector.java | 5 + .../ui/browserframe/BrowserFrameConnector.java | 5 + .../vaadin/client/ui/button/ButtonConnector.java | 5 + .../client/ui/checkbox/CheckBoxConnector.java | 2 +- .../colorpicker/AbstractColorPickerConnector.java | 3 +- .../ui/colorpicker/VColorPickerGradient.java | 22 +- .../client/ui/colorpicker/VColorPickerGrid.java | 15 +- .../client/ui/combobox/ComboBoxConnector.java | 5 + .../client/ui/composite/CompositeConnector.java | 2 +- .../client/ui/csslayout/CssLayoutConnector.java | 1 + .../customcomponent/CustomComponentConnector.java | 5 + .../ui/customfield/CustomFieldConnector.java | 5 + .../ui/customlayout/CustomLayoutConnector.java | 6 + .../ui/datefield/AbstractDateFieldConnector.java | 10 + .../client/ui/datefield/DateFieldConnector.java | 2 + .../ui/datefield/DateTimeFieldConnector.java | 1 + .../ui/datefield/InlineDateTimeFieldConnector.java | 1 + .../client/ui/datefield/TextualDateConnector.java | 9 + .../client/ui/embedded/EmbeddedConnector.java | 7 + .../client/ui/formlayout/FormLayoutConnector.java | 7 + .../client/ui/gridlayout/GridLayoutConnector.java | 7 + .../com/vaadin/client/ui/image/ImageConnector.java | 6 + .../com/vaadin/client/ui/label/LabelConnector.java | 9 + .../ui/layout/ComponentConnectorLayoutSlot.java | 41 ++++ .../client/ui/layout/ElementResizeEvent.java | 23 ++ .../client/ui/layout/ElementResizeListener.java | 14 +- .../client/ui/layout/LayoutDependencyTree.java | 239 ++++++++++++++++++++- .../java/com/vaadin/client/ui/layout/Margins.java | 77 +++++++ .../vaadin/client/ui/layout/MayScrollChildren.java | 6 + .../com/vaadin/client/ui/layout/VLayoutSlot.java | 215 ++++++++++++++++++ .../com/vaadin/client/ui/link/LinkConnector.java | 5 + .../client/ui/loginform/LoginFormConnector.java | 10 +- .../java/com/vaadin/client/ui/menubar/MenuBar.java | 37 ++-- .../vaadin/client/ui/menubar/MenuBarConnector.java | 15 +- .../ui/nativebutton/NativeButtonConnector.java | 5 + .../AbstractOrderedLayoutConnector.java | 3 + .../client/ui/orderedlayout/CaptionPosition.java | 9 +- .../orderedlayout/HorizontalLayoutConnector.java | 4 +- .../com/vaadin/client/ui/orderedlayout/Slot.java | 79 ++++++- .../ui/orderedlayout/VAbstractOrderedLayout.java | 22 +- .../ui/orderedlayout/VerticalLayoutConnector.java | 4 +- .../com/vaadin/client/ui/panel/PanelConnector.java | 6 + .../ui/passwordfield/PasswordFieldConnector.java | 5 + .../client/ui/popupview/PopupViewConnector.java | 6 + .../client/ui/popupview/VisibilityChangeEvent.java | 21 ++ .../ui/popupview/VisibilityChangeHandler.java | 11 + .../ui/progressbar/ProgressBarConnector.java | 3 + .../client/ui/richtextarea/VRichTextToolbar.java | 152 +++++++++---- .../vaadin/client/ui/slider/SliderConnector.java | 8 + .../ui/splitpanel/AbstractSplitPanelConnector.java | 10 +- .../splitpanel/HorizontalSplitPanelConnector.java | 5 + .../ui/splitpanel/VerticalSplitPanelConnector.java | 5 + .../client/ui/tabsheet/TabsheetBaseConnector.java | 6 + .../client/ui/tabsheet/TabsheetConnector.java | 8 + .../client/ui/textarea/TextAreaConnector.java | 5 + .../ui/textfield/AbstractTextFieldConnector.java | 5 + .../client/ui/textfield/TextFieldConnector.java | 4 +- .../client/ui/treegrid/TreeGridConnector.java | 9 +- .../java/com/vaadin/client/ui/ui/UIConnector.java | 30 ++- .../vaadin/client/ui/upload/UploadConnector.java | 9 + .../ui/upload/UploadIFrameOnloadStrategy.java | 13 ++ .../com/vaadin/client/ui/video/VideoConnector.java | 5 + .../vaadin/client/ui/window/WindowConnector.java | 15 ++ .../vaadin/client/widget/treegrid/TreeGrid.java | 13 +- .../widget/treegrid/events/TreeGridClickEvent.java | 1 + .../treegrid/events/TreeGridDoubleClickEvent.java | 1 + .../java/com/vaadin/client/widgets/Overlay.java | 111 +++++++++- server/src/main/java/com/vaadin/ui/Grid.java | 22 ++ server/src/main/java/com/vaadin/ui/TreeGrid.java | 8 +- .../gridlayout/GridLayoutCaptionAlignment.java | 1 + 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)} *

* + * @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 + * 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 getRpcProxy(Class 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 Collection 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. *

* 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("", scriptStart); scripts += html.substring(scriptStart + 1, j) + ";"; - nextPosToCheck = endOfPrevScript = j + "".length(); + endOfPrevScript = j + "".length(); + nextPosToCheck = endOfPrevScript; scriptStart = lc.indexOf(" getParameters(UIDL uidl) { Map 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. *

* 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 + * the resolution type which this field is based on (day, month, ...) + */ public abstract class AbstractDateFieldConnector> extends AbstractFieldConnector { @@ -137,6 +145,7 @@ public abstract class AbstractDateFieldConnector> widget.setDefaultDate(getDefaultValues()); } + @SuppressWarnings("rawtypes") @OnStateChange("assistiveLabels") private void updateAssistiveLabels() { if (getWidget() instanceof VAbstractPopupCalendar) { @@ -153,6 +162,7 @@ public abstract class AbstractDateFieldConnector> * 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 getWidget() { return (VAbstractPopupCalendar) super.getWidget(); @@ -179,7 +181,14 @@ public abstract class TextualDateConnectortrue if the item's command should be fired, - * false otherwise. + * @param item + * the item whose popup is to be shown. + * @param fireCommand + * true if the item's command should be fired, + * false 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 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 { private static Type 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 { return getType(); } + /** + * Returns the {@link Type} used to register this event. + * + * @return the type + */ public static Type 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 { + /** + * 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 getSubWindows() { List 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 { * 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.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 { /** * 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 { /** * 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 TYPE = new Type( 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 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 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 extends AbstractListing 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 column) { return getParent().getInternalIdForColumn(column); } @@ -2761,6 +2769,20 @@ public class Grid extends AbstractListing implements HasComponents, return beanType; } + /** + * Sends a {@link ColumnVisibilityChangeEvent} to all listeners. + * + * @param + * 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 void fireColumnVisibilityChangeEvent(Column 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 extends Grid * @see TreeGrid#TreeGrid() * @see TreeGrid#TreeGrid(Class) * + * @param + * 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 extends Grid /** * 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 extends Grid /** * 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 extends Grid * @param items * the items to expand */ + @SuppressWarnings("unchecked") public void expand(T... items) { expand(Arrays.asList(items)); } @@ -434,6 +437,7 @@ public class TreeGrid extends Grid * @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 -- cgit v1.2.3