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