- removed unused private methods - removed unused private variables - removed unnecessary initializations - removed unnecessary substring(0) - removed inner assignments - renamed private methods that started with upper case - renamed static final variables to use upper case - converted to use non-deprecated options - suppressed unavoidable warnings - divided long Strings to multiple lines - added missing types - added missing JavaDoc parameters - formatting - updated comments & JavaDocstags/8.14.0.alpha1
@@ -39,6 +39,7 @@ import com.vaadin.shared.ui.dd.AcceptCriterion; | |||
* classpath. | |||
* | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
public class AcceptCriteriaFactoryGenerator extends Generator { | |||
private String packageName; | |||
@@ -75,8 +76,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator { | |||
*/ | |||
private void generateClass(TreeLogger logger, GeneratorContext context) { | |||
// get print writer that receives the source code | |||
PrintWriter printWriter = null; | |||
printWriter = context.tryCreate(logger, packageName, className); | |||
PrintWriter printWriter = context.tryCreate(logger, packageName, | |||
className); | |||
// print writer if null, source code has ALREADY been generated, | |||
// return (WidgetMap is equal to all permutations atm) | |||
if (printWriter == null) { | |||
@@ -86,8 +87,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator { | |||
Date date = new Date(); | |||
// init composer, set class properties, create source writer | |||
ClassSourceFileComposerFactory composer = null; | |||
composer = new ClassSourceFileComposerFactory(packageName, className); | |||
ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory( | |||
packageName, className); | |||
composer.addImport("com.google.gwt.core.client.GWT"); | |||
composer.setSuperclass( | |||
"com.vaadin.client.ui.dd.VAcceptCriterionFactory"); |
@@ -511,16 +511,16 @@ public class ConnectorBundleLoaderFactory extends Generator { | |||
writeInvokers(logger, w, bundle); | |||
writeParamTypes(w, bundle); | |||
writeProxys(w, bundle); | |||
writeMethodAttributes(logger, w, bundle); | |||
writeMethodAttributes(w, bundle); | |||
w.println("%s(store);", loadNativeJsMethodName); | |||
// Must use Java code to generate Type data (because of Type[]), doing | |||
// this after the JS property data has been initialized | |||
writePropertyTypes(logger, w, bundle); | |||
writePropertyTypes(w, bundle); | |||
writeSerializers(logger, w, bundle); | |||
writePresentationTypes(w, bundle); | |||
writeDelegateToWidget(logger, w, bundle); | |||
writeDelegateToWidget(w, bundle); | |||
writeOnStateChangeHandlers(logger, w, bundle); | |||
} | |||
@@ -652,8 +652,8 @@ public class ConnectorBundleLoaderFactory extends Generator { | |||
} | |||
} | |||
private void writeDelegateToWidget(TreeLogger logger, | |||
SplittingSourceWriter w, ConnectorBundle bundle) { | |||
private void writeDelegateToWidget(SplittingSourceWriter w, | |||
ConnectorBundle bundle) { | |||
Map<JClassType, Set<Property>> needsDelegateToWidget = bundle | |||
.getNeedsDelegateToWidget(); | |||
for (Entry<JClassType, Set<Property>> entry : needsDelegateToWidget | |||
@@ -713,7 +713,7 @@ public class ConnectorBundleLoaderFactory extends Generator { | |||
} | |||
} | |||
private void writePropertyTypes(TreeLogger logger, SplittingSourceWriter w, | |||
private void writePropertyTypes(SplittingSourceWriter w, | |||
ConnectorBundle bundle) { | |||
Set<Property> properties = bundle.getNeedsProperty(); | |||
for (Property property : properties) { | |||
@@ -729,8 +729,8 @@ public class ConnectorBundleLoaderFactory extends Generator { | |||
} | |||
} | |||
private void writeMethodAttributes(TreeLogger logger, | |||
SplittingSourceWriter w, ConnectorBundle bundle) { | |||
private void writeMethodAttributes(SplittingSourceWriter w, | |||
ConnectorBundle bundle) { | |||
for (Entry<JClassType, Map<JMethod, Set<MethodAttribute>>> typeEntry : bundle | |||
.getMethodAttributes().entrySet()) { | |||
JClassType type = typeEntry.getKey(); | |||
@@ -879,7 +879,7 @@ public class ConnectorBundleLoaderFactory extends Generator { | |||
TreeLogger methodLogger = typeLogger.branch(Type.DEBUG, | |||
"Invoking " + method.getName() + " using jsni"); | |||
// Must use JSNI to access non-public methods | |||
writeJsniInvoker(methodLogger, w, type, method); | |||
writeJsniInvoker(methodLogger, w, method); | |||
} | |||
w.println(");"); | |||
@@ -890,7 +890,7 @@ public class ConnectorBundleLoaderFactory extends Generator { | |||
} | |||
private void writeJsniInvoker(TreeLogger logger, SplittingSourceWriter w, | |||
JClassType type, JMethod method) throws UnableToCompleteException { | |||
JMethod method) throws UnableToCompleteException { | |||
w.println("new JsniInvoker() {"); | |||
w.indent(); | |||
@@ -53,7 +53,7 @@ public class MethodProperty extends Property { | |||
Set<String> getters = new HashSet<>(); | |||
List<JMethod> setters = getSetters(type, getters); | |||
for (JMethod setter : setters) { | |||
String getter = findGetter(type, setter); | |||
String getter = findGetter(setter); | |||
properties.add(new MethodProperty(setter.getEnclosingType(), setter, | |||
getters.contains(getter) ? getter : null)); | |||
} | |||
@@ -118,8 +118,7 @@ public class MethodProperty extends Property { | |||
} | |||
private static String findGetter(JClassType beanType, | |||
JMethod setterMethod) { | |||
private static String findGetter(JMethod setterMethod) { | |||
JType setterParameterType = setterMethod.getParameterTypes()[0]; | |||
String fieldName = setterMethod.getName().substring(3); | |||
if (setterParameterType.getQualifiedSourceName() |
@@ -49,15 +49,25 @@ import elemental.json.JsonValue; | |||
*/ | |||
public class JsonEncoder { | |||
private JsonEncoder() { | |||
// private constructor to prevent initialization | |||
} | |||
/** | |||
* Encode a value to a JSON representation for transport from the client to | |||
* the server. | |||
* | |||
* @param value | |||
* value to convert | |||
* @param type | |||
* type information, not needed for all encoding tasks, such as | |||
* encoding a String | |||
* @param connection | |||
* application connection providing the context, not needed for | |||
* all encoding tasks, such as encoding a String | |||
* @return JSON representation of the value | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public static JsonValue encode(Object value, Type type, | |||
ApplicationConnection connection) { | |||
if (null == value) { | |||
@@ -80,17 +90,17 @@ public class JsonEncoder { | |||
} else if (value instanceof Character) { | |||
return Json.create(String.valueOf(value)); | |||
} else if (value instanceof Object[] && type == null) { | |||
// Non-legacy arrays handed by generated serializer | |||
// Non-legacy arrays handled by generated serializer | |||
return encodeLegacyObjectArray((Object[]) value, connection); | |||
} else if (value instanceof Enum) { | |||
return encodeEnum((Enum<?>) value, connection); | |||
return encodeEnum((Enum<?>) value); | |||
} else if (value instanceof Map) { | |||
return encodeMap((Map) value, type, connection); | |||
return encodeMap((Map<Object, Object>) value, type, connection); | |||
} else if (value instanceof Connector) { | |||
Connector connector = (Connector) value; | |||
return Json.create(connector.getConnectorId()); | |||
} else if (value instanceof Collection) { | |||
return encodeCollection((Collection) value, type, connection); | |||
return encodeCollection((Collection<?>) value, type, connection); | |||
} else if (value instanceof UidlValue) { | |||
return encodeVariableChange((UidlValue) value, connection); | |||
} else { | |||
@@ -254,8 +264,7 @@ public class JsonEncoder { | |||
return jsonMap; | |||
} | |||
private static JsonValue encodeEnum(Enum<?> e, | |||
ApplicationConnection connection) { | |||
private static JsonValue encodeEnum(Enum<?> e) { | |||
return Json.create(e.toString()); | |||
} | |||
@@ -270,8 +279,8 @@ public class JsonEncoder { | |||
return jsonArray; | |||
} | |||
private static JsonArray encodeCollection(Collection collection, Type type, | |||
ApplicationConnection connection) { | |||
private static JsonArray encodeCollection(Collection<?> collection, | |||
Type type, ApplicationConnection connection) { | |||
JsonArray jsonArray = Json.createArray(); | |||
int idx = 0; | |||
for (Object o : collection) { |
@@ -54,11 +54,12 @@ import elemental.json.JsonObject; | |||
* @author Vaadin Ltd | |||
* @since 8.0 | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
@Connect(DetailsManager.class) | |||
public class DetailsManagerConnector extends AbstractExtensionConnector { | |||
/* Map for tracking which details are open on which row */ | |||
private TreeMap<Integer, String> indexToDetailConnectorId = new TreeMap<>(); | |||
private Map<Integer, String> indexToDetailConnectorId = new TreeMap<>(); | |||
/* For listening data changes that originate from DataSource. */ | |||
private Registration dataChangeRegistration; | |||
/* For listening spacer index changes that originate from Escalator. */ | |||
@@ -266,7 +267,6 @@ public class DetailsManagerConnector extends AbstractExtensionConnector { | |||
/** | |||
* Height aware details generator for client-side Grid. | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
private class CustomDetailsGenerator | |||
implements HeightAwareDetailsGenerator { | |||
@@ -44,6 +44,7 @@ import com.vaadin.client.ValueMap; | |||
* | |||
* @since 7.1.4 | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
public class AnalyzeLayoutsPanel extends FlowPanel { | |||
private List<SelectConnectorListener> listeners = new ArrayList<>(); | |||
@@ -88,19 +89,19 @@ public class AnalyzeLayoutsPanel extends FlowPanel { | |||
+ "states, but reported here as they might be.</em>")); | |||
if (!zeroHeightComponents.isEmpty()) { | |||
add(new HTML("<p><strong>Vertically zero size:</strong></p>")); | |||
printClientSideDetectedIssues(zeroHeightComponents, ac); | |||
printClientSideDetectedIssues(zeroHeightComponents); | |||
} | |||
if (!zeroWidthComponents.isEmpty()) { | |||
add(new HTML( | |||
"<p><strong>Horizontally zero size:</strong></p>")); | |||
printClientSideDetectedIssues(zeroWidthComponents, ac); | |||
printClientSideDetectedIssues(zeroWidthComponents); | |||
} | |||
} | |||
} | |||
private void printClientSideDetectedIssues( | |||
Set<ComponentConnector> zeroSized, ApplicationConnection ac) { | |||
Set<ComponentConnector> zeroSized) { | |||
// keep track of already highlighted parents | |||
HashSet<String> parents = new HashSet<>(); |
@@ -456,14 +456,14 @@ public class TouchScrollDelegate implements NativePreviewHandler { | |||
} | |||
deltaScrollTop = overscroll - origScrollTop; | |||
} | |||
quickSetScrollPosition(0, deltaScrollTop); | |||
quickSetScrollPosition(deltaScrollTop); | |||
moved = true; | |||
event.preventDefault(); | |||
event.stopPropagation(); | |||
} | |||
} | |||
private void quickSetScrollPosition(int deltaX, int deltaY) { | |||
private void quickSetScrollPosition(int deltaY) { | |||
deltaScrollPos = deltaY; | |||
if (ANDROID_WITH_BROKEN_SCROLL_TOP) { | |||
deltaY += origScrollTop; | |||
@@ -500,7 +500,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { | |||
: Math.abs(origY - lastClientY) >= SIGNIFICANT_MOVE_THRESHOLD; | |||
} | |||
private void onTouchEnd(NativeEvent event) { | |||
private void onTouchEnd() { | |||
if (!moved) { | |||
activeScrollDelegate = null; | |||
handlerRegistration.removeHandler(); | |||
@@ -532,17 +532,14 @@ public class TouchScrollDelegate implements NativePreviewHandler { | |||
if (pixelsPerMs < 0) { | |||
pixelsToMove = -pixelsToMove; | |||
} | |||
// getLogger().info("pixels to move" + pixelsToMove); | |||
finalY = currentY + pixelsToMove; | |||
if (finalY > maxFinalY + getMaxOverScroll()) { | |||
// getLogger().info("To max overscroll"); | |||
finalY = getMaxFinalY() + getMaxOverScroll(); | |||
int fixedPixelsToMove = finalY - currentY; | |||
pixelsToMove = fixedPixelsToMove; | |||
} else if (finalY < 0 - getMaxOverScroll()) { | |||
// getLogger().info("to min overscroll"); | |||
finalY = -getMaxOverScroll(); | |||
int fixedPixelsToMove = finalY - currentY; | |||
pixelsToMove = fixedPixelsToMove; | |||
@@ -552,7 +549,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { | |||
} | |||
if (duration == -1) { | |||
// did not keep in side borders or was outside borders, calculate | |||
// a good enough duration based on pixelsToBeMoved. | |||
// a good enough duration based on pixelsToMove. | |||
duration = getAnimationTimeForDistance(pixelsToMove); | |||
} | |||
if (duration > MAX_DURATION) { | |||
@@ -690,7 +687,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { | |||
if (moved) { | |||
event.cancel(); | |||
} | |||
onTouchEnd(event.getNativeEvent()); | |||
onTouchEnd(); | |||
} | |||
break; | |||
case Event.ONMOUSEMOVE: |
@@ -97,14 +97,16 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
*/ | |||
public interface FocusOutListener { | |||
/** | |||
* @param event | |||
* dom event | |||
* @return true if the calendar panel is not used after focus moves out | |||
*/ | |||
boolean onFocusOut(DomEvent<?> event); | |||
} | |||
/** | |||
* FocusChangeListener is notified when the panel changes its _focused_ | |||
* value. | |||
* FocusChangeListener is notified when the panel changes its | |||
* {@code focused} value. | |||
*/ | |||
public interface FocusChangeListener { | |||
void focusChanged(Date focusedDate); | |||
@@ -183,6 +185,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* Represents a click handler for when a user selects a value by using the | |||
* mouse | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
private ClickHandler dayClickHandler = event -> { | |||
if (!isEnabled() || isReadonly()) { | |||
return; | |||
@@ -231,6 +234,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* A Date representing the day of month to be focused. Must be | |||
* one of the days currently visible. | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
private void focusDay(Date date) { | |||
// Only used when calendar body is present | |||
if (acceptDayFocus()) { | |||
@@ -350,6 +354,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* one of the days currently visible. | |||
* | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
private void selectDate(Date date) { | |||
if (selectedDay != null) { | |||
selectedDay.removeStyleDependentName(CN_SELECTED); | |||
@@ -765,7 +770,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
// If dateStrResolution has more year digits than rangeEnd, we need | |||
// to pad it in order to be lexicographically compatible | |||
String dateStrResolution = dateStrResolution(date, minResolution); | |||
String paddedEnd = rangeEnd.substring(0); | |||
String paddedEnd = rangeEnd; | |||
int yearDigits = dateStrResolution.indexOf("-"); | |||
if (yearDigits == -1) { | |||
yearDigits = dateStrResolution.length(); | |||
@@ -777,21 +782,6 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
.compareTo(dateStrResolution) >= 0; | |||
} | |||
private static Date clearDateBelowMonth(Date date) { | |||
date.setDate(1); | |||
return clearDateBelowDay(date); | |||
} | |||
private static Date clearDateBelowDay(Date date) { | |||
date.setHours(0); | |||
date.setMinutes(0); | |||
date.setSeconds(0); | |||
// Clearing milliseconds | |||
long time = date.getTime() / 1000; | |||
date = new Date(time * 1000); | |||
return date; | |||
} | |||
/** | |||
* Builds the day and time selectors of the calendar. | |||
*/ | |||
@@ -952,9 +942,12 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
} | |||
/** | |||
* Returns the value of initialRenderDone | |||
* Returns the value of initialRenderDone. | |||
* | |||
* @since 8.7 | |||
* | |||
* @return {@code true} if the initial render has been marked as done, | |||
* {@code false} otherwise | |||
*/ | |||
public boolean isInitialRenderDone() { | |||
return initialRenderDone; | |||
@@ -1386,7 +1379,8 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* Was the ctrl key pressed? | |||
* @param shift | |||
* Was the shift key pressed? | |||
* @return | |||
* @return {@code true} if the navigation was handled successfully, | |||
* {@code false} otherwise | |||
*/ | |||
protected boolean handleNavigationMonthMode(int keycode, boolean ctrl, | |||
boolean shift) { | |||
@@ -1572,7 +1566,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* selection. By default this is backspace but it can be overridden to | |||
* change the key to whatever you want. | |||
* | |||
* @return | |||
* @return the reset key | |||
*/ | |||
protected int getResetKey() { | |||
return KeyCodes.KEY_BACKSPACE; | |||
@@ -1583,7 +1577,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* enter key but it can be changed to whatever you like by overriding this | |||
* method. | |||
* | |||
* @return | |||
* @return the select key | |||
*/ | |||
protected int getSelectKey() { | |||
return KeyCodes.KEY_ENTER; | |||
@@ -1594,7 +1588,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* Else this does nothing. By default this is the Escape key but you can | |||
* change the key to whatever you want by overriding this method. | |||
* | |||
* @return | |||
* @return the closing key | |||
*/ | |||
protected int getCloseKey() { | |||
return KeyCodes.KEY_ESCAPE; | |||
@@ -1605,7 +1599,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* right arrow key but by overriding this method it can be changed to | |||
* whatever you like. | |||
* | |||
* @return | |||
* @return the forward key | |||
*/ | |||
protected int getForwardKey() { | |||
return KeyCodes.KEY_RIGHT; | |||
@@ -1616,7 +1610,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* the left arrow key but by overriding this method it can be changed to | |||
* whatever you like. | |||
* | |||
* @return | |||
* @return the backward key | |||
*/ | |||
protected int getBackwardKey() { | |||
return KeyCodes.KEY_LEFT; | |||
@@ -1627,7 +1621,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* the down arrow key but by overriding this method it can be changed to | |||
* whatever you like. | |||
* | |||
* @return | |||
* @return the next week key | |||
*/ | |||
protected int getNextKey() { | |||
return KeyCodes.KEY_DOWN; | |||
@@ -1638,7 +1632,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* is the up arrow key but by overriding this method it can be changed to | |||
* whatever you like. | |||
* | |||
* @return | |||
* @return the previous week key | |||
*/ | |||
protected int getPreviousKey() { | |||
return KeyCodes.KEY_UP; | |||
@@ -1665,6 +1659,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* com.google.gwt.event.dom.client.MouseDownHandler#onMouseDown(com.google | |||
* .gwt.event.dom.client.MouseDownEvent) | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
@Override | |||
public void onMouseDown(MouseDownEvent event) { | |||
// Click-n-hold the left mouse button for fast-forward or fast-rewind. | |||
@@ -1721,8 +1716,9 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
} | |||
private Date parseRangeString(String dateStr) { | |||
if (dateStr == null || "".equals(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); | |||
@@ -1735,8 +1731,9 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
private int parsePart(String dateStr, int beginIndex, int length, | |||
int defValue) { | |||
if (dateStr.length() < beginIndex + length) | |||
if (dateStr.length() < beginIndex + length) { | |||
return defValue; | |||
} | |||
return Integer | |||
.parseInt(dateStr.substring(beginIndex, beginIndex + length)); | |||
} | |||
@@ -1807,7 +1804,8 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
value = null; | |||
} | |||
} else { | |||
focusedDate = displayedMonth = null; | |||
displayedMonth = null; | |||
focusedDate = null; | |||
} | |||
} else { | |||
focusedDate = new FocusedDate(value.getYear(), value.getMonth(), | |||
@@ -1854,11 +1852,12 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
} | |||
/** | |||
* If true should be returned if the panel will not be used after this | |||
* event. | |||
* True should be returned if the panel will not be used after this event. | |||
* | |||
* @param event | |||
* @return | |||
* dom event | |||
* @return {@code true} if the panel will not be used after this event, | |||
* {@code false} otherwise | |||
*/ | |||
protected boolean onTabOut(DomEvent<?> event) { | |||
if (focusOutListener != null) { | |||
@@ -1949,10 +1948,6 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
private static final String SUBPART_NEXT_YEAR = "nexty"; | |||
private static final String SUBPART_PREV_YEAR = "prevy"; | |||
private static final String SUBPART_HOUR_SELECT = "h"; | |||
private static final String SUBPART_MINUTE_SELECT = "m"; | |||
private static final String SUBPART_SECS_SELECT = "s"; | |||
private static final String SUBPART_AMPM_SELECT = "ampm"; | |||
private static final String SUBPART_DAY = "day"; | |||
private static final String SUBPART_MONTH_YEAR_HEADER = "header"; | |||
@@ -1999,8 +1994,11 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
* Checks if subElement is inside the widget DOM hierarchy. | |||
* | |||
* @param w | |||
* the widget to investigate | |||
* @param subElement | |||
* @return true if {@code w} is a parent of subElement, false otherwise. | |||
* the element to search for | |||
* @return {@code true} if the given widget is a parent of the given | |||
* element, {@code false} otherwise. | |||
*/ | |||
protected boolean contains(Widget w, Element subElement) { | |||
if (w == null || w.getElement() == null) { | |||
@@ -2010,6 +2008,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
return w.getElement().isOrHasChild(subElement); | |||
} | |||
@SuppressWarnings("unchecked") | |||
@Override | |||
public com.google.gwt.user.client.Element getSubPartElement( | |||
String subPart) { | |||
@@ -2132,8 +2131,8 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> | |||
*/ | |||
public void setRangeEnd(String newRangeEnd) { | |||
if (!SharedUtil.equals(rangeEnd, newRangeEnd)) { | |||
// Dates with year 10000 or more has + prefix, which is not compatible | |||
// with format returned by dateStrResolution method | |||
// Dates with year 10000 or more has + prefix, which is not | |||
// compatible with format returned by dateStrResolution method | |||
if (newRangeEnd.startsWith("+")) { | |||
rangeEnd = newRangeEnd.substring(1); | |||
} else { |
@@ -17,7 +17,6 @@ package com.vaadin.client.ui.combobox; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.logging.Logger; | |||
import com.vaadin.client.Profiler; | |||
import com.vaadin.client.annotations.OnStateChange; | |||
@@ -487,9 +486,6 @@ public class ComboBoxConnector extends AbstractListingConnector | |||
} | |||
} | |||
private static final Logger LOGGER = Logger | |||
.getLogger(ComboBoxConnector.class.getName()); | |||
private class PagedDataChangeHandler implements DataChangeHandler { | |||
private final DataSource<?> dataSource; |
@@ -116,11 +116,11 @@ public class DragAndDropHandler { | |||
// End drag if ESC is pressed | |||
int keyCode = event.getNativeEvent().getKeyCode(); | |||
if (keyCode == KeyCodes.KEY_ESCAPE) { | |||
cancelDrag(event); | |||
cancelDrag(); | |||
} | |||
break; | |||
case Event.ONTOUCHCANCEL: | |||
cancelDrag(event); | |||
cancelDrag(); | |||
break; | |||
case Event.ONTOUCHEND: | |||
case Event.ONMOUSEUP: | |||
@@ -236,7 +236,7 @@ public class DragAndDropHandler { | |||
} | |||
} | |||
private void cancelDrag(NativePreviewEvent event) { | |||
private void cancelDrag() { | |||
callback.onDragCancel(); | |||
callback.onDragEnd(); | |||
stopDrag(); |
@@ -491,6 +491,7 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
* Assigns relative sizes to the children that should expand based on their | |||
* expand ratios. | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
public void updateExpandedSizes() { | |||
// Ensure the expand wrapper is in place | |||
if (expandWrapper == null) { | |||
@@ -651,8 +652,7 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
totalSize += size; | |||
} | |||
} else { | |||
int max = -1; | |||
max = layoutManager.getOuterWidth( | |||
int max = layoutManager.getOuterWidth( | |||
slot.getWidget().getElement()); | |||
if (slot.hasCaption()) { | |||
int max2 = layoutManager.getOuterWidth( |
@@ -764,13 +764,13 @@ public class Escalator extends Widget | |||
/*-{ | |||
var vScroll = esc.@com.vaadin.client.widgets.Escalator::verticalScrollbar; | |||
var vScrollElem = vScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); | |||
var hScroll = esc.@com.vaadin.client.widgets.Escalator::horizontalScrollbar; | |||
var hScrollElem = hScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); | |||
return $entry(function(e) { | |||
var target = e.target; | |||
// in case the scroll event was native (i.e. scrollbars were dragged, or | |||
// the scrollTop/Left was manually modified), the bundles have old cache | |||
// values. We need to make sure that the caches are kept up to date. | |||
@@ -791,29 +791,29 @@ public class Escalator extends Widget | |||
return $entry(function(e) { | |||
var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; | |||
var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; | |||
// Delta mode 0 is in pixels; we don't need to do anything... | |||
// A delta mode of 1 means we're scrolling by lines instead of pixels | |||
// We need to scale the number of lines by the default line height | |||
if (e.deltaMode === 1) { | |||
var brc = esc.@com.vaadin.client.widgets.Escalator::body; | |||
deltaY *= brc.@com.vaadin.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()(); | |||
} | |||
// Other delta modes aren't supported | |||
if ((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { | |||
var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; | |||
// Print warning message | |||
esc.@com.vaadin.client.widgets.Escalator::logWarning(*)(msg); | |||
} | |||
// IE8 has only delta y | |||
if (isNaN(deltaY)) { | |||
deltaY = -0.5*e.wheelDelta; | |||
} | |||
@com.vaadin.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e); | |||
}); | |||
}-*/; |
@@ -275,8 +275,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, | |||
*/ | |||
public void setText(String text) { | |||
detach(); | |||
this.content = text; | |||
this.type = GridStaticCellType.TEXT; | |||
content = text; | |||
type = GridStaticCellType.TEXT; | |||
section.requestSectionRefresh(); | |||
} | |||
@@ -355,8 +355,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, | |||
public void setHtml(String html) { | |||
detach(); | |||
this.content = html; | |||
this.type = GridStaticCellType.HTML; | |||
content = html; | |||
type = GridStaticCellType.HTML; | |||
section.requestSectionRefresh(); | |||
} | |||
@@ -388,13 +388,13 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, | |||
* null). | |||
*/ | |||
public void setWidget(Widget widget) { | |||
if (this.content == widget) { | |||
if (content == widget) { | |||
return; | |||
} | |||
detach(); | |||
this.content = widget; | |||
this.type = GridStaticCellType.WIDGET; | |||
content = widget; | |||
type = GridStaticCellType.WIDGET; | |||
section.requestSectionRefresh(); | |||
} | |||
@@ -7937,9 +7937,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, | |||
cell = new Cell(rowIndex, colIndex, cellElement); | |||
} catch (IllegalStateException exception) { | |||
// IllegalStateException may occur if user has scrolled Grid so | |||
// that Escalator has updated, and row under Editor is no longer | |||
// there | |||
// IllegalStateException may occur if user has scrolled | |||
// Grid so that Escalator has updated, and row under | |||
// Editor is no longer there | |||
return; | |||
} | |||
} else { |
@@ -204,9 +204,8 @@ public class GAEVaadinServlet extends VaadinServlet { | |||
} | |||
boolean locked = false; | |||
MemcacheService memcache = null; | |||
String mutex = MUTEX_BASE + session.getId(); | |||
memcache = MemcacheServiceFactory.getMemcacheService(); | |||
MemcacheService memcache = MemcacheServiceFactory.getMemcacheService(); | |||
try { | |||
// try to get lock | |||
long started = System.currentTimeMillis(); |
@@ -44,8 +44,9 @@ import com.vaadin.v7.ui.TextField; | |||
* instance. | |||
* | |||
* @author Vaadin Ltd | |||
* @deprecated As of 8.0, no direct replacement available. {@link Binder#forMemberField(HasValue)} and | |||
* {@link Binder#bindInstanceFields(Object)} should be used instead. | |||
* @deprecated As of 8.0, no direct replacement available. | |||
* {@link Binder#forMemberField(HasValue)} and | |||
* {@link Binder#bindInstanceFields(Object)} should be used instead. | |||
*/ | |||
@Deprecated | |||
public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
@@ -68,12 +69,13 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
return INSTANCE; | |||
} | |||
@SuppressWarnings("rawtypes") | |||
@Override | |||
public <T extends Field> T createField(Class<?> type, Class<T> fieldType) { | |||
if (Enum.class.isAssignableFrom(type)) { | |||
return createEnumField(type, fieldType); | |||
} else if (Date.class.isAssignableFrom(type)) { | |||
return createDateField(type, fieldType); | |||
return createDateField(fieldType); | |||
} else if (Boolean.class.isAssignableFrom(type) | |||
|| boolean.class.isAssignableFrom(type)) { | |||
return createBooleanField(fieldType); | |||
@@ -94,7 +96,8 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
return rta; | |||
} | |||
private <T extends Field> T createEnumField(Class<?> type, | |||
@SuppressWarnings({ "unchecked" }) | |||
private <T extends Field<?>> T createEnumField(Class<?> type, | |||
Class<T> fieldType) { | |||
// Determine first if we should (or can) create a select for the enum | |||
Class<AbstractSelect> selectClass = null; | |||
@@ -106,7 +109,7 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
if (selectClass != null) { | |||
AbstractSelect s = createCompatibleSelect(selectClass); | |||
populateWithEnumData(s, (Class<? extends Enum>) type); | |||
populateWithEnumData(s, (Class<? extends Enum<?>>) type); | |||
return (T) s; | |||
} else if (AbstractTextField.class.isAssignableFrom(fieldType)) { | |||
return (T) createAbstractTextField( | |||
@@ -116,9 +119,8 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
return null; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private <T extends Field> T createDateField(Class<?> type, | |||
Class<T> fieldType) { | |||
@SuppressWarnings({ "unchecked" }) | |||
private <T extends Field<?>> T createDateField(Class<T> fieldType) { | |||
AbstractField<?> field; | |||
if (InlineDateField.class.isAssignableFrom(fieldType)) { | |||
@@ -177,10 +179,12 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
* the type of the field | |||
* @return true if any AbstractSelect can be assigned to the field | |||
*/ | |||
@SuppressWarnings("rawtypes") | |||
protected boolean anySelect(Class<? extends Field> fieldType) { | |||
return anyField(fieldType) || fieldType == AbstractSelect.class; | |||
} | |||
@SuppressWarnings({ "rawtypes", "unchecked" }) | |||
protected <T extends Field> T createBooleanField(Class<T> fieldType) { | |||
if (fieldType.isAssignableFrom(CheckBox.class)) { | |||
CheckBox cb = new CheckBox(null); | |||
@@ -194,6 +198,7 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
return null; | |||
} | |||
@SuppressWarnings("unchecked") | |||
protected <T extends AbstractTextField> T createAbstractTextField( | |||
Class<T> fieldType) { | |||
if (fieldType == AbstractTextField.class) { | |||
@@ -222,6 +227,7 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
* @return A field capable of editing the data or null if no field could be | |||
* created | |||
*/ | |||
@SuppressWarnings("rawtypes") | |||
protected <T extends Field> T createDefaultField(Class<?> type, | |||
Class<T> fieldType) { | |||
if (fieldType.isAssignableFrom(TextField.class)) { | |||
@@ -239,6 +245,7 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
* @param enumClass | |||
* The Enum class to use | |||
*/ | |||
@SuppressWarnings({ "rawtypes", "unchecked" }) | |||
protected void populateWithEnumData(AbstractSelect select, | |||
Class<? extends Enum> enumClass) { | |||
select.removeAllItems(); | |||
@@ -247,7 +254,6 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { | |||
} | |||
select.addContainerProperty(CAPTION_PROPERTY_ID, String.class, ""); | |||
select.setItemCaptionPropertyId(CAPTION_PROPERTY_ID); | |||
@SuppressWarnings("unchecked") | |||
EnumSet<?> enumSet = EnumSet.allOf(enumClass); | |||
for (Object r : enumSet) { | |||
Item newItem = select.addItem(r); |
@@ -52,10 +52,10 @@ import elemental.json.JsonObject; | |||
/** | |||
* Provides Vaadin server-side container data source to a | |||
* {@link com.vaadin.v7.client.connectors.GridConnector GridConnector}. This is currently | |||
* implemented as an Extension hardcoded to support a specific connector type. | |||
* This will be changed once framework support for something more flexible has | |||
* been implemented. | |||
* {@link com.vaadin.v7.client.connectors.GridConnector GridConnector}. This is | |||
* currently implemented as an Extension hardcoded to support a specific | |||
* connector type. This will be changed once framework support for something | |||
* more flexible has been implemented. | |||
* | |||
* @since 7.4 | |||
* @author Vaadin Ltd | |||
@@ -152,10 +152,10 @@ public class RpcDataProviderExtension extends AbstractExtension { | |||
/** | |||
* A class to listen to changes in property values in the Container added | |||
* with {@link Grid#setContainerDatasource(com.vaadin.v7.data.Container.Indexed) | |||
* Grid#setContainerDatasource(Container.Indexed)}, | |||
* and notifies the data source to update the client-side representation | |||
* of the modified item. | |||
* with | |||
* {@link Grid#setContainerDatasource(com.vaadin.v7.data.Container.Indexed) | |||
* Grid#setContainerDatasource(Container.Indexed)}, and notifies the data | |||
* source to update the client-side representation of the modified item. | |||
* <p> | |||
* One instance of this class can (and should) be reused for all the | |||
* properties in an item, since this class will inform that the entire row | |||
@@ -166,8 +166,8 @@ public class RpcDataProviderExtension extends AbstractExtension { | |||
* value changes, an instance of this class needs to be attached to each and | |||
* every Item's Property in the container. | |||
* | |||
* @see Grid#addValueChangeListener(com.vaadin.v7.data.Container, Object, Object) | |||
* Grid#addValueChangeListener(Container, Object, Object) | |||
* @see Grid#addValueChangeListener(com.vaadin.v7.data.Container, Object, | |||
* Object) Grid#addValueChangeListener(Container, Object, Object) | |||
* @see Grid#valueChangeListeners | |||
*/ | |||
private class GridValueChangeListener implements ValueChangeListener { | |||
@@ -389,15 +389,14 @@ public class RpcDataProviderExtension extends AbstractExtension { | |||
Item item = container.getItem(itemId); | |||
rows.set(i, getRowData(getGrid().getColumns(), itemId, item)); | |||
rows.set(i, getRowData(itemId, item)); | |||
} | |||
rpc.setRowData(firstRowToPush, rows); | |||
activeItemHandler.addActiveItems(itemIds); | |||
} | |||
private JsonObject getRowData(Collection<Column> columns, Object itemId, | |||
Item item) { | |||
private JsonObject getRowData(Object itemId, Item item) { | |||
final JsonObject rowObject = Json.createObject(); | |||
for (DataGenerator dg : dataGenerators) { | |||
@@ -530,14 +529,13 @@ public class RpcDataProviderExtension extends AbstractExtension { | |||
} | |||
Collection<Object> activeItemIds = activeItemHandler.getActiveItemIds(); | |||
List<Column> columns = getGrid().getColumns(); | |||
JsonArray rowData = Json.createArray(); | |||
int i = 0; | |||
for (Object itemId : itemIds) { | |||
if (activeItemIds.contains(itemId)) { | |||
Item item = container.getItem(itemId); | |||
if (item != null) { | |||
JsonObject row = getRowData(columns, itemId, item); | |||
JsonObject row = getRowData(itemId, item); | |||
rowData.set(i++, row); | |||
} | |||
} |
@@ -464,8 +464,7 @@ public class ComboBox extends AbstractSelect | |||
assert filteredSize >= 0; | |||
currentPage = adjustCurrentPage(currentPage, needNullSelectOption, | |||
indexToEnsureInView, filteredSize); | |||
int first = getFirstItemIndexOnCurrentPage(needNullSelectOption, | |||
filteredSize); | |||
int first = getFirstItemIndexOnCurrentPage(needNullSelectOption); | |||
int last = getLastItemIndexOnCurrentPage(needNullSelectOption, | |||
filteredSize, first); | |||
@@ -562,8 +561,7 @@ public class ComboBox extends AbstractSelect | |||
int size = options.size(); | |||
currentPage = adjustCurrentPage(currentPage, needNullSelectOption, | |||
indexToEnsureInView, size); | |||
int first = getFirstItemIndexOnCurrentPage(needNullSelectOption, | |||
size); | |||
int first = getFirstItemIndexOnCurrentPage(needNullSelectOption); | |||
int last = getLastItemIndexOnCurrentPage(needNullSelectOption, size, | |||
first); | |||
return options.subList(first, last + 1); | |||
@@ -581,14 +579,10 @@ public class ComboBox extends AbstractSelect | |||
* true if a null option should be shown before any other options | |||
* (takes up the first slot on the first page, not counted in | |||
* index) | |||
* @param size | |||
* number of items after filtering (not including the null item, | |||
* if any) | |||
* @return first item to show on the UI (index to the filtered list of | |||
* options, not taking the null item into consideration if any) | |||
*/ | |||
private int getFirstItemIndexOnCurrentPage(boolean needNullSelectOption, | |||
int size) { | |||
private int getFirstItemIndexOnCurrentPage(boolean needNullSelectOption) { | |||
// Not all options are visible, find out which ones are on the | |||
// current "page". | |||
int first = currentPage * pageLength; |
@@ -212,7 +212,8 @@ public class Grid extends AbstractComponent | |||
* @since 7.5.0 | |||
*/ | |||
@Deprecated | |||
public interface ColumnVisibilityChangeListener extends SerializableEventListener { | |||
public interface ColumnVisibilityChangeListener | |||
extends SerializableEventListener { | |||
/** | |||
* Called when a column has become hidden or unhidden. | |||
* | |||
@@ -567,6 +568,7 @@ public class Grid extends AbstractComponent | |||
} | |||
} | |||
@SuppressWarnings("rawtypes") | |||
@Override | |||
protected <T extends Field> T build(String caption, Class<?> dataType, | |||
Class<T> fieldType) throws BindException { | |||
@@ -630,6 +632,7 @@ public class Grid extends AbstractComponent | |||
return INSTANCE; | |||
} | |||
@SuppressWarnings("rawtypes") | |||
@Override | |||
public <T extends Field> T createField(Class<?> type, | |||
Class<T> fieldType) { | |||
@@ -649,6 +652,7 @@ public class Grid extends AbstractComponent | |||
return super.createCompatibleSelect(fieldType); | |||
} | |||
@SuppressWarnings("rawtypes") | |||
@Override | |||
protected void populateWithEnumData(AbstractSelect select, | |||
Class<? extends Enum> enumClass) { | |||
@@ -2364,7 +2368,8 @@ public class Grid extends AbstractComponent | |||
Renderer<?> renderer = column.getRenderer(); | |||
Item item = cell.getItem(); | |||
Property itemProperty = item.getItemProperty(cell.getPropertyId()); | |||
Property<?> itemProperty = item | |||
.getItemProperty(cell.getPropertyId()); | |||
Object modelValue = itemProperty == null ? null | |||
: itemProperty.getValue(); | |||
@@ -2505,6 +2510,7 @@ public class Grid extends AbstractComponent | |||
* The cells to merge. Must be from the same row. | |||
* @return The remaining visible cell after the merge | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public CELLTYPE join(CELLTYPE... cells) { | |||
if (cells.length < 2) { | |||
throw new IllegalArgumentException( | |||
@@ -3776,6 +3782,7 @@ public class Grid extends AbstractComponent | |||
return converter; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private <T> boolean internalSetRenderer(Renderer<T> renderer) { | |||
Converter<? extends T, ?> converter; | |||
@@ -4410,6 +4417,7 @@ public class Grid extends AbstractComponent | |||
* the locale to use in conversion | |||
* @return an encoded value ready to be sent to the client | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public static <T> JsonValue encodeValue(Object modelValue, | |||
Renderer<T> renderer, Converter<?, ?> converter, | |||
Locale locale) { | |||
@@ -4437,7 +4445,6 @@ public class Grid extends AbstractComponent | |||
} else { | |||
assert presentationType | |||
.isAssignableFrom(converter.getPresentationType()); | |||
@SuppressWarnings("unchecked") | |||
Converter<T, Object> safeConverter = (Converter<T, Object>) converter; | |||
presentationValue = safeConverter.convertToPresentation( | |||
modelValue, safeConverter.getPresentationType(), | |||
@@ -4688,13 +4695,6 @@ public class Grid extends AbstractComponent | |||
*/ | |||
private SelectionModel selectionModel; | |||
/** | |||
* Used to know whether selection change events originate from the server or | |||
* the client so the selection change handler knows whether the changes | |||
* should be sent to the client. | |||
*/ | |||
private boolean applyingSelectionFromClient; | |||
private final Header header = new Header(this); | |||
private final Footer footer = new Footer(this); | |||
@@ -6739,7 +6739,8 @@ public class Grid extends AbstractComponent | |||
* @since 7.6 | |||
*/ | |||
public void setCellDescriptionGenerator(CellDescriptionGenerator generator) { | |||
public void setCellDescriptionGenerator( | |||
CellDescriptionGenerator generator) { | |||
setCellDescriptionGenerator(generator, ContentMode.PREFORMATTED); | |||
} | |||
@@ -6760,12 +6761,13 @@ public class Grid extends AbstractComponent | |||
* @since 8.3.2 | |||
*/ | |||
public void setCellDescriptionGenerator(CellDescriptionGenerator generator, | |||
ContentMode contentMode) { | |||
ContentMode contentMode) { | |||
if (contentMode == null) { | |||
throw new IllegalArgumentException("Content mode cannot be null"); | |||
} | |||
cellDescriptionGenerator = generator; | |||
getState().hasDescriptions = (generator != null || rowDescriptionGenerator != null); | |||
getState().hasDescriptions = (generator != null | |||
|| rowDescriptionGenerator != null); | |||
getState().cellTooltipContentMode = contentMode; | |||
datasourceExtension.refreshCache(); | |||
} | |||
@@ -6811,7 +6813,7 @@ public class Grid extends AbstractComponent | |||
* @since 7.6 | |||
*/ | |||
public void setRowDescriptionGenerator(RowDescriptionGenerator generator) { | |||
setRowDescriptionGenerator(generator, ContentMode.PREFORMATTED ); | |||
setRowDescriptionGenerator(generator, ContentMode.PREFORMATTED); | |||
} | |||
/** | |||
@@ -6832,7 +6834,7 @@ public class Grid extends AbstractComponent | |||
* @since 8.3.2 | |||
*/ | |||
public void setRowDescriptionGenerator(RowDescriptionGenerator generator, | |||
ContentMode contentMode) { | |||
ContentMode contentMode) { | |||
if (contentMode == null) { | |||
throw new IllegalArgumentException("Content mode cannot be null"); | |||
} | |||
@@ -6934,6 +6936,7 @@ public class Grid extends AbstractComponent | |||
* @throws UnsupportedOperationException | |||
* if the container does not support adding new items | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public Object addRow(Object... values) { | |||
if (values == null) { | |||
throw new IllegalArgumentException("Values cannot be null"); |
@@ -211,6 +211,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Creates a new empty tree with caption. | |||
* | |||
* @param caption | |||
* the caption of the component | |||
*/ | |||
public Tree(String caption) { | |||
this(caption, new HierarchicalContainer()); | |||
@@ -220,7 +221,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Creates a new tree with caption and connect it to a Container. | |||
* | |||
* @param caption | |||
* the caption of the component | |||
* @param dataSource | |||
* the container | |||
*/ | |||
public Tree(String caption, Container dataSource) { | |||
super(caption, dataSource); | |||
@@ -370,6 +373,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* succeeds only if all expandable items are expanded. | |||
* | |||
* @param startItemId | |||
* ID of the initial item | |||
* @return True if the expand operation succeeded | |||
*/ | |||
public boolean expandItemsRecursively(Object startItemId) { | |||
@@ -423,6 +427,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* succeeds only if all expandable items are collapsed. | |||
* | |||
* @param startItemId | |||
* ID of the initial item | |||
* @return True if the collapse operation succeeded | |||
*/ | |||
public boolean collapseItemsRecursively(Object startItemId) { | |||
@@ -670,8 +675,6 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
// rendered selectedKeys | |||
LinkedList<String> selectedKeys = new LinkedList<String>(); | |||
final LinkedList<String> expandedKeys = new LinkedList<String>(); | |||
// Iterates through hierarchical tree using a stack of iterators | |||
final Stack<Iterator<?>> iteratorStack = new Stack<Iterator<?>>(); | |||
Collection<?> ids; | |||
@@ -769,7 +772,6 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
} | |||
if (areChildrenAllowed(itemId) && isExpanded(itemId)) { | |||
target.addAttribute("expanded", true); | |||
expandedKeys.add(key); | |||
} | |||
// Add caption change listener | |||
@@ -1027,11 +1029,12 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
private final Object expandedItemId; | |||
/** | |||
* New instance of options change event. | |||
* New instance of expanding event. | |||
* | |||
* @param source | |||
* the Source of the event. | |||
* the source component of the event. | |||
* @param expandedItemId | |||
* ID of the item that was expanded | |||
*/ | |||
public ExpandEvent(Component source, Object expandedItemId) { | |||
super(source); | |||
@@ -1039,9 +1042,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
} | |||
/** | |||
* Node where the event occurred. | |||
* ID of the item that was expanded. | |||
* | |||
* @return the Source of the event. | |||
* @return the item id. | |||
*/ | |||
public Object getItemId() { | |||
return expandedItemId; | |||
@@ -1082,6 +1085,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
/** | |||
* @deprecated As of 7.0, replaced by | |||
* {@link #addExpandListener(ExpandListener)} | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
*/ | |||
@Deprecated | |||
public void addListener(ExpandListener listener) { | |||
@@ -1102,6 +1108,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
/** | |||
* @deprecated As of 7.0, replaced by | |||
* {@link #removeExpandListener(ExpandListener)} | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
*/ | |||
@Deprecated | |||
public void removeListener(ExpandListener listener) { | |||
@@ -1137,6 +1146,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* @param source | |||
* the Source of the event. | |||
* @param collapsedItemId | |||
* ID of the item that was collapsed | |||
*/ | |||
public CollapseEvent(Component source, Object collapsedItemId) { | |||
super(source); | |||
@@ -1144,7 +1154,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
} | |||
/** | |||
* Gets tge Collapsed Item id. | |||
* Gets the ID of the item that was collapsed. | |||
* | |||
* @return the collapsed item id. | |||
*/ | |||
@@ -1188,6 +1198,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
/** | |||
* @deprecated As of 7.0, replaced by | |||
* {@link #addCollapseListener(CollapseListener)} | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
*/ | |||
@Deprecated | |||
public void addListener(CollapseListener listener) { | |||
@@ -1208,6 +1221,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
/** | |||
* @deprecated As of 7.0, replaced by | |||
* {@link #removeCollapseListener(CollapseListener)} | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
*/ | |||
@Deprecated | |||
public void removeListener(CollapseListener listener) { | |||
@@ -1476,9 +1492,11 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* If the method returns null, the current target is on a root node or | |||
* on other undefined area over the tree component. | |||
* <p> | |||
* The default Tree implementation marks the targetted tree node with | |||
* CSS classnames v-tree-node-dragfolder and | |||
* v-tree-node-caption-dragfolder (for the caption element). | |||
* The default Tree implementation marks the targeted tree node with CSS | |||
* classnames v-tree-node-dragfolder and v-tree-node-caption-dragfolder | |||
* (for the caption element). | |||
* | |||
* @return the ID of the item that can receive the targeted drop | |||
*/ | |||
public Object getItemIdInto() { | |||
@@ -1553,10 +1571,11 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
} | |||
/** | |||
* Sets the drag mode that controls how Tree behaves as a {@link DragSource} | |||
* . | |||
* Sets the drag mode that controls how Tree behaves as a | |||
* {@link DragSource}. | |||
* | |||
* @param dragMode | |||
* the drag mode to set | |||
*/ | |||
public void setDragMode(TreeDragMode dragMode) { | |||
this.dragMode = dragMode; | |||
@@ -1831,6 +1850,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
/** | |||
* Get the item description generator which generates tooltips for tree | |||
* items. | |||
* | |||
* @return the item description generator | |||
*/ | |||
public ItemDescriptionGenerator getItemDescriptionGenerator() { | |||
return itemDescriptionGenerator; |
@@ -36,8 +36,6 @@ public class CalendarDateRange implements Serializable { | |||
private Date end; | |||
private final transient TimeZone tz; | |||
/** | |||
* Constructor. | |||
* | |||
@@ -45,12 +43,13 @@ public class CalendarDateRange implements Serializable { | |||
* The start date and time of the date range | |||
* @param end | |||
* The end date and time of the date range | |||
* @param tz | |||
* Time zone. Unused. | |||
*/ | |||
public CalendarDateRange(Date start, Date end, TimeZone tz) { | |||
super(); | |||
this.start = start; | |||
this.end = end; | |||
this.tz = tz; | |||
} | |||
/** |
@@ -16,7 +16,6 @@ | |||
package com.vaadin.v7.ui.components.colorpicker; | |||
import java.lang.reflect.Method; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.HashSet; | |||
import java.util.List; | |||
@@ -161,6 +160,9 @@ public class ColorPickerPopup extends Window | |||
/** | |||
* Instantiates a new color picker popup. | |||
* | |||
* @param initialColor | |||
* initially selected color | |||
*/ | |||
public ColorPickerPopup(Color initialColor) { | |||
this(); | |||
@@ -209,11 +211,6 @@ public class ColorPickerPopup extends Window | |||
history.setWidth("97%"); | |||
history.setHeight("22px"); | |||
// Create the default colors | |||
List<Color> defaultColors = new ArrayList<Color>(); | |||
defaultColors.add(Color.BLACK); | |||
defaultColors.add(Color.WHITE); | |||
// Create the history | |||
VerticalLayout innerContainer = new VerticalLayout(); | |||
innerContainer.setWidth("100%"); |
@@ -133,8 +133,7 @@ public class DragAndDropService implements VariableOwner, ClientConnector { | |||
* operation based on the info passed from the client widgets (drag | |||
* source for Transferable, drop target for DragDropDetails). | |||
*/ | |||
Transferable transferable = constructTransferable(dropTarget, | |||
variables); | |||
Transferable transferable = constructTransferable(variables); | |||
TargetDetails dropData = constructDragDropDetails(dropTarget, | |||
variables); | |||
DragAndDropEvent dropEvent = new DragAndDropEvent(transferable, | |||
@@ -161,8 +160,7 @@ public class DragAndDropService implements VariableOwner, ClientConnector { | |||
* operation based on the info passed from the client widgets (drag | |||
* source for Transferable, current target for DragDropDetails). | |||
*/ | |||
Transferable transferable = constructTransferable(dropTarget, | |||
variables); | |||
Transferable transferable = constructTransferable(variables); | |||
TargetDetails dragDropDetails = constructDragDropDetails(dropTarget, | |||
variables); | |||
@@ -207,8 +205,7 @@ public class DragAndDropService implements VariableOwner, ClientConnector { | |||
} | |||
@SuppressWarnings("unchecked") | |||
private Transferable constructTransferable(DropTarget dropHandlerOwner, | |||
Map<String, Object> variables) { | |||
private Transferable constructTransferable(Map<String, Object> variables) { | |||
final Component sourceComponent = (Component) variables | |||
.get("component"); | |||
@@ -412,7 +412,7 @@ public class JsonCodec implements Serializable { | |||
// Arrays | |||
if (JsonConstants.VTYPE_ARRAY.equals(transportType)) { | |||
return decodeObjectArray(targetType, (JsonArray) encodedJsonValue, | |||
return decodeObjectArray((JsonArray) encodedJsonValue, | |||
connectorTracker); | |||
} else if (JsonConstants.VTYPE_STRINGARRAY.equals(transportType)) { | |||
@@ -625,13 +625,14 @@ public class JsonCodec implements Serializable { | |||
} | |||
} | |||
@SuppressWarnings({ "rawtypes", "unchecked" }) | |||
private static Object decodeEnum(Class<? extends Enum> cls, | |||
JsonString value) { | |||
return Enum.valueOf(cls, value.getString()); | |||
} | |||
private static Object[] decodeObjectArray(Type targetType, | |||
JsonArray jsonArray, ConnectorTracker connectorTracker) { | |||
private static Object[] decodeObjectArray(JsonArray jsonArray, | |||
ConnectorTracker connectorTracker) { | |||
List<Object> list = decodeList(List.class, true, jsonArray, | |||
connectorTracker); | |||
return list.toArray(new Object[list.size()]); | |||
@@ -685,6 +686,7 @@ public class JsonCodec implements Serializable { | |||
} | |||
} | |||
@SuppressWarnings("deprecation") | |||
public static EncodeResult encode(Object value, JsonValue diffState, | |||
Type valueType, ConnectorTracker connectorTracker) { | |||
@@ -1000,6 +1002,7 @@ public class JsonCodec implements Serializable { | |||
/* | |||
* Encodes a connector map. Invisible connectors are skipped. | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
private static JsonObject encodeConnectorMap(Type valueType, Map<?, ?> map, | |||
ConnectorTracker connectorTracker) { | |||
JsonObject jsonMap = Json.createObject(); | |||
@@ -1040,6 +1043,7 @@ public class JsonCodec implements Serializable { | |||
return TYPE_TO_TRANSPORT_TYPE.get(getClassForType(valueType)); | |||
} | |||
@SuppressWarnings({ "rawtypes", "unchecked" }) | |||
private static JsonValue serializeJson(Object value, | |||
ConnectorTracker connectorTracker) { | |||
JSONSerializer serializer = CUSTOM_SERIALIZERS.get(value.getClass()); |
@@ -45,7 +45,7 @@ import com.vaadin.ui.CustomLayout; | |||
* @author Vaadin Ltd. | |||
* @since 5.0 | |||
*/ | |||
@SuppressWarnings("serial") | |||
@SuppressWarnings({ "deprecation", "serial" }) | |||
public class JsonPaintTarget implements PaintTarget { | |||
/* Document type declarations */ | |||
@@ -82,6 +82,7 @@ public class JsonPaintTarget implements PaintTarget { | |||
* Creates a new JsonPaintTarget. | |||
* | |||
* @param manager | |||
* communication manager | |||
* @param outWriter | |||
* A character-output stream. | |||
* @param cachingRequired | |||
@@ -124,6 +125,8 @@ public class JsonPaintTarget implements PaintTarget { | |||
* | |||
* @param tagName | |||
* the name of the start tag. | |||
* @param isChildNode | |||
* {@code true} if child node, {@code false} otherwise | |||
* @throws PaintException | |||
* if the paint operation failed. | |||
* | |||
@@ -181,9 +184,7 @@ public class JsonPaintTarget implements PaintTarget { | |||
if (!openJsonTags.isEmpty()) { | |||
final JsonTag parent = openJsonTags.pop(); | |||
String lastTag = ""; | |||
lastTag = mOpenTags.pop(); | |||
String lastTag = mOpenTags.pop(); | |||
if (!tagName.equalsIgnoreCase(lastTag)) { | |||
throw new PaintException("Invalid UIDL: wrong ending tag: '" | |||
+ tagName + "' expected: '" + lastTag + "'."); |
@@ -78,7 +78,7 @@ import elemental.json.Json; | |||
import elemental.json.JsonArray; | |||
import elemental.json.JsonObject; | |||
@SuppressWarnings("serial") | |||
@SuppressWarnings({ "deprecation", "serial" }) | |||
public class VaadinServlet extends HttpServlet implements Constants { | |||
private class ScssCacheEntry implements Serializable { | |||
@@ -197,9 +197,13 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
private VaadinServletService servletService; | |||
// Mapped uri is for the jar file | |||
static final Map<URI, Integer> openFileSystems = new HashMap<>(); | |||
private static final Object fileSystemLock = new Object(); | |||
/** | |||
* Mapped uri is for the jar file. | |||
* <p> | |||
* FOR INTERNAL USE ONLY, may get renamed or removed. | |||
*/ | |||
static final Map<URI, Integer> OPEN_FILE_SYSTEMS = new HashMap<>(); | |||
private static final Object FILE_SYSTEM_LOCK = new Object(); | |||
/** | |||
* Called by the servlet container to indicate to a servlet that the servlet | |||
@@ -696,6 +700,7 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
* servers). | |||
* | |||
* @param servletContext | |||
* the {@link ServletContext} in which this servlet is running | |||
* @param path | |||
* the resource path. | |||
* @return the resource path. | |||
@@ -706,8 +711,7 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
@Deprecated | |||
protected static String getResourcePath(ServletContext servletContext, | |||
String path) { | |||
String resultPath = null; | |||
resultPath = servletContext.getRealPath(path); | |||
String resultPath = servletContext.getRealPath(path); | |||
if (resultPath != null) { | |||
return resultPath; | |||
} else { | |||
@@ -729,7 +733,8 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
* e.g. '(' and ')', so values should be safe in javascript too. | |||
* | |||
* @param themeName | |||
* @return | |||
* name of the theme | |||
* @return name of the theme without special characters | |||
* | |||
* @deprecated As of 7.0. Will likely change or be removed in a future | |||
* version | |||
@@ -782,7 +787,7 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
/** | |||
* Returns the default theme. Must never return null. | |||
* | |||
* @return | |||
* @return default theme name | |||
*/ | |||
public static String getDefaultTheme() { | |||
return DEFAULT_THEME_NAME; | |||
@@ -825,7 +830,9 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
* @param response | |||
* The response | |||
* @throws IOException | |||
* if an I/O exception occurs | |||
* @throws ServletException | |||
* if a servlet exception occurs | |||
* | |||
* @since 8.5 | |||
*/ | |||
@@ -971,6 +978,7 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
* @param resourceUrl | |||
* The url to send | |||
* @throws IOException | |||
* if an I/O exception occurs | |||
*/ | |||
protected void writeStaticResourceResponse(HttpServletRequest request, | |||
HttpServletResponse response, URL resourceUrl) throws IOException { | |||
@@ -1228,8 +1236,11 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
* outside the VAADIN directory if the method is overridden. | |||
* | |||
* @param request | |||
* current request | |||
* @param resourceUrl | |||
* @return | |||
* URL of the resource to validate | |||
* @return {@code true} if the resource is a valid VAADIN resource, | |||
* {@code false} otherwise | |||
* | |||
* @since 6.6.7 | |||
* | |||
@@ -1356,7 +1367,7 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
// Package protected for feature verification purpose | |||
FileSystem getFileSystem(URI resourceURI) throws IOException { | |||
synchronized (fileSystemLock) { | |||
synchronized (FILE_SYSTEM_LOCK) { | |||
URI fileURI = getFileURI(resourceURI); | |||
if (!fileURI.getScheme().equals("file")) { | |||
throw new IOException("Can not read scheme '" | |||
@@ -1364,7 +1375,7 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
+ " and will determine this as not a folder"); | |||
} | |||
Integer locks = openFileSystems.computeIfPresent(fileURI, | |||
Integer locks = OPEN_FILE_SYSTEMS.computeIfPresent(fileURI, | |||
(key, value) -> value + 1); | |||
if (locks != null) { | |||
// Get filesystem is for the file to get the correct provider | |||
@@ -1373,20 +1384,20 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
// Opened filesystem is for the file to get the correct provider | |||
FileSystem fileSystem = FileSystems.newFileSystem(resourceURI, | |||
Collections.emptyMap()); | |||
openFileSystems.put(fileURI, 1); | |||
OPEN_FILE_SYSTEMS.put(fileURI, 1); | |||
return fileSystem; | |||
} | |||
} | |||
// Package protected for feature verification purpose | |||
void closeFileSystem(URI resourceURI) { | |||
synchronized (fileSystemLock) { | |||
synchronized (FILE_SYSTEM_LOCK) { | |||
try { | |||
URI fileURI = getFileURI(resourceURI); | |||
Integer locks = openFileSystems.computeIfPresent(fileURI, | |||
Integer locks = OPEN_FILE_SYSTEMS.computeIfPresent(fileURI, | |||
(key, value) -> value - 1); | |||
if (locks != null && locks == 0) { | |||
openFileSystems.remove(fileURI); | |||
OPEN_FILE_SYSTEMS.remove(fileURI); | |||
// Get filesystem is for the file to get the correct | |||
// provider | |||
FileSystems.getFileSystem(resourceURI).close(); | |||
@@ -1459,7 +1470,8 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
/** | |||
* @param request | |||
* @return | |||
* the request that is to be evaluated | |||
* @return request type | |||
* | |||
* @deprecated As of 7.0. This is no longer used and only provided for | |||
* backwards compatibility. Each {@link RequestHandler} can | |||
@@ -1574,6 +1586,7 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
* | |||
* @param request | |||
* the HTTP request. | |||
* @return current application URL | |||
* @throws MalformedURLException | |||
* if the application is denied access to the persistent data | |||
* store represented by the given URL. | |||
@@ -1687,6 +1700,7 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
* characters" to keep the text somewhat readable. | |||
* | |||
* @param unsafe | |||
* the string that needs to be made safe | |||
* @return a safe string to be added inside an html tag | |||
* | |||
* @deprecated As of 7.0. Will likely change or be removed in a future | |||
@@ -1714,10 +1728,9 @@ public class VaadinServlet extends HttpServlet implements Constants { | |||
private static boolean isSafe(char c) { | |||
return // | |||
c > 47 && c < 58 || // alphanum | |||
c > 64 && c < 91 || // A-Z | |||
c > 96 && c < 123 // a-z | |||
; | |||
(c > 47 && c < 58) || // alphanum | |||
(c > 64 && c < 91) || // A-Z | |||
(c > 96 && c < 123); // a-z | |||
} | |||
private static final Logger getLogger() { |
@@ -26,7 +26,6 @@ import java.util.logging.Level; | |||
import java.util.logging.Logger; | |||
import com.vaadin.server.JsonPaintTarget; | |||
import com.vaadin.server.LegacyCommunicationManager; | |||
import com.vaadin.ui.CustomLayout; | |||
import com.vaadin.ui.UI; | |||
@@ -53,10 +52,6 @@ public class ResourceWriter implements Serializable { | |||
public void write(UI ui, Writer writer, JsonPaintTarget target) | |||
throws IOException { | |||
// TODO PUSH Refactor so that this is not needed | |||
LegacyCommunicationManager manager = ui.getSession() | |||
.getCommunicationManager(); | |||
// Precache custom layouts | |||
// TODO We should only precache the layouts that are not |
@@ -31,7 +31,6 @@ import java.util.logging.Logger; | |||
import com.vaadin.server.ClientConnector; | |||
import com.vaadin.server.Constants; | |||
import com.vaadin.server.JsonCodec; | |||
import com.vaadin.server.LegacyCommunicationManager; | |||
import com.vaadin.server.LegacyCommunicationManager.InvalidUIDLSecurityKeyException; | |||
import com.vaadin.server.ServerRpcManager; | |||
import com.vaadin.server.ServerRpcManager.RpcInvocationException; | |||
@@ -64,6 +63,7 @@ import elemental.json.impl.JsonUtil; | |||
* @author Vaadin Ltd | |||
* @since 7.1 | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
public class ServerRpcHandler implements Serializable { | |||
/** | |||
@@ -212,6 +212,7 @@ public class ServerRpcHandler implements Serializable { | |||
* @param reader | |||
* The {@link Reader} used to read the JSON. | |||
* @param request | |||
* The {@link VaadinRequest} to handle. | |||
* @throws IOException | |||
* If reading the message fails. | |||
* @throws InvalidUIDLSecurityKeyException | |||
@@ -332,8 +333,7 @@ public class ServerRpcHandler implements Serializable { | |||
Set<Connector> enabledConnectors = new HashSet<>(); | |||
List<MethodInvocation> invocations = parseInvocations( | |||
ui.getConnectorTracker(), invocationsData, | |||
lastSyncIdSeenByClient); | |||
ui.getConnectorTracker(), invocationsData); | |||
for (MethodInvocation invocation : invocations) { | |||
final ClientConnector connector = connectorTracker | |||
.getConnector(invocation.getConnectorId()); | |||
@@ -489,14 +489,10 @@ public class ServerRpcHandler implements Serializable { | |||
* @param invocationsJson | |||
* JSON containing all information needed to execute all | |||
* requested RPC calls. | |||
* @param lastSyncIdSeenByClient | |||
* the most recent sync id the client has seen at the time the | |||
* request was sent | |||
* @return list of MethodInvocation to perform | |||
*/ | |||
private List<MethodInvocation> parseInvocations( | |||
ConnectorTracker connectorTracker, JsonArray invocationsJson, | |||
int lastSyncIdSeenByClient) { | |||
ConnectorTracker connectorTracker, JsonArray invocationsJson) { | |||
int invocationCount = invocationsJson.length(); | |||
List<MethodInvocation> invocations = new ArrayList<>(invocationCount); | |||
@@ -507,8 +503,7 @@ public class ServerRpcHandler implements Serializable { | |||
JsonArray invocationJson = invocationsJson.getArray(i); | |||
MethodInvocation invocation = parseInvocation(invocationJson, | |||
previousInvocation, connectorTracker, | |||
lastSyncIdSeenByClient); | |||
previousInvocation, connectorTracker); | |||
if (invocation != null) { | |||
// Can be null if the invocation was a legacy invocation and it | |||
// was merged with the previous one or if the invocation was | |||
@@ -522,7 +517,7 @@ public class ServerRpcHandler implements Serializable { | |||
private MethodInvocation parseInvocation(JsonArray invocationJson, | |||
MethodInvocation previousInvocation, | |||
ConnectorTracker connectorTracker, long lastSyncIdSeenByClient) { | |||
ConnectorTracker connectorTracker) { | |||
String connectorId = invocationJson.getString(0); | |||
String interfaceName = invocationJson.getString(1); | |||
String methodName = invocationJson.getString(2); | |||
@@ -536,7 +531,6 @@ public class ServerRpcHandler implements Serializable { | |||
} | |||
return parseLegacyChangeVariablesInvocation(connectorId, | |||
interfaceName, methodName, | |||
(LegacyChangeVariablesInvocation) previousInvocation, | |||
parametersJson, connectorTracker); | |||
} else { | |||
@@ -547,7 +541,7 @@ public class ServerRpcHandler implements Serializable { | |||
} | |||
private LegacyChangeVariablesInvocation parseLegacyChangeVariablesInvocation( | |||
String connectorId, String interfaceName, String methodName, | |||
String connectorId, | |||
LegacyChangeVariablesInvocation previousInvocation, | |||
JsonArray parametersJson, ConnectorTracker connectorTracker) { | |||
if (parametersJson.length() != 2) { | |||
@@ -643,10 +637,12 @@ public class ServerRpcHandler implements Serializable { | |||
} | |||
/** | |||
* Generates an error message when the client is trying to to something | |||
* Generates an error message when the client is trying to do something | |||
* ('what') with a connector which is disabled or invisible. | |||
* | |||
* @since 7.1.8 | |||
* @param what | |||
* the ignored operation | |||
* @param connector | |||
* the connector which is disabled (or invisible) | |||
* @return an error message |
@@ -46,6 +46,7 @@ import elemental.json.JsonException; | |||
* @author Vaadin Ltd | |||
* @since 7.1 | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
public class UidlRequestHandler extends SynchronizedRequestHandler | |||
implements SessionExpiredHandler { | |||
@@ -89,7 +90,7 @@ public class UidlRequestHandler extends SynchronizedRequestHandler | |||
try { | |||
rpcHandler.handleRpc(uI, request.getReader(), request); | |||
writeUidl(request, response, uI, stringWriter); | |||
writeUidl(response, uI, stringWriter); | |||
} catch (JsonException e) { | |||
getLogger().log(Level.SEVERE, "Error writing JSON to response", e); | |||
// Refresh on client side | |||
@@ -117,8 +118,8 @@ public class UidlRequestHandler extends SynchronizedRequestHandler | |||
UIInitHandler.commitJsonResponse(request, response, json); | |||
} | |||
private void writeUidl(VaadinRequest request, VaadinResponse response, | |||
UI ui, Writer writer) throws IOException { | |||
private void writeUidl(VaadinResponse response, UI ui, Writer writer) | |||
throws IOException { | |||
openJsonMessage(writer, response); | |||
new UidlWriter().write(ui, writer, false); |
@@ -52,8 +52,6 @@ import java.util.jar.Manifest; | |||
*/ | |||
public class ClassPathExplorer { | |||
private static final String VAADIN_ADDON_VERSION_ATTRIBUTE = "Vaadin-Package-Version"; | |||
/** | |||
* File filter that only accepts directories. | |||
*/ |
@@ -427,7 +427,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & | |||
} | |||
/** | |||
* Parses string representaion of date range limit into date type | |||
* Parses string representation of date range limit into date type. | |||
* | |||
* @param temporalStr | |||
* the string representation | |||
@@ -1005,7 +1005,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & | |||
.orElse(null)); | |||
} | |||
private Iterable<R> getResolutionsHigherOrEqualTo(R resoution) { | |||
private Iterable<R> getResolutionsHigherOrEqualTo(R resolution) { | |||
return getResolutions().skip(resolution.ordinal()) | |||
.collect(Collectors.toList()); | |||
} | |||
@@ -1141,10 +1141,11 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & | |||
} | |||
/** | |||
* Control whether value change event is emitted when user input value | |||
* does not meet the integrated range validator. | |||
* Control whether value change event is emitted when user input value does | |||
* not meet the integrated range validator. | |||
* | |||
* @param preventInvalidInput Set to false to disable the value change event. | |||
* @param preventInvalidInput | |||
* Set to false to disable the value change event. | |||
* | |||
* @since 8.13 | |||
*/ | |||
@@ -1153,8 +1154,8 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & | |||
} | |||
/** | |||
* Check whether value change is emitted when user input value does | |||
* not meet integrated range validator. The default is false. | |||
* Check whether value change is emitted when user input value does not meet | |||
* integrated range validator. The default is false. | |||
* | |||
* @return a Boolean value | |||
* |
@@ -275,7 +275,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* <code>true</code> if event is a result of user | |||
* interaction, <code>false</code> if from API call | |||
*/ | |||
public ColumnReorderEvent(Grid source, boolean userOriginated) { | |||
public ColumnReorderEvent(Grid<?> source, boolean userOriginated) { | |||
super(source); | |||
this.userOriginated = userOriginated; | |||
} | |||
@@ -306,6 +306,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @param source | |||
* the grid where the event originated from | |||
* @param column | |||
* the column that was resized | |||
* @param userOriginated | |||
* <code>true</code> if event is a result of user | |||
* interaction, <code>false</code> if from API call | |||
@@ -356,6 +358,16 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* Creates a new {@code ItemClick} event containing the given item and | |||
* Column originating from the given Grid. | |||
* | |||
* @param source | |||
* the grid where the event originated from | |||
* @param column | |||
* the column that contains the clicked cell | |||
* @param item | |||
* the item that was clicked | |||
* @param mouseEventDetails | |||
* mouse event details about the click | |||
* @param rowIndex | |||
* the index of the row that contains the clicked cell | |||
*/ | |||
public ItemClick(Grid<T> source, Column<T, ?> column, T item, | |||
MouseEventDetails mouseEventDetails, int rowIndex) { | |||
@@ -390,6 +402,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* @return the grid | |||
*/ | |||
@Override | |||
@SuppressWarnings("unchecked") | |||
public Grid<T> getSource() { | |||
return (Grid<T>) super.getSource(); | |||
} | |||
@@ -501,6 +514,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
} | |||
@Override | |||
@SuppressWarnings("unchecked") | |||
public Grid<T> getComponent() { | |||
return (Grid<T>) super.getComponent(); | |||
} | |||
@@ -849,18 +863,18 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
public static class Column<T, V> extends AbstractExtension { | |||
/** | |||
* behavior when parsing nested properties which may contain | |||
* <code>null</code> values in the property chain | |||
* Behavior when parsing nested properties which may contain | |||
* <code>null</code> values in the property chain. | |||
*/ | |||
public enum NestedNullBehavior { | |||
/** | |||
* throw a NullPointerException if there is a nested | |||
* <code>null</code> value | |||
* Throw a NullPointerException if there is a nested | |||
* <code>null</code> value. | |||
*/ | |||
THROW, | |||
/** | |||
* silently ignore any exceptions caused by nested <code>null</code> | |||
* values | |||
* Silently ignore any exceptions caused by nested <code>null</code> | |||
* values. | |||
*/ | |||
ALLOW_NULLS | |||
} | |||
@@ -1578,6 +1592,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* the expand ratio of this column. {@code 0} to not have it | |||
* expand at all. A negative number to clear the expand | |||
* value. | |||
* @return this column | |||
* @throws IllegalStateException | |||
* if the column is no longer attached to any grid | |||
* @see #setWidth(double) | |||
@@ -1607,6 +1622,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* <p> | |||
* Equal to calling {@link #setExpandRatio(int) setExpandRatio(-1)} | |||
* | |||
* @return this column | |||
* @throws IllegalStateException | |||
* if the column is no longer attached to any grid | |||
*/ | |||
@@ -1790,6 +1806,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @param pixels | |||
* the maximum width | |||
* @return this column | |||
* @throws IllegalStateException | |||
* if the column is no longer attached to any grid | |||
* @see #setExpandRatio(int) | |||
@@ -1826,6 +1843,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* @param resizable | |||
* {@code true} if this column should be resizable, | |||
* {@code false} otherwise | |||
* @return this column | |||
* @throws IllegalStateException | |||
* if the column is no longer attached to any grid | |||
*/ | |||
@@ -1961,8 +1979,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* {@code true} if column is editable; {@code false} if not | |||
* @return this column | |||
* @throws IllegalStateException | |||
* if editable is true and column has no editor binding or | |||
* component defined | |||
* if editable is true and column has no editor binding or | |||
* component defined | |||
* | |||
* @see #setEditorComponent(HasValue, Setter) | |||
* @see #setEditorBinding(Binding) | |||
@@ -2045,6 +2063,9 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* <strong>Note:</strong> The same component cannot be used for multiple | |||
* columns. | |||
* | |||
* @param <C> | |||
* a class that extends both {@link HasValue} and | |||
* {@link Component} | |||
* @param editorComponent | |||
* the editor component | |||
* @param setter | |||
@@ -2081,6 +2102,11 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* <strong>Note:</strong> The same component cannot be used for multiple | |||
* columns. | |||
* | |||
* @param <F> | |||
* a value type | |||
* @param <C> | |||
* a class that extends both {@link HasValue} (for type | |||
* {@code <F>}) and {@link Component} | |||
* @param editorComponent | |||
* the editor component | |||
* @return this column | |||
@@ -2113,8 +2139,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* all currently available row data to be recreated and sent to the | |||
* client. | |||
* | |||
* Note: Setting a new renderer will reset presentation provider if | |||
* it exists. | |||
* Note: Setting a new renderer will reset presentation provider if it | |||
* exists. | |||
* | |||
* @param renderer | |||
* the new renderer | |||
@@ -2660,6 +2686,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* @see Grid#Grid() | |||
* @see Grid#Grid(Class) | |||
* | |||
* @param <BEAN> | |||
* the grid bean type | |||
* @param propertySet | |||
* the property set implementation to use, not <code>null</code>. | |||
* @return a new grid using the provided property set, not <code>null</code> | |||
@@ -2875,6 +2903,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @param valueProvider | |||
* the value provider | |||
* @param <V> | |||
* the column value type | |||
* | |||
* @return the new column | |||
*/ | |||
@@ -3061,8 +3091,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
/** | |||
* Removes the given column from this {@link Grid}. | |||
* | |||
* Note: If you have Editor with binding in this Grid to this property, you need to remove that | |||
* using removeBinding method provided by Binder. | |||
* Note: If you have Editor with binding in this Grid to this property, you | |||
* need to remove that using removeBinding method provided by Binder. | |||
* | |||
* @param column | |||
* the column to remove | |||
@@ -4014,6 +4044,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @see Column#setId(String) | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public void setColumns(String... columnIds) { | |||
// Must extract to an explicitly typed variable because otherwise javac | |||
// cannot determine which overload of setColumnOrder to use | |||
@@ -4068,6 +4099,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* @param columns | |||
* the columns in the order they should be | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public void setColumnOrder(Column<T, ?>... columns) { | |||
setColumnOrder(Stream.of(columns)); | |||
} | |||
@@ -4133,6 +4165,11 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
return new GridSingleSelect<>(this); | |||
} | |||
/** | |||
* Returns the {@link Editor} for this grid. | |||
* | |||
* @return the editor, not null | |||
*/ | |||
public Editor<T> getEditor() { | |||
return editor; | |||
} | |||
@@ -4223,6 +4260,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @see #getSelectionModel() | |||
* @see GridSelectionModel | |||
* @return the items in the current selection, not null | |||
*/ | |||
public Set<T> getSelectedItems() { | |||
return getSelectionModel().getSelectedItems(); | |||
@@ -4234,6 +4272,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @see #getSelectionModel() | |||
* @see GridSelectionModel | |||
* @param item | |||
* the item to select, not null | |||
*/ | |||
public void select(T item) { | |||
getSelectionModel().select(item); | |||
@@ -4245,6 +4285,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @see #getSelectionModel() | |||
* @see GridSelectionModel | |||
* @param item | |||
* the item to deselect, not null | |||
*/ | |||
public void deselect(T item) { | |||
getSelectionModel().deselect(item); | |||
@@ -4849,10 +4891,10 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
*/ | |||
protected void writeData(Element body, DesignContext designContext) { | |||
getDataProvider().fetch(new Query<>()) | |||
.forEach(item -> writeRow(body, item, designContext)); | |||
.forEach(item -> writeRow(body, item)); | |||
} | |||
private void writeRow(Element container, T item, DesignContext context) { | |||
private void writeRow(Element container, T item) { | |||
Element tableRow = container.appendElement("tr"); | |||
tableRow.attr("item", serializeDeclarativeRepresentation(item)); | |||
if (getSelectionModel().isSelected(item)) { |
@@ -641,6 +641,7 @@ public class GridLayout extends AbstractLayout | |||
* Constructs an <code>OverlapsException</code>. | |||
* | |||
* @param existingArea | |||
* the existing area that needs overlapping | |||
*/ | |||
public OverlapsException(Area existingArea) { | |||
this.existingArea = existingArea; | |||
@@ -698,6 +699,7 @@ public class GridLayout extends AbstractLayout | |||
* detail message. | |||
* | |||
* @param areaOutOfBounds | |||
* the area that exceeds the bounds of the grid | |||
*/ | |||
public OutOfBoundsException(Area areaOutOfBounds) { | |||
super(String.format("%s, layout dimension: %sx%s", areaOutOfBounds, | |||
@@ -837,6 +839,7 @@ public class GridLayout extends AbstractLayout | |||
* by GridLayout. | |||
* | |||
* @param cursorX | |||
* current cursor x-position | |||
*/ | |||
public void setCursorX(int cursorX) { | |||
this.cursorX = cursorX; | |||
@@ -1058,7 +1061,9 @@ public class GridLayout extends AbstractLayout | |||
* @see #setWidth(float, Unit) | |||
* | |||
* @param columnIndex | |||
* The column index, starting from 0 for the leftmost row. | |||
* @param ratio | |||
* the expand ratio | |||
*/ | |||
public void setColumnExpandRatio(int columnIndex, float ratio) { | |||
columnExpandRatio.put(columnIndex, ratio); | |||
@@ -1072,6 +1077,7 @@ public class GridLayout extends AbstractLayout | |||
* @see #setColumnExpandRatio(int, float) | |||
* | |||
* @param columnIndex | |||
* The column index, starting from 0 for the leftmost row. | |||
* @return the expand ratio, 0.0f by default | |||
*/ | |||
public float getColumnExpandRatio(int columnIndex) { | |||
@@ -1103,6 +1109,7 @@ public class GridLayout extends AbstractLayout | |||
* @param rowIndex | |||
* The row index, starting from 0 for the topmost row. | |||
* @param ratio | |||
* the expand ratio | |||
*/ | |||
public void setRowExpandRatio(int rowIndex, float ratio) { | |||
rowExpandRatio.put(rowIndex, ratio); | |||
@@ -1195,6 +1202,7 @@ public class GridLayout extends AbstractLayout | |||
* MarginInfo ) | |||
*/ | |||
@Override | |||
@SuppressWarnings("deprecation") | |||
public void setMargin(MarginInfo marginInfo) { | |||
getState().marginsBitmask = marginInfo.getBitMask(); | |||
} | |||
@@ -1205,6 +1213,7 @@ public class GridLayout extends AbstractLayout | |||
* @see com.vaadin.ui.Layout.MarginHandler#getMargin() | |||
*/ | |||
@Override | |||
@SuppressWarnings("deprecation") | |||
public MarginInfo getMargin() { | |||
return new MarginInfo(getState(false).marginsBitmask); | |||
} | |||
@@ -1430,7 +1439,7 @@ public class GridLayout extends AbstractLayout | |||
} | |||
if (components.isEmpty()) { | |||
writeEmptyColsAndRows(design, designContext); | |||
writeEmptyColsAndRows(design); | |||
return; | |||
} | |||
@@ -1566,10 +1575,8 @@ public class GridLayout extends AbstractLayout | |||
* components in the {@link GridLayout} | |||
* | |||
* @param design | |||
* @param designContext | |||
*/ | |||
private void writeEmptyColsAndRows(Element design, | |||
DesignContext designContext) { | |||
private void writeEmptyColsAndRows(Element design) { | |||
int rowCount = getState(false).rows; | |||
int colCount = getState(false).columns; | |||
@@ -334,7 +334,7 @@ public class Panel extends AbstractSingleComponentContainer | |||
public void writeDesign(Element design, DesignContext designContext) { | |||
super.writeDesign(design, designContext); | |||
// handle tabindex | |||
Panel def = designContext.getDefaultInstance(this); | |||
designContext.getDefaultInstance(this); | |||
} | |||
} |
@@ -140,7 +140,7 @@ public class TabSheet extends AbstractComponentContainer | |||
registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); | |||
// expand horizontally by default | |||
setWidth(100, UNITS_PERCENTAGE); | |||
setWidth(100, Unit.PERCENTAGE); | |||
setCloseHandler(TabSheet::removeComponent); | |||
} | |||
@@ -450,8 +450,7 @@ public class TabSheet extends AbstractComponentContainer | |||
@Override | |||
public void moveComponentsFrom(ComponentContainer source) { | |||
for (final Iterator<Component> i = source.getComponentIterator(); i | |||
.hasNext();) { | |||
for (final Iterator<Component> i = source.iterator(); i.hasNext();) { | |||
final Component c = i.next(); | |||
String caption = null; | |||
Resource icon = null; | |||
@@ -644,8 +643,7 @@ public class TabSheet extends AbstractComponentContainer | |||
*/ | |||
private boolean updateSelection() { | |||
Component originalSelection = selected; | |||
for (final Iterator<Component> i = getComponentIterator(); i | |||
.hasNext();) { | |||
for (final Iterator<Component> i = iterator(); i.hasNext();) { | |||
final Component component = i.next(); | |||
Tab tab = tabs.get(component); | |||
@@ -851,7 +849,8 @@ public class TabSheet extends AbstractComponentContainer | |||
* @since 3.0 | |||
*/ | |||
@FunctionalInterface | |||
public interface SelectedTabChangeListener extends SerializableEventListener { | |||
public interface SelectedTabChangeListener | |||
extends SerializableEventListener { | |||
/** | |||
* Selected (shown) tab in tab sheet has has been changed. | |||
@@ -1015,11 +1014,15 @@ public class TabSheet extends AbstractComponentContainer | |||
/** | |||
* Gets the caption for the tab. | |||
* | |||
* @return the caption | |||
*/ | |||
public String getCaption(); | |||
/** | |||
* Gets the icon for the tab. | |||
* | |||
* @return tue icon resource | |||
*/ | |||
public Resource getIcon(); | |||
@@ -1036,6 +1039,8 @@ public class TabSheet extends AbstractComponentContainer | |||
* | |||
* @param icon | |||
* the icon to set | |||
* @param iconAltText | |||
* the alt text | |||
*/ | |||
public void setIcon(Resource icon, String iconAltText); | |||
@@ -1043,6 +1048,8 @@ public class TabSheet extends AbstractComponentContainer | |||
* Gets the icon alt text for the tab. | |||
* | |||
* @since 7.2 | |||
* | |||
* @return the alt text | |||
*/ | |||
public String getIconAlternateText(); | |||
@@ -1114,11 +1121,15 @@ public class TabSheet extends AbstractComponentContainer | |||
* TODO currently not sent to the client | |||
* | |||
* @see AbstractComponent#setComponentError(ErrorMessage) | |||
* | |||
* @return the error message | |||
*/ | |||
public ErrorMessage getComponentError(); | |||
/** | |||
* Get the component related to the Tab. | |||
* | |||
* @return the component | |||
*/ | |||
public Component getComponent(); | |||
@@ -1407,6 +1418,7 @@ public class TabSheet extends AbstractComponentContainer | |||
* The default CloseHandler for TabSheet will only remove the tab. | |||
* | |||
* @param handler | |||
* the close handler that should be used | |||
*/ | |||
public void setCloseHandler(CloseHandler handler) { | |||
closeHandler = handler; | |||
@@ -1434,7 +1446,8 @@ public class TabSheet extends AbstractComponentContainer | |||
* | |||
* @param tab | |||
* The tab | |||
* @return | |||
* @return the index of the given tab, or -1 if there is no such tab in this | |||
* tabsheet | |||
*/ | |||
public int getTabPosition(Tab tab) { | |||
return components.indexOf(tab.getComponent()); | |||
@@ -1659,7 +1672,7 @@ public class TabSheet extends AbstractComponentContainer | |||
public void writeDesign(Element design, DesignContext designContext) { | |||
super.writeDesign(design, designContext); | |||
TabSheet def = designContext.getDefaultInstance(this); | |||
Attributes attr = design.attributes(); | |||
design.attributes(); | |||
// write tabs | |||
if (!designContext.shouldWriteChildren(this, def)) { |
@@ -15,7 +15,6 @@ | |||
*/ | |||
package com.vaadin.ui.components.colorpicker; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.HashSet; | |||
import java.util.List; | |||
@@ -28,19 +27,19 @@ import com.vaadin.data.HasValue; | |||
import com.vaadin.shared.Registration; | |||
import com.vaadin.shared.ui.MarginInfo; | |||
import com.vaadin.shared.ui.colorpicker.Color; | |||
import com.vaadin.ui.TabSheet; | |||
import com.vaadin.ui.Window; | |||
import com.vaadin.ui.VerticalLayout; | |||
import com.vaadin.ui.HorizontalLayout; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.Slider; | |||
import com.vaadin.ui.Layout; | |||
import com.vaadin.ui.AbstractColorPicker.Coordinates2Color; | |||
import com.vaadin.ui.Alignment; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.HasComponents; | |||
import com.vaadin.ui.AbstractColorPicker.Coordinates2Color; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.HasComponents; | |||
import com.vaadin.ui.HorizontalLayout; | |||
import com.vaadin.ui.Layout; | |||
import com.vaadin.ui.Slider; | |||
import com.vaadin.ui.Slider.ValueOutOfBoundsException; | |||
import com.vaadin.ui.TabSheet; | |||
import com.vaadin.ui.VerticalLayout; | |||
import com.vaadin.ui.Window; | |||
/** | |||
* A component that represents color selection popup within a color picker. | |||
@@ -206,11 +205,6 @@ public class ColorPickerPopup extends Window implements HasValue<Color> { | |||
history.setWidth("97%"); | |||
history.setHeight("22px"); | |||
// Create the default colors | |||
List<Color> defaultColors = new ArrayList<>(); | |||
defaultColors.add(Color.BLACK); | |||
defaultColors.add(Color.WHITE); | |||
// Create the history | |||
VerticalLayout innerContainer = new VerticalLayout(); | |||
innerContainer.setWidth("100%"); | |||
@@ -503,6 +497,7 @@ public class ColorPickerPopup extends Window implements HasValue<Color> { | |||
} | |||
@Override | |||
@SuppressWarnings("deprecation") | |||
public Registration addValueChangeListener( | |||
ValueChangeListener<Color> listener) { | |||
Objects.requireNonNull(listener, "listener cannot be null"); |
@@ -49,8 +49,6 @@ public class ColorPickerPreview extends CssLayout implements HasValue<Color> { | |||
/** The field. */ | |||
private final TextField field; | |||
/** The old value. */ | |||
private String oldValue; | |||
private Registration valueChangeListenerRegistration = null; | |||
private boolean readOnly; | |||
@@ -96,8 +94,6 @@ public class ColorPickerPreview extends CssLayout implements HasValue<Color> { | |||
field.setValue(colorCSS); | |||
field.setComponentError(null); | |||
oldValue = colorCSS; | |||
// Re-register listener | |||
valueChangeListenerRegistration = field | |||
.addValueChangeListener(this::valueChange); | |||
@@ -121,6 +117,7 @@ public class ColorPickerPreview extends CssLayout implements HasValue<Color> { | |||
} | |||
@Override | |||
@SuppressWarnings("deprecation") | |||
public Registration addValueChangeListener( | |||
ValueChangeListener<Color> listener) { | |||
Objects.requireNonNull(listener, "listener cannot be null"); | |||
@@ -141,7 +138,6 @@ public class ColorPickerPreview extends CssLayout implements HasValue<Color> { | |||
*/ | |||
color = ColorUtil.stringToColor(value); | |||
oldValue = value; | |||
fireEvent(new ValueChangeEvent<>(this, oldColor, | |||
event.isUserOriginated())); | |||
} catch (NumberFormatException e) { |
@@ -354,10 +354,14 @@ public class DesignContext implements Serializable { | |||
* Returns the default instance for the given class. The instance must not | |||
* be modified by the caller. | |||
* | |||
* @param <T> | |||
* a component class | |||
* @param component | |||
* the component that determines the class | |||
* @return the default instance for the given class. The return value must | |||
* not be modified by the caller | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public <T> T getDefaultInstance(Component component) { | |||
// If the root is a @DesignRoot component, it can't use itself as a | |||
// reference or the written design will be empty | |||
@@ -385,6 +389,9 @@ public class DesignContext implements Serializable { | |||
/** | |||
* Reads and stores the mappings from prefixes to package names from meta | |||
* tags located under <head> in the html document. | |||
* | |||
* @param doc | |||
* the document | |||
*/ | |||
protected void readPackageMappings(Document doc) { | |||
Element head = doc.head(); | |||
@@ -848,7 +855,8 @@ public class DesignContext implements Serializable { | |||
String value) { | |||
Map<String, String> map = customAttributes.get(component); | |||
if (map == null) { | |||
customAttributes.put(component, map = new HashMap<>()); | |||
map = new HashMap<>(); | |||
customAttributes.put(component, map); | |||
} | |||
map.put(attribute, value); | |||
} |
@@ -233,7 +233,7 @@ public class VaadinServletTest { | |||
public void isAllowedVAADINResource_jarWarFileScheme_detectsAsStaticResources() | |||
throws IOException, URISyntaxException, ServletException { | |||
assertTrue("Can not run concurrently with other test", | |||
VaadinServlet.openFileSystems.isEmpty()); | |||
VaadinServlet.OPEN_FILE_SYSTEMS.isEmpty()); | |||
VaadinServlet servlet = new VaadinServlet(); | |||
servlet.init(new MockServletConfig()); | |||
@@ -276,7 +276,7 @@ public class VaadinServletTest { | |||
public void isAllowedVAADINResource_jarInAJar_detectsAsStaticResources() | |||
throws IOException, URISyntaxException, ServletException { | |||
assertTrue("Can not run concurrently with other test", | |||
VaadinServlet.openFileSystems.isEmpty()); | |||
VaadinServlet.OPEN_FILE_SYSTEMS.isEmpty()); | |||
VaadinServlet servlet = new VaadinServlet(); | |||
servlet.init(new MockServletConfig()); | |||
@@ -325,7 +325,7 @@ public class VaadinServletTest { | |||
public void openingJarFileSystemForDifferentFilesInSameJar_existingFileSystemIsUsed() | |||
throws IOException, URISyntaxException, ServletException { | |||
assertTrue("Can not run concurrently with other test", | |||
VaadinServlet.openFileSystems.isEmpty()); | |||
VaadinServlet.OPEN_FILE_SYSTEMS.isEmpty()); | |||
VaadinServlet servlet = new VaadinServlet(); | |||
servlet.init(new MockServletConfig()); | |||
@@ -348,15 +348,15 @@ public class VaadinServletTest { | |||
servlet.getFileSystem(fileResourceURL.toURI()); | |||
assertEquals("Same file should be marked for both resources", | |||
(Integer) 2, VaadinServlet.openFileSystems.entrySet() | |||
(Integer) 2, VaadinServlet.OPEN_FILE_SYSTEMS.entrySet() | |||
.iterator().next().getValue()); | |||
servlet.closeFileSystem(folderResourceURL.toURI()); | |||
assertEquals("Closing resource should be removed from jar uri", | |||
(Integer) 1, VaadinServlet.openFileSystems.entrySet() | |||
(Integer) 1, VaadinServlet.OPEN_FILE_SYSTEMS.entrySet() | |||
.iterator().next().getValue()); | |||
servlet.closeFileSystem(fileResourceURL.toURI()); | |||
assertTrue("Closing last resource should clear marking", | |||
VaadinServlet.openFileSystems.isEmpty()); | |||
VaadinServlet.OPEN_FILE_SYSTEMS.isEmpty()); | |||
try { | |||
FileSystems.getFileSystem(folderResourceURL.toURI()); | |||
@@ -375,7 +375,7 @@ public class VaadinServletTest { | |||
throws IOException, InterruptedException, ExecutionException, | |||
URISyntaxException, ServletException { | |||
assertTrue("Can not run concurrently with other test", | |||
VaadinServlet.openFileSystems.isEmpty()); | |||
VaadinServlet.OPEN_FILE_SYSTEMS.isEmpty()); | |||
VaadinServlet servlet = new VaadinServlet(); | |||
servlet.init(new MockServletConfig()); | |||
@@ -547,7 +547,7 @@ public class VaadinServletTest { | |||
private void ensureFileSystemsCleared(URL fileResourceURL) | |||
throws URISyntaxException { | |||
assertFalse("URI should have been cleared", | |||
VaadinServlet.openFileSystems | |||
VaadinServlet.OPEN_FILE_SYSTEMS | |||
.containsKey(fileResourceURL.toURI())); | |||
try { | |||
FileSystems.getFileSystem(fileResourceURL.toURI()); |
@@ -34,9 +34,7 @@ public class AbstractComponentElement extends AbstractElement { | |||
*/ | |||
public String getCaption() { | |||
final String gwtIdAttribute = "aria-labelledby"; | |||
WebElement captElem = null; | |||
String captionId = null; | |||
captionId = getAttribute(gwtIdAttribute); | |||
String captionId = getAttribute(gwtIdAttribute); | |||
// IE8 getAttribute returns empty string instead of null | |||
// when there is no attribute with specified name | |||
if (captionId == null || captionId.isEmpty()) { | |||
@@ -45,7 +43,7 @@ public class AbstractComponentElement extends AbstractElement { | |||
captionId = elem.getAttribute(gwtIdAttribute); | |||
} | |||
// element ids are unique, we can search the whole page | |||
captElem = getDriver().findElement(By.id(captionId)); | |||
WebElement captElem = getDriver().findElement(By.id(captionId)); | |||
return captElem.getText(); | |||
} | |||
@@ -22,11 +22,9 @@ import com.vaadin.ui.VerticalLayout; | |||
* @author Vaadin Ltd | |||
* | |||
*/ | |||
public abstract class HasValueRequiredIndicator<C extends HasValue & Component> | |||
public abstract class HasValueRequiredIndicator<C extends HasValue<?> & Component> | |||
extends AbstractTestUI { | |||
private static final List<Class<? extends Layout>> LAYOUTS = getVaadinLayouts(); | |||
@Override | |||
protected void setup(VaadinRequest request) { | |||
getContent().setSizeFull(); | |||
@@ -70,6 +68,7 @@ public abstract class HasValueRequiredIndicator<C extends HasValue & Component> | |||
if (type instanceof Class<?>) { | |||
Class<?> clazz = (Class<?>) type; | |||
try { | |||
@SuppressWarnings("unchecked") | |||
C component = (C) clazz.newInstance(); | |||
initValue(component); | |||
component.setRequiredIndicatorVisible(true); |
@@ -20,8 +20,6 @@ public class GridNullSafeNestedPropertyColumn extends AbstractTestUI { | |||
private List<Person> personList = new ArrayList<>(); | |||
private ListDataProvider<Person> listDataProvider; | |||
private Grid.Column nullSafeColumn = null; | |||
private Grid.Column regularColumn = null; | |||
@Override | |||
protected void setup(VaadinRequest request) { | |||
@@ -47,8 +45,7 @@ public class GridNullSafeNestedPropertyColumn extends AbstractTestUI { | |||
Button addSafeColumnButton = new Button( | |||
"add 'address.streetAddress' as a null-safe column", event -> { | |||
nullSafeColumn = grid.addColumn("address.streetAddress", | |||
new TextRenderer(), | |||
grid.addColumn("address.streetAddress", new TextRenderer(), | |||
Grid.Column.NestedNullBehavior.ALLOW_NULLS); | |||
}); | |||
addSafeColumnButton.setId("safe"); | |||
@@ -56,7 +53,7 @@ public class GridNullSafeNestedPropertyColumn extends AbstractTestUI { | |||
Button addUnsafeColumnButton = new Button( | |||
"add 'address.streetAddress' column without nested null safety", | |||
event -> { | |||
regularColumn = grid.addColumn("address.streetAddress"); | |||
grid.addColumn("address.streetAddress"); | |||
}); | |||
addUnsafeColumnButton.setId("unsafe"); | |||
@@ -4,16 +4,17 @@ import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.v7.data.Item; | |||
import com.vaadin.v7.ui.Table; | |||
@SuppressWarnings("deprecation") | |||
public class CollapseIndicatorOverlapsColumn extends TestBase { | |||
@Override | |||
protected void setup() { | |||
Table tbl = createTable(); | |||
tbl = createTable(); | |||
tbl.setWidth("400px"); | |||
addComponent(tbl); | |||
} | |||
@SuppressWarnings("unchecked") | |||
private Table createTable() { | |||
Table tbl = new Table(); | |||
tbl.addContainerProperty("COL1", String.class, "Column 1"); |
@@ -1,7 +1,5 @@ | |||
package com.vaadin.tests.components.table; | |||
import java.net.MalformedURLException; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.shared.ui.ContentMode; | |||
import com.vaadin.tests.components.AbstractReindeerTestUI; | |||
@@ -14,6 +12,7 @@ import com.vaadin.v7.ui.Table; | |||
import com.vaadin.v7.ui.Table.Align; | |||
import com.vaadin.v7.ui.themes.Reindeer; | |||
@SuppressWarnings("deprecation") | |||
public class TableInTabsheet extends AbstractReindeerTestUI { | |||
@Override | |||
@@ -28,41 +27,30 @@ public class TableInTabsheet extends AbstractReindeerTestUI { | |||
} | |||
private VerticalLayout title() { | |||
VerticalLayout vP = new VerticalLayout(); | |||
vP.setStyleName(Reindeer.LAYOUT_BLACK); | |||
Label tit = new Label("<h1> Tab/Table Test</h1>", ContentMode.HTML); | |||
vP.addComponent(tit); | |||
return vP; | |||
} | |||
private VerticalLayout page() { | |||
VerticalLayout vP = new VerticalLayout(); | |||
vP.setStyleName(Reindeer.LAYOUT_BLUE); | |||
TabSheet t = new TabSheet(); | |||
t.setWidth(1000, Unit.PIXELS); | |||
HorizontalLayout hP = new HorizontalLayout(); | |||
t.addTab(Ranking(), "Ranking"); | |||
try { | |||
t.addTab(GDocs(""), "Dez 2011"); | |||
t.addTab(GDocs(""), "Jan 2012"); | |||
t.addTab(GDocs(""), "Abr 2012"); | |||
} catch (MalformedURLException e) { | |||
e.printStackTrace(); | |||
} | |||
t.addTab(createRankingLayout(), "Ranking"); | |||
t.addTab(createSimpleTabContent(), "Dez 2011"); | |||
t.addTab(createSimpleTabContent(), "Jan 2012"); | |||
t.addTab(createSimpleTabContent(), "Abr 2012"); | |||
hP.addComponent(t); | |||
vP.addComponent(hP); | |||
return vP; | |||
} | |||
private AbsoluteLayout Ranking() { | |||
private AbsoluteLayout createRankingLayout() { | |||
AbsoluteLayout vT = new AbsoluteLayout(); | |||
vT.setHeight(500, Unit.PIXELS); | |||
vT.setWidth(900, Unit.PIXELS); | |||
@@ -86,22 +74,20 @@ public class TableInTabsheet extends AbstractReindeerTestUI { | |||
vT.addComponent(table, "left: 50px; top: 50px;"); | |||
return vT; | |||
} | |||
private VerticalLayout GDocs(String end) throws MalformedURLException { | |||
private VerticalLayout createSimpleTabContent() { | |||
VerticalLayout vT = new VerticalLayout(); | |||
vT.setHeight(500, Unit.PIXELS); | |||
vT.setWidth(900, Unit.PIXELS); | |||
return vT; | |||
} | |||
@Override | |||
protected String getTestDescription() { | |||
return "Chaning to a different tab and then back to the first tab should properly render the table."; | |||
return "Chaning to a different tab and then back to the first tab " | |||
+ "should properly render the table."; | |||
} | |||
@Override |
@@ -4,6 +4,7 @@ import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractReindeerTestUI; | |||
import com.vaadin.v7.ui.TreeTable; | |||
@SuppressWarnings("deprecation") | |||
public class TreeTableScrollOnExpand extends AbstractReindeerTestUI { | |||
@Override | |||
@@ -15,9 +16,9 @@ public class TreeTableScrollOnExpand extends AbstractReindeerTestUI { | |||
t.addContainerProperty("Name", String.class, "null"); | |||
for (int i = 1; i <= 100; i++) { | |||
String parentID = "Item " + i; | |||
Object parent = t.addItem(new Object[] { parentID }, parentID); | |||
t.addItem(new Object[] { parentID }, parentID); | |||
String childID = "Item " + (100 + i); | |||
Object child = t.addItem(new Object[] { childID }, childID); | |||
t.addItem(new Object[] { childID }, childID); | |||
t.getContainerDataSource().setParent(childID, parentID); | |||
} | |||
addComponent(t); | |||
@@ -30,7 +31,8 @@ public class TreeTableScrollOnExpand extends AbstractReindeerTestUI { | |||
@Override | |||
public String getTestDescription() { | |||
return "After selecting an item and scrolling it out of view, TreeTable should not scroll to the " | |||
return "After selecting an item and scrolling it out of view, " | |||
+ "TreeTable should not scroll to the " | |||
+ "selected item when expanding an item."; | |||
} | |||
} |
@@ -8,14 +8,12 @@ import com.vaadin.ui.Label; | |||
import com.vaadin.v7.ui.themes.ChameleonTheme; | |||
import com.vaadin.v7.ui.themes.Runo; | |||
@SuppressWarnings("deprecation") | |||
public class AccordionsCssTest { | |||
private TestSampler parent; | |||
private int debugIdCounter = 0; | |||
public AccordionsCssTest(TestSampler parent) { | |||
this.parent = parent; | |||
Accordion def = createAccordionWith("Def Accordion", null); | |||
parent.addComponent(def); | |||
@@ -19,6 +19,7 @@ import com.vaadin.v7.event.DataBoundTransferable; | |||
import com.vaadin.v7.ui.AbstractSelect.AbstractSelectTargetDetails; | |||
import com.vaadin.v7.ui.Table; | |||
@SuppressWarnings("deprecation") | |||
public class DDTest7 extends TestBase { | |||
java.util.Random r = new java.util.Random(1); | |||
@@ -135,11 +136,12 @@ public class DDTest7 extends TestBase { | |||
} | |||
@SuppressWarnings("unchecked") | |||
private void moveAfter(IndexedContainer containerDataSource, | |||
Object itemId, Object idAfter) { | |||
try { | |||
IndexedContainer clone = null; | |||
clone = (IndexedContainer) containerDataSource.clone(); | |||
IndexedContainer clone = (IndexedContainer) containerDataSource | |||
.clone(); | |||
containerDataSource.removeItem(itemId); | |||
Item newItem = containerDataSource.addItemAfter(idAfter, | |||
itemId); | |||
@@ -158,6 +160,7 @@ public class DDTest7 extends TestBase { | |||
} | |||
@SuppressWarnings("unchecked") | |||
private void populateTable() { | |||
table.addContainerProperty("Name", String.class, ""); | |||
table.addContainerProperty("Weight", Integer.class, 0); |
@@ -5,17 +5,15 @@ import com.vaadin.tests.data.bean.Address; | |||
import com.vaadin.tests.data.bean.Country; | |||
import com.vaadin.tests.data.bean.Person; | |||
import com.vaadin.tests.data.bean.Sex; | |||
import com.vaadin.tests.util.Log; | |||
import com.vaadin.ui.CheckBox; | |||
import com.vaadin.v7.data.fieldgroup.BeanFieldGroup; | |||
import com.vaadin.v7.ui.NativeSelect; | |||
import com.vaadin.v7.ui.TextField; | |||
@SuppressWarnings("deprecation") | |||
public class FormWithNestedProperties | |||
extends AbstractBeanFieldGroupTest<Person> { | |||
private Log log = new Log(5); | |||
private TextField firstName = new TextField("First name"); | |||
private TextField lastName = new TextField("Last name"); | |||
private TextField email = new TextField("Email"); | |||
@@ -32,8 +30,8 @@ public class FormWithNestedProperties | |||
super.setup(); | |||
setFieldBinder(new BeanFieldGroup<>(Person.class)); | |||
country = (NativeSelect) getFieldBinder().buildAndBind("country", | |||
"address.country", NativeSelect.class); | |||
country = getFieldBinder().buildAndBind("country", "address.country", | |||
NativeSelect.class); | |||
getFieldBinder().bindMemberFields(this); | |||
addComponent(firstName); | |||
addComponent(lastName); |
@@ -46,6 +46,7 @@ import com.vaadin.v7.ui.TwinColSelect; | |||
* <p> | |||
* {@link VaadinIconSet} is the newer one for testing valo+vaadin icons. | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
public class FontIcons extends AbstractReindeerTestUI { | |||
@Override | |||
@@ -171,9 +172,9 @@ public class FontIcons extends AbstractReindeerTestUI { | |||
menu.setIcon(icon); | |||
menu.setCaption("MenuBar"); | |||
MenuItem mi = menu.addItem("File", icon, null); | |||
mi.addItem("Item", icon, null); | |||
MenuItem smi = mi.addItem("Item", icon, null); | |||
smi = mi.addItem("Item", icon, null); | |||
smi = smi.addItem("Item", icon, null); | |||
smi.addItem("Item", icon, null); | |||
gl.addComponent(menu); | |||
// Tree, caption + item + subitem + action icons |
@@ -9,7 +9,6 @@ import com.vaadin.ui.VerticalLayout; | |||
public class MessageView extends Panel implements View { | |||
public static final String NAME = "message"; | |||
private Layout layout; | |||
public MessageView() { | |||
super(new VerticalLayout()); |
@@ -15,8 +15,6 @@ import com.vaadin.ui.VerticalLayout; | |||
public class LoggingItemDataProvider | |||
extends CallbackDataProvider<String, String> { | |||
private int counter; | |||
public LoggingItemDataProvider(int size, VerticalLayout logContainer) { | |||
super(q -> fetch(logContainer, q, size), | |||
q -> size(logContainer, q, size)); |
@@ -21,16 +21,15 @@ import com.vaadin.v7.ui.Grid; | |||
import com.vaadin.v7.ui.NativeSelect; | |||
import com.vaadin.v7.ui.renderers.DateRenderer; | |||
@SuppressWarnings("deprecation") | |||
public class GridThemeUI extends AbstractTestUIWithLog { | |||
private Grid grid; | |||
protected static String[] columns = { "firstName", "lastName", "gender", | |||
"birthDate", "age", "alive", "address.streetAddress", | |||
"address.postalCode", "address.city", "address.country" }; | |||
protected BeanItemContainer<ComplexPerson> container = ComplexPerson | |||
.createContainer(100);; | |||
.createContainer(100); | |||
{ | |||
container.addNestedContainerBean("address"); | |||
} | |||
@@ -113,7 +112,8 @@ public class GridThemeUI extends AbstractTestUIWithLog { | |||
b.setSizeFull(); | |||
row.join("address.streetAddress", "address.postalCode", | |||
"address.city", "address.country").setComponent(b); | |||
// TODO: revert back to 25 when #16597 is fixed.. | |||
// NOTE: can't set column width that is too narrow to accommodate | |||
// cell paddings, e.g. 25 would not be enough for Valo | |||
getColumn("age").setWidth(42); | |||
removeColumn("salary"); | |||
setEditorEnabled(true); |
@@ -76,6 +76,7 @@ import com.vaadin.v7.ui.renderers.NumberRenderer; | |||
* @author Vaadin Ltd | |||
*/ | |||
@Theme("valo") | |||
@SuppressWarnings("deprecation") | |||
public class GridBasicFeatures extends AbstractComponentTest<Grid> { | |||
public static final String ROW_STYLE_GENERATOR_ROW_NUMBERS_FOR_3_OF_4 = "Row numbers for 3/4"; | |||
@@ -1017,7 +1018,6 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { | |||
protected void createColumnActions() { | |||
createCategory("Columns", null); | |||
for (int c = 0; c < COLUMNS; c++) { | |||
final int index = c; | |||
createCategory(getColumnProperty(c), "Columns"); | |||
createClickAction("Add / Remove", getColumnProperty(c), |