diff options
7 files changed, 55 insertions, 37 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VContextMenu.java b/client/src/main/java/com/vaadin/client/ui/VContextMenu.java index fec956270e..d9feb6193f 100644 --- a/client/src/main/java/com/vaadin/client/ui/VContextMenu.java +++ b/client/src/main/java/com/vaadin/client/ui/VContextMenu.java @@ -293,12 +293,9 @@ public class VContextMenu extends VOverlay implements SubPartAware { com.google.gwt.user.client.Element subElement) { if (getElement().isOrHasChild(subElement)) { com.google.gwt.dom.client.Element e = subElement; - { - while (e != null - && !e.getTagName().toLowerCase().equals("tr")) { - e = e.getParentElement(); - // ApplicationConnection.getConsole().log("Found row"); - } + while (e != null && !e.getTagName().toLowerCase().equals("tr")) { + e = e.getParentElement(); + // ApplicationConnection.getConsole().log("Found row"); } com.google.gwt.dom.client.TableSectionElement parentElement = (TableSectionElement) e .getParentElement(); diff --git a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java index 432f44fe05..293206760d 100644 --- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java @@ -697,8 +697,7 @@ public class VMenuBar extends SimpleFocusablePanel * @param item */ public void hideChildMenu(CustomMenuItem item) { - if (visibleChildMenu != null - && !(visibleChildMenu == item.getSubMenu())) { + if (visibleChildMenu != null && visibleChildMenu != item.getSubMenu()) { popup.hide(); } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/textfield/TextFieldConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/textfield/TextFieldConnector.java index 18e1361352..15037d4b50 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/textfield/TextFieldConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/textfield/TextFieldConnector.java @@ -88,7 +88,7 @@ public class TextFieldConnector extends AbstractFieldConnector * side value). <input> is updated only when it looses focus, so we * force updating if not focused. Lost focus issue appeared in (#15144) */ - if (!(Util.getFocusedElement() == getWidget().getElement()) + if (Util.getFocusedElement() != getWidget().getElement() || !uidl.getBooleanAttribute( TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) || getWidget().valueBeforeEdit == null 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 diff --git a/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java b/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java index adbde7d798..6f57c395d4 100644 --- a/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java +++ b/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java @@ -67,8 +67,9 @@ public class VaadinResourceTrackerComponent { BundleContext context = bundle.getBundleContext(); OsgiVaadinTheme theme = context.getService(themeRef); - if (theme == null) + if (theme == null) { return; + } VaadinResourceService resourceService = OsgiVaadinResources .getService(); @@ -105,8 +106,9 @@ public class VaadinResourceTrackerComponent { BundleContext context = bundle.getBundleContext(); OsgiVaadinWidgetset widgetset = context.getService(widgetsetRef); - if (widgetset == null) + if (widgetset == null) { return; + } VaadinResourceService service = OsgiVaadinResources.getService(); try { |