aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2021-08-23 08:49:41 +0300
committerGitHub <noreply@github.com>2021-08-23 08:49:41 +0300
commit0423bb910da10bd98ef61bb3d94069153e49f3a1 (patch)
tree746a925d043e11c8a362fc57827b0af8e6be7e24
parent7c666980c0dabcf6f3dbcd0e395b5cbdec024dc7 (diff)
downloadvaadin-framework-0423bb910da10bd98ef61bb3d94069153e49f3a1.tar.gz
vaadin-framework-0423bb910da10bd98ef61bb3d94069153e49f3a1.zip
Some Checkstyle tweaks. (#12376)
- Added and updated JavaDocs. - Formatting fixes. - Suppressed deprecation warnings.
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VPasswordField.java4
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VSlider.java7
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VTextArea.java22
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VTextField.java29
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java13
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VUI.java17
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VVerticalLayout.java1
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VVideo.java32
8 files changed, 114 insertions, 11 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VPasswordField.java b/client/src/main/java/com/vaadin/client/ui/VPasswordField.java
index 4c1df5efbf..514117d17d 100644
--- a/client/src/main/java/com/vaadin/client/ui/VPasswordField.java
+++ b/client/src/main/java/com/vaadin/client/ui/VPasswordField.java
@@ -25,8 +25,12 @@ import com.google.gwt.user.client.DOM;
*/
public class VPasswordField extends VTextField {
+ /** Default classname for this widget. */
public static final String CLASSNAME = "v-passwordfield";
+ /**
+ * Constructs a widget for a PasswordField.
+ */
public VPasswordField() {
super(DOM.createInputPassword());
setStyleName(CLASSNAME);
diff --git a/client/src/main/java/com/vaadin/client/ui/VSlider.java b/client/src/main/java/com/vaadin/client/ui/VSlider.java
index 434322c563..ba639e87f3 100644
--- a/client/src/main/java/com/vaadin/client/ui/VSlider.java
+++ b/client/src/main/java/com/vaadin/client/ui/VSlider.java
@@ -35,9 +35,16 @@ import com.vaadin.client.BrowserInfo;
import com.vaadin.client.WidgetUtil;
import com.vaadin.shared.ui.slider.SliderOrientation;
+/**
+ * Widget class for the Slider component.
+ *
+ * @author Vaadin Ltd
+ *
+ */
public class VSlider extends SimpleFocusablePanel
implements Field, HasValue<Double>, SubPartAware {
+ /** Default classname for this widget. */
public static final String CLASSNAME = "v-slider";
/**
diff --git a/client/src/main/java/com/vaadin/client/ui/VTextArea.java b/client/src/main/java/com/vaadin/client/ui/VTextArea.java
index b50bd88a04..7aab9b5cf8 100644
--- a/client/src/main/java/com/vaadin/client/ui/VTextArea.java
+++ b/client/src/main/java/com/vaadin/client/ui/VTextArea.java
@@ -34,8 +34,10 @@ import com.vaadin.client.ui.dd.DragImageModifier;
* @author Vaadin Ltd.
*
*/
+@SuppressWarnings("deprecation")
public class VTextArea extends VTextField implements DragImageModifier {
+ /** Default classname for this widget. */
public static final String CLASSNAME = "v-textarea";
private EnterDownHandler enterDownHandler = new EnterDownHandler();
@@ -56,6 +58,9 @@ public class VTextArea extends VTextField implements DragImageModifier {
}
}
+ /**
+ * Constructs a widget for a TextArea.
+ */
public VTextArea() {
super(DOM.createTextArea());
setStyleName(CLASSNAME);
@@ -63,14 +68,31 @@ public class VTextArea extends VTextField implements DragImageModifier {
getElement().getStyle().setOverflowX(Overflow.HIDDEN);
}
+ /**
+ * Gets the base TextAreaElement of this widget.
+ *
+ * @return the base element
+ */
public TextAreaElement getTextAreaElement() {
return super.getElement().cast();
}
+ /**
+ * Sets the number of text rows that should be displayed.
+ *
+ * @param rows
+ * the number of text rows
+ */
public void setRows(int rows) {
getTextAreaElement().setRows(rows);
}
+ /**
+ * Sets whether the words should wrap or not.
+ *
+ * @param wordWrap
+ * {@code true} if the words should wrap, {@code false} otherwise
+ */
public void setWordWrap(boolean wordWrap) {
if (wordWrap == this.wordWrap) {
return;
diff --git a/client/src/main/java/com/vaadin/client/ui/VTextField.java b/client/src/main/java/com/vaadin/client/ui/VTextField.java
index 5b029178e7..0d92be2c8d 100644
--- a/client/src/main/java/com/vaadin/client/ui/VTextField.java
+++ b/client/src/main/java/com/vaadin/client/ui/VTextField.java
@@ -33,13 +33,28 @@ import com.google.gwt.user.client.ui.TextBoxBase;
public class VTextField extends TextBoxBase
implements Field, FocusHandler, BlurHandler, AbstractTextFieldWidget {
+ /** Default classname for this widget. */
public static final String CLASSNAME = "v-textfield";
+ /**
+ * Classname suffix for this widget when focused.
+ *
+ * @see #addStyleDependentName(String)
+ */
public static final String CLASSNAME_FOCUS = "focus";
+ /**
+ * Constructs a widget for a TextField.
+ */
public VTextField() {
this(DOM.createInputText());
}
+ /**
+ * Constructs a text entry widget that wraps the given input element.
+ *
+ * @param node
+ * the input element to wrap
+ */
protected VTextField(Element node) {
super(node);
setStyleName(CLASSNAME);
@@ -47,6 +62,13 @@ public class VTextField extends TextBoxBase
addBlurHandler(this);
}
+ /**
+ * Sets the {@code maxLength} Integer property for this widget's base
+ * element. If the given value is negative, the property is removed.
+ *
+ * @param maxLength
+ * the new maximum length
+ */
public void setMaxLength(int maxLength) {
if (maxLength >= 0) {
getElement().setPropertyInt("maxLength", maxLength);
@@ -55,6 +77,13 @@ public class VTextField extends TextBoxBase
}
}
+ /**
+ * Sets the {@code placeholder} String property for this widget's base
+ * element. If the given value is {@code null}, the property is removed.
+ *
+ * @param placeholder
+ * the new placeholder text
+ */
public void setPlaceholder(String placeholder) {
if (placeholder != null) {
getElement().setAttribute("placeholder", placeholder);
diff --git a/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java b/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java
index d54fd28a00..48b7535e68 100644
--- a/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java
+++ b/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java
@@ -38,7 +38,6 @@ import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
@@ -351,7 +350,7 @@ public class VTwinColSelect extends Composite implements MultiSelectWidget,
listBox.setItemSelected(i, isSelected);
if (isSelected) {
// Ensure that last selected item is visible
- scrollToView(listBox,i);
+ scrollToView(listBox, i);
}
}
// remove extra
@@ -364,9 +363,11 @@ public class VTwinColSelect extends Composite implements MultiSelectWidget,
if (scheduledScrollToItem == -1) {
scheduledScrollToItem = i;
Scheduler.get().scheduleDeferred(() -> {
- Element el = (Element) listBox.getElement().getChild(scheduledScrollToItem);
- el.scrollIntoView();
- scheduledScrollToItem = -1;
+ @SuppressWarnings("deprecation")
+ com.google.gwt.user.client.Element el = (com.google.gwt.user.client.Element) listBox
+ .getElement().getChild(scheduledScrollToItem);
+ el.scrollIntoView();
+ scheduledScrollToItem = -1;
});
} else {
scheduledScrollToItem = i;
@@ -684,6 +685,7 @@ public class VTwinColSelect extends Composite implements MultiSelectWidget,
}
+ @SuppressWarnings("deprecation")
@Override
public com.google.gwt.user.client.Element getSubPartElement(
String subPart) {
@@ -715,6 +717,7 @@ public class VTwinColSelect extends Composite implements MultiSelectWidget,
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/VUI.java b/client/src/main/java/com/vaadin/client/ui/VUI.java
index 20c43d1b9e..9ac94830c6 100644
--- a/client/src/main/java/com/vaadin/client/ui/VUI.java
+++ b/client/src/main/java/com/vaadin/client/ui/VUI.java
@@ -42,6 +42,12 @@ import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler;
import com.vaadin.client.ui.ui.UIConnector;
import com.vaadin.shared.ApplicationConstants;
+/**
+ * Widget class for the UI.
+ *
+ * @author Vaadin Ltd
+ *
+ */
public class VUI extends SimplePanel implements ResizeHandler,
Window.ClosingHandler, ShortcutActionHandlerOwner, Focusable,
com.google.gwt.user.client.ui.Focusable, HasResizeHandlers,
@@ -97,6 +103,9 @@ public class VUI extends SimplePanel implements ResizeHandler,
private Element storedFocus;
+ /**
+ * Constructs a widget for an UI.
+ */
public VUI() {
super();
// Allow focusing the view by using the focus() method, the view
@@ -319,6 +328,14 @@ public class VUI extends SimplePanel implements ResizeHandler,
Profiler.leave("VUI.sendClientResized");
}
+ /**
+ *
+ * Opens the given URL in the current browser window. If this UI needs to be
+ * closed as a result it should be handled separately.
+ *
+ * @param url
+ * the URL to navigate to
+ */
public static native void goTo(String url)
/*-{
$wnd.location = url;
diff --git a/client/src/main/java/com/vaadin/client/ui/VVerticalLayout.java b/client/src/main/java/com/vaadin/client/ui/VVerticalLayout.java
index 2c3c8c2c19..e4472988e2 100644
--- a/client/src/main/java/com/vaadin/client/ui/VVerticalLayout.java
+++ b/client/src/main/java/com/vaadin/client/ui/VVerticalLayout.java
@@ -23,6 +23,7 @@ import com.vaadin.client.ui.orderedlayout.VAbstractOrderedLayout;
*/
public class VVerticalLayout extends VAbstractOrderedLayout {
+ /** Default classname for this widget. */
public static final String CLASSNAME = "v-verticallayout";
/**
diff --git a/client/src/main/java/com/vaadin/client/ui/VVideo.java b/client/src/main/java/com/vaadin/client/ui/VVideo.java
index 7d78ace327..692a5cb7f0 100644
--- a/client/src/main/java/com/vaadin/client/ui/VVideo.java
+++ b/client/src/main/java/com/vaadin/client/ui/VVideo.java
@@ -22,12 +22,22 @@ import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.VideoElement;
import com.vaadin.client.Util;
+/**
+ * Widget class for the Video component.
+ *
+ * @author Vaadin Ltd
+ *
+ */
public class VVideo extends VMediaBase {
+ /** Default classname for this widget. */
public static String CLASSNAME = "v-video";
private VideoElement video;
+ /**
+ * Constructs a widget for the Video component.
+ */
public VVideo() {
video = Document.get().createVideoElement();
setMediaElement(video);
@@ -41,6 +51,7 @@ public class VVideo extends VMediaBase {
* video metadata has been loaded.
*
* @param el
+ * the root element of this widget
*/
private native void updateDimensionsWhenMetadataLoaded(Element el)
/*-{
@@ -48,21 +59,30 @@ public class VVideo extends VMediaBase {
el.addEventListener('loadedmetadata', $entry(function(e) {
self.@com.vaadin.client.ui.VVideo::updateElementDynamicSize(II)(el.videoWidth, el.videoHeight);
}), false);
-
+
}-*/;
/**
* Updates the dimensions of the widget.
*
- * @param w
- * @param h
+ * @param width
+ * width to set (in pixels)
+ * @param height
+ * height to set (in pixels)
*/
- private void updateElementDynamicSize(int w, int h) {
- video.getStyle().setWidth(w, Unit.PX);
- video.getStyle().setHeight(h, Unit.PX);
+ @SuppressWarnings("deprecation")
+ private void updateElementDynamicSize(int width, int height) {
+ video.getStyle().setWidth(width, Unit.PX);
+ video.getStyle().setHeight(height, Unit.PX);
Util.notifyParentOfSizeChange(this, true);
}
+ /**
+ * Sets the poster URL.
+ *
+ * @param poster
+ * the poster image URL
+ */
public void setPoster(String poster) {
video.setPoster(poster);
}