@@ -46,6 +46,15 @@ | |||
<build> | |||
<plugins> | |||
<plugin> | |||
<groupId>net.revelc.code.formatter</groupId> | |||
<artifactId>formatter-maven-plugin</artifactId> | |||
</plugin> | |||
<plugin> | |||
<groupId>com.github.dantwining.whitespace-maven-plugin</groupId> | |||
<artifactId>whitespace-maven-plugin</artifactId> | |||
</plugin> | |||
<plugin> | |||
<artifactId>maven-resources-plugin</artifactId> | |||
<executions> |
@@ -147,17 +147,15 @@ public class ApplicationConfiguration implements EntryPoint { | |||
}-*/; | |||
/** | |||
* Reads a configuration parameter as an {@link Element} object. | |||
* Please note | |||
* that the javascript value of the parameter should also be an Element | |||
* object, | |||
* or else an undefined exception may be thrown when calling this method | |||
* or methods on the returned object. | |||
* Reads a configuration parameter as an {@link Element} object. Please | |||
* note that the javascript value of the parameter should also be an | |||
* Element object, or else an undefined exception may be thrown when | |||
* calling this method or methods on the returned object. | |||
* | |||
* @param name | |||
* name of the configuration parameter | |||
* @return element for the configuration parameter, or <code>null</code> if no | |||
* value is defined | |||
* name of the configuration parameter | |||
* @return element for the configuration parameter, or <code>null</code> | |||
* if no value is defined | |||
* @since 8.4 | |||
*/ | |||
private native Element getConfigElement(String name) |
@@ -263,8 +263,8 @@ public class ComputedStyle { | |||
* | |||
* @param String | |||
* a value starting with a number | |||
* @return the value from the string before any non-numeric characters. | |||
* If the value cannot be parsed to a number, returns 0. | |||
* @return the value from the string before any non-numeric characters. If | |||
* the value cannot be parsed to a number, returns 0. | |||
*/ | |||
private static native int parseIntNative(final String value) | |||
/*-{ |
@@ -41,9 +41,9 @@ public interface HasChildMeasurementHintConnector | |||
/** | |||
* Measure child component only if child component is an | |||
* {@link com.vaadin.client.ui.AbstractLayoutConnector AbstractLayoutConnector} | |||
* or implements either {@link ManagedLayout} or | |||
* {@link ElementResizeListener}. | |||
* {@link com.vaadin.client.ui.AbstractLayoutConnector | |||
* AbstractLayoutConnector} or implements either {@link ManagedLayout} | |||
* or {@link ElementResizeListener}. | |||
*/ | |||
MEASURE_IF_NEEDED, | |||
@@ -64,7 +64,7 @@ public class VErrorMessage extends FlowPanel { | |||
* all previous style names. | |||
* | |||
* @param errorLevel | |||
* error level | |||
* error level | |||
* @since 8.2 | |||
*/ | |||
public void updateErrorLevel(ErrorLevel errorLevel) { |
@@ -83,10 +83,9 @@ public class WidgetSet { | |||
return connector; | |||
} | |||
} catch (NoDataException e) { | |||
throw new IllegalStateException( | |||
"There is no information about " + classType | |||
+ ". Did you remember to compile the right widgetset?", | |||
e); | |||
throw new IllegalStateException("There is no information about " | |||
+ classType | |||
+ ". Did you remember to compile the right widgetset?", e); | |||
} finally { | |||
Profiler.leave("WidgetSet.createConnector"); | |||
} |
@@ -53,7 +53,7 @@ public class WidgetUtil { | |||
/** | |||
* Simple object to store another object. | |||
* | |||
* | |||
* @param <T> | |||
* the object type to store | |||
* @since 8.4 | |||
@@ -64,7 +64,7 @@ public class WidgetUtil { | |||
/** | |||
* Gets the current object. | |||
* | |||
* | |||
* @return the stored object | |||
*/ | |||
public T get() { | |||
@@ -73,7 +73,7 @@ public class WidgetUtil { | |||
/** | |||
* Sets the current object. | |||
* | |||
* | |||
* @param reference | |||
* the object to store | |||
*/ | |||
@@ -809,7 +809,7 @@ public class WidgetUtil { | |||
com.google.gwt.dom.client.Element el, String p) | |||
/*-{ | |||
try { | |||
if (el.currentStyle) { | |||
// IE | |||
return el.currentStyle[p]; | |||
@@ -824,7 +824,7 @@ public class WidgetUtil { | |||
} catch (e) { | |||
return ""; | |||
} | |||
}-*/; | |||
/** | |||
@@ -838,7 +838,7 @@ public class WidgetUtil { | |||
try { | |||
el.focus(); | |||
} catch (e) { | |||
} | |||
}-*/; | |||
@@ -1191,7 +1191,7 @@ public class WidgetUtil { | |||
if ($wnd.document.activeElement) { | |||
return $wnd.document.activeElement; | |||
} | |||
return null; | |||
}-*/; | |||
@@ -1262,11 +1262,11 @@ public class WidgetUtil { | |||
/*-{ | |||
var top = elem.offsetTop; | |||
var height = elem.offsetHeight; | |||
if (elem.parentNode != elem.offsetParent) { | |||
top -= elem.parentNode.offsetTop; | |||
} | |||
var cur = elem.parentNode; | |||
while (cur && (cur.nodeType == 1)) { | |||
if (top < cur.scrollTop) { | |||
@@ -1275,12 +1275,12 @@ public class WidgetUtil { | |||
if (top + height > cur.scrollTop + cur.clientHeight) { | |||
cur.scrollTop = (top + height) - cur.clientHeight; | |||
} | |||
var offsetTop = cur.offsetTop; | |||
if (cur.parentNode != cur.offsetParent) { | |||
offsetTop -= cur.parentNode.offsetTop; | |||
} | |||
top += offsetTop - cur.scrollTop; | |||
cur = cur.parentNode; | |||
} | |||
@@ -1729,7 +1729,7 @@ public class WidgetUtil { | |||
} | |||
var heightWithoutBorder = cloneElement.offsetHeight; | |||
parentElement.removeChild(cloneElement); | |||
return heightWithBorder - heightWithoutBorder; | |||
} | |||
}-*/; |
@@ -149,16 +149,15 @@ public class AtmospherePushConnection implements PushConnection { | |||
final PushConfigurationState pushConfiguration) { | |||
this.connection = connection; | |||
connection.addHandler(ApplicationStoppedEvent.TYPE, | |||
event -> { | |||
if (state == State.DISCONNECT_PENDING | |||
|| state == State.DISCONNECTED) { | |||
return; | |||
} | |||
disconnect(() -> { | |||
}); | |||
}); | |||
connection.addHandler(ApplicationStoppedEvent.TYPE, event -> { | |||
if (state == State.DISCONNECT_PENDING | |||
|| state == State.DISCONNECTED) { | |||
return; | |||
} | |||
disconnect(() -> { | |||
}); | |||
}); | |||
config = createConfig(); | |||
String debugParameter = Location.getParameter("debug"); | |||
if ("push".equals(debugParameter)) { |
@@ -92,16 +92,14 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { | |||
public void setConnection(ApplicationConnection connection) { | |||
this.connection = connection; | |||
connection.addHandler(ApplicationStoppedEvent.TYPE, | |||
event -> { | |||
if (isReconnecting()) { | |||
giveUp(); | |||
} | |||
if (scheduledReconnect != null | |||
&& scheduledReconnect.isRunning()) { | |||
scheduledReconnect.cancel(); | |||
} | |||
}); | |||
connection.addHandler(ApplicationStoppedEvent.TYPE, event -> { | |||
if (isReconnecting()) { | |||
giveUp(); | |||
} | |||
if (scheduledReconnect != null && scheduledReconnect.isRunning()) { | |||
scheduledReconnect.cancel(); | |||
} | |||
}); | |||
// Allow dialog to cache needed resources to make them available when we | |||
// are offline |
@@ -58,10 +58,9 @@ public class RpcManager { | |||
method.invoke(clientRpc, invocation.getParameters()); | |||
} | |||
} catch (NoDataException e) { | |||
throw new IllegalStateException( | |||
"There is no information about " + method.getSignature() | |||
+ ". Did you remember to compile the right widgetset?", | |||
e); | |||
throw new IllegalStateException("There is no information about " | |||
+ method.getSignature() | |||
+ ". Did you remember to compile the right widgetset?", e); | |||
} | |||
} | |||
@@ -92,10 +91,9 @@ public class RpcManager { | |||
Type[] parameterTypes = method.getParameterTypes(); | |||
return parameterTypes; | |||
} catch (NoDataException e) { | |||
throw new IllegalStateException( | |||
"There is no information about " + method.getSignature() | |||
+ ". Did you remember to compile the right widgetset?", | |||
e); | |||
throw new IllegalStateException("There is no information about " | |||
+ method.getSignature() | |||
+ ". Did you remember to compile the right widgetset?", e); | |||
} | |||
} | |||
@@ -21,8 +21,8 @@ import com.google.gwt.http.client.Response; | |||
import elemental.json.JsonObject; | |||
/** | |||
* XhrConnectionError provides detail about an error which occurred during | |||
* an XHR request to the server. | |||
* XhrConnectionError provides detail about an error which occurred during an | |||
* XHR request to the server. | |||
* | |||
* @since 7.6 | |||
* @author Vaadin Ltd |
@@ -46,11 +46,11 @@ public class HierarchicalDataCommunicatorConnector | |||
*/ | |||
JsonObject hierarchyData = newRowData.getObject( | |||
HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION); | |||
if (!hierarchyData.hasKey(HierarchicalDataCommunicatorConstants.ROW_DEPTH)) { | |||
if (!hierarchyData | |||
.hasKey(HierarchicalDataCommunicatorConstants.ROW_DEPTH)) { | |||
hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_DEPTH, | |||
oldRowData | |||
.getObject( | |||
HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) | |||
oldRowData.getObject( | |||
HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) | |||
.getNumber( | |||
HierarchicalDataCommunicatorConstants.ROW_DEPTH)); | |||
} |
@@ -25,12 +25,13 @@ import elemental.json.JsonObject; | |||
/** | |||
* An abstract base class for renderer connectors. A renderer connector is used | |||
* to link a client-side {@link com.vaadin.client.renderers.Renderer Renderer} to a server-side | |||
* {@link com.vaadin.ui.renderers.Renderer Renderer}. As a connector, it can | |||
* use the regular Vaadin RPC and shared state mechanism to pass additional | |||
* state and information between the client and the server. This base class | |||
* itself only uses the basic {@link com.vaadin.shared.communication.SharedState | |||
* SharedState} and no RPC interfaces. | |||
* to link a client-side {@link com.vaadin.client.renderers.Renderer Renderer} | |||
* to a server-side {@link com.vaadin.ui.renderers.Renderer Renderer}. As a | |||
* connector, it can use the regular Vaadin RPC and shared state mechanism to | |||
* pass additional state and information between the client and the server. This | |||
* base class itself only uses the basic | |||
* {@link com.vaadin.shared.communication.SharedState SharedState} and no RPC | |||
* interfaces. | |||
* | |||
* @param <T> | |||
* the presentation type of the renderer |
@@ -39,7 +39,7 @@ import elemental.json.JsonValue; | |||
public class ColumnConnector extends AbstractExtensionConnector { | |||
public abstract static class CustomColumn | |||
extends Column<Object, JsonObject> { | |||
extends Column<Object, JsonObject> { | |||
private final String connectorId; | |||
private ContentMode tooltipContentMode; |
@@ -110,8 +110,8 @@ public class GridConnector extends AbstractListingConnector | |||
String columnId = columnToIdMap.get(cell.getColumn()); | |||
int rowIndex = cell.getRowIndex(); | |||
getRpcProxy(GridServerRpc.class).itemClick(rowKey, columnId, | |||
MouseEventDetailsBuilder | |||
.buildMouseEventDetails(mouseEvent), rowIndex); | |||
MouseEventDetailsBuilder.buildMouseEventDetails(mouseEvent), | |||
rowIndex); | |||
} | |||
} | |||
@@ -54,7 +54,9 @@ public class InfoSection implements Section { | |||
public void run() { | |||
refresh(); | |||
} | |||
}; public InfoSection() { | |||
}; | |||
public InfoSection() { | |||
createContent(); | |||
} | |||
@@ -223,7 +223,8 @@ public class LogSection implements Section { | |||
/** | |||
* Sets the log row limit. | |||
* | |||
* @param limit The limit | |||
* @param limit | |||
* The limit | |||
*/ | |||
public void setLimit(int limit) { | |||
this.limit = limit; |
@@ -144,9 +144,9 @@ public class FileDropTargetConnector extends DropTargetExtensionConnector { | |||
* Returns the files parameter of the dataTransfer object. | |||
* | |||
* @param dataTransfer | |||
* DataTransfer object to retrieve files from. | |||
* DataTransfer object to retrieve files from. | |||
* @return {@code DataTransfer.files} parameter of the given dataTransfer | |||
* object. | |||
* object. | |||
*/ | |||
private native FileList getFiles(DataTransfer dataTransfer) | |||
/*-{ | |||
@@ -157,13 +157,13 @@ public class FileDropTargetConnector extends DropTargetExtensionConnector { | |||
* Checks whether the file on the given index is indeed a file or a folder. | |||
* | |||
* @param file | |||
* File object to prove it is not a folder. | |||
* File object to prove it is not a folder. | |||
* @param fileIndex | |||
* Index of the file object. | |||
* Index of the file object. | |||
* @param dataTransfer | |||
* DataTransfer object that contains the list of files. | |||
* DataTransfer object that contains the list of files. | |||
* @return {@code true} if the given file at the given index is not a | |||
* folder, {@code false} otherwise. | |||
* folder, {@code false} otherwise. | |||
*/ | |||
private native boolean isFile(File file, int fileIndex, | |||
DataTransfer dataTransfer) |
@@ -105,17 +105,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector | |||
@OnStateChange("registeredEventListeners") | |||
void handleContextClickListenerChange() { | |||
if (contextHandler == null && hasEventListener(EventId.CONTEXT_CLICK)) { | |||
contextHandler = getWidget() | |||
.addDomHandler(event -> { | |||
final MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder | |||
.buildMouseEventDetails(event.getNativeEvent(), | |||
getWidget().getElement()); | |||
event.preventDefault(); | |||
event.stopPropagation(); | |||
sendContextClickEvent(mouseEventDetails, | |||
event.getNativeEvent().getEventTarget()); | |||
}, ContextMenuEvent.getType()); | |||
contextHandler = getWidget().addDomHandler(event -> { | |||
final MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder | |||
.buildMouseEventDetails(event.getNativeEvent(), | |||
getWidget().getElement()); | |||
event.preventDefault(); | |||
event.stopPropagation(); | |||
sendContextClickEvent(mouseEventDetails, | |||
event.getNativeEvent().getEventTarget()); | |||
}, ContextMenuEvent.getType()); | |||
// if the widget has a contextclick listener, add touch support as | |||
// well. | |||
@@ -178,8 +177,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector | |||
} | |||
// Prevent selection for the element while pending long tap. | |||
WidgetUtil.setTextSelectionEnabled(widget.getElement(), | |||
false); | |||
WidgetUtil.setTextSelectionEnabled(widget.getElement(), false); | |||
if (BrowserInfo.get().isAndroid()) { | |||
// Android fires ContextMenu events automatically. | |||
@@ -187,9 +185,9 @@ public abstract class AbstractComponentConnector extends AbstractConnector | |||
} | |||
/* | |||
* we need to build mouseEventDetails eagerly - the event won't | |||
* be guaranteed to be around when the timer executes. At least | |||
* this was the case with iOS devices. | |||
* we need to build mouseEventDetails eagerly - the event won't be | |||
* guaranteed to be around when the timer executes. At least this | |||
* was the case with iOS devices. | |||
*/ | |||
final MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder | |||
@@ -487,7 +485,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector | |||
HasErrorIndicatorElement hasErrorIndicatorElement = (HasErrorIndicatorElement) widget; | |||
if (getState().errorMessage != null) { | |||
hasErrorIndicatorElement.setErrorIndicatorElementVisible(true); | |||
ErrorUtil.setErrorLevelStyle(hasErrorIndicatorElement.getErrorIndicatorElement(), | |||
ErrorUtil.setErrorLevelStyle( | |||
hasErrorIndicatorElement.getErrorIndicatorElement(), | |||
StyleConstants.STYLE_NAME_ERROR_INDICATOR, | |||
getState().errorLevel); | |||
} else { |
@@ -98,7 +98,7 @@ public class FocusUtil { | |||
/** | |||
* Finds all the focusable children of given parent element. | |||
* | |||
* | |||
* @param parent | |||
* the parent element | |||
* @return array of focusable children | |||
@@ -112,7 +112,7 @@ public class FocusUtil { | |||
/** | |||
* Moves the focus to the first focusable child of given parent element. | |||
* | |||
* | |||
* @param parent | |||
* the parent element | |||
* @since 8.1.7 | |||
@@ -126,7 +126,8 @@ public class FocusUtil { | |||
for (int i = 0; i < focusableChildren.length; i++) { | |||
Element element = focusableChildren[i]; | |||
String classes = element.getAttribute("class"); | |||
if (classes == null || !classes.toLowerCase().contains("disabled")) { | |||
if (classes == null | |||
|| !classes.toLowerCase().contains("disabled")) { | |||
element.focus(); | |||
return; | |||
} | |||
@@ -135,7 +136,7 @@ public class FocusUtil { | |||
/** | |||
* Moves the focus to the last focusable child of given parent element. | |||
* | |||
* | |||
* @param parent | |||
* the parent element | |||
* @since 8.1.7 |
@@ -35,8 +35,8 @@ public interface HasErrorIndicatorElement { | |||
* Sets the visibility of the error indicator element. | |||
* | |||
* @param visible | |||
* {@code true} to show the error indicator element, {@code false} | |||
* to hide it | |||
* {@code true} to show the error indicator element, | |||
* {@code false} to hide it | |||
*/ | |||
void setErrorIndicatorElementVisible(boolean visible); | |||
} |
@@ -31,8 +31,7 @@ public final class JavaScriptComponentConnector extends | |||
private final JavaScriptConnectorHelper helper = new JavaScriptConnectorHelper( | |||
this) { | |||
@Override | |||
protected void showInitProblem( | |||
List<String> attemptedNames) { | |||
protected void showInitProblem(List<String> attemptedNames) { | |||
getWidget().showNoInitFound(attemptedNames); | |||
} | |||
}; |
@@ -101,8 +101,8 @@ public class TouchScrollDelegate implements NativePreviewHandler { | |||
private static TouchScrollDelegate activeScrollDelegate; | |||
private static final boolean ANDROID_WITH_BROKEN_SCROLL_TOP = BrowserInfo.get() | |||
.isAndroidWithBrokenScrollTop(); | |||
private static final boolean ANDROID_WITH_BROKEN_SCROLL_TOP = BrowserInfo | |||
.get().isAndroidWithBrokenScrollTop(); | |||
/** | |||
* A helper class for making a widget scrollable. Uses native scrolling if | |||
@@ -562,8 +562,8 @@ public class TouchScrollDelegate implements NativePreviewHandler { | |||
finalScrollTop = finalY; | |||
if (Math.abs(pixelsToMove) < 3 || duration < 20) { | |||
getLogger().info("Small 'momentum' " + pixelsToMove + " | " + duration | |||
+ " Skipping animation,"); | |||
getLogger().info("Small 'momentum' " + pixelsToMove + " | " | |||
+ duration + " Skipping animation,"); | |||
moveTransformationToScrolloffset(); | |||
return; | |||
} | |||
@@ -701,7 +701,8 @@ public class TouchScrollDelegate implements NativePreviewHandler { | |||
} | |||
break; | |||
default: | |||
getLogger().info("Non touch event:" + event.getNativeEvent().getType()); | |||
getLogger().info( | |||
"Non touch event:" + event.getNativeEvent().getType()); | |||
event.cancel(); | |||
break; | |||
} |
@@ -722,8 +722,8 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
} | |||
String dateStrResolution = dateStrResolution(date, minResolution); | |||
return rangeStart.substring(0,dateStrResolution.length()) | |||
.compareTo(dateStrResolution) <=0; | |||
return rangeStart.substring(0, dateStrResolution.length()) | |||
.compareTo(dateStrResolution) <= 0; | |||
} | |||
private String dateStrResolution(Date date, R minResolution) { | |||
@@ -760,7 +760,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
} | |||
String dateStrResolution = dateStrResolution(date, minResolution); | |||
return rangeEnd.substring(0,dateStrResolution.length()) | |||
return rangeEnd.substring(0, dateStrResolution.length()) | |||
.compareTo(dateStrResolution) >= 0; | |||
} | |||
@@ -868,10 +868,9 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
// Set assistive label to read focused date and month/year | |||
Roles.getButtonRole().set(day.getElement()); | |||
Roles.getButtonRole() | |||
.setAriaLabelledbyProperty(day.getElement(), | |||
Id.of(day.getElement()), | |||
Id.of(getFlexCellFormatter().getElement(0, 2))); | |||
Roles.getButtonRole().setAriaLabelledbyProperty( | |||
day.getElement(), Id.of(day.getElement()), | |||
Id.of(getFlexCellFormatter().getElement(0, 2))); | |||
day.setStyleName(getDateField().getStylePrimaryName() | |||
+ "-calendarpanel-day"); | |||
@@ -895,9 +894,8 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
day.addStyleDependentName(CN_FOCUSED); | |||
// Reference focused day from calendar panel | |||
Roles.getGridRole() | |||
.setAriaActivedescendantProperty(getElement(), | |||
Id.of(day.getElement())); | |||
Roles.getGridRole().setAriaActivedescendantProperty( | |||
getElement(), Id.of(day.getElement())); | |||
} | |||
} | |||
if (curr.getMonth() != displayedMonth.getMonth()) { | |||
@@ -1682,30 +1680,33 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* @param date | |||
*/ | |||
private Date adjustDateToFitInsideRange(Date date) { | |||
if(!isAcceptedByRangeStart(date,resolution)) { | |||
if (!isAcceptedByRangeStart(date, resolution)) { | |||
date = parseRangeString(rangeStart); | |||
} else | |||
if(!isAcceptedByRangeEnd(date,resolution)) { | |||
} else if (!isAcceptedByRangeEnd(date, resolution)) { | |||
date = parseRangeString(rangeEnd); | |||
} | |||
return date; | |||
} | |||
private Date parseRangeString(String dateStr) { | |||
if(dateStr == null || "".equals(dateStr)) return null; | |||
int year = Integer.parseInt(dateStr.substring(0,4)) - 1900; | |||
int month = parsePart(dateStr, 5, 2,1) - 1; | |||
int day = parsePart(dateStr, 8, 2,1); | |||
int hrs = parsePart(dateStr, 11, 2,0); | |||
int min = parsePart(dateStr, 14, 2,0); | |||
int sec = parsePart(dateStr, 17, 2,0); | |||
if (dateStr == null || "".equals(dateStr)) | |||
return null; | |||
int year = Integer.parseInt(dateStr.substring(0, 4)) - 1900; | |||
int month = parsePart(dateStr, 5, 2, 1) - 1; | |||
int day = parsePart(dateStr, 8, 2, 1); | |||
int hrs = parsePart(dateStr, 11, 2, 0); | |||
int min = parsePart(dateStr, 14, 2, 0); | |||
int sec = parsePart(dateStr, 17, 2, 0); | |||
return new Date(year,month,day,hrs,min,sec); | |||
return new Date(year, month, day, hrs, min, sec); | |||
} | |||
private int parsePart(String dateStr, int beginIndex, int length, int defValue) { | |||
if(dateStr.length() < beginIndex + length) return defValue; | |||
return Integer.parseInt(dateStr.substring(beginIndex, beginIndex + length)); | |||
private int parsePart(String dateStr, int beginIndex, int length, | |||
int defValue) { | |||
if (dateStr.length() < beginIndex + length) | |||
return defValue; | |||
return Integer | |||
.parseInt(dateStr.substring(beginIndex, beginIndex + length)); | |||
} | |||
/** | |||
@@ -2112,7 +2113,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* Set assistive label for the previous year element. | |||
* | |||
* @param label | |||
* the label to set | |||
* the label to set | |||
* @since 8.4 | |||
*/ | |||
public void setAssistiveLabelPreviousYear(String label) { | |||
@@ -2123,7 +2124,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* Set assistive label for the next year element. | |||
* | |||
* @param label | |||
* the label to set | |||
* the label to set | |||
* @since 8.4 | |||
*/ | |||
public void setAssistiveLabelNextYear(String label) { | |||
@@ -2134,7 +2135,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* Set assistive label for the previous month element. | |||
* | |||
* @param label | |||
* the label to set | |||
* the label to set | |||
* @since 8.4 | |||
*/ | |||
public void setAssistiveLabelPreviousMonth(String label) { | |||
@@ -2145,7 +2146,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* Set assistive label for the next month element. | |||
* | |||
* @param label | |||
* the label to set | |||
* the label to set | |||
* @since 8.4 | |||
*/ | |||
public void setAssistiveLabelNextMonth(String label) { |
@@ -55,9 +55,8 @@ import com.vaadin.shared.EventId; | |||
*/ | |||
public abstract class VAbstractTextualDate<R extends Enum<R>> | |||
extends VDateField<R> | |||
implements ChangeHandler, Focusable, | |||
SubPartAware, HandlesAriaCaption, HandlesAriaInvalid, | |||
HandlesAriaRequired, KeyDownHandler { | |||
implements ChangeHandler, Focusable, SubPartAware, HandlesAriaCaption, | |||
HandlesAriaInvalid, HandlesAriaRequired, KeyDownHandler { | |||
private static final String PARSE_ERROR_CLASSNAME = "-parseerror"; | |||
private static final String ISO_DATE_TIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss"; | |||
@@ -86,10 +85,8 @@ public abstract class VAbstractTextualDate<R extends Enum<R>> | |||
super(resoluton); | |||
text = new TextBox(); | |||
text.addChangeHandler(this); | |||
text.addFocusHandler( | |||
event -> fireBlurFocusEvent(event, true)); | |||
text.addBlurHandler( | |||
event -> fireBlurFocusEvent(event, false)); | |||
text.addFocusHandler(event -> fireBlurFocusEvent(event, true)); | |||
text.addBlurHandler(event -> fireBlurFocusEvent(event, false)); | |||
if (BrowserInfo.get().isIE()) { | |||
addDomHandler(this, KeyDownEvent.getType()); | |||
} | |||
@@ -278,7 +275,7 @@ public abstract class VAbstractTextualDate<R extends Enum<R>> | |||
* | |||
* @since 8.2 | |||
* @deprecated Use {@link #updateBufferedResolutions()} and | |||
* {@link #sendBufferedValues()} instead. | |||
* {@link #sendBufferedValues()} instead. | |||
*/ | |||
@Deprecated | |||
protected final void updateAndSendBufferedValues() { | |||
@@ -409,8 +406,7 @@ public abstract class VAbstractTextualDate<R extends Enum<R>> | |||
} | |||
} | |||
private void fireBlurFocusEvent(DomEvent<?> event, | |||
boolean focus) { | |||
private void fireBlurFocusEvent(DomEvent<?> event, boolean focus) { | |||
String styleName = VTextField.CLASSNAME + "-" | |||
+ VTextField.CLASSNAME_FOCUS; | |||
if (focus) { |
@@ -257,12 +257,12 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, | |||
return $entry(function(e) { | |||
var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; | |||
var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; | |||
// IE8 has only delta y | |||
if (isNaN(deltaY)) { | |||
deltaY = -0.5*e.wheelDelta; | |||
} | |||
@com.vaadin.client.ui.VComboBox.JsniUtil::moveScrollFromEvent(*)(widget, deltaX, deltaY, e, e.deltaMode); | |||
}); | |||
}-*/; |
@@ -283,8 +283,8 @@ public abstract class VDateField<R extends Enum<R>> extends FlowPanel | |||
*/ | |||
public void sendBufferedValues() { | |||
rpc.update(bufferedDateString, | |||
bufferedResolutions.entrySet().stream().collect(Collectors | |||
.toMap(entry -> entry.getKey().name(), | |||
bufferedResolutions.entrySet().stream().collect( | |||
Collectors.toMap(entry -> entry.getKey().name(), | |||
entry -> entry.getValue()))); | |||
bufferedDateString = null; | |||
bufferedResolutions.clear(); |
@@ -387,8 +387,8 @@ public class VDragAndDropWrapper extends VCustomComponent | |||
if (event.isFile(i)) { | |||
final int fileId = filecounter++; | |||
final VHtml5File file = event.getFile(i); | |||
getLogger().info("Preparing to upload file " + file.getName() | |||
+ " with id " + fileId + ", size=" | |||
getLogger().info("Preparing to upload file " | |||
+ file.getName() + " with id " + fileId + ", size=" | |||
+ file.getSize()); | |||
transferable.setData("fi" + fileIndex, "" + fileId); | |||
transferable.setData("fn" + fileIndex, file.getName()); |
@@ -28,8 +28,8 @@ import com.vaadin.client.Util; | |||
import com.vaadin.client.WidgetUtil.ErrorUtil; | |||
import com.vaadin.shared.ui.BorderStyle; | |||
public class VLink extends HTML implements ClickHandler, HasEnabled, | |||
HasErrorIndicatorElement { | |||
public class VLink extends HTML | |||
implements ClickHandler, HasEnabled, HasErrorIndicatorElement { | |||
public static final String CLASSNAME = "v-link"; | |||
@@ -60,9 +60,9 @@ import com.vaadin.client.extensions.EventTrigger; | |||
import com.vaadin.shared.ui.ContentMode; | |||
import com.vaadin.shared.ui.menubar.MenuBarConstants; | |||
public class VMenuBar extends FocusableFlowPanel | |||
implements CloseHandler<PopupPanel>, KeyPressHandler, KeyDownHandler, | |||
FocusHandler, SubPartAware, MouseOutHandler, MouseOverHandler, EventTrigger { | |||
public class VMenuBar extends FocusableFlowPanel implements | |||
CloseHandler<PopupPanel>, KeyPressHandler, KeyDownHandler, FocusHandler, | |||
SubPartAware, MouseOutHandler, MouseOverHandler, EventTrigger { | |||
// The hierarchy of VMenuBar is a bit weird as VMenuBar is the Paintable, | |||
// used for the root menu but also used for the sub menus. | |||
@@ -803,7 +803,7 @@ public class VMenuBar extends FocusableFlowPanel | |||
* | |||
*/ | |||
public static class CustomMenuItem extends Widget | |||
implements HasHTML, SubPartAware { | |||
implements HasHTML, SubPartAware { | |||
protected String html = null; | |||
protected Command command = null; | |||
@@ -1924,7 +1924,8 @@ public class VMenuBar extends FocusableFlowPanel | |||
"The 'partInformation' parameter must contain the menu item id"); | |||
} | |||
getTriggers().computeIfAbsent(partInformation, s-> new ArrayList<>()).add(command); | |||
getTriggers().computeIfAbsent(partInformation, s -> new ArrayList<>()) | |||
.add(command); | |||
return () -> { | |||
List<Command> commands = getTriggers().get(partInformation); | |||
if (commands != null) { |
@@ -31,8 +31,8 @@ import com.vaadin.client.WidgetUtil.ErrorUtil; | |||
import com.vaadin.shared.MouseEventDetails; | |||
import com.vaadin.shared.ui.button.ButtonServerRpc; | |||
public class VNativeButton extends Button implements ClickHandler, | |||
HasErrorIndicatorElement { | |||
public class VNativeButton extends Button | |||
implements ClickHandler, HasErrorIndicatorElement { | |||
public static final String CLASSNAME = "v-nativebutton"; | |||
@@ -171,8 +171,8 @@ public class VNativeButton extends Button implements ClickHandler, | |||
if (visible) { | |||
if (errorIndicatorElement == null) { | |||
errorIndicatorElement = ErrorUtil.createErrorIndicatorElement(); | |||
getElement() | |||
.insertBefore(errorIndicatorElement, captionElement); | |||
getElement().insertBefore(errorIndicatorElement, | |||
captionElement); | |||
} | |||
} else if (errorIndicatorElement != null) { | |||
getElement().removeChild(errorIndicatorElement); |
@@ -294,13 +294,12 @@ public class VNotification extends VOverlay { | |||
// in some browsers) | |||
if (getStyleName() | |||
.contains(VOverlay.ADDITIONAL_CLASSNAME_ANIMATE_IN)) { | |||
AnimationUtil.addAnimationEndListener(getElement(), | |||
event -> { | |||
if (AnimationUtil.getAnimationName(event).contains( | |||
VOverlay.ADDITIONAL_CLASSNAME_ANIMATE_IN)) { | |||
VNotification.this.hide(); | |||
} | |||
}); | |||
AnimationUtil.addAnimationEndListener(getElement(), event -> { | |||
if (AnimationUtil.getAnimationName(event).contains( | |||
VOverlay.ADDITIONAL_CLASSNAME_ANIMATE_IN)) { | |||
VNotification.this.hide(); | |||
} | |||
}); | |||
} else { | |||
VNotification.super.hide(); | |||
fireEvent(new HideEvent(this)); | |||
@@ -481,8 +480,8 @@ public class VNotification extends VOverlay { | |||
* @param description | |||
* The Notification description, can be {@code null}. | |||
* @param htmlContentAllowed | |||
* Whether {@code caption} and {@code description} | |||
* are interpreted as HTML or not. | |||
* Whether {@code caption} and {@code description} are | |||
* interpreted as HTML or not. | |||
* @param iconUri | |||
* The icon URI, can be {@code null}. | |||
* @param styleName | |||
@@ -496,7 +495,8 @@ public class VNotification extends VOverlay { | |||
*/ | |||
public static VNotification showNotification(ApplicationConnection client, | |||
String caption, String description, boolean htmlContentAllowed, | |||
String iconUri, String styleName, Position position, int delayMsec) { | |||
String iconUri, String styleName, Position position, | |||
int delayMsec) { | |||
String html = ""; | |||
if (iconUri != null) { | |||
html += client.getIcon(iconUri).getElement().getString(); |
@@ -245,9 +245,8 @@ public class VPopupView extends HTML | |||
// directly attached to the RootPanel. | |||
addDomHandler(event -> { | |||
if (shortcutActionHandler != null) { | |||
shortcutActionHandler | |||
.handleKeyboardEvent( | |||
Event.as(event.getNativeEvent())); | |||
shortcutActionHandler.handleKeyboardEvent( | |||
Event.as(event.getNativeEvent())); | |||
} | |||
}, KeyDownEvent.getType()); | |||
} |
@@ -34,8 +34,7 @@ import com.vaadin.client.ui.dd.DragImageModifier; | |||
* @author Vaadin Ltd. | |||
* | |||
*/ | |||
public class VTextArea extends VTextField | |||
implements DragImageModifier { | |||
public class VTextArea extends VTextField implements DragImageModifier { | |||
public static final String CLASSNAME = "v-textarea"; | |||
@@ -359,17 +359,15 @@ public class VTwinColSelect extends Composite implements MultiSelectWidget, | |||
private void moveSelectedItemsLeftToRight() { | |||
Set<String> movedItems = moveSelectedItems(optionsListBox, | |||
selectionsListBox); | |||
selectionChangeListeners | |||
.forEach(listener -> listener.accept(movedItems, | |||
Collections.emptySet())); | |||
selectionChangeListeners.forEach(listener -> listener.accept(movedItems, | |||
Collections.emptySet())); | |||
} | |||
private void moveSelectedItemsRightToLeft() { | |||
Set<String> movedItems = moveSelectedItems(selectionsListBox, | |||
optionsListBox); | |||
selectionChangeListeners | |||
.forEach(listener -> listener.accept(Collections.emptySet(), | |||
movedItems)); | |||
selectionChangeListeners.forEach(listener -> listener | |||
.accept(Collections.emptySet(), movedItems)); | |||
} | |||
private static Set<String> moveSelectedItems(ListBox source, |
@@ -318,7 +318,8 @@ public class VUpload extends SimplePanel { | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public void submit() { | |||
if (submitted || !enabled) { | |||
getLogger().info("Submit cancelled (disabled or already submitted)"); | |||
getLogger() | |||
.info("Submit cancelled (disabled or already submitted)"); | |||
return; | |||
} | |||
if (fu.getFilename().isEmpty()) { |
@@ -176,8 +176,8 @@ public class AriaHelper { | |||
* @param element | |||
* Element to move out of sight | |||
* @param assistiveOnly | |||
* {@code true} when element should only be visible for | |||
* assistive devices, {@code false} to make the element visible for all | |||
* {@code true} when element should only be visible for assistive | |||
* devices, {@code false} to make the element visible for all | |||
*/ | |||
public static void setVisibleForAssistiveDevicesOnly(Element element, | |||
boolean assistiveOnly) { |
@@ -150,17 +150,17 @@ public abstract class AbstractDateFieldConnector<R extends Enum<R>> | |||
* updates these labels. | |||
* | |||
* @param calendar | |||
* the calendar panel for which to set the assistive labels | |||
* the calendar panel for which to set the assistive labels | |||
* @since 8.4 | |||
*/ | |||
protected void setAndUpdateAssistiveLabels( | |||
VAbstractCalendarPanel calendar) { | |||
calendar.setAssistiveLabelPreviousMonth( | |||
getState().assistiveLabels.get(AccessibleElement.PREVIOUS_MONTH)); | |||
calendar.setAssistiveLabelPreviousMonth(getState().assistiveLabels | |||
.get(AccessibleElement.PREVIOUS_MONTH)); | |||
calendar.setAssistiveLabelNextMonth( | |||
getState().assistiveLabels.get(AccessibleElement.NEXT_MONTH)); | |||
calendar.setAssistiveLabelPreviousYear( | |||
getState().assistiveLabels.get(AccessibleElement.PREVIOUS_YEAR)); | |||
calendar.setAssistiveLabelPreviousYear(getState().assistiveLabels | |||
.get(AccessibleElement.PREVIOUS_YEAR)); | |||
calendar.setAssistiveLabelNextYear( | |||
getState().assistiveLabels.get(AccessibleElement.NEXT_YEAR)); | |||
@@ -51,24 +51,22 @@ public abstract class AbstractInlineDateFieldConnector<PANEL extends VAbstractCa | |||
protected void updateListeners() { | |||
VAbstractDateFieldCalendar<PANEL, R> widget = getWidget(); | |||
if (isResolutionMonthOrHigher()) { | |||
widget.calendarPanel | |||
.setFocusChangeListener(date -> { | |||
Date date2 = new Date(); | |||
if (widget.calendarPanel.getDate() != null) { | |||
date2.setTime(widget.calendarPanel.getDate() | |||
.getTime()); | |||
} | |||
/* | |||
* Update the value of calendarPanel | |||
*/ | |||
date2.setYear(date.getYear()); | |||
date2.setMonth(date.getMonth()); | |||
widget.calendarPanel.setDate(date2); | |||
/* | |||
* Then update the value from panel to server | |||
*/ | |||
widget.updateValueFromPanel(); | |||
}); | |||
widget.calendarPanel.setFocusChangeListener(date -> { | |||
Date date2 = new Date(); | |||
if (widget.calendarPanel.getDate() != null) { | |||
date2.setTime(widget.calendarPanel.getDate().getTime()); | |||
} | |||
/* | |||
* Update the value of calendarPanel | |||
*/ | |||
date2.setYear(date.getYear()); | |||
date2.setMonth(date.getMonth()); | |||
widget.calendarPanel.setDate(date2); | |||
/* | |||
* Then update the value from panel to server | |||
*/ | |||
widget.updateValueFromPanel(); | |||
}); | |||
} else { | |||
widget.calendarPanel.setFocusChangeListener(null); | |||
} | |||
@@ -124,4 +122,4 @@ public abstract class AbstractInlineDateFieldConnector<PANEL extends VAbstractCa | |||
*/ | |||
protected abstract boolean isResolutionMonthOrHigher(); | |||
} | |||
} |
@@ -57,26 +57,25 @@ public class DateTimeFieldConnector extends | |||
VPopupTimeCalendar widget = getWidget(); | |||
if (widget.getCurrentResolution() | |||
.compareTo(DateTimeResolution.DAY) < 0) { | |||
widget.calendar | |||
.setTimeChangeListener((hour, min, sec, msec) -> { | |||
Date d = widget.getDate(); | |||
if (d == null) { | |||
// date currently null, use the value from | |||
// calendarPanel | |||
// (~ client time at the init of the widget) | |||
d = (Date) widget.calendar.getDate().clone(); | |||
} | |||
d.setHours(hour); | |||
d.setMinutes(min); | |||
d.setSeconds(sec); | |||
DateTimeService.setMilliseconds(d, msec); | |||
widget.calendar.setTimeChangeListener((hour, min, sec, msec) -> { | |||
Date d = widget.getDate(); | |||
if (d == null) { | |||
// date currently null, use the value from | |||
// calendarPanel | |||
// (~ client time at the init of the widget) | |||
d = (Date) widget.calendar.getDate().clone(); | |||
} | |||
d.setHours(hour); | |||
d.setMinutes(min); | |||
d.setSeconds(sec); | |||
DateTimeService.setMilliseconds(d, msec); | |||
// Always update time changes to the server | |||
widget.updateValue(d); | |||
// Always update time changes to the server | |||
widget.updateValue(d); | |||
// Update text field | |||
widget.buildDate(); | |||
}); | |||
// Update text field | |||
widget.buildDate(); | |||
}); | |||
} | |||
} | |||
} | |||
} |
@@ -34,7 +34,8 @@ public final class VTargetDetailIs extends VAcceptCriterion { | |||
protected boolean accept(VDragEvent drag, UIDL configuration) { | |||
String name = configuration.getStringAttribute("p"); | |||
String t = configuration.hasAttribute("t") | |||
? configuration.getStringAttribute("t").intern() : "s"; | |||
? configuration.getStringAttribute("t").intern() | |||
: "s"; | |||
Object value = null; | |||
if (t == "s") { | |||
value = configuration.getStringAttribute("v"); |
@@ -83,10 +83,8 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector | |||
} | |||
} else { | |||
if (widget.fileIdToReceiver.containsKey(fileId) | |||
&& receiverUrl != null | |||
&& !receiverUrl | |||
.equals(widget.fileIdToReceiver | |||
.get(fileId))) { | |||
&& receiverUrl != null && !receiverUrl.equals( | |||
widget.fileIdToReceiver.get(fileId))) { | |||
getLogger().severe( | |||
"Overwriting file receiver mapping for fileId " | |||
+ fileId + " . Old receiver URL: " |
@@ -134,8 +134,8 @@ public class EmbeddedConnector extends AbstractComponentConnector { | |||
setResourceUrl(getResourceUrl("src")); | |||
clearBrowserElement = false; | |||
} else { | |||
getLogger().severe( | |||
"Unknown Embedded type '" + widget.type + "'"); | |||
getLogger() | |||
.severe("Unknown Embedded type '" + widget.type + "'"); | |||
} | |||
} else if (state.mimeType != null) { | |||
// remove old style name related to type | |||
@@ -152,8 +152,8 @@ public class EmbeddedConnector extends AbstractComponentConnector { | |||
widget.mimetype = "flash"; | |||
// Handle embedding of Flash | |||
widget.addStyleName(VEmbedded.CLASSNAME + "-flash"); | |||
widget.setHTML(widget.createFlashEmbed(state, | |||
getResourceUrl("src"))); | |||
widget.setHTML( | |||
widget.createFlashEmbed(state, getResourceUrl("src"))); | |||
} else if (mime.equals("image/svg+xml")) { | |||
widget.mimetype = "svg"; | |||
@@ -202,7 +202,8 @@ public class EmbeddedConnector extends AbstractComponentConnector { | |||
getLogger().severe("Unknown Embedded mimetype '" + mime + "'"); | |||
} | |||
} else { | |||
getLogger().severe("Unknown Embedded; no type or mimetype attribute"); | |||
getLogger() | |||
.severe("Unknown Embedded; no type or mimetype attribute"); | |||
} | |||
if (clearBrowserElement) { |
@@ -40,14 +40,16 @@ public class ComponentConnectorLayoutSlot extends VLayoutSlot { | |||
protected int getCaptionHeight() { | |||
VCaption caption = getCaption(); | |||
return caption != null | |||
? getLayoutManager().getOuterHeight(caption.getElement()) : 0; | |||
? getLayoutManager().getOuterHeight(caption.getElement()) | |||
: 0; | |||
} | |||
@Override | |||
protected int getCaptionWidth() { | |||
VCaption caption = getCaption(); | |||
return caption != null | |||
? getLayoutManager().getOuterWidth(caption.getElement()) : 0; | |||
? getLayoutManager().getOuterWidth(caption.getElement()) | |||
: 0; | |||
} | |||
public LayoutManager getLayoutManager() { |
@@ -168,7 +168,8 @@ public abstract class VLayoutSlot { | |||
int captionHeight; | |||
VCaption caption = getCaption(); | |||
Style captionStyle = caption == null ? null : caption.getElement().getStyle(); | |||
Style captionStyle = caption == null ? null | |||
: caption.getElement().getStyle(); | |||
if (caption == null || caption.shouldBePlacedAfterComponent()) { | |||
style.clearPaddingTop(); | |||
captionHeight = 0; |
@@ -158,8 +158,8 @@ public class NativeSelectConnector | |||
if (widgetEnabled) { | |||
getWidget().getListBox().getElement().removeAttribute("disabled"); | |||
} else { | |||
getWidget().getListBox().getElement() | |||
.setAttribute("disabled", "disabled"); | |||
getWidget().getListBox().getElement().setAttribute("disabled", | |||
"disabled"); | |||
} | |||
} | |||
} |
@@ -459,8 +459,7 @@ public abstract class AbstractOrderedLayoutConnector | |||
// Update slot style names | |||
List<String> childStyles = child.getState().styles; | |||
if (childStyles == null) { | |||
widget.setSlotStyleNames(child.getWidget(), | |||
(String[]) null); | |||
widget.setSlotStyleNames(child.getWidget(), (String[]) null); | |||
} else { | |||
widget.setSlotStyleNames(child.getWidget(), | |||
childStyles.toArray(new String[childStyles.size()])); | |||
@@ -489,11 +488,11 @@ public abstract class AbstractOrderedLayoutConnector | |||
if (needsFixedHeight()) { | |||
// Add resize listener to ensure the widget itself is measured | |||
getLayoutManager().addElementResizeListener( | |||
widget.getElement(), childComponentResizeListener); | |||
getLayoutManager().addElementResizeListener(widget.getElement(), | |||
childComponentResizeListener); | |||
} else { | |||
getLayoutManager().removeElementResizeListener( | |||
widget.getElement(), childComponentResizeListener); | |||
getLayoutManager().removeElementResizeListener(widget.getElement(), | |||
childComponentResizeListener); | |||
} | |||
// Then update listeners based on bookkeeping | |||
@@ -507,8 +506,8 @@ public abstract class AbstractOrderedLayoutConnector | |||
// updateExpandedSizes causes fixed size components to temporarily | |||
// lose their size. updateExpandCompensation must be delayed until | |||
// the browser has a chance to measure them. | |||
Scheduler.get().scheduleFinally( | |||
() -> widget.updateExpandCompensation()); | |||
Scheduler.get() | |||
.scheduleFinally(() -> widget.updateExpandCompensation()); | |||
} else { | |||
widget.clearExpand(); | |||
} | |||
@@ -694,4 +693,4 @@ public abstract class AbstractOrderedLayoutConnector | |||
super.onUnregister(); | |||
} | |||
} | |||
} |
@@ -93,16 +93,14 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector | |||
// Restore default stylenames | |||
panel.contentNode.setClassName(VPanel.CLASSNAME + "-content"); | |||
panel.bottomDecoration | |||
.setClassName(VPanel.CLASSNAME + "-deco"); | |||
panel.bottomDecoration.setClassName(VPanel.CLASSNAME + "-deco"); | |||
panel.captionNode.setClassName(VPanel.CLASSNAME + "-caption"); | |||
boolean hasCaption = hasCaption(); | |||
if (hasCaption) { | |||
panel.setCaption(getState().caption); | |||
} else { | |||
panel.setCaption(""); | |||
panel.captionNode | |||
.setClassName(VPanel.CLASSNAME + "-nocaption"); | |||
panel.captionNode.setClassName(VPanel.CLASSNAME + "-nocaption"); | |||
} | |||
// Add proper stylenames for all elements. This way we can prevent |
@@ -70,8 +70,8 @@ public class PopupViewConnector extends AbstractHasComponentsConnector | |||
if (popup.captionWrapper != null) { | |||
popup.captionWrapper.updateCaption(); | |||
} else { | |||
popup.captionWrapper = new VCaptionWrapper( | |||
childConnector, getConnection()); | |||
popup.captionWrapper = new VCaptionWrapper(childConnector, | |||
getConnection()); | |||
popup.setWidget(popup.captionWrapper); | |||
popup.captionWrapper.updateCaption(); | |||
} | |||
@@ -135,7 +135,7 @@ public class PopupViewConnector extends AbstractHasComponentsConnector | |||
} else { | |||
// The popup shouldn't be visible, try to hide it. | |||
popup.hide(false,false,false); | |||
popup.hide(false, false, false); | |||
} | |||
} | |||
@@ -139,8 +139,7 @@ public abstract class AbstractSplitPanelConnector extends | |||
panel.maximumPosition = splitterState.maxPosition | |||
+ splitterState.maxPositionUnit; | |||
panel.position = splitterState.position | |||
+ splitterState.positionUnit; | |||
panel.position = splitterState.position + splitterState.positionUnit; | |||
panel.setPositionReversed(splitterState.positionReversed); | |||
@@ -59,8 +59,8 @@ public abstract class TabsheetBaseConnector | |||
// Widgets in the TabSheet before update | |||
List<Widget> oldWidgets = new ArrayList<>(); | |||
for (Iterator<Widget> iterator = widget | |||
.getWidgetIterator(); iterator.hasNext();) { | |||
for (Iterator<Widget> iterator = widget.getWidgetIterator(); iterator | |||
.hasNext();) { | |||
oldWidgets.add(iterator.next()); | |||
} | |||
@@ -40,8 +40,9 @@ public abstract class AbstractTextFieldConnector extends AbstractFieldConnector | |||
@Override | |||
public void selectRange(int start, int length) { | |||
int textLength = getAbstractTextField().getValue().length(); | |||
//Enable setting cursor position after the last character | |||
start = restrictTo(start, 0, length == 0 ? textLength : (textLength - 1)); | |||
// Enable setting cursor position after the last character | |||
start = restrictTo(start, 0, | |||
length == 0 ? textLength : (textLength - 1)); | |||
length = restrictTo(length, 0, textLength - start); | |||
getAbstractTextField().setSelectionRange(start, length); | |||
} |
@@ -421,12 +421,11 @@ public class TreeGridConnector extends GridConnector { | |||
} | |||
private static boolean isCollapsed(JsonObject rowData) { | |||
assert rowData | |||
.hasKey(HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) : "missing hierarchy data for row " | |||
assert rowData.hasKey( | |||
HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) : "missing hierarchy data for row " | |||
+ rowData.asString(); | |||
return rowData | |||
.getObject( | |||
HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) | |||
return rowData.getObject( | |||
HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) | |||
.getBoolean( | |||
HierarchicalDataCommunicatorConstants.ROW_COLLAPSED); | |||
} |
@@ -511,16 +511,18 @@ public class UIConnector extends AbstractSingleComponentContainerConnector | |||
* Initialize UIConnector and attach UI to the rootPanelElement. | |||
* | |||
* @param rootPanelElement | |||
* element to attach ui into | |||
* element to attach ui into | |||
* @param applicationConnection | |||
* application connection | |||
* application connection | |||
* @since 8.4 | |||
*/ | |||
public void init(Element rootPanelElement, | |||
ApplicationConnection applicationConnection) { | |||
Panel root = new AbsolutePanel(rootPanelElement) {{ | |||
onAttach(); | |||
}}; | |||
Panel root = new AbsolutePanel(rootPanelElement) { | |||
{ | |||
onAttach(); | |||
} | |||
}; | |||
initConnector(root, applicationConnection); | |||
} | |||
@@ -530,9 +532,9 @@ public class UIConnector extends AbstractSingleComponentContainerConnector | |||
* element. | |||
* | |||
* @param rootPanelId | |||
* root panel element id | |||
* root panel element id | |||
* @param applicationConnection | |||
* application connection | |||
* application connection | |||
*/ | |||
public void init(String rootPanelId, | |||
ApplicationConnection applicationConnection) { | |||
@@ -566,7 +568,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector | |||
DOM.sinkEvents(ui.getElement(), Event.ONSCROLL); | |||
// Remove the v-app-loading or any splash screen added inside the div by | |||
// the user | |||
root.getElement().setInnerHTML(""); |
@@ -70,8 +70,8 @@ public class UploadConnector extends AbstractComponentConnector | |||
upload.submitButton | |||
.setText(uidl.getStringAttribute("buttoncaption")); | |||
if (uidl.hasAttribute("buttonstylename")) { | |||
upload.submitButton | |||
.setStyleName(uidl.getStringAttribute("buttonstylename")); | |||
upload.submitButton.setStyleName( | |||
uidl.getStringAttribute("buttonstylename")); | |||
} | |||
upload.submitButton.setVisible(true); | |||
} else { |
@@ -172,8 +172,8 @@ public interface ColumnConfiguration { | |||
throws IllegalArgumentException; | |||
/** | |||
* Refreshes a range of columns in the current row containers in each Escalator | |||
* section. | |||
* Refreshes a range of columns in the current row containers in each | |||
* Escalator section. | |||
* <p> | |||
* The data for the refreshed columns is queried from the current cell | |||
* renderer. |
@@ -27,8 +27,8 @@ import com.vaadin.client.widgets.Escalator; | |||
* should the displayed data need to be fetched remotely. | |||
* <p> | |||
* This has a similar function to {@link com.vaadin.client.widgets.Grid Grid's} | |||
* {@link com.vaadin.client.renderers.Renderer Renderers} | |||
* , although they operate on different abstraction levels. | |||
* {@link com.vaadin.client.renderers.Renderer Renderers} , although they | |||
* operate on different abstraction levels. | |||
* | |||
* @since 7.4 | |||
* @author Vaadin Ltd |
@@ -241,8 +241,7 @@ public class FlyweightRow implements Row { | |||
assert offset >= 0 && offset + numberOfCells <= cells | |||
.size() : "Invalid range of cells"; | |||
return () -> CellIterator | |||
.attached( | |||
cells.subList(offset, offset + numberOfCells)); | |||
.attached(cells.subList(offset, offset + numberOfCells)); | |||
} | |||
/** | |||
@@ -266,8 +265,7 @@ public class FlyweightRow implements Row { | |||
assert offset >= 0 && offset + numberOfCells <= cells | |||
.size() : "Invalid range of cells"; | |||
return () -> CellIterator | |||
.unattached( | |||
cells.subList(offset, offset + numberOfCells)); | |||
.unattached(cells.subList(offset, offset + numberOfCells)); | |||
} | |||
/** |
@@ -23,7 +23,8 @@ import com.google.gwt.event.shared.GwtEvent; | |||
* @author Vaadin Ltd | |||
* @since 8.3.2 | |||
*/ | |||
public class SpacerVisibilityChangedEvent extends GwtEvent<SpacerVisibilityChangedHandler> { | |||
public class SpacerVisibilityChangedEvent | |||
extends GwtEvent<SpacerVisibilityChangedHandler> { | |||
/** | |||
* Handler type. | |||
@@ -41,10 +42,10 @@ public class SpacerVisibilityChangedEvent extends GwtEvent<SpacerVisibilityChang | |||
* Creates a spacer visibility changed event. | |||
* | |||
* @param rowIndex | |||
* index of row to which the spacer belongs | |||
* index of row to which the spacer belongs | |||
* @param visible | |||
* {@code true} if the spacer element is shown, {@code false} if the | |||
* spacer element is hidden | |||
* {@code true} if the spacer element is shown, {@code false} if | |||
* the spacer element is hidden | |||
*/ | |||
public SpacerVisibilityChangedEvent(int rowIndex, boolean visible) { | |||
this.rowIndex = rowIndex; | |||
@@ -64,7 +65,7 @@ public class SpacerVisibilityChangedEvent extends GwtEvent<SpacerVisibilityChang | |||
* Gets whether the spacer element is displayed. | |||
* | |||
* @return {@code true} if the spacer element is shown, {@code false} if the | |||
* spacer element is hidden | |||
* spacer element is hidden | |||
*/ | |||
public boolean isSpacerVisible() { | |||
return visible; |
@@ -356,8 +356,9 @@ public class AutoScroller { | |||
endBound = Math.max(finalEndBound, pageCordinate); | |||
} else { | |||
/* | |||
* Subsequent runs make sure that the scroll area grows (but doesn't | |||
* shrink) with the finger, but no further than the final bound. | |||
* Subsequent runs make sure that the scroll area grows (but | |||
* doesn't shrink) with the finger, but no further than the | |||
* final bound. | |||
*/ | |||
int oldTopBound = startBound; | |||
if (startBound < finalStartBound) { |
@@ -34,8 +34,8 @@ public class DataAvailableEvent extends GwtEvent<DataAvailableHandler> { | |||
} | |||
/** | |||
* Returns the range of available rows in {@link com.vaadin.client.data.DataSource DataSource} | |||
* for this event. | |||
* Returns the range of available rows in | |||
* {@link com.vaadin.client.data.DataSource DataSource} for this event. | |||
* | |||
* @return range of available rows | |||
*/ |
@@ -122,7 +122,8 @@ public class MultiSelectionRenderer<T> | |||
@Override | |||
public void onKeyUp(KeyUpEvent event) { | |||
if (event.getNativeKeyCode() != KeyCodes.KEY_SPACE || !checkBox.isEnabled()) { | |||
if (event.getNativeKeyCode() != KeyCodes.KEY_SPACE | |||
|| !checkBox.isEnabled()) { | |||
return; | |||
} | |||
int logicalRow = getLogicalRowIndex(grid, checkBox.getElement()); | |||
@@ -460,8 +461,9 @@ public class MultiSelectionRenderer<T> | |||
bottomBound = Math.max(finalBottomBound, pageY); | |||
} else { | |||
/* | |||
* Subsequent runs make sure that the scroll area grows (but doesn't | |||
* shrink) with the finger, but no further than the final bound. | |||
* Subsequent runs make sure that the scroll area grows (but | |||
* doesn't shrink) with the finger, but no further than the | |||
* final bound. | |||
*/ | |||
int oldTopBound = topBound; | |||
if (topBound < finalTopBound) { | |||
@@ -645,7 +647,7 @@ public class MultiSelectionRenderer<T> | |||
checkBox.setEnabled(grid.isEnabled() && !grid.isEditorActive()); | |||
} | |||
private int getDOMRowIndex(RendererCellReference cell){ | |||
private int getDOMRowIndex(RendererCellReference cell) { | |||
// getRowIndex starts with zero, that's why we add an additional 1. | |||
// getDOMRowIndex should include getHeaderRows as well, this number | |||
// should be equals to aria-rowindex. |
@@ -124,8 +124,8 @@ public interface SelectionModel<T> { | |||
* Checks if the user is allowed to have more than on item selected. | |||
* <p> | |||
* | |||
* @return <code>true</code> if the user is allowed to select multiple items, | |||
* <code>false</code> otherwise | |||
* @return <code>true</code> if the user is allowed to select multiple | |||
* items, <code>false</code> otherwise | |||
* @since 8.2 | |||
*/ | |||
boolean isMultiSelectionAllowed(); |
@@ -56,15 +56,13 @@ public class SpaceSelectHandler<T> { | |||
scrollHandler = null; | |||
} | |||
scrollHandler = grid | |||
.addDataAvailableHandler(dataAvailableEvent -> { | |||
if (dataAvailableEvent.getAvailableRows() | |||
.contains(rowIndex)) { | |||
setSelected(grid, rowIndex); | |||
scrollHandler.removeHandler(); | |||
scrollHandler = null; | |||
} | |||
}); | |||
scrollHandler = grid.addDataAvailableHandler(dataAvailableEvent -> { | |||
if (dataAvailableEvent.getAvailableRows().contains(rowIndex)) { | |||
setSelected(grid, rowIndex); | |||
scrollHandler.removeHandler(); | |||
scrollHandler = null; | |||
} | |||
}); | |||
grid.scrollToRow(rowIndex, ScrollDestination.ANY); | |||
} | |||
@@ -1150,8 +1150,8 @@ public class Escalator extends Widget | |||
* The following WAI-ARIA attributes are added through this class: | |||
* | |||
* <ul> | |||
* <li>aria-rowcount (since 8.2)</li> | |||
* <li>roles provided by {@link AriaGridRole} (since 8.2)</li> | |||
* <li>aria-rowcount (since 8.2)</li> | |||
* <li>roles provided by {@link AriaGridRole} (since 8.2)</li> | |||
* </ul> | |||
* | |||
* @since 8.2 | |||
@@ -1213,8 +1213,10 @@ public class Escalator extends Widget | |||
/** | |||
* Sets the {@code role} attribute to the given element. | |||
* | |||
* @param element element that should get the role attribute | |||
* @param role role to be added | |||
* @param element | |||
* element that should get the role attribute | |||
* @param role | |||
* role to be added | |||
* | |||
* @since 8.2 | |||
*/ | |||
@@ -1230,15 +1232,11 @@ public class Escalator extends Widget | |||
*/ | |||
public enum AriaGridRole { | |||
ROW("row"), | |||
ROWHEADER("rowheader"), | |||
ROWGROUP("rowgroup"), | |||
GRIDCELL("gridcell"), | |||
COLUMNHEADER("columnheader"); | |||
ROW("row"), ROWHEADER("rowheader"), ROWGROUP("rowgroup"), GRIDCELL( | |||
"gridcell"), COLUMNHEADER("columnheader"); | |||
private final String name; | |||
AriaGridRole(String name) { | |||
this.name = name; | |||
} | |||
@@ -1304,8 +1302,8 @@ public class Escalator extends Widget | |||
/** | |||
* Gets the role attribute of an element to represent a cell in a row. | |||
* <p> | |||
* Usually {@link AriaGridRole#GRIDCELL} except for a cell in | |||
* the header. | |||
* Usually {@link AriaGridRole#GRIDCELL} except for a cell in the | |||
* header. | |||
* | |||
* @return the role attribute for the element to represent cells | |||
* | |||
@@ -1318,8 +1316,7 @@ public class Escalator extends Widget | |||
/** | |||
* Gets the role attribute of an element to represent a row in a grid. | |||
* <p> | |||
* Usually {@link AriaGridRole#ROW} except for a row in | |||
* the header. | |||
* Usually {@link AriaGridRole#ROW} except for a row in the header. | |||
* | |||
* @return the role attribute for the element to represent rows | |||
* | |||
@@ -1573,7 +1570,8 @@ public class Escalator extends Widget | |||
.getColumnCount(); col++) { | |||
final double colWidth = columnConfiguration | |||
.getColumnWidthActual(col); | |||
final TableCellElement cellElem = createCellElement(colWidth); | |||
final TableCellElement cellElem = createCellElement( | |||
colWidth); | |||
tr.appendChild(cellElem); | |||
// Set stylename and position if new cell is frozen | |||
if (col < columnConfiguration.frozenColumns) { |
@@ -5624,7 +5624,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, | |||
/** | |||
* Returns whether Grid should handle events from Widgets in this | |||
* Column. | |||
* | |||
* | |||
* @return {@code true} to handle events from widgets; {@code false} to | |||
* not | |||
* @since 8.3 | |||
@@ -7377,7 +7377,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, | |||
/** | |||
* Helper method for making sure desired row is visible and it is properly | |||
* rendered. | |||
* | |||
* | |||
* @param rowIndex | |||
* the row to look for | |||
* @param destination | |||
@@ -7402,7 +7402,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, | |||
/** | |||
* Helper method for making sure desired row is visible and it is properly | |||
* rendered. | |||
* | |||
* | |||
* @param rowIndex | |||
* the row to look for | |||
* @param whenRendered | |||
@@ -7452,7 +7452,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, | |||
/** | |||
* Helper method for scrolling and making sure row is visible. | |||
* | |||
* | |||
* @param rowIndex | |||
* the row index to make visible | |||
* @param destination |
@@ -1,8 +1,8 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.1//EN" "http://gwtproject.org/doctype/2.8.1/gwt-module.dtd"> | |||
<module> | |||
<!-- This GWT module defines the Vaadin DefaultWidgetSet. This is the module | |||
you want to extend when creating an extended widget set, or when creating | |||
<!-- This GWT module defines the Vaadin DefaultWidgetSet. This is the module | |||
you want to extend when creating an extended widget set, or when creating | |||
a specialized widget set with a subset of the components. --> | |||
<!-- Hint for WidgetSetBuilder not to automatically update the file --> | |||
@@ -35,8 +35,8 @@ | |||
<when-type-is class="com.vaadin.client.widgets.Overlay" /> | |||
</replace-with> | |||
<!-- Since 7.2. Compile all permutations (browser support) into one Javascript | |||
file. Speeds up compilation and does not make the Javascript significantly | |||
<!-- Since 7.2. Compile all permutations (browser support) into one Javascript | |||
file. Speeds up compilation and does not make the Javascript significantly | |||
larger. --> | |||
<collapse-all-properties /> | |||
@@ -1,8 +1,8 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.1//EN" "http://gwtproject.org/doctype/2.8.1/gwt-module.dtd"> | |||
<module> | |||
<!-- This GWT module inherits all Vaadin client side functionality modules. | |||
This is the module you want to inherit in your client side project to be | |||
<!-- This GWT module inherits all Vaadin client side functionality modules. | |||
This is the module you want to inherit in your client side project to be | |||
able to use com.vaadin.* classes. --> | |||
<!-- Hint for WidgetSetBuilder not to automatically update the file --> | |||
@@ -18,7 +18,7 @@ | |||
<source path="client" /> | |||
<source path="shared" /> | |||
<!-- Use own Scheduler implementation to be able to track if commands | |||
<!-- Use own Scheduler implementation to be able to track if commands | |||
are running --> | |||
<replace-with class="com.vaadin.client.VSchedulerImpl"> | |||
<when-type-is class="com.google.gwt.core.client.impl.SchedulerImpl" /> | |||
@@ -29,7 +29,7 @@ | |||
<when-type-is class="com.vaadin.client.communication.PushConnection" /> | |||
</replace-with> | |||
<!-- Set vaadin.profiler to true to include profiling support in the | |||
<!-- Set vaadin.profiler to true to include profiling support in the | |||
module --> | |||
<define-property name="vaadin.profiler" values="true,false" /> | |||
<set-property name="vaadin.profiler" value="false" /> | |||
@@ -59,11 +59,11 @@ | |||
<when-property-is name="user.agent" value="gecko1_8" /> | |||
</none> | |||
</set-property> | |||
<!-- If no proper user agent is found, at least try some, e.g. with crawlers --> | |||
<set-property-fallback name="user.agent" value="safari" /> | |||
<!-- Fall through to this rule when the browser doesn't support pointer | |||
<!-- Fall through to this rule when the browser doesn't support pointer | |||
event --> | |||
<replace-with class="com.vaadin.client.event.PointerEventSupportImpl"> | |||
<when-type-is class="com.vaadin.client.event.PointerEventSupportImpl" /> |
@@ -8,8 +8,7 @@ import com.vaadin.shared.util.SharedUtil; | |||
public class ApplicationConnectionURLGenerationTest { | |||
private static final String[] URIS = { | |||
"http://demo.vaadin.com/", // | |||
private static final String[] URIS = { "http://demo.vaadin.com/", // | |||
"https://demo.vaadin.com/", "http://demo.vaadin.com/foo", | |||
"http://demo.vaadin.com/foo?f", "http://demo.vaadin.com/foo?f=1", | |||
"http://demo.vaadin.com:1234/foo?a", |
@@ -453,6 +453,38 @@ | |||
<artifactId>vaadin-maven-plugin</artifactId> | |||
<version>${vaadin.plugin.version}</version> | |||
</plugin> | |||
<plugin> | |||
<groupId>net.revelc.code.formatter</groupId> | |||
<artifactId>formatter-maven-plugin</artifactId> | |||
<version>2.7.2</version> | |||
<configuration> | |||
<configFile>${project.basedir}/../eclipse/VaadinJavaConventions.xml</configFile> | |||
<skipJsFormatting>true</skipJsFormatting> | |||
</configuration> | |||
<executions> | |||
<execution> | |||
<id>format-source</id> | |||
<goals> | |||
<goal>format</goal> | |||
</goals> | |||
<phase>process-sources</phase> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<plugin> | |||
<groupId>com.github.dantwining.whitespace-maven-plugin</groupId> | |||
<artifactId>whitespace-maven-plugin</artifactId> | |||
<version>1.0.4</version> | |||
<executions> | |||
<execution> | |||
<id>trim-trailing-spaces-source</id> | |||
<goals> | |||
<goal>trim</goal> | |||
</goals> | |||
<phase>process-sources</phase> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-checkstyle-plugin</artifactId> | |||
@@ -540,16 +572,6 @@ | |||
</pluginManagement> | |||
<plugins> | |||
<plugin> | |||
<groupId>com.marvinformatics.formatter</groupId> | |||
<artifactId>formatter-maven-plugin</artifactId> | |||
<version>1.8.1</version> | |||
<configuration> | |||
<configFile>classpath:/eclipse/VaadinJavaConventions.xml</configFile> | |||
<!-- Provide a dummy JS config file to avoid errors --> | |||
<configJsFile>classpath:/eclipse/VaadinJavaConventions.xml</configJsFile> | |||
</configuration> | |||
</plugin> | |||
<plugin> | |||
<groupId>org.codehaus.mojo</groupId> | |||
<artifactId>animal-sniffer-maven-plugin</artifactId> |
@@ -139,6 +139,14 @@ | |||
<build> | |||
<plugins> | |||
<plugin> | |||
<groupId>net.revelc.code.formatter</groupId> | |||
<artifactId>formatter-maven-plugin</artifactId> | |||
</plugin> | |||
<plugin> | |||
<groupId>com.github.dantwining.whitespace-maven-plugin</groupId> | |||
<artifactId>whitespace-maven-plugin</artifactId> | |||
</plugin> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-dependency-plugin</artifactId> |
@@ -42,9 +42,9 @@ import com.vaadin.server.ClientConnector; | |||
* </ul> | |||
* Note that you should (almost) always use URLs starting with | |||
* {@literal frontend://} so that the framework can resolve the files to either | |||
* {@literal VAADIN/frontend/es5} or {@literal VAADIN/frontend/es6} depending on if the browser | |||
* supports ES6 classes (most browers) or not (IE11 and Safari <= 9). Polymer | |||
* elements rely on importing dependencies using relative paths | |||
* {@literal VAADIN/frontend/es5} or {@literal VAADIN/frontend/es6} depending on | |||
* if the browser supports ES6 classes (most browers) or not (IE11 and Safari <= | |||
* 9). Polymer elements rely on importing dependencies using relative paths | |||
* {@literal ../../other-element/other-element.html}, which will not work if | |||
* they are installed in different locations. | |||
* <p> |
@@ -35,22 +35,23 @@ import com.vaadin.data.HasValue; | |||
* <p> | |||
* In following usage example, the text field would be bound to property "foo" | |||
* in the Entity class. | |||
* | |||
* <pre> | |||
class Editor extends FormLayout { | |||
@PropertyId("foo") | |||
TextField myField = new TextField(); | |||
} | |||
class Entity { | |||
String foo; | |||
} | |||
{ | |||
Editor editor = new Editor(); | |||
Binder<Entity> binder = new Binder(Entity.class); | |||
binder.bindInstanceFields(editor); | |||
} | |||
</pre> | |||
* class Editor extends FormLayout { | |||
* @PropertyId("foo") | |||
* TextField myField = new TextField(); | |||
* } | |||
* | |||
* class Entity { | |||
* String foo; | |||
* } | |||
* | |||
* { | |||
* Editor editor = new Editor(); | |||
* Binder<Entity> binder = new Binder(Entity.class); | |||
* binder.bindInstanceFields(editor); | |||
* } | |||
* </pre> | |||
* | |||
* @since 8.0 | |||
* @author Vaadin Ltd |
@@ -67,8 +67,9 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
* When this instance is deserialized, it will be replaced with a | |||
* property set for the corresponding bean type and property name. | |||
*/ | |||
return get(instanceKey.type,instanceKey.checkNestedDefinitions, | |||
new PropertyFilterDefinition(instanceKey.depth,instanceKey.ignorePackageNames)); | |||
return get(instanceKey.type, instanceKey.checkNestedDefinitions, | |||
new PropertyFilterDefinition(instanceKey.depth, | |||
instanceKey.ignorePackageNames)); | |||
} | |||
} | |||
@@ -144,8 +145,8 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
* serialize a DTO that when deserialized will get the corresponding | |||
* property definition from the cache. | |||
*/ | |||
return new SerializedPropertyDefinition(getPropertySet().instanceKey.type, | |||
getName()); | |||
return new SerializedPropertyDefinition( | |||
getPropertySet().instanceKey.type, getName()); | |||
} | |||
} | |||
@@ -177,7 +178,7 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
super(propertySet, parent.getType(), descriptor); | |||
this.parent = parent; | |||
} | |||
@Override | |||
public ValueProvider<T, V> getGetter() { | |||
return bean -> { | |||
@@ -210,22 +211,21 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
public String getName() { | |||
return parent.getName() + "." + super.getName(); | |||
} | |||
@Override | |||
public String getTopLevelName() { | |||
return super.getName(); | |||
} | |||
private Object writeReplace() { | |||
/* | |||
* Instead of serializing this actual property definition, only | |||
* serialize a DTO that when deserialized will get the corresponding | |||
* property definition from the cache. | |||
*/ | |||
return new SerializedPropertyDefinition(getPropertySet().instanceKey.type, | |||
getName()); | |||
return new SerializedPropertyDefinition( | |||
getPropertySet().instanceKey.type, getName()); | |||
} | |||
/** | |||
* Gets the parent property definition. | |||
@@ -308,8 +308,8 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
this.instanceKey = instanceKey; | |||
try { | |||
definitions = BeanUtil.getBeanPropertyDescriptors(instanceKey.type).stream() | |||
.filter(BeanPropertySet::hasNonObjectReadMethod) | |||
definitions = BeanUtil.getBeanPropertyDescriptors(instanceKey.type) | |||
.stream().filter(BeanPropertySet::hasNonObjectReadMethod) | |||
.map(descriptor -> new BeanPropertyDefinition<>(this, | |||
instanceKey.type, descriptor)) | |||
.collect(Collectors.toMap(PropertyDefinition::getName, | |||
@@ -322,13 +322,15 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
} | |||
} | |||
private BeanPropertySet(InstanceKey<T> instanceKey, Map<String, PropertyDefinition<T, ?>> definitions) { | |||
private BeanPropertySet(InstanceKey<T> instanceKey, | |||
Map<String, PropertyDefinition<T, ?>> definitions) { | |||
this.instanceKey = instanceKey; | |||
this.definitions = new HashMap<>(definitions); | |||
} | |||
private BeanPropertySet(InstanceKey<T> instanceKey, boolean checkNestedDefinitions, | |||
PropertyFilterDefinition propertyFilterDefinition) { | |||
private BeanPropertySet(InstanceKey<T> instanceKey, | |||
boolean checkNestedDefinitions, | |||
PropertyFilterDefinition propertyFilterDefinition) { | |||
this(instanceKey); | |||
if (checkNestedDefinitions) { | |||
Objects.requireNonNull(propertyFilterDefinition, | |||
@@ -400,12 +402,13 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
Objects.requireNonNull(beanType, "Bean type cannot be null"); | |||
InstanceKey key = new InstanceKey(beanType, false, 0, null); | |||
// Cache the reflection results | |||
return (PropertySet<T>) INSTANCES.computeIfAbsent(key, | |||
ignored -> new BeanPropertySet<>(key)).copy(); | |||
return (PropertySet<T>) INSTANCES | |||
.computeIfAbsent(key, ignored -> new BeanPropertySet<>(key)) | |||
.copy(); | |||
} | |||
private BeanPropertySet<T> copy() { | |||
return new BeanPropertySet<>(instanceKey,definitions); | |||
return new BeanPropertySet<>(instanceKey, definitions); | |||
} | |||
/** | |||
@@ -428,9 +431,10 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
InstanceKey key = new InstanceKey(beanType, false, | |||
filterDefinition.getMaxNestingDepth(), | |||
filterDefinition.getIgnorePackageNamesStartingWith()); | |||
return (PropertySet<T>) INSTANCES.computeIfAbsent(key, | |||
k -> new BeanPropertySet<>(key, checkNestedDefinitions, | |||
filterDefinition)).copy(); | |||
return (PropertySet<T>) INSTANCES | |||
.computeIfAbsent(key, k -> new BeanPropertySet<>(key, | |||
checkNestedDefinitions, filterDefinition)) | |||
.copy(); | |||
} | |||
@Override | |||
@@ -479,7 +483,7 @@ public class BeanPropertySet<T> implements PropertySet<T> { | |||
/** | |||
* Gets the bean type of this bean property set. | |||
* | |||
* | |||
* @since 8.2 | |||
* @return the bean type of this bean property set | |||
*/ |
@@ -51,11 +51,11 @@ public class BeanValidationBinder<BEAN> extends Binder<BEAN> { | |||
public BeanValidationBinder(Class<BEAN> beanType) { | |||
super(beanType); | |||
if (!BeanUtil.checkBeanValidationAvailable()) { | |||
throw new IllegalStateException( | |||
BeanValidationBinder.class.getSimpleName() | |||
+ " cannot be used because a JSR-303 Bean Validation " | |||
+ "implementation not found on the classpath or could not be initialized. Use " | |||
+ Binder.class.getSimpleName() + " instead"); | |||
throw new IllegalStateException(BeanValidationBinder.class | |||
.getSimpleName() | |||
+ " cannot be used because a JSR-303 Bean Validation " | |||
+ "implementation not found on the classpath or could not be initialized. Use " | |||
+ Binder.class.getSimpleName() + " instead"); | |||
} | |||
this.beanType = beanType; | |||
} |
@@ -197,9 +197,9 @@ public class Binder<BEAN> implements Serializable { | |||
/** | |||
* Gets the current read-only status for this Binding. | |||
* | |||
* | |||
* @see #setReadOnly(boolean) | |||
* | |||
* | |||
* @return {@code true} if read-only; {@code false} if not | |||
* @since 8.4 | |||
*/ |
@@ -25,9 +25,9 @@ import com.vaadin.event.SerializableEventListener; | |||
* handling. | |||
* <p> | |||
* The default handler will show | |||
* {@link com.vaadin.ui.AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) an | |||
* error message} for failed field validations. For bean level validation errors | |||
* it will display the first error message in | |||
* {@link com.vaadin.ui.AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) | |||
* an error message} for failed field validations. For bean level validation | |||
* errors it will display the first error message in | |||
* {@link Binder#setStatusLabel(com.vaadin.ui.Label) status label}, if one has | |||
* been set. | |||
* |
@@ -24,8 +24,8 @@ import com.vaadin.event.SerializableEventListener; | |||
* {@link BindingBuilder#withValidationStatusHandler(BindingValidationStatusHandler)} | |||
* Register} an instance of this class to be able to override the default | |||
* handling, which is to show | |||
* {@link com.vaadin.ui.AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) an | |||
* error message} for failed field validations. | |||
* {@link com.vaadin.ui.AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) | |||
* an error message} for failed field validations. | |||
* | |||
* @author Vaadin Ltd | |||
* |
@@ -72,7 +72,7 @@ public interface PropertyDefinition<T, V> extends Serializable { | |||
/** | |||
* Gets the top level name of this property. | |||
* | |||
* | |||
* @return the top level property name, not <code>null</code> | |||
* @since 8.3 | |||
*/ |
@@ -25,21 +25,19 @@ import java.util.List; | |||
* @author Vaadin Ltd | |||
* @since 8.2 | |||
*/ | |||
public class PropertyFilterDefinition | |||
implements Serializable { | |||
public class PropertyFilterDefinition implements Serializable { | |||
private int maxNestingDepth; | |||
private List<String> ignorePackageNamesStartingWith; | |||
/** | |||
* Create a property filter with max nesting depth and package names | |||
* to ignore. | |||
* Create a property filter with max nesting depth and package names to | |||
* ignore. | |||
* | |||
* @param maxNestingDepth | |||
* The maximum amount of nesting levels for | |||
* sub-properties. | |||
* The maximum amount of nesting levels for sub-properties. | |||
* @param ignorePackageNamesStartingWith | |||
* Ignore package names that start with this string, for | |||
* example "java.lang". | |||
* Ignore package names that start with this string, for example | |||
* "java.lang". | |||
*/ | |||
public PropertyFilterDefinition(int maxNestingDepth, | |||
List<String> ignorePackageNamesStartingWith) { | |||
@@ -71,7 +69,8 @@ public class PropertyFilterDefinition | |||
* @return default property filter | |||
*/ | |||
public static PropertyFilterDefinition getDefaultFilter() { | |||
return new PropertyFilterDefinition(BeanPropertySet.NestedBeanPropertyDefinition.MAX_PROPERTY_NESTING_DEPTH, | |||
return new PropertyFilterDefinition( | |||
BeanPropertySet.NestedBeanPropertyDefinition.MAX_PROPERTY_NESTING_DEPTH, | |||
Arrays.asList("java")); | |||
} | |||
} |
@@ -357,11 +357,11 @@ public class TreeData<T> implements Serializable { | |||
* Get the parent item for the given item. | |||
* | |||
* @param item | |||
* the item for which to retrieve the parent item for | |||
* the item for which to retrieve the parent item for | |||
* @return parent item for the given item or {@code null} if the item is a | |||
* root item. | |||
* @throws IllegalArgumentException | |||
* if the item does not exist in this structure | |||
* if the item does not exist in this structure | |||
* @since 8.1.1 | |||
*/ | |||
public T getParent(T item) { | |||
@@ -375,14 +375,14 @@ public class TreeData<T> implements Serializable { | |||
/** | |||
* Moves an item to become a child of the given parent item. The new parent | |||
* item must exist in the hierarchy. Setting the parent to {@code null} | |||
* makes the item a root item. After making changes to the tree data, {@link | |||
* TreeDataProvider#refreshAll()} should be called. | |||
* makes the item a root item. After making changes to the tree data, | |||
* {@link TreeDataProvider#refreshAll()} should be called. | |||
* | |||
* @param item | |||
* the item to be set as the child of {@code parent} | |||
* the item to be set as the child of {@code parent} | |||
* @param parent | |||
* the item to be set as parent or {@code null} to set the item as | |||
* root | |||
* the item to be set as parent or {@code null} to set the item | |||
* as root | |||
* @since 8.1 | |||
*/ | |||
public void setParent(T item, T parent) { | |||
@@ -422,9 +422,9 @@ public class TreeData<T> implements Serializable { | |||
* {@link TreeDataProvider#refreshAll()} should be called. | |||
* | |||
* @param item | |||
* the item to be moved | |||
* the item to be moved | |||
* @param sibling | |||
* the item after which the moved item will be located, or {@code | |||
* the item after which the moved item will be located, or {@code | |||
* null} to move item to first position | |||
* @since 8.1 | |||
*/ | |||
@@ -451,9 +451,8 @@ public class TreeData<T> implements Serializable { | |||
if (!Objects.equals(parent, | |||
itemToWrapperMap.get(sibling).getParent())) { | |||
throw new IllegalArgumentException( | |||
"Items '" + item + "' and '" + sibling | |||
+ "' don't have the same parent"); | |||
throw new IllegalArgumentException("Items '" + item + "' and '" | |||
+ sibling + "' don't have the same parent"); | |||
} | |||
List<T> children = itemToWrapperMap.get(parent).getChildren(); |
@@ -59,10 +59,8 @@ public class ValidationException extends Exception { | |||
* @return a list of all validation errors | |||
*/ | |||
public List<ValidationResult> getValidationErrors() { | |||
List<ValidationResult> errors = | |||
getFieldValidationErrors().stream() | |||
.map(s -> s.getResult().get()) | |||
.collect(Collectors.toList()); | |||
List<ValidationResult> errors = getFieldValidationErrors().stream() | |||
.map(s -> s.getResult().get()).collect(Collectors.toList()); | |||
errors.addAll(getBeanValidationErrors()); | |||
return errors; | |||
} |
@@ -35,21 +35,25 @@ import com.vaadin.ui.InlineDateTimeField; | |||
* @author Vaadin Ltd | |||
* @since 8.0 | |||
*/ | |||
public class LocalDateTimeToDateConverter implements Converter<LocalDateTime, Date> { | |||
public class LocalDateTimeToDateConverter | |||
implements Converter<LocalDateTime, Date> { | |||
private ZoneId zoneId; | |||
/** | |||
* Creates a new converter using the given time zone. | |||
* | |||
* @param zoneId the time zone to use, not <code>null</code> | |||
* @param zoneId | |||
* the time zone to use, not <code>null</code> | |||
*/ | |||
public LocalDateTimeToDateConverter(ZoneId zoneId) { | |||
this.zoneId = Objects.requireNonNull(zoneId, "Zone identifier cannot be null"); | |||
this.zoneId = Objects.requireNonNull(zoneId, | |||
"Zone identifier cannot be null"); | |||
} | |||
@Override | |||
public Result<Date> convertToModel(LocalDateTime localDate, ValueContext context) { | |||
public Result<Date> convertToModel(LocalDateTime localDate, | |||
ValueContext context) { | |||
if (localDate == null) { | |||
return Result.ok(null); | |||
} | |||
@@ -58,12 +62,14 @@ public class LocalDateTimeToDateConverter implements Converter<LocalDateTime, Da | |||
} | |||
@Override | |||
public LocalDateTime convertToPresentation(Date date, ValueContext context) { | |||
public LocalDateTime convertToPresentation(Date date, | |||
ValueContext context) { | |||
if (date == null) { | |||
return null; | |||
} | |||
return Instant.ofEpochMilli(date.getTime()).atZone(zoneId).toLocalDateTime(); | |||
return Instant.ofEpochMilli(date.getTime()).atZone(zoneId) | |||
.toLocalDateTime(); | |||
} | |||
} |
@@ -41,8 +41,9 @@ import com.vaadin.data.ValueContext; | |||
public class StringToDateConverter implements Converter<String, Date> { | |||
/** | |||
* Returns the format used by {@link #convertToPresentation(Date, ValueContext)} | |||
* and {@link #convertToModel(String, ValueContext)}. | |||
* Returns the format used by | |||
* {@link #convertToPresentation(Date, ValueContext)} and | |||
* {@link #convertToModel(String, ValueContext)}. | |||
* | |||
* @param locale | |||
* The locale to use |
@@ -27,8 +27,7 @@ package com.vaadin.data.provider; | |||
* @param <F> | |||
* filter type | |||
*/ | |||
public abstract class AbstractHierarchicalDataProvider<T, F> | |||
extends AbstractDataProvider<T, F> | |||
implements HierarchicalDataProvider<T, F> { | |||
public abstract class AbstractHierarchicalDataProvider<T, F> extends | |||
AbstractDataProvider<T, F> implements HierarchicalDataProvider<T, F> { | |||
} |
@@ -161,8 +161,8 @@ public interface DataProvider<T, F> extends Serializable { | |||
* // ComboBox uses String as the filter type | |||
* DataProvider<Person, String> wrappedProvider = dataProvider | |||
* .withConvertedFilter(filterText -> { | |||
* SerializablePredicate<Person> predicate = person -> person.getName() | |||
* .startsWith(filterText); | |||
* SerializablePredicate<Person> predicate = person -> person | |||
* .getName().startsWith(filterText); | |||
* return predicate; | |||
* }); | |||
* comboBox.setDataProvider(wrappedProvider); |
@@ -28,7 +28,8 @@ import com.vaadin.ui.Grid.Column; | |||
public class GridSortOrder<T> extends SortOrder<Column<T, ?>> { | |||
/** | |||
* Construct sorting information for usage in a {@link com.vaadin.ui.Grid Grid}. | |||
* Construct sorting information for usage in a {@link com.vaadin.ui.Grid | |||
* Grid}. | |||
* | |||
* @param column | |||
* the column to be sorted |
@@ -116,14 +116,17 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { | |||
} | |||
/** | |||
* Create new {@code HierarchyMapper} for the given data provider. | |||
* May be overridden in subclasses. | |||
* Create new {@code HierarchyMapper} for the given data provider. May be | |||
* overridden in subclasses. | |||
* | |||
* @param dataProvider the data provider | |||
* @param <F> Query type | |||
* @param dataProvider | |||
* the data provider | |||
* @param <F> | |||
* Query type | |||
* @return new {@link HierarchyMapper} | |||
*/ | |||
protected <F> HierarchyMapper<T, F> createHierarchyMapper(HierarchicalDataProvider<T, F> dataProvider) { | |||
protected <F> HierarchyMapper<T, F> createHierarchyMapper( | |||
HierarchicalDataProvider<T, F> dataProvider) { | |||
return new HierarchyMapper<>(dataProvider); | |||
} | |||
@@ -171,7 +174,7 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { | |||
* method will have no effect if the row is already collapsed. | |||
* {@code syncAndRefresh} indicates whether the changes should be | |||
* synchronised to the client and the data provider be notified. | |||
* | |||
* | |||
* @param item | |||
* the item to collapse | |||
* @param syncAndRefresh | |||
@@ -180,7 +183,8 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { | |||
* changes, {@code false} otherwise. | |||
*/ | |||
public void collapse(T item, boolean syncAndRefresh) { | |||
Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) : null; | |||
Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) | |||
: null; | |||
doCollapse(item, index, syncAndRefresh); | |||
} | |||
@@ -202,7 +206,7 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { | |||
* will have no effect if the row is already collapsed. The index is | |||
* provided by the client-side or calculated from a full data request. | |||
* | |||
* | |||
* | |||
* @param item | |||
* the item to collapse | |||
* @param index | |||
@@ -220,7 +224,7 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { | |||
* provided by the client-side or calculated from a full data request. | |||
* {@code syncAndRefresh} indicates whether the changes should be | |||
* synchronised to the client and the data provider be notified. | |||
* | |||
* | |||
* @param item | |||
* the item to collapse | |||
* @param index | |||
@@ -267,7 +271,8 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { | |||
* false} otherwise. | |||
*/ | |||
public void expand(T item, boolean syncAndRefresh) { | |||
Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) : null; | |||
Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) | |||
: null; | |||
doExpand(item, index, syncAndRefresh); | |||
} | |||
@@ -304,11 +309,10 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { | |||
Range addedRows = mapper.expand(item, index); | |||
if (syncAndRefresh) { | |||
if (!reset && !addedRows.isEmpty()) { | |||
getClientRpc() | |||
.insertRows(addedRows.getStart(), addedRows.length()); | |||
Stream<T> children = mapper | |||
.fetchItems(item, | |||
Range.withLength(0, addedRows.length())); | |||
getClientRpc().insertRows(addedRows.getStart(), | |||
addedRows.length()); | |||
Stream<T> children = mapper.fetchItems(item, | |||
Range.withLength(0, addedRows.length())); | |||
pushData(addedRows.getStart(), | |||
children.collect(Collectors.toList())); | |||
} |
@@ -397,8 +397,11 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> { | |||
/** | |||
* Find parent for the given item among open folders. | |||
* @param item the item | |||
* @return parent item or {@code null} for root items or if the parent is closed | |||
* | |||
* @param item | |||
* the item | |||
* @return parent item or {@code null} for root items or if the parent is | |||
* closed | |||
*/ | |||
protected T getParentOfItem(T item) { | |||
Objects.requireNonNull(item, "Can not find the parent of null"); | |||
@@ -408,8 +411,8 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> { | |||
/** | |||
* Removes all children of an item identified by a given id. Items removed | |||
* by this method as well as the original item are all marked to be | |||
* collapsed. | |||
* May be overridden in subclasses for removing obsolete data to avoid memory leaks. | |||
* collapsed. May be overridden in subclasses for removing obsolete data to | |||
* avoid memory leaks. | |||
* | |||
* @param id | |||
* the item id | |||
@@ -427,10 +430,11 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> { | |||
} | |||
} | |||
expandedItemIds.remove(id); | |||
invalidatedChildren.stream().map(getDataProvider()::getId).forEach(x -> { | |||
removeChildren(x); | |||
parentIdMap.remove(x); | |||
}); | |||
invalidatedChildren.stream().map(getDataProvider()::getId) | |||
.forEach(x -> { | |||
removeChildren(x); | |||
parentIdMap.remove(x); | |||
}); | |||
} | |||
/** | |||
@@ -532,15 +536,18 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> { | |||
} | |||
/** | |||
* Register parent and children items into inner structures. | |||
* May be overridden in subclasses. | |||
* Register parent and children items into inner structures. May be | |||
* overridden in subclasses. | |||
* | |||
* @param parent the parent item | |||
* @param childList list of parents children to be registered. | |||
* @param parent | |||
* the parent item | |||
* @param childList | |||
* list of parents children to be registered. | |||
*/ | |||
protected void registerChildren(T parent, List<T> childList) { | |||
childMap.put(parent, new HashSet<>(childList)); | |||
childList.forEach(x -> parentIdMap.put(getDataProvider().getId(x), parent)); | |||
childList.forEach( | |||
x -> parentIdMap.put(getDataProvider().getId(x), parent)); | |||
} | |||
/** |
@@ -383,8 +383,7 @@ public interface InMemoryDataProvider<T> extends | |||
ValueProvider<T, String> valueProvider, Locale locale) { | |||
Objects.requireNonNull(locale, "Locale cannot be null"); | |||
return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString( | |||
this, valueProvider, | |||
String::contains, () -> locale); | |||
this, valueProvider, String::contains, () -> locale); | |||
} | |||
/** | |||
@@ -425,8 +424,8 @@ public interface InMemoryDataProvider<T> extends | |||
*/ | |||
public default DataProvider<T, String> filteringByPrefix( | |||
ValueProvider<T, String> valueProvider, Locale locale) { | |||
return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(this, valueProvider, | |||
String::startsWith, () -> locale); | |||
return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString( | |||
this, valueProvider, String::startsWith, () -> locale); | |||
} | |||
/** | |||
@@ -445,7 +444,8 @@ public interface InMemoryDataProvider<T> extends | |||
*/ | |||
public default DataProvider<T, String> filteringByPrefix( | |||
ValueProvider<T, String> valueProvider) { | |||
return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(this, valueProvider, | |||
String::startsWith, InMemoryDataProviderHelpers.CURRENT_LOCALE_SUPPLIER); | |||
return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString( | |||
this, valueProvider, String::startsWith, | |||
InMemoryDataProviderHelpers.CURRENT_LOCALE_SUPPLIER); | |||
} | |||
} |
@@ -41,8 +41,7 @@ import com.vaadin.ui.Component; | |||
* | |||
* | |||
*/ | |||
public class ActionManager | |||
implements Action.Handler, Action.Notifier { | |||
public class ActionManager implements Action.Handler, Action.Notifier { | |||
private static final long serialVersionUID = 1641868163608066491L; | |||
@@ -30,7 +30,8 @@ import com.vaadin.util.ReflectTools; | |||
* @param <T> | |||
* collapsed item type | |||
*/ | |||
public class CollapseEvent<T> extends Component.Event implements HasUserOriginated { | |||
public class CollapseEvent<T> extends Component.Event | |||
implements HasUserOriginated { | |||
private final T collapsedItem; | |||
@@ -19,8 +19,8 @@ import com.vaadin.server.ClientConnector; | |||
import com.vaadin.ui.UI; | |||
/** | |||
* Event which is fired for all registered MarkDirtyListeners when a | |||
* connector is marked as dirty. | |||
* Event which is fired for all registered MarkDirtyListeners when a connector | |||
* is marked as dirty. | |||
* | |||
* @since 8.4 | |||
*/ |
@@ -27,7 +27,7 @@ public interface MarkedAsDirtyListener extends ConnectorEventListener { | |||
* Method called when a client connector has been marked as dirty. | |||
* | |||
* @param event | |||
* marked as dirty connector event object | |||
* marked as dirty connector event object | |||
*/ | |||
void connectorMarkedAsDirty(MarkedAsDirtyConnectorEvent event); | |||
} |
@@ -60,10 +60,11 @@ public interface AcceptCriterion extends Serializable { | |||
public void paint(PaintTarget target) throws PaintException; | |||
/** | |||
* This needs to be implemented if and only if a criterion does some lazy server side | |||
* initialization. The UIDL painted in this method will be passed to client | |||
* side drop handler implementation. Implementation can assume that | |||
* {@link #accept(DragAndDropEvent)} is called before this method. | |||
* This needs to be implemented if and only if a criterion does some lazy | |||
* server side initialization. The UIDL painted in this method will be | |||
* passed to client side drop handler implementation. Implementation can | |||
* assume that {@link #accept(DragAndDropEvent)} is called before this | |||
* method. | |||
* | |||
* @param target | |||
* @throws PaintException |
@@ -30,8 +30,7 @@ import com.vaadin.server.PaintTarget; | |||
* | |||
* @since 6.3 | |||
*/ | |||
public abstract class ClientSideCriterion | |||
implements AcceptCriterion { | |||
public abstract class ClientSideCriterion implements AcceptCriterion { | |||
/* | |||
* All criteria that extend this must be completely validatable on client |
@@ -36,8 +36,7 @@ import com.vaadin.server.PaintTarget; | |||
* | |||
* @since 6.3 | |||
*/ | |||
public abstract class ServerSideCriterion | |||
implements AcceptCriterion { | |||
public abstract class ServerSideCriterion implements AcceptCriterion { | |||
private static final long serialVersionUID = 2128510128911628902L; | |||
@@ -36,7 +36,8 @@ public class BootstrapFragmentResponse extends BootstrapResponse { | |||
/** | |||
* Crate a new bootstrap fragment response. | |||
* | |||
* @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest, VaadinSession, Class, UIProvider) | |||
* @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest, | |||
* VaadinSession, Class, UIProvider) | |||
* | |||
* @param handler | |||
* the bootstrap handler that is firing the event |
@@ -325,8 +325,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { | |||
protected String encodeQueryStringParameterValue(String queryString) { | |||
String encodedString = null; | |||
try { | |||
encodedString = URLEncoder.encode(queryString, | |||
UTF_8.name()); | |||
encodedString = URLEncoder.encode(queryString, UTF_8.name()); | |||
} catch (UnsupportedEncodingException e) { | |||
// should never happen | |||
throw new RuntimeException("Could not find UTF-8", e); | |||
@@ -661,8 +660,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { | |||
mainDiv.attr("id", context.getAppId()); | |||
mainDiv.addClass("v-app"); | |||
mainDiv.addClass(context.getThemeName()); | |||
mainDiv.addClass(context.getUIClass().getSimpleName() | |||
.toLowerCase(Locale.ROOT)); | |||
mainDiv.addClass( | |||
context.getUIClass().getSimpleName().toLowerCase(Locale.ROOT)); | |||
if (style != null && !style.isEmpty()) { | |||
mainDiv.attr("style", style); | |||
} |