diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-13 15:11:49 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-10-13 16:11:49 +0300 |
commit | f42e0cc6f2c8623d3acb0033222cd6360e5f521a (patch) | |
tree | 264dd788ca94754373c50b1d41fb9536b55ab757 /server | |
parent | e651d542cbef31cfc09786e1978e33915cb68a27 (diff) | |
download | vaadin-framework-f42e0cc6f2c8623d3acb0033222cd6360e5f521a.tar.gz vaadin-framework-f42e0cc6f2c8623d3acb0033222cd6360e5f521a.zip |
Fix some checkstyle warnings (#10179)
Diffstat (limited to 'server')
3 files changed, 46 insertions, 26 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractLocalDateField.java b/server/src/main/java/com/vaadin/ui/AbstractLocalDateField.java index 2584eaf6ea..84072288e5 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractLocalDateField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractLocalDateField.java @@ -48,7 +48,8 @@ public abstract class AbstractLocalDateField /** * Constructs an empty <code>AbstractLocalDateField</code> with caption. * - * @param caption the caption of the datefield. + * @param caption + * the caption of the datefield. */ public AbstractLocalDateField(String caption) { super(caption, DateResolution.DAY); @@ -58,8 +59,10 @@ public abstract class AbstractLocalDateField * Constructs a new <code>AbstractLocalDateField</code> with the given * caption and initial text contents. * - * @param caption the caption <code>String</code> for the editor. - * @param value the LocalDate value. + * @param caption + * the caption <code>String</code> for the editor. + * @param value + * the LocalDate value. */ public AbstractLocalDateField(String caption, LocalDate value) { super(caption, value, DateResolution.DAY); @@ -72,15 +75,15 @@ public abstract class AbstractLocalDateField value = LocalDate.of(1, 1, 1); } switch (resolution) { - case DAY: - return value.getDayOfMonth(); - case MONTH: - return value.getMonthValue(); - case YEAR: - return value.getYear(); - default: - assert false : "Unexpected resolution argument " + resolution; - return -1; + case DAY: + return value.getDayOfMonth(); + case MONTH: + return value.getMonthValue(); + case YEAR: + return value.getYear(); + default: + assert false : "Unexpected resolution argument " + resolution; + return -1; } } @@ -141,8 +144,11 @@ public abstract class AbstractLocalDateField @Override protected String formatDate(LocalDate value) { - if (value == null) return ""; - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT); + if (value == null) { + return ""; + } + DateTimeFormatter dateTimeFormatter = DateTimeFormatter + .ofLocalizedDate(FormatStyle.SHORT); Locale locale = getLocale(); if (locale != null) { dateTimeFormatter = dateTimeFormatter.withLocale(locale); diff --git a/server/src/main/java/com/vaadin/ui/AbstractLocalDateTimeField.java b/server/src/main/java/com/vaadin/ui/AbstractLocalDateTimeField.java index 0eca15246a..e5fad79825 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractLocalDateTimeField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractLocalDateTimeField.java @@ -168,8 +168,11 @@ public abstract class AbstractLocalDateTimeField @Override protected String formatDate(LocalDateTime value) { - if (value == null) return ""; - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT); + if (value == null) { + return ""; + } + DateTimeFormatter dateTimeFormatter = DateTimeFormatter + .ofLocalizedDateTime(FormatStyle.SHORT); Locale locale = getLocale(); if (locale != null) { dateTimeFormatter = dateTimeFormatter.withLocale(locale); diff --git a/server/src/main/java/com/vaadin/ui/Composite.java b/server/src/main/java/com/vaadin/ui/Composite.java index fcdbf4b04f..7367f4aefd 100644 --- a/server/src/main/java/com/vaadin/ui/Composite.java +++ b/server/src/main/java/com/vaadin/ui/Composite.java @@ -122,7 +122,7 @@ public class Composite extends AbstractComponent implements HasComponents { if (getCompositionRoot() != null) { return Collections.singletonList(getCompositionRoot()).iterator(); } else { - return Collections.<Component>emptyList().iterator(); + return Collections.<Component> emptyList().iterator(); } } @@ -173,7 +173,8 @@ public class Composite extends AbstractComponent implements HasComponents { @Override public String getPrimaryStyleName() { - return getRootAbstractComponentPropertyOrNull(AbstractComponent::getPrimaryStyleName); + return getRootAbstractComponentPropertyOrNull( + AbstractComponent::getPrimaryStyleName); } @Override @@ -183,24 +184,30 @@ public class Composite extends AbstractComponent implements HasComponents { private Component getRootOrThrow() { Component root = getCompositionRoot(); - if (root == null) throw new IllegalStateException("Composition root has not been set"); + if (root == null) { + throw new IllegalStateException( + "Composition root has not been set"); + } return root; } private AbstractComponent getRootAbstractComponentOrThrow() { Component root = getRootOrThrow(); if (!(root instanceof AbstractComponent)) { - throw new IllegalStateException("Composition root is not AbstractComponent"); + throw new IllegalStateException( + "Composition root is not AbstractComponent"); } return (AbstractComponent) root; } - private <T> T getRootPropertyOrNull(SerializableFunction<Component, T> getter) { + private <T> T getRootPropertyOrNull( + SerializableFunction<Component, T> getter) { Component root = getCompositionRoot(); return root == null ? null : getter.apply(root); } - private <T> T getRootAbstractComponentPropertyOrNull(SerializableFunction<AbstractComponent, T> getter) { + private <T> T getRootAbstractComponentPropertyOrNull( + SerializableFunction<AbstractComponent, T> getter) { Component root = getCompositionRoot(); if (root instanceof AbstractComponent) { return getter.apply((AbstractComponent) root); @@ -285,7 +292,8 @@ public class Composite extends AbstractComponent implements HasComponents { @Override public String getDebugId() { - return getRootAbstractComponentPropertyOrNull(AbstractComponent::getDebugId); + return getRootAbstractComponentPropertyOrNull( + AbstractComponent::getDebugId); } @Override @@ -305,7 +313,8 @@ public class Composite extends AbstractComponent implements HasComponents { @Override public boolean isCaptionAsHtml() { - return getRootAbstractComponentPropertyOrNull(AbstractComponent::isCaptionAsHtml); + return getRootAbstractComponentPropertyOrNull( + AbstractComponent::isCaptionAsHtml); } @Override @@ -335,12 +344,14 @@ public class Composite extends AbstractComponent implements HasComponents { @Override public ErrorMessage getErrorMessage() { - return getRootAbstractComponentPropertyOrNull(AbstractComponent::getErrorMessage); + return getRootAbstractComponentPropertyOrNull( + AbstractComponent::getErrorMessage); } @Override public ErrorMessage getComponentError() { - return getRootAbstractComponentPropertyOrNull(AbstractComponent::getComponentError); + return getRootAbstractComponentPropertyOrNull( + AbstractComponent::getComponentError); } @Override |