aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorSun Zhe <31067185+ZheSun88@users.noreply.github.com>2018-12-20 17:00:57 +0200
committerGitHub <noreply@github.com>2018-12-20 17:00:57 +0200
commit0cfbee6ed5663d928a31def30d111733eae93731 (patch)
tree0737483b3ca66322f9c7f4a06c2824c2d00bd26e /server/src
parent353ba29cfdefddb032122cbeae5f02f6d9de76ba (diff)
downloadvaadin-framework-0cfbee6ed5663d928a31def30d111733eae93731.tar.gz
vaadin-framework-0cfbee6ed5663d928a31def30d111733eae93731.zip
Update release note and since tag (#11386)
* Some formatting changes
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main/java/com/vaadin/ui/CheckBox.java48
-rw-r--r--server/src/main/java/com/vaadin/ui/HasStyleNames.java20
-rw-r--r--server/src/main/java/com/vaadin/ui/MenuBar.java4
-rw-r--r--server/src/test/java/com/vaadin/ui/CheckBoxTest.java51
4 files changed, 68 insertions, 55 deletions
diff --git a/server/src/main/java/com/vaadin/ui/CheckBox.java b/server/src/main/java/com/vaadin/ui/CheckBox.java
index c0e259f330..0a54db5ccf 100644
--- a/server/src/main/java/com/vaadin/ui/CheckBox.java
+++ b/server/src/main/java/com/vaadin/ui/CheckBox.java
@@ -79,7 +79,7 @@ public class CheckBox extends AbstractField<Boolean>
private final CheckBox checkBox;
- private CheckBoxInputElement(CheckBox checkBox){
+ private CheckBoxInputElement(CheckBox checkBox) {
this.checkBox = checkBox;
}
@@ -88,9 +88,11 @@ public class CheckBox extends AbstractField<Boolean>
public String getStyleName() {
// replaced String with StringBuilder
StringBuilder s = new StringBuilder();
- if (ComponentStateUtil.hasStyles(checkBox.getState(false).inputStyles)) {
- for (final Iterator<String> it = checkBox.getState(false).inputStyles
- .iterator(); it.hasNext();) {
+ if (ComponentStateUtil
+ .hasStyles(checkBox.getState(false).inputStyles)) {
+ for (final Iterator<String> it = checkBox
+ .getState(false).inputStyles.iterator(); it
+ .hasNext();) {
s.append(it.next());
if (it.hasNext()) {
s.append(" ");
@@ -124,7 +126,8 @@ public class CheckBox extends AbstractField<Boolean>
if (style == null || style.isEmpty()) {
return;
}
- if (checkBox.getState().inputStyles != null && checkBox.getState().inputStyles.contains(style)) {
+ if (checkBox.getState().inputStyles != null
+ && checkBox.getState().inputStyles.contains(style)) {
return;
}
if (style.contains(" ")) {
@@ -149,7 +152,8 @@ public class CheckBox extends AbstractField<Boolean>
if (ComponentStateUtil.hasStyles(checkBox.getState().inputStyles)) {
StringTokenizer tokenizer = new StringTokenizer(style, " ");
while (tokenizer.hasMoreTokens()) {
- checkBox.getState().inputStyles.remove(tokenizer.nextToken());
+ checkBox.getState().inputStyles
+ .remove(tokenizer.nextToken());
}
}
}
@@ -162,7 +166,7 @@ public class CheckBox extends AbstractField<Boolean>
private final CheckBox checkBox;
- private CheckBoxLabelElement(CheckBox checkBox){
+ private CheckBoxLabelElement(CheckBox checkBox) {
this.checkBox = checkBox;
}
@@ -171,9 +175,11 @@ public class CheckBox extends AbstractField<Boolean>
public String getStyleName() {
// replaced String with StringBuilder
StringBuilder s = new StringBuilder();
- if (ComponentStateUtil.hasStyles(checkBox.getState(false).labelStyles)) {
- for (final Iterator<String> it = checkBox.getState(false).labelStyles
- .iterator(); it.hasNext();) {
+ if (ComponentStateUtil
+ .hasStyles(checkBox.getState(false).labelStyles)) {
+ for (final Iterator<String> it = checkBox
+ .getState(false).labelStyles.iterator(); it
+ .hasNext();) {
s.append(it.next());
if (it.hasNext()) {
s.append(" ");
@@ -207,7 +213,8 @@ public class CheckBox extends AbstractField<Boolean>
if (style == null || style.isEmpty()) {
return;
}
- if (checkBox.getState().labelStyles != null && checkBox.getState().labelStyles.contains(style)) {
+ if (checkBox.getState().labelStyles != null
+ && checkBox.getState().labelStyles.contains(style)) {
return;
}
if (style.contains(" ")) {
@@ -232,7 +239,8 @@ public class CheckBox extends AbstractField<Boolean>
if (ComponentStateUtil.hasStyles(checkBox.getState().labelStyles)) {
StringTokenizer tokenizer = new StringTokenizer(style, " ");
while (tokenizer.hasMoreTokens()) {
- checkBox.getState().labelStyles.remove(tokenizer.nextToken());
+ checkBox.getState().labelStyles
+ .remove(tokenizer.nextToken());
}
}
}
@@ -386,28 +394,28 @@ public class CheckBox extends AbstractField<Boolean>
}
/**
- * Returns the {@link CheckBoxInputElement} element to manipulate
- * the style name of the {@code input} element of the {@link CheckBox}.
+ * Returns the {@link CheckBoxInputElement} element to manipulate the style
+ * name of the {@code input} element of the {@link CheckBox}.
*
- * @since
+ * @since 8.7
* @return the current {@link CheckBoxInputElement}, not {@code null}.
*/
public CheckBoxInputElement getInputElement() {
- if(checkBoxInputElement == null) {
+ if (checkBoxInputElement == null) {
checkBoxInputElement = new CheckBoxInputElement(this);
}
return checkBoxInputElement;
}
/**
- * Returns the {@link CheckBoxLabelElement} element to manipulate
- * the style name of the {@code label} element of the {@link CheckBox}.
+ * Returns the {@link CheckBoxLabelElement} element to manipulate the style
+ * name of the {@code label} element of the {@link CheckBox}.
*
- * @since
+ * @since 8.7
* @return the current {@link CheckBoxLabelElement}, not {@code null}.
*/
public CheckBoxLabelElement getLabelElement() {
- if(checkBoxLabelElement == null) {
+ if (checkBoxLabelElement == null) {
checkBoxLabelElement = new CheckBoxLabelElement(this);
}
return checkBoxLabelElement;
diff --git a/server/src/main/java/com/vaadin/ui/HasStyleNames.java b/server/src/main/java/com/vaadin/ui/HasStyleNames.java
index 953711b1e6..2485c57597 100644
--- a/server/src/main/java/com/vaadin/ui/HasStyleNames.java
+++ b/server/src/main/java/com/vaadin/ui/HasStyleNames.java
@@ -21,11 +21,11 @@ import java.io.Serializable;
* Implemented by components which support style names.
*
* <p>
- * Each style name will occur only once as specified and it is not
- * prefixed with the style name of the component.
+ * Each style name will occur only once as specified and it is not prefixed with
+ * the style name of the component.
* </p>
*
- * @since
+ * @since 8.7
*/
public interface HasStyleNames extends Serializable {
@@ -40,7 +40,7 @@ public interface HasStyleNames extends Serializable {
* added.
* </p>
*
- * @since
+ * @since 8.7
* @return the style name or a space-separated list of user-defined style
* names of the component
* @see #setStyleName(String)
@@ -62,7 +62,7 @@ public interface HasStyleNames extends Serializable {
* removing those defined in other layers.
* </p>
*
- * @since
+ * @since 8.7
* @param style
* the new style or styles of the component as a space-separated
* list
@@ -83,7 +83,7 @@ public interface HasStyleNames extends Serializable {
* Functionally this is equivalent to using {@link #addStyleName(String)} or
* {@link #removeStyleName(String)}
*
- * @since
+ * @since 8.7
* @param style
* the style name to be added or removed
* @param add
@@ -106,7 +106,7 @@ public interface HasStyleNames extends Serializable {
* be rendered as a HTML class name, which can be used in a CSS definition.
*
*
- * @since
+ * @since 8.7
* @param style
* the new style to be added to the component
* @see #getStyleName()
@@ -119,7 +119,7 @@ public interface HasStyleNames extends Serializable {
* Adds one or more style names to this component by using one or multiple
* parameters.
*
- * @since
+ * @since 8.7
* @param styles
* the style name or style names to be added to the component
* @see #addStyleName(String)
@@ -143,7 +143,7 @@ public interface HasStyleNames extends Serializable {
* style names defined in Vaadin or GWT can not be removed.
* </p>
*
- * @since
+ * @since 8.7
* @param style
* the style name or style names to be removed
* @see #getStyleName()
@@ -163,7 +163,7 @@ public interface HasStyleNames extends Serializable {
* style names defined in Vaadin or GWT can not be removed.
* </p>
*
- * @since
+ * @since 8.7
* @param styles
* the style name or style names to be removed
* @see #removeStyleName(String)
diff --git a/server/src/main/java/com/vaadin/ui/MenuBar.java b/server/src/main/java/com/vaadin/ui/MenuBar.java
index ce43802cc5..137e6ea522 100644
--- a/server/src/main/java/com/vaadin/ui/MenuBar.java
+++ b/server/src/main/java/com/vaadin/ui/MenuBar.java
@@ -455,7 +455,7 @@ public class MenuBar extends AbstractComponent
* {@link com.vaadin.client.ui.menubar.MenuBarConnector#updateFromUIDL(UIDL, ApplicationConnection)}
* after mouseDownEvent
*
- * @since
+ * @since 8.7
*/
public int getDelayMs() {
return getState(false).delayMs;
@@ -466,7 +466,7 @@ public class MenuBar extends AbstractComponent
* {@link com.vaadin.client.ui.menubar.MenuBarConnector#updateFromUIDL(UIDL, ApplicationConnection)}
* after mouseDownEvent
*
- * @since
+ * @since 8.7
*/
public void setDelayMs(int delayMs) {
getState().delayMs = delayMs;
diff --git a/server/src/test/java/com/vaadin/ui/CheckBoxTest.java b/server/src/test/java/com/vaadin/ui/CheckBoxTest.java
index 0fbd6fa694..c9c8b84465 100644
--- a/server/src/test/java/com/vaadin/ui/CheckBoxTest.java
+++ b/server/src/test/java/com/vaadin/ui/CheckBoxTest.java
@@ -1,10 +1,5 @@
package com.vaadin.ui;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.Ignore;
@@ -15,6 +10,11 @@ import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.checkbox.CheckBoxServerRpc;
import com.vaadin.tests.util.MockUI;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
public class CheckBoxTest {
@Test
public void initiallyFalse() {
@@ -74,32 +74,36 @@ public class CheckBoxTest {
@Test
public void getComboBoxInput() {
CheckBox cb = new CheckBox();
- assertNotNull("getInputElement should always return a element", cb.getInputElement());
+ assertNotNull("getInputElement should always return a element",
+ cb.getInputElement());
assertHasStyleNames(cb.getInputElement());
}
@Test
public void getCheckBoxLabel() {
CheckBox cb = new CheckBox();
- assertNotNull("getLabelElement should always return a element", cb.getLabelElement());
+ assertNotNull("getLabelElement should always return a element",
+ cb.getLabelElement());
assertHasStyleNames(cb.getLabelElement());
}
@Test
@Ignore("Component#setStyleName(null, false) should not throw a NPE")
public void setStyleName_null_false_throws_NPE() {
- // FIXME? - Currently it throws a NPE like the implementation in Component.java
- // waiting for other ticket that fixes the behaviour in Component.java before
+ // FIXME? - Currently it throws a NPE like the implementation in
+ // Component.java
+ // waiting for other ticket that fixes the behaviour in Component.java
+ // before
CheckBox cb = new CheckBox();
cb.getLabelElement().addStyleName("first");
cb.getLabelElement().setStyleName(null, false);
- assertEquals("Removing a null style should be ignored",
- "first", cb.getLabelElement().getStyleName());
+ assertEquals("Removing a null style should be ignored", "first",
+ cb.getLabelElement().getStyleName());
}
private void assertHasStyleNames(HasStyleNames hasStyleNames) {
- assertEquals("Given element should not have a default style name",
- "", hasStyleNames.getStyleName());
+ assertEquals("Given element should not have a default style name", "",
+ hasStyleNames.getStyleName());
hasStyleNames.addStyleName("first");
assertEquals("first", hasStyleNames.getStyleName());
@@ -109,8 +113,8 @@ public class CheckBoxTest {
"first", hasStyleNames.getStyleName());
hasStyleNames.addStyleName(null);
- assertEquals("Adding null as style should be ignored",
- "first", hasStyleNames.getStyleName());
+ assertEquals("Adding null as style should be ignored", "first",
+ hasStyleNames.getStyleName());
hasStyleNames.addStyleName("");
assertEquals("Adding an empty string as style should be ignored",
@@ -131,19 +135,19 @@ public class CheckBoxTest {
hasStyleNames.addStyleNames("third", "fourth");
assertEquals("first second third fourth", hasStyleNames.getStyleName());
- hasStyleNames.removeStyleNames("second", "fourth");
+ hasStyleNames.removeStyleNames("second", "fourth");
assertEquals("first third", hasStyleNames.getStyleName());
hasStyleNames.setStyleName(null);
- assertEquals("Setting null as style should reset them",
- "", hasStyleNames.getStyleName());
+ assertEquals("Setting null as style should reset them", "",
+ hasStyleNames.getStyleName());
hasStyleNames.setStyleName("set-style");
assertEquals("set-style", hasStyleNames.getStyleName());
hasStyleNames.setStyleName("");
- assertEquals("Setting an empty string as style should reset them",
- "", hasStyleNames.getStyleName());
+ assertEquals("Setting an empty string as style should reset them", "",
+ hasStyleNames.getStyleName());
hasStyleNames.setStyleName("set-style multiple values");
assertEquals("set-style multiple values", hasStyleNames.getStyleName());
@@ -160,11 +164,12 @@ public class CheckBoxTest {
"multiple values", hasStyleNames.getStyleName());
hasStyleNames.setStyleName(null, true);
- assertEquals("Adding a null style should be ignored",
- "multiple values", hasStyleNames.getStyleName());
+ assertEquals("Adding a null style should be ignored", "multiple values",
+ hasStyleNames.getStyleName());
hasStyleNames.setStyleName("multiple values", false);
- assertEquals("Removing all set style names should result in an empty style name",
+ assertEquals(
+ "Removing all set style names should result in an empty style name",
"", hasStyleNames.getStyleName());
hasStyleNames.setStyleName("set-style", true);