Browse Source

Some Checkstyle tweaks. (#12376)

- Added and updated JavaDocs.
- Formatting fixes.
- Suppressed deprecation warnings.
tags/8.14.0.beta1
Anna Koskinen 2 years ago
parent
commit
0423bb910d
No account linked to committer's email address

+ 4
- 0
client/src/main/java/com/vaadin/client/ui/VPasswordField.java View File

@@ -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);

+ 7
- 0
client/src/main/java/com/vaadin/client/ui/VSlider.java View File

@@ -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";

/**

+ 22
- 0
client/src/main/java/com/vaadin/client/ui/VTextArea.java View File

@@ -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;

+ 29
- 0
client/src/main/java/com/vaadin/client/ui/VTextField.java View File

@@ -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);

+ 8
- 5
client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java View File

@@ -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) {

+ 17
- 0
client/src/main/java/com/vaadin/client/ui/VUI.java View File

@@ -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;

+ 1
- 0
client/src/main/java/com/vaadin/client/ui/VVerticalLayout.java View File

@@ -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";

/**

+ 26
- 6
client/src/main/java/com/vaadin/client/ui/VVideo.java View File

@@ -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);
}

Loading…
Cancel
Save