new InputStreamReader(p.getInputStream()));
String line = "";
- List<String> authors = new ArrayList<String>();
+ List<String> authors = new ArrayList<>();
while ((line = b.readLine()) != null) {
String author = line;
if (authorMap.containsKey(author)) {
}
String milestone = "";
- List<String> versions = new ArrayList<String>();
+ List<String> versions = new ArrayList<>();
for (String version : versionsProperty.split(" ")) {
if (version.endsWith(".0") || version.matches(".*\\.rc\\d+")) {
// Find all prerelease versions for final or rc
}
private static List<String> findPrereleaseVersions(String baseVersion) {
- List<String> versions = new ArrayList<String>();
+ List<String> versions = new ArrayList<>();
for (int i = 0; i < 50; i++) {
versions.add(baseVersion + ".alpha" + i);
}
// Accepted packages
- List<String> acceptedPackagePrefixes = new ArrayList<String>();
+ List<String> acceptedPackagePrefixes = new ArrayList<>();
for (int i = 1; i < args.length; i++) {
acceptedPackagePrefixes.add(args[i]);
}
private static HashSet<String> getPackages(JarFile jar,
List<String> acceptedPackagePrefixes,
boolean includeNumberPackages) {
- HashSet<String> packages = new HashSet<String>();
+ HashSet<String> packages = new HashSet<>();
Pattern startsWithNumber = Pattern.compile("\\.\\d");
ArtifactSet toReturn = new ArtifactSet(artifacts);
// The temporary scss files provided from the artefacts
- List<FileInfo> scssFiles = new ArrayList<FileInfo>();
+ List<FileInfo> scssFiles = new ArrayList<>();
// The public files are provided as inputstream, but the compiler
// needs real files, as they can contain references to other
this.target = target;
this.baseName = baseName;
this.splitSize = splitSize;
- methodNames = new ArrayList<String>();
+ methodNames = new ArrayList<>();
methodNames.add(baseName);
}
private void detectBadProperties(ConnectorBundle bundle, TreeLogger logger)
throws UnableToCompleteException {
- Map<JClassType, Set<String>> definedProperties = new HashMap<JClassType, Set<String>>();
+ Map<JClassType, Set<String>> definedProperties = new HashMap<>();
for (Property property : bundle.getNeedsProperty()) {
JClassType beanType = property.getBeanType();
Set<String> usedPropertyNames = definedProperties.get(beanType);
if (usedPropertyNames == null) {
- usedPropertyNames = new HashSet<String>();
+ usedPropertyNames = new HashSet<>();
definedProperties.put(beanType, usedPropertyNames);
}
+ connector.getName());
// Build map to speed up error checking
- HashMap<String, Property> stateProperties = new HashMap<String, Property>();
+ HashMap<String, Property> stateProperties = new HashMap<>();
JClassType stateType = ConnectorBundle
.findInheritedMethod(connector, "getState").getReturnType()
.isClassOrInterface();
private void writeSuperClasses(SplittingSourceWriter w,
ConnectorBundle bundle) {
- List<JClassType> needsSuperclass = new ArrayList<JClassType>(
+ List<JClassType> needsSuperclass = new ArrayList<>(
bundle.getNeedsSuperclass());
// Emit in hierarchy order to ensure superclass is defined when
// referenced
TypeOracle typeOracle)
throws NotFoundException, UnableToCompleteException {
- Map<LoadStyle, Collection<JClassType>> connectorsByLoadStyle = new HashMap<LoadStyle, Collection<JClassType>>();
+ Map<LoadStyle, Collection<JClassType>> connectorsByLoadStyle = new HashMap<>();
for (LoadStyle loadStyle : LoadStyle.values()) {
connectorsByLoadStyle.put(loadStyle, new ArrayList<JClassType>());
}
}
}
- List<ConnectorBundle> bundles = new ArrayList<ConnectorBundle>();
+ List<ConnectorBundle> bundles = new ArrayList<>();
Collection<TypeVisitor> visitors = getVisitors(typeOracle);
JClassType[] types = serverConnectorType.getSubtypes();
- Map<String, JClassType> mappings = new TreeMap<String, JClassType>();
+ Map<String, JClassType> mappings = new TreeMap<>();
// Keep track of what has happened to avoid logging intermediate state
- Map<JClassType, List<JClassType>> replaced = new TreeMap<JClassType, List<JClassType>>(
+ Map<JClassType, List<JClassType>> replaced = new TreeMap<>(
ConnectorBundle.jClassComparator);
for (JClassType type : types) {
List<JClassType> previousReplacements = replaced
.remove(superclass);
if (previousReplacements == null) {
- previousReplacements = new ArrayList<JClassType>();
+ previousReplacements = new ArrayList<>();
}
previousReplacements.add(superclass);
private final Collection<TypeVisitor> visitors;
private final Map<JType, JClassType> customSerializers;
- private final Set<JType> hasSerializeSupport = new HashSet<JType>();
- private final Set<JType> needsSerializeSupport = new HashSet<JType>();
+ private final Set<JType> hasSerializeSupport = new HashSet<>();
+ private final Set<JType> needsSerializeSupport = new HashSet<>();
- private final Map<JType, GeneratedSerializer> serializers = new TreeMap<JType, GeneratedSerializer>(
+ private final Map<JType, GeneratedSerializer> serializers = new TreeMap<>(
new Comparator<JType>() {
@Override
public int compare(JType o1, JType o2) {
}
});
- private final Map<JClassType, Map<JMethod, Set<MethodAttribute>>> methodAttributes = new TreeMap<JClassType, Map<JMethod, Set<MethodAttribute>>>(
+ private final Map<JClassType, Map<JMethod, Set<MethodAttribute>>> methodAttributes = new TreeMap<>(
jClassComparator);
- private final Set<JClassType> needsSuperClass = new TreeSet<JClassType>(
+ private final Set<JClassType> needsSuperClass = new TreeSet<>(
jClassComparator);
- private final Set<JClassType> needsGwtConstructor = new TreeSet<JClassType>(
+ private final Set<JClassType> needsGwtConstructor = new TreeSet<>(
jClassComparator);
- private final Set<JClassType> visitedTypes = new HashSet<JClassType>();
+ private final Set<JClassType> visitedTypes = new HashSet<>();
- private final Set<JClassType> needsProxySupport = new TreeSet<JClassType>(
+ private final Set<JClassType> needsProxySupport = new TreeSet<>(
jClassComparator);
- private final Map<JClassType, JType> presentationTypes = new TreeMap<JClassType, JType>(
+ private final Map<JClassType, JType> presentationTypes = new TreeMap<>(
jClassComparator);
- private final Map<JClassType, Set<String>> identifiers = new TreeMap<JClassType, Set<String>>(
+ private final Map<JClassType, Set<String>> identifiers = new TreeMap<>(
jClassComparator);
- private final Map<JClassType, Set<JMethod>> needsReturnType = new TreeMap<JClassType, Set<JMethod>>(
+ private final Map<JClassType, Set<JMethod>> needsReturnType = new TreeMap<>(
jClassComparator);
- private final Map<JClassType, Set<JMethod>> needsInvoker = new TreeMap<JClassType, Set<JMethod>>(
+ private final Map<JClassType, Set<JMethod>> needsInvoker = new TreeMap<>(
jClassComparator);
- private final Map<JClassType, Set<JMethod>> needsParamTypes = new TreeMap<JClassType, Set<JMethod>>(
+ private final Map<JClassType, Set<JMethod>> needsParamTypes = new TreeMap<>(
jClassComparator);
- private final Map<JClassType, Set<JMethod>> needsOnStateChange = new TreeMap<JClassType, Set<JMethod>>(
+ private final Map<JClassType, Set<JMethod>> needsOnStateChange = new TreeMap<>(
jClassComparator);
- private final Set<Property> needsProperty = new TreeSet<Property>();
- private final Map<JClassType, Set<Property>> needsDelegateToWidget = new TreeMap<JClassType, Set<Property>>(
+ private final Set<Property> needsProperty = new TreeSet<>();
+ private final Map<JClassType, Set<Property>> needsDelegateToWidget = new TreeMap<>(
jClassComparator);
private ConnectorBundle(String name, ConnectorBundle previousBundle,
private static Map<JType, JClassType> findCustomSerializers(
TypeOracle oracle) throws NotFoundException {
- Map<JType, JClassType> serializers = new HashMap<JType, JClassType>();
+ Map<JType, JClassType> serializers = new HashMap<>();
JClassType serializerInterface = oracle
.findType(JSONSerializer.class.getName());
}
public Collection<Property> getProperties(JClassType type) {
- Set<Property> properties = new TreeSet<Property>();
+ Set<Property> properties = new TreeSet<>();
properties.addAll(MethodProperty.findProperties(type));
properties.addAll(FieldProperty.findProperties(type));
private <K> void addMapping(Map<K, Set<String>> map, K key, String value) {
Set<String> set = map.get(key);
if (set == null) {
- set = new TreeSet<String>();
+ set = new TreeSet<>();
map.put(key, set);
}
set.add(value);
JMethod value) {
Set<JMethod> set = map.get(key);
if (set == null) {
- set = new TreeSet<JMethod>(jMethodComparator);
+ set = new TreeSet<>(jMethodComparator);
map.put(key, set);
}
set.add(value);
Map<JMethod, Set<MethodAttribute>> typeData = methodAttributes
.get(type);
if (typeData == null) {
- typeData = new TreeMap<JMethod, Set<MethodAttribute>>(
+ typeData = new TreeMap<>(
jMethodComparator);
methodAttributes.put(type, typeData);
}
Map<JMethod, Set<MethodAttribute>> methods = methodAttributes
.get(type);
if (methods == null) {
- methods = new TreeMap<JMethod, Set<MethodAttribute>>(
+ methods = new TreeMap<>(
jMethodComparator);
methodAttributes.put(type, methods);
}
Set<MethodAttribute> attributes = methods.get(method);
if (attributes == null) {
- attributes = new TreeSet<MethodAttribute>();
+ attributes = new TreeSet<>();
methods.put(method, attributes);
}
}
}
- private static Set<Class<?>> frameworkHandledTypes = new LinkedHashSet<Class<?>>();
+ private static Set<Class<?>> frameworkHandledTypes = new LinkedHashSet<>();
{
frameworkHandledTypes.add(String.class);
frameworkHandledTypes.add(Boolean.class);
public void setNeedsDelegateToWidget(Property property, JClassType type) {
if (!isNeedsDelegateToWidget(type)) {
- TreeSet<Property> set = new TreeSet<Property>();
+ TreeSet<Property> set = new TreeSet<>();
set.add(property);
needsDelegateToWidget.put(type, set);
} else if (!needsDelegateToWidget.get(type).contains(property)) {
}
public static Collection<FieldProperty> findProperties(JClassType type) {
- Collection<FieldProperty> properties = new ArrayList<FieldProperty>();
+ Collection<FieldProperty> properties = new ArrayList<>();
List<JField> fields = getPublicFields(type);
for (JField field : fields) {
}
private static List<JField> getPublicFields(JClassType type) {
- Set<String> names = new HashSet<String>();
- ArrayList<JField> fields = new ArrayList<JField>();
+ Set<String> names = new HashSet<>();
+ ArrayList<JField> fields = new ArrayList<>();
for (JClassType subType : type.getFlattenedSupertypeHierarchy()) {
JField[] subFields = subType.getFields();
for (JField field : subFields) {
}
public static Collection<MethodProperty> findProperties(JClassType type) {
- Collection<MethodProperty> properties = new ArrayList<MethodProperty>();
+ Collection<MethodProperty> properties = new ArrayList<>();
- Set<String> getters = new HashSet<String>();
+ Set<String> getters = new HashSet<>();
List<JMethod> setters = getSetters(type, getters);
for (JMethod setter : setters) {
String getter = findGetter(type, setter);
*/
private static List<JMethod> getSetters(JClassType beanType,
Set<String> getters) {
- List<JMethod> setterMethods = new ArrayList<JMethod>();
+ List<JMethod> setterMethods = new ArrayList<>();
while (beanType != null && !beanType.getQualifiedSourceName()
.equals(Object.class.getName())) {
* generate nag messages in the UI.
*/
public List<CValUiInfo> run() throws InvalidCvalException {
- List<CValUiInfo> ret = new ArrayList<CValUiInfo>();
+ List<CValUiInfo> ret = new ArrayList<>();
try {
// Visit all MANIFEST in our classpath
Enumeration<URL> manifests = Thread.currentThread()
private HashMap<Integer, String> unknownComponents;
- private Map<Integer, Class<? extends ServerConnector>> classes = new HashMap<Integer, Class<? extends ServerConnector>>();
+ private Map<Integer, Class<? extends ServerConnector>> classes = new HashMap<>();
private boolean widgetsetVersionSent = false;
private static boolean moduleLoaded = false;
static// TODO consider to make this hashmap per application
- LinkedList<Command> callbacks = new LinkedList<Command>();
+ LinkedList<Command> callbacks = new LinkedList<>();
private static int dependenciesLoading;
- private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<ApplicationConnection>();
+ private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<>();
- private Map<Integer, Integer> componentInheritanceMap = new HashMap<Integer, Integer>();
- private Map<Integer, String> tagToServerSideClassName = new HashMap<Integer, String>();
+ private Map<Integer, Integer> componentInheritanceMap = new HashMap<>();
+ private Map<Integer, String> tagToServerSideClassName = new HashMap<>();
/**
* Checks whether path info in requests to the server-side service should be
if (type == null) {
type = UnknownComponentConnector.class;
if (unknownComponents == null) {
- unknownComponents = new HashMap<Integer, String>();
+ unknownComponents = new HashMap<>();
}
unknownComponents.put(tag, getServerSideClassNameForTag(tag));
}
* @return Integer array of tags pointing to this classname
*/
public Integer[] getTagsForServerSideClassName(String classname) {
- List<Integer> tags = new ArrayList<Integer>();
+ List<Integer> tags = new ArrayList<>();
for (Map.Entry<Integer, String> entry : tagToServerSideClassName
.entrySet()) {
*/
public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh";
- private final HashMap<String, String> resourcesMap = new HashMap<String, String>();
+ private final HashMap<String, String> resourcesMap = new HashMap<>();
private WidgetSet widgetSet;
public static class RequestStartingEvent
extends ApplicationConnectionEvent {
- public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>();
+ public static Type<CommunicationHandler> TYPE = new Type<>();
public RequestStartingEvent(ApplicationConnection connection) {
super(connection);
public static class ResponseHandlingEndedEvent
extends ApplicationConnectionEvent {
- public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>();
+ public static Type<CommunicationHandler> TYPE = new Type<>();
public ResponseHandlingEndedEvent(ApplicationConnection connection) {
super(connection);
super(connection);
}
- public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>();
+ public static Type<CommunicationHandler> TYPE = new Type<>();
@Override
public Type<CommunicationHandler> getAssociatedType() {
public static class ApplicationStoppedEvent
extends GwtEvent<ApplicationStoppedHandler> {
- public static Type<ApplicationStoppedHandler> TYPE = new Type<ApplicationStoppedHandler>();
+ public static Type<ApplicationStoppedHandler> TYPE = new Type<>();
@Override
public Type<ApplicationStoppedHandler> getAssociatedType() {
additionalTooltips.remove(key);
} else {
if (additionalTooltips == null) {
- additionalTooltips = new HashMap<Object, TooltipInfo>();
+ additionalTooltips = new HashMap<>();
}
additionalTooltips.put(key, tooltip);
}
}-*/;
final Collection<ComponentDetail> values() {
- ArrayList<ComponentDetail> list = new ArrayList<ComponentDetail>();
+ ArrayList<ComponentDetail> list = new ArrayList<>();
fillWithValues(list);
return list;
}
/**
* Type of this event, used by the event bus.
*/
- public static final Type<ConnectorHierarchyChangeHandler> TYPE = new Type<ConnectorHierarchyChangeHandler>();
+ public static final Type<ConnectorHierarchyChangeHandler> TYPE = new Type<>();
List<ComponentConnector> oldChildren;
*/
@Deprecated
public ComponentConnector[] getComponentConnectors() {
- ArrayList<ComponentConnector> result = new ArrayList<ComponentConnector>();
+ ArrayList<ComponentConnector> result = new ArrayList<>();
JsArrayObject<ServerConnector> connectors = getConnectorsAsJsArray();
int size = connectors.size();
@Deprecated
public Collection<? extends ServerConnector> getConnectors() {
Collection<ComponentDetail> values = idToComponentDetail.values();
- ArrayList<ServerConnector> arrayList = new ArrayList<ServerConnector>(
+ ArrayList<ServerConnector> arrayList = new ArrayList<>(
values.size());
for (ComponentDetail componentDetail : values) {
arrayList.add(componentDetail.getConnector());
.createObject();
private final JavaScriptObject rpcMap = JavaScriptObject.createObject();
- private final Map<String, JavaScriptObject> rpcObjects = new HashMap<String, JavaScriptObject>();
- private final Map<String, Set<String>> rpcMethods = new HashMap<String, Set<String>>();
- private final Map<Element, Map<JavaScriptObject, ElementResizeListener>> resizeListeners = new HashMap<Element, Map<JavaScriptObject, ElementResizeListener>>();
+ private final Map<String, JavaScriptObject> rpcObjects = new HashMap<>();
+ private final Map<String, Set<String>> rpcMethods = new HashMap<>();
+ private final Map<Element, Map<JavaScriptObject, ElementResizeListener>> resizeListeners = new HashMap<>();
private JavaScriptObject connectorWrapper;
private int tag;
JavaScriptObject wildcardRpcObject = rpcObjects.get("");
Set<String> interfaces = rpcMethods.get(method);
if (interfaces == null) {
- interfaces = new HashSet<String>();
+ interfaces = new HashSet<>();
rpcMethods.put(method, interfaces);
attachRpcMethod(wildcardRpcObject, null, method);
}
protected boolean initJavaScript() {
ApplicationConfiguration conf = connector.getConnection()
.getConfiguration();
- ArrayList<String> attemptedNames = new ArrayList<String>();
+ ArrayList<String> attemptedNames = new ArrayList<>();
Integer tag = Integer.valueOf(this.tag);
while (tag != null) {
String serverSideClassName = conf.getServerSideClassNameForTag(tag);
Map<JavaScriptObject, ElementResizeListener> elementListeners = resizeListeners
.get(element);
if (elementListeners == null) {
- elementListeners = new HashMap<JavaScriptObject, ElementResizeListener>();
+ elementListeners = new HashMap<>();
resizeListeners.put(element, elementListeners);
}
private static final boolean debugLogging = false;
private ApplicationConnection connection;
- private final Set<Element> measuredNonConnectorElements = new HashSet<Element>();
+ private final Set<Element> measuredNonConnectorElements = new HashSet<>();
private final MeasuredSize nullSize = new MeasuredSize();
private LayoutDependencyTree currentDependencyTree;
private FastStringSet pendingOverflowFixes = FastStringSet.create();
- private final Map<Element, Collection<ElementResizeListener>> elementResizeListeners = new HashMap<Element, Collection<ElementResizeListener>>();
- private final Set<Element> listenersToFire = new HashSet<Element>();
+ private final Map<Element, Collection<ElementResizeListener>> elementResizeListeners = new HashMap<>();
+ private final Set<Element> listenersToFire = new HashSet<>();
private boolean layoutPending = false;
private Timer layoutTimer = new Timer() {
int pendingOverflowCount = pendingOverflowConnectorsIds.length();
ConnectorMap connectorMap = ConnectorMap.get(connection);
if (pendingOverflowCount > 0) {
- HashMap<Element, String> originalOverflows = new HashMap<Element, String>();
+ HashMap<Element, String> originalOverflows = new HashMap<>();
FastStringSet delayedOverflowFixes = FastStringSet.create();
Collection<ElementResizeListener> listeners = elementResizeListeners
.get(element);
if (listeners == null) {
- listeners = new HashSet<ElementResizeListener>();
+ listeners = new HashSet<>();
elementResizeListeners.put(element, listeners);
ensureMeasured(element);
}
*/
public class LocaleService {
- private static Map<String, LocaleData> cache = new HashMap<String, LocaleData>();
+ private static Map<String, LocaleData> cache = new HashMap<>();
private static String defaultLocale;
*/
public static class Node {
private final String name;
- private final LinkedHashMap<String, Node> children = new LinkedHashMap<String, Node>();
+ private final LinkedHashMap<String, Node> children = new LinkedHashMap<>();
private double time = 0;
private int count = 0;
private double enterTime = 0;
return;
}
- LinkedList<Node> stack = new LinkedList<Node>();
+ LinkedList<Node> stack = new LinkedList<>();
Node rootNode = new Node(null);
stack.add(rootNode);
JsArray<GwtStatsEvent> gwtStatsEvents = getGwtStatsEvents();
return;
}
- Set<Node> extendedTimeNodes = new HashSet<Node>();
+ Set<Node> extendedTimeNodes = new HashSet<>();
for (int i = 0; i < gwtStatsEvents.length(); i++) {
GwtStatsEvent gwtStatsEvent = gwtStatsEvents.get(i);
String eventName = gwtStatsEvent.getEventName();
return;
}
- Map<String, Node> totals = new HashMap<String, Node>();
+ Map<String, Node> totals = new HashMap<>();
rootNode.sumUpTotals(totals);
- ArrayList<Node> totalList = new ArrayList<Node>(totals.values());
+ ArrayList<Node> totalList = new ArrayList<>(totals.values());
Collections.sort(totalList, new Comparator<Node>() {
@Override
public int compare(Node o1, Node o2) {
"domContentLoadedEventStart", "domContentLoadedEventEnd",
"domComplete", "loadEventStart", "loadEventEnd" };
- LinkedHashMap<String, Double> timings = new LinkedHashMap<String, Double>();
+ LinkedHashMap<String, Double> timings = new LinkedHashMap<>();
for (String key : keys) {
double value = getPerformanceTiming(key);
private ApplicationConnection connection;
- private final Set<String> loadedResources = new HashSet<String>();
- private final Set<String> preloadedResources = new HashSet<String>();
+ private final Set<String> loadedResources = new HashSet<>();
+ private final Set<String> preloadedResources = new HashSet<>();
- private final Map<String, Collection<ResourceLoadListener>> loadListeners = new HashMap<String, Collection<ResourceLoadListener>>();
- private final Map<String, Collection<ResourceLoadListener>> preloadListeners = new HashMap<String, Collection<ResourceLoadListener>>();
+ private final Map<String, Collection<ResourceLoadListener>> loadListeners = new HashMap<>();
+ private final Map<String, Collection<ResourceLoadListener>> preloadListeners = new HashMap<>();
private final Element head;
Map<String, Collection<ResourceLoadListener>> listenerMap) {
Collection<ResourceLoadListener> listeners = listenerMap.get(url);
if (listeners == null) {
- listeners = new HashSet<ResourceLoader.ResourceLoadListener>();
+ listeners = new HashSet<>();
listeners.add(listener);
listenerMap.put(url, listeners);
return true;
*/
public Set<String> getVariableNames() {
if (!hasVariables()) {
- return new HashSet<String>();
+ return new HashSet<>();
} else {
Set<String> keySet = var().getKeySet();
return keySet;
* @return the value of the variable
*/
public Set<String> getStringArrayVariableAsSet(final String name) {
- final HashSet<String> s = new HashSet<String>();
+ final HashSet<String> s = new HashSet<>();
JsArrayString a = var().getJSStringArray(name);
for (int i = 0; i < a.length(); i++) {
s.add(a.get(i));
try {
getLogger().info("RPC invocations to be sent to the server:");
String curId = null;
- ArrayList<MethodInvocation> invocations = new ArrayList<MethodInvocation>();
+ ArrayList<MethodInvocation> invocations = new ArrayList<>();
for (MethodInvocation methodInvocation : methodInvocations) {
String id = methodInvocation.getConnectorId();
}-*/;
public Set<String> getKeySet() {
- final HashSet<String> attrs = new HashSet<String>();
+ final HashSet<String> attrs = new HashSet<>();
JsArrayString attributeNamesArray = getKeyArray();
for (int i = 0; i < attributeNamesArray.length(); i++) {
attrs.add(attributeNamesArray.get(i));
*/
abstract class WidgetMap {
- protected static HashMap<Class<? extends ServerConnector>, WidgetInstantiator> instmap = new HashMap<Class<? extends ServerConnector>, WidgetInstantiator>();
+ protected static HashMap<Class<? extends ServerConnector>, WidgetInstantiator> instmap = new HashMap<>();
/**
* Create a new instance of a connector based on its type.
/*
* Map the size units with their type.
*/
- private static Map<String, Unit> type2Unit = new HashMap<String, Style.Unit>();
+ private static Map<String, Unit> type2Unit = new HashMap<>();
static {
for (Unit unit : Unit.values()) {
type2Unit.put(unit.getType(), unit);
if (jsonMap.getType() == JsonType.ARRAY) {
JsonArray array = (JsonArray) jsonMap;
if (array.length() == 0) {
- return new HashMap<Object, Object>();
+ return new HashMap<>();
}
}
private static Map<Object, Object> decodeObjectMap(Type keyType,
Type valueType, JsonArray jsonValue,
ApplicationConnection connection) {
- Map<Object, Object> map = new HashMap<Object, Object>();
+ Map<Object, Object> map = new HashMap<>();
JsonArray keys = jsonValue.get(0);
JsonArray values = jsonValue.get(1);
private static Map<Object, Object> decodeConnectorMap(Type valueType,
JsonObject jsonMap, ApplicationConnection connection) {
- Map<Object, Object> map = new HashMap<Object, Object>();
+ Map<Object, Object> map = new HashMap<>();
ConnectorMap connectorMap = ConnectorMap.get(connection);
private static Map<Object, Object> decodeStringMap(Type valueType,
JsonObject jsonMap, ApplicationConnection connection) {
- Map<Object, Object> map = new HashMap<Object, Object>();
+ Map<Object, Object> map = new HashMap<>();
for (String key : jsonMap.keys()) {
Object value = decodeValue(valueType, jsonMap.get(key), null,
private static List<Object> decodeList(Type type, JsonArray jsonArray,
ApplicationConnection connection) {
- List<Object> tokens = new ArrayList<Object>();
+ List<Object> tokens = new ArrayList<>();
decodeIntoCollection(type.getParameterTypes()[0], jsonArray, connection,
tokens);
return tokens;
private static Set<Object> decodeSet(Type type, JsonArray jsonArray,
ApplicationConnection connection) {
- Set<Object> tokens = new HashSet<Object>();
+ Set<Object> tokens = new HashSet<>();
decodeIntoCollection(type.getParameterTypes()[0], jsonArray, connection,
tokens);
return tokens;
* If responseHandlingLocks contains any objects, response handling is
* suspended until the collection is empty or a timeout has occurred.
*/
- private Set<Object> responseHandlingLocks = new HashSet<Object>();
+ private Set<Object> responseHandlingLocks = new HashSet<>();
/**
* Contains all UIDL messages received while response handling is suspended
*/
- private List<PendingUIDLMessage> pendingUIDLMessages = new ArrayList<PendingUIDLMessage>();
+ private List<PendingUIDLMessage> pendingUIDLMessages = new ArrayList<>();
// will hold the CSRF token once received
private String csrfToken = ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE;
Profiler.enter(
"updateConnectorHierarchy find new connectors");
- List<ServerConnector> newChildren = new ArrayList<ServerConnector>();
- List<ComponentConnector> newComponents = new ArrayList<ComponentConnector>();
+ List<ServerConnector> newChildren = new ArrayList<>();
+ List<ComponentConnector> newComponents = new ArrayList<>();
for (int connectorIndex = 0; connectorIndex < childConnectorSize; connectorIndex++) {
String childConnectorId = childConnectorIds
.get(connectorIndex);
* invocation. Without lastonly, an incremental id based on
* {@link #lastInvocationTag} is used to get unique values.
*/
- private LinkedHashMap<String, MethodInvocation> pendingInvocations = new LinkedHashMap<String, MethodInvocation>();
+ private LinkedHashMap<String, MethodInvocation> pendingInvocations = new LinkedHashMap<>();
private int lastInvocationTag = 0;
/**
* Type of this event, used by the event bus.
*/
- public static final Type<StateChangeHandler> TYPE = new Type<StateChangeHandler>();
+ public static final Type<StateChangeHandler> TYPE = new Type<>();
/**
* Used to cache a FastStringSet representation of the properties that have
public Set<String> getChangedProperties() {
if (changedPropertiesSet == null) {
Profiler.enter("StateChangeEvent.getChangedProperties populate");
- changedPropertiesSet = new HashSet<String>();
+ changedPropertiesSet = new HashSet<>();
getChangedPropertiesFastSet().addAllTo(changedPropertiesSet);
Profiler.leave("StateChangeEvent.getChangedProperties populate");
}
@Override
public List<Element> getElementsByPath(String path) {
// This type of search is not supported in LegacyLocator
- List<Element> array = new ArrayList<Element>();
+ List<Element> array = new ArrayList<>();
Element e = getElementByPath(path);
if (e != null) {
array.add(e);
public List<Element> getElementsByPathStartingAt(String path,
Element root) {
// This type of search is not supported in LegacyLocator
- List<Element> array = new ArrayList<Element>();
+ List<Element> array = new ArrayList<>();
Element e = getElementByPathStartingAt(path, root);
if (e != null) {
array.add(e);
if (widgetClassName.equals("VWindow")) {
List<WindowConnector> windows = client.getUIConnector()
.getSubWindows();
- List<VWindow> windowWidgets = new ArrayList<VWindow>(
+ List<VWindow> windowWidgets = new ArrayList<>(
windows.size());
for (WindowConnector wc : windows) {
windowWidgets.add(wc.getWidget());
if (path.startsWith("(")) {
return extractPredicates(path.substring(path.lastIndexOf(')')));
}
- return new ArrayList<SelectorPredicate>();
+ return new ArrayList<>();
}
/**
* @return a List of Predicate objects
*/
public static List<SelectorPredicate> extractPredicates(String path) {
- List<SelectorPredicate> predicates = new ArrayList<SelectorPredicate>();
+ List<SelectorPredicate> predicates = new ArrayList<>();
String predicateStr = extractPredicateString(path);
if (null == predicateStr || predicateStr.length() == 0) {
* @return List of predicate strings
*/
private static List<String> readPredicatesFromString(String predicateStr) {
- List<String> predicates = new ArrayList<String>();
+ List<String> predicates = new ArrayList<>();
int prevIdx = 0;
int idx = LocatorUtil.indexOfIgnoringQuoted(predicateStr, ',', prevIdx);
List<ConnectorPath> hierarchy = getConnectorHierarchyForElement(
targetElement);
- List<String> path = new ArrayList<String>();
+ List<String> path = new ArrayList<>();
// Assemble longname path components back-to-forth with useful
// predicates - first try ID, then caption.
*/
private List<String> generateQueries(List<String> components) {
// Prepare to loop through all the elements.
- List<String> paths = new ArrayList<String>();
+ List<String> paths = new ArrayList<>();
int compIdx = 0;
String basePath = components.get(compIdx).replace("com.vaadin.ui.", "");
// Add a basic search for the first element (eg. //Button)
private List<ConnectorPath> getConnectorHierarchyForElement(Element elem) {
Element e = elem;
ComponentConnector c = Util.findPaintable(client, e);
- List<ConnectorPath> connectorHierarchy = new ArrayList<ConnectorPath>();
+ List<ConnectorPath> connectorHierarchy = new ArrayList<>();
while (c != null) {
path = path.substring(1, path.lastIndexOf(')'));
}
- List<Element> elements = new ArrayList<Element>();
+ List<Element> elements = new ArrayList<>();
if (LocatorUtil.isNotificationElement(path)) {
for (VNotification n : findNotificationsByPath(path)) {
*/
private List<VNotification> findNotificationsByPath(String path) {
- List<VNotification> notifications = new ArrayList<VNotification>();
+ List<VNotification> notifications = new ArrayList<>();
for (Widget w : RootPanel.get()) {
if (w instanceof VNotification) {
notifications.add((VNotification) w);
connectors = Arrays.asList(root);
}
- List<Element> output = new ArrayList<Element>();
+ List<Element> output = new ArrayList<>();
if (null != connectors && !connectors.isEmpty()) {
for (ComponentConnector connector : connectors) {
if (!actualRoot
String[] fragments = splitFirstFragmentFromTheRest(path);
- List<ComponentConnector> connectors = new ArrayList<ComponentConnector>();
+ List<ComponentConnector> connectors = new ArrayList<>();
for (ComponentConnector parent : parents) {
connectors.addAll(filterMatches(
collectPotentialMatches(parent, fragments[0],
private List<ComponentConnector> collectPotentialMatches(
ComponentConnector parent, String pathFragment,
boolean collectRecursively) {
- ArrayList<ComponentConnector> potentialMatches = new ArrayList<ComponentConnector>();
+ ArrayList<ComponentConnector> potentialMatches = new ArrayList<>();
String widgetName = getWidgetName(pathFragment);
// Special case when searching for UIElement.
if (LocatorUtil.isUIElement(pathFragment)) {
private List<String> getIDsForConnector(ComponentConnector connector) {
Class<?> connectorClass = connector.getClass();
- List<String> ids = new ArrayList<String>();
+ List<String> ids = new ArrayList<>();
TypeDataStore.get().findIdentifiersFor(connectorClass).addAllTo(ids);
*/
private final <T> List<T> eliminateDuplicates(List<T> list) {
- LinkedHashSet<T> set = new LinkedHashSet<T>(list);
+ LinkedHashSet<T> set = new LinkedHashSet<>(list);
list.clear();
list.addAll(set);
return list;
*/
public class VaadinDataSource extends AbstractRemoteDataSource<JsonObject> {
- private Set<String> droppedKeys = new HashSet<String>();
+ private Set<String> droppedKeys = new HashSet<>();
protected VaadinDataSource() {
registerRpc(DataCommunicatorClientRpc.class,
@Override
public void setData(int firstIndex, JsonArray data) {
- ArrayList<JsonObject> rows = new ArrayList<JsonObject>(
+ ArrayList<JsonObject> rows = new ArrayList<>(
data.length());
for (int i = 0; i < data.length(); i++) {
JsonObject rowObject = data.getObject(i);
protected void init() {
super.init();
- new ClickSelectHandler<JsonObject>(getWidget());
+ new ClickSelectHandler<>(getWidget());
getWidget().addSortHandler(this::handleSortEvent);
layout();
private Range cached = Range.between(0, 0);
- private final HashMap<Integer, T> indexToRowMap = new HashMap<Integer, T>();
- private final HashMap<Object, Integer> keyToIndexMap = new HashMap<Object, Integer>();
+ private final HashMap<Integer, T> indexToRowMap = new HashMap<>();
+ private final HashMap<Object, Integer> keyToIndexMap = new HashMap<>();
private Set<DataChangeHandler> dataChangeHandlers = new LinkedHashSet<>();
}
};
- private Map<Object, Integer> pinnedCounts = new HashMap<Object, Integer>();
- private Map<Object, RowHandleImpl> pinnedRows = new HashMap<Object, RowHandleImpl>();
+ private Map<Object, Integer> pinnedCounts = new HashMap<>();
+ private Map<Object, RowHandleImpl> pinnedRows = new HashMap<>();
// Size not yet known
private int size = -1;
if (range.isEmpty()) {
return;
}
- currentRequestCallback = new RequestRowsCallback<T>(this, range);
+ currentRequestCallback = new RequestRowsCallback<>(this, range);
requestRows(range.getStart(), range.length(), currentRequestCallback);
}
*/
public class AnalyzeLayoutsPanel extends FlowPanel {
- private List<SelectConnectorListener> listeners = new ArrayList<SelectConnectorListener>();
+ private List<SelectConnectorListener> listeners = new ArrayList<>();
public void update() {
clear();
add(new Label("Layouts analyzed, no top level problems"));
}
- Set<ComponentConnector> zeroHeightComponents = new HashSet<ComponentConnector>();
- Set<ComponentConnector> zeroWidthComponents = new HashSet<ComponentConnector>();
+ Set<ComponentConnector> zeroHeightComponents = new HashSet<>();
+ Set<ComponentConnector> zeroWidthComponents = new HashSet<>();
findZeroSizeComponents(zeroHeightComponents, zeroWidthComponents,
ac.getUIConnector());
if (zeroHeightComponents.size() > 0 || zeroWidthComponents.size() > 0) {
Set<ComponentConnector> zeroSized, ApplicationConnection ac) {
// keep track of already highlighted parents
- HashSet<String> parents = new HashSet<String>();
+ HashSet<String> parents = new HashSet<>();
for (final ComponentConnector connector : zeroSized) {
final ServerConnector parent = connector.getParent();
public void update(ServerConnector connector) {
SharedState state = connector.getState();
- Set<String> ignoreProperties = new HashSet<String>();
+ Set<String> ignoreProperties = new HashSet<>();
ignoreProperties.add("id");
String html = getRowHTML("Id", connector.getConnectorId());
public class HierarchyPanel extends FlowPanel {
// TODO separate click listeners for simple selection and doubleclick
- private List<SelectConnectorListener> listeners = new ArrayList<SelectConnectorListener>();
+ private List<SelectConnectorListener> listeners = new ArrayList<>();
public void update() {
// Try to keep track of currently open nodes and reopen them
static Element show(Element element, String color) {
if (element != null) {
if (highlights == null) {
- highlights = new HashSet<Element>();
+ highlights = new HashSet<>();
}
Element highlight = DOM.createDiv();
private Set<String> getUsedConnectorNames(
ApplicationConfiguration configuration) {
int tag = 0;
- Set<String> usedConnectors = new HashSet<String>();
+ Set<String> usedConnectors = new HashSet<>();
while (true) {
String serverSideClass = configuration
.getServerSideClassNameForTag(tag);
private final String path;
private final Element element;
private final ComponentLocator locator;
- private static Map<String, Integer> counter = new HashMap<String, Integer>();
- private static Map<String, String> legacyNames = new HashMap<String, String>();
+ private static Map<String, Integer> counter = new HashMap<>();
+ private static Map<String, String> legacyNames = new HashMap<>();
static {
legacyNames.put("FilterSelect", "ComboBox");
private final FlowPanel selectorPanel = new FlowPanel();
// map from full path to SelectorWidget to enable reuse of old selectors
- private Map<SelectorPath, SelectorWidget> selectorWidgets = new HashMap<SelectorPath, SelectorWidget>();
+ private Map<SelectorPath, SelectorWidget> selectorWidgets = new HashMap<>();
private final FlowPanel controls = new FlowPanel();
protected SimplePanel content = new SimplePanel();
// sections
- protected ArrayList<Section> sections = new ArrayList<Section>();
+ protected ArrayList<Section> sections = new ArrayList<>();
// handles resize/move
protected HandlerRegistration mouseDownHandler = null;
* Event type for InputEvent. Represents the meta-data associated with this
* event.
*/
- private static final Type<InputHandler> TYPE = new Type<InputHandler>(
+ private static final Type<InputHandler> TYPE = new Type<>(
"input", new InputEvent());
protected InputEvent() {
* Event type for PointerCancelEvent. Represents the meta-data associated
* with this event.
*/
- private static final Type<PointerCancelHandler> TYPE = new Type<PointerCancelHandler>(
+ private static final Type<PointerCancelHandler> TYPE = new Type<>(
EventType.PointerCancel.getNativeEventName(),
new PointerCancelEvent());
* Event type for PointerDownEvent. Represents the meta-data associated with
* this event.
*/
- private static final Type<PointerDownHandler> TYPE = new Type<PointerDownHandler>(
+ private static final Type<PointerDownHandler> TYPE = new Type<>(
EventType.PointerDown.getNativeEventName(), new PointerDownEvent());
/**
* Event type for PointerMoveEvent. Represents the meta-data associated with
* this event.
*/
- private static final Type<PointerMoveHandler> TYPE = new Type<PointerMoveHandler>(
+ private static final Type<PointerMoveHandler> TYPE = new Type<>(
EventType.PointerMove.getNativeEventName(), new PointerMoveEvent());
/**
* Event type for PointerUpEvent. Represents the meta-data associated with
* this event.
*/
- private static final Type<PointerUpHandler> TYPE = new Type<PointerUpHandler>(
+ private static final Type<PointerUpHandler> TYPE = new Type<>(
EventType.PointerUp.getNativeEventName(), new PointerUpEvent());
/**
@Connect(JavaScript.class)
public class JavaScriptManagerConnector extends AbstractExtensionConnector {
- private Set<String> currentNames = new HashSet<String>();
+ private Set<String> currentNames = new HashSet<>();
@Override
protected void init() {
removeCallback(name);
}
- currentNames = new HashSet<String>(newNames);
+ currentNames = new HashSet<>(newNames);
for (String name : newNames) {
addCallback(name);
}
private Throwable error = null;
- private List<BundleLoadCallback> callbacks = new ArrayList<BundleLoadCallback>();
+ private List<BundleLoadCallback> callbacks = new ArrayList<>();
private final String packageName;
public abstract void init();
- protected List<CValUiInfo> cvals = new ArrayList<CValUiInfo>();
+ protected List<CValUiInfo> cvals = new ArrayList<>();
public void cval(String typeName) {
if (!cvals.isEmpty()) {
throws NoDataException {
JsArrayObject<Property> propertiesArray = getPropertiesAsArray(type);
int size = propertiesArray.size();
- ArrayList<Property> properties = new ArrayList<Property>(size);
+ ArrayList<Property> properties = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
properties.add(propertiesArray.get(i));
}
return null;
}
Cell cell = container.getCell(e);
- EventCellReference<T> cellReference = new EventCellReference<T>(
+ EventCellReference<T> cellReference = new EventCellReference<>(
grid);
// FIXME: Section is currently always body. Might be useful for the
// future to have an actual check.
if (handlers != null) {
Profiler.enter("AbstractConnector.onStateChanged @OnStateChange");
- HashSet<OnStateChangeMethod> invokedMethods = new HashSet<OnStateChangeMethod>();
+ HashSet<OnStateChangeMethod> invokedMethods = new HashSet<>();
JsArrayString propertyNames = handlers.getKeys();
for (int i = 0; i < propertyNames.length(); i++) {
ShortcutActionHandler getShortcutActionHandler();
}
- private final ArrayList<ShortcutAction> actions = new ArrayList<ShortcutAction>();
+ private final ArrayList<ShortcutAction> actions = new ArrayList<>();
private ApplicationConnection client;
private String paintableId;
public static ArrayList<Element> getElements(Element scrolledElement2) {
NodeList<Node> childNodes = scrolledElement2.getChildNodes();
- ArrayList<Element> l = new ArrayList<Element>();
+ ArrayList<Element> l = new ArrayList<>();
for (int i = 0; i < childNodes.getLength(); i++) {
Node item = childNodes.getItem(i);
if (item.getNodeType() == Node.ELEMENT_NODE) {
}
public void setElements(Element[] elements) {
- scrollableElements = new HashSet<Element>(Arrays.asList(elements));
+ scrollableElements = new HashSet<>(Arrays.asList(elements));
}
/**
public static class SplitterMoveEvent
extends GwtEvent<SplitterMoveHandler> {
- public static final Type<SplitterMoveHandler> TYPE = new Type<SplitterMoveHandler>();
+ public static final Type<SplitterMoveHandler> TYPE = new Type<>();
private Widget splitPanel;
public static final String CLASSNAME = AccordionState.PRIMARY_STYLE_NAME;
- private Set<Widget> widgets = new HashSet<Widget>();
+ private Set<Widget> widgets = new HashSet<>();
private StackItem openTab;
public static final String CLASSNAME = "v-customlayout";
/** Location-name to containing element in DOM map */
- private final HashMap<String, Element> locationToElement = new HashMap<String, Element>();
+ private final HashMap<String, Element> locationToElement = new HashMap<>();
/** Location-name to contained widget map */
- final HashMap<String, Widget> locationToWidget = new HashMap<String, Widget>();
+ final HashMap<String, Widget> locationToWidget = new HashMap<>();
/** Widget to captionwrapper map */
- private final HashMap<Widget, VCaptionWrapper> childWidgetToCaptionWrapper = new HashMap<Widget, VCaptionWrapper>();
+ private final HashMap<Widget, VCaptionWrapper> childWidgetToCaptionWrapper = new HashMap<>();
/**
* Unexecuted scripts loaded from the template.
}
/** For internal use only. May be removed or replaced in the future. */
- public List<Integer> fileIds = new ArrayList<Integer>();
+ public List<Integer> fileIds = new ArrayList<>();
/** For internal use only. May be removed or replaced in the future. */
- public List<VHtml5File> files = new ArrayList<VHtml5File>();
+ public List<VHtml5File> files = new ArrayList<>();
private void queueFilePost(final int fileId, final VHtml5File file) {
fileIds.add(fileId);
* @return
*/
public static Map<String, String> getParameters(UIDL uidl) {
- Map<String, String> parameters = new HashMap<String, String>();
+ Map<String, String> parameters = new HashMap<>();
Iterator<Object> childIterator = uidl.getChildIterator();
while (childIterator.hasNext()) {
protected String codetype;
protected String standby;
protected String archive;
- protected Map<String, String> embedParams = new HashMap<String, String>();
+ protected Map<String, String> embedParams = new HashMap<>();
protected boolean needsRebuild = false;
protected String width;
protected String height;
}
if (!embedParams.equals(params)) {
- embedParams = new HashMap<String, String>(params);
+ embedParams = new HashMap<>(params);
needsRebuild = true;
}
}
*/
private String[] getStylesFromState(AbstractComponentState state,
boolean enabled) {
- List<String> styles = new ArrayList<String>();
+ List<String> styles = new ArrayList<>();
if (ComponentStateUtil.hasStyles(state)) {
for (String name : state.styles) {
styles.add(name);
private static final int COLUMN_ERRORFLAG = 1;
public static final int COLUMN_WIDGET = 2;
- private HashMap<Widget, Caption> widgetToCaption = new HashMap<Widget, Caption>();
- private HashMap<Widget, ErrorFlag> widgetToError = new HashMap<Widget, ErrorFlag>();
+ private HashMap<Widget, Caption> widgetToCaption = new HashMap<>();
+ private HashMap<Widget, ErrorFlag> widgetToError = new HashMap<>();
public VFormLayoutTable() {
DOM.setElementProperty(getElement(), "cellPadding", "0");
public ApplicationConnection client;
/** For internal use only. May be removed or replaced in the future. */
- public HashMap<Widget, Cell> widgetToCell = new HashMap<Widget, Cell>();
+ public HashMap<Widget, Cell> widgetToCell = new HashMap<>();
/** For internal use only. May be removed or replaced in the future. */
public int[] columnWidths;
}
}
- private LinkedList<SpanList> colSpans = new LinkedList<SpanList>();
- private LinkedList<SpanList> rowSpans = new LinkedList<SpanList>();
+ private LinkedList<SpanList> colSpans = new LinkedList<>();
+ private LinkedList<SpanList> rowSpans = new LinkedList<>();
private class SpanList {
final int span;
- List<Cell> cells = new LinkedList<Cell>();
+ List<Cell> cells = new LinkedList<>();
public SpanList(int span) {
this.span = span;
public VMenuBar(boolean subMenu, VMenuBar parentMenu) {
- items = new ArrayList<CustomMenuItem>();
+ items = new ArrayList<>();
popup = null;
visibleChildMenu = null;
this.subMenu = subMenu;
}
String currentStyles = super.getStyleName();
- List<String> customStyles = new ArrayList<String>();
+ List<String> customStyles = new ArrayList<>();
for (String style : currentStyles.split(" ")) {
if (!style.isEmpty() && !style.startsWith(primaryStyleName)) {
customStyles.add(style);
return item.getElement();
} else {
- Queue<CustomMenuItem> submenuItems = new LinkedList<CustomMenuItem>();
+ Queue<CustomMenuItem> submenuItems = new LinkedList<>();
for (CustomMenuItem item : getItems()) {
if (isItemNamed(item, subPart)) {
return item.getElement();
private static final int Z_INDEX_BASE = 20000;
public static final String STYLE_SYSTEM = "system";
- private static final ArrayList<VNotification> notifications = new ArrayList<VNotification>();
+ private static final ArrayList<VNotification> notifications = new ArrayList<>();
private boolean infiniteDelay = false;
private int hideDelay = 0;
public void addEventListener(EventListener listener) {
if (listeners == null) {
- listeners = new ArrayList<EventListener>();
+ listeners = new ArrayList<>();
}
listeners.add(listener);
}
private boolean hasHadMouseOver = false;
private boolean hideOnMouseOut = true;
- private final Set<Element> activeChildren = new HashSet<Element>();
+ private final Set<Element> activeChildren = new HashSet<>();
private ShortcutActionHandler shortcutActionHandler;
protected ApplicationConnection client;
/** For internal use only. May be removed or replaced in the future. */
- protected final ArrayList<String> tabKeys = new ArrayList<String>();
+ protected final ArrayList<String> tabKeys = new ArrayList<>();
/** For internal use only. May be removed or replaced in the future. */
- protected Set<String> disabledTabKeys = new HashSet<String>();
+ protected Set<String> disabledTabKeys = new HashSet<>();
/** For internal use only. May be removed or replaced in the future. */
protected int activeTabIndex = 0;
public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
ScrollHandler, KeyDownHandler, FocusHandler, BlurHandler, Focusable {
- private static ArrayList<VWindow> windowOrder = new ArrayList<VWindow>();
+ private static ArrayList<VWindow> windowOrder = new ArrayList<>();
private static boolean orderingDefered;
private int id;
- private HashMap<String, Object> dropDetails = new HashMap<String, Object>();
+ private HashMap<String, Object> dropDetails = new HashMap<>();
private Element elementOver;
@Override
public void handleResponse(boolean accepted, UIDL response) {
- hashSet = new HashSet<String>();
+ hashSet = new HashSet<>();
String[] stringArrayAttribute = response
.getStringArrayAttribute("allowedIds");
for (int i = 0; i < stringArrayAttribute.length; i++) {
private ComponentConnector component;
- private final Map<String, Object> variables = new HashMap<String, Object>();
+ private final Map<String, Object> variables = new HashMap<>();
/**
* Returns the component from which the transferable is created (eg. a tree
String receiverUrl = uidl.getStringVariable(fileId);
fileId = fileId.substring(4);
if (getWidget().fileIdToReceiver == null) {
- getWidget().fileIdToReceiver = new HashMap<String, String>();
+ getWidget().fileIdToReceiver = new HashMap<>();
}
if ("".equals(receiverUrl)) {
Integer id = Integer.parseInt(fileId);
targetWidth = Math.max(0, targetWidth);
if (oldMaxWidths == null) {
- oldMaxWidths = new HashMap<ComponentConnector, String>();
+ oldMaxWidths = new HashMap<>();
}
for (ComponentConnector child : getChildComponents()) {
public Collection<ComponentConnector> getMeasureTargets() {
JsArrayString targetIds = getMeasureTargetsJsArray();
int length = targetIds.length();
- ArrayList<ComponentConnector> targets = new ArrayList<ComponentConnector>(
+ ArrayList<ComponentConnector> targets = new ArrayList<>(
length);
ConnectorMap connectorMap = ConnectorMap.get(connection);
private final Element table;
private final Element outer;
- private final ArrayList<MenuItem> items = new ArrayList<MenuItem>();
+ private final ArrayList<MenuItem> items = new ArrayList<>();
private MenuBar parentMenu;
private PopupPanel popup;
private MenuItem selectedItem;
UIDL uidlItems = uidl.getChildUIDL(1);
Iterator<Object> itr = uidlItems.getChildIterator();
- Stack<Iterator<Object>> iteratorStack = new Stack<Iterator<Object>>();
- Stack<VMenuBar> menuStack = new Stack<VMenuBar>();
+ Stack<Iterator<Object>> iteratorStack = new Stack<>();
+ Stack<VMenuBar> menuStack = new Stack<>();
VMenuBar currentMenu = getWidget();
while (itr.hasNext()) {
protected boolean definedHeight = false;
- private Map<Widget, Slot> widgetToSlot = new HashMap<Widget, Slot>();
+ private Map<Widget, Slot> widgetToSlot = new HashMap<>();
private Element expandWrapper;
private boolean centerAfterLayout = false;
- private final List<HandlerRegistration> handlerRegistration = new ArrayList<HandlerRegistration>();
+ private final List<HandlerRegistration> handlerRegistration = new ArrayList<>();
@Override
protected void init() {
public static Type<VisibilityChangeHandler> getType() {
if (TYPE == null) {
- TYPE = new Type<VisibilityChangeHandler>();
+ TYPE = new Type<>();
}
return TYPE;
}
if (ComponentStateUtil.hasStyles(getState())) {
getWidget().componentStyleNames = getState().styles;
} else {
- getWidget().componentStyleNames = new LinkedList<String>();
+ getWidget().componentStyleNames = new LinkedList<>();
}
// Splitter updates
getWidget().setEnabled(isEnabled());
// Widgets in the TabSheet before update
- ArrayList<Widget> oldWidgets = new ArrayList<Widget>();
+ ArrayList<Widget> oldWidgets = new ArrayList<>();
for (Iterator<Widget> iterator = getWidget()
.getWidgetIterator(); iterator.hasNext();) {
oldWidgets.add(iterator.next());
* @return
*/
public List<WindowConnector> getSubWindows() {
- ArrayList<WindowConnector> windows = new ArrayList<WindowConnector>();
+ ArrayList<WindowConnector> windows = new ArrayList<>();
for (ComponentConnector child : getChildComponents()) {
if (child instanceof WindowConnector) {
windows.add((WindowConnector) child);
*/
public class WindowMoveEvent extends GwtEvent<WindowMoveHandler> {
- private static final Type<WindowMoveHandler> TYPE = new Type<WindowMoveHandler>();
+ private static final Type<WindowMoveHandler> TYPE = new Type<>();
private final int newX;
private final int newY;
private CellIterator(final Collection<FlyweightCell> cells,
final boolean attached) {
- this.cells = new ArrayList<FlyweightCell>(cells);
+ this.cells = new ArrayList<>(cells);
cellsAttached = attached;
}
private int row;
private TableRowElement element;
private double[] columnWidths = null;
- private final List<FlyweightCell> cells = new ArrayList<FlyweightCell>();
+ private final List<FlyweightCell> cells = new ArrayList<>();
public void setup(final TableRowElement e, final int row,
double[] columnWidths) {
/**
* The type of this event.
*/
- public static final Type<RowVisibilityChangeHandler> TYPE = new Type<RowVisibilityChangeHandler>();
+ public static final Type<RowVisibilityChangeHandler> TYPE = new Type<>();
private final Range visibleRows;
/**
* Handler type.
*/
- public final static Type<RowHeightChangedHandler> TYPE = new Type<RowHeightChangedHandler>();
+ public final static Type<RowHeightChangedHandler> TYPE = new Type<>();
public static final Type<RowHeightChangedHandler> getType() {
return TYPE;
public class DataAvailableEvent extends GwtEvent<DataAvailableHandler> {
private Range rowsAvailable;
- public static final Type<DataAvailableHandler> TYPE = new Type<DataAvailableHandler>();
+ public static final Type<DataAvailableHandler> TYPE = new Type<>();
public DataAvailableEvent(Range rowsAvailable) {
this.rowsAvailable = rowsAvailable;
private TableCellElement element;
public EventCellReference(Grid<T> grid) {
- super(new RowReference<T>(grid));
+ super(new RowReference<>(grid));
}
/**
if (datasource == null) {
throw new IllegalArgumentException("datasource cannot be null");
}
- ds = new ArrayList<T>(datasource);
+ ds = new ArrayList<>(datasource);
wrapper = new ListWrapper();
}
*/
public ListDataSource(T... rows) {
if (rows == null) {
- ds = new ArrayList<T>();
+ ds = new ArrayList<>();
} else {
- ds = new ArrayList<T>(Arrays.asList(rows));
+ ds = new ArrayList<>(Arrays.asList(rows));
}
wrapper = new ListWrapper();
}
}
this.grid = grid;
- comparators = new HashMap<Grid.Column<?, T>, Comparator<?>>();
+ comparators = new HashMap<>();
sortHandlerRegistration = grid.addSortHandler(new SortHandler<T>() {
@Override
/**
* Handler type.
*/
- private final static Type<ColumnReorderHandler<?>> TYPE = new Type<ColumnReorderHandler<?>>();
+ private final static Type<ColumnReorderHandler<?>> TYPE = new Type<>();
public static final Type<ColumnReorderHandler<?>> getType() {
return TYPE;
/**
* Handler type.
*/
- private final static Type<ColumnResizeHandler<?>> TYPE = new Type<ColumnResizeHandler<?>>();
+ private final static Type<ColumnResizeHandler<?>> TYPE = new Type<>();
private Column<?, T> column;
public class ColumnVisibilityChangeEvent<T>
extends GwtEvent<ColumnVisibilityChangeHandler<T>> {
- private final static Type<ColumnVisibilityChangeHandler<?>> TYPE = new Type<ColumnVisibilityChangeHandler<?>>();
+ private final static Type<ColumnVisibilityChangeHandler<?>> TYPE = new Type<>();
public static final Type<ColumnVisibilityChangeHandler<?>> getType() {
return TYPE;
/**
* The type of this event
*/
- public static final Type<GridEnabledHandler> TYPE = new Type<GridEnabledHandler>();
+ public static final Type<GridEnabledHandler> TYPE = new Type<>();
private final boolean enabled;
public GridEnabledEvent(boolean enabled) {
public class ScrollEvent extends GwtEvent<ScrollHandler> {
/** The type of this event */
- public static final Type<ScrollHandler> TYPE = new Type<ScrollHandler>();
+ public static final Type<ScrollHandler> TYPE = new Type<>();
@Override
public Type<ScrollHandler> getAssociatedType() {
/**
* Handler type.
*/
- private final static Type<SelectAllHandler<?>> TYPE = new Type<SelectAllHandler<?>>();;
+ private final static Type<SelectAllHandler<?>> TYPE = new Type<>();;
private SelectionModel.Multi<T> selectionModel;
@Override
public Collection<String> getConsumedEvents() {
- final HashSet<String> events = new HashSet<String>();
+ final HashSet<String> events = new HashSet<>();
/*
* this column's first interest is only to attach a NativePreventHandler
@SuppressWarnings("rawtypes")
public class SelectionEvent<T> extends GwtEvent<SelectionHandler> {
- private static final Type<SelectionHandler> eventType = new Type<SelectionHandler>();
+ private static final Type<SelectionHandler> eventType = new Type<>();
private final Grid<T> grid;
private final List<T> added;
this.batched = batched;
if (added != null) {
- this.added = new ArrayList<T>(added);
+ this.added = new ArrayList<>(added);
} else {
this.added = Collections.emptyList();
}
if (removed != null) {
- this.removed = new ArrayList<T>(removed);
+ this.removed = new ArrayList<>(removed);
} else {
this.removed = Collections.emptyList();
}
private Grid<T> grid;
private boolean batchStarted = false;
- private final LinkedHashSet<RowHandle<T>> selectionBatch = new LinkedHashSet<RowHandle<T>>();
- private final LinkedHashSet<RowHandle<T>> deselectionBatch = new LinkedHashSet<RowHandle<T>>();
+ private final LinkedHashSet<RowHandle<T>> selectionBatch = new LinkedHashSet<>();
+ private final LinkedHashSet<RowHandle<T>> deselectionBatch = new LinkedHashSet<>();
/* Event handling for selection with space key */
private SpaceSelectHandler<T> spaceSelectHandler;
public SelectionModelMulti() {
grid = null;
renderer = null;
- selectedRows = new LinkedHashSet<RowHandle<T>>();
+ selectedRows = new LinkedHashSet<>();
}
@Override
this.grid = grid;
if (this.grid != null) {
- spaceSelectHandler = new SpaceSelectHandler<T>(grid);
- this.renderer = new MultiSelectionRenderer<T>(grid);
+ spaceSelectHandler = new SpaceSelectHandler<>(grid);
+ this.renderer = new MultiSelectionRenderer<>(grid);
} else {
spaceSelectHandler.removeHandler();
spaceSelectHandler = null;
@SuppressWarnings("unchecked")
final LinkedHashSet<RowHandle<T>> selectedRowsClone = (LinkedHashSet<RowHandle<T>>) selectedRows
.clone();
- SelectionEvent<T> event = new SelectionEvent<T>(grid, null,
+ SelectionEvent<T> event = new SelectionEvent<>(grid, null,
getSelectedRows(), isBeingBatchSelected());
selectedRows.clear();
throw new IllegalArgumentException("Rows cannot be null");
}
- Set<T> added = new LinkedHashSet<T>();
+ Set<T> added = new LinkedHashSet<>();
for (T row : rows) {
RowHandle<T> handle = grid.getDataSource().getHandle(row);
}
if (added.size() > 0) {
- grid.fireEvent(new SelectionEvent<T>(grid, added, null,
+ grid.fireEvent(new SelectionEvent<>(grid, added, null,
isBeingBatchSelected()));
return true;
throw new IllegalArgumentException("Rows cannot be null");
}
- Set<T> removed = new LinkedHashSet<T>();
+ Set<T> removed = new LinkedHashSet<>();
for (T row : rows) {
RowHandle<T> handle = grid.getDataSource().getHandle(row);
}
if (removed.size() > 0) {
- grid.fireEvent(new SelectionEvent<T>(grid, null, removed,
+ grid.fireEvent(new SelectionEvent<>(grid, null, removed,
isBeingBatchSelected()));
return true;
}
@Override
public Collection<T> getSelectedRows() {
- Set<T> selected = new LinkedHashSet<T>();
+ Set<T> selected = new LinkedHashSet<>();
for (RowHandle<T> handle : selectedRows) {
selected.add(handle.getRow());
}
}
deselectionBatch.clear();
- grid.fireEvent(new SelectionEvent<T>(grid, added, removed,
+ grid.fireEvent(new SelectionEvent<>(grid, added, removed,
isBeingBatchSelected()));
}
}
private ArrayList<T> rowHandlesToRows(Collection<RowHandle<T>> rowHandles) {
- ArrayList<T> rows = new ArrayList<T>(rowHandles.size());
+ ArrayList<T> rows = new ArrayList<>(rowHandles.size());
for (RowHandle<T> handle : rowHandles) {
rows.add(handle.getRow());
}
this.grid = grid;
if (this.grid != null) {
- spaceSelectHandler = new SpaceSelectHandler<T>(grid);
- clickSelectHandler = new ClickSelectHandler<T>(grid);
+ spaceSelectHandler = new SpaceSelectHandler<>(grid);
+ clickSelectHandler = new ClickSelectHandler<>(grid);
updateHandlerDeselectAllowed();
} else {
spaceSelectHandler.removeHandler();
T removed = getSelectedRow();
if (selectByHandle(grid.getDataSource().getHandle(row))) {
- grid.fireEvent(new SelectionEvent<T>(grid, row, removed, false));
+ grid.fireEvent(new SelectionEvent<>(grid, row, removed, false));
return true;
}
if (isSelected(row)) {
deselectByHandle(selectedRow);
- grid.fireEvent(new SelectionEvent<T>(grid, null, row, false));
+ grid.fireEvent(new SelectionEvent<>(grid, null, row, false));
return true;
}
*/
public List<SortOrder> build() {
- List<SortOrder> order = new ArrayList<SortOrder>(count);
+ List<SortOrder> order = new ArrayList<>(count);
Sort s = this;
for (int i = count - 1; i >= 0; --i) {
*/
public class SortEvent<T> extends GwtEvent<SortHandler<?>> {
- private static final Type<SortHandler<?>> TYPE = new Type<SortHandler<?>>();
+ private static final Type<SortHandler<?>> TYPE = new Type<>();
private final Grid<T> grid;
private final List<SortOrder> order;
// The object to deal with one direction scrolling
private class Movement {
- final List<Double> speeds = new ArrayList<Double>();
+ final List<Double> speeds = new ArrayList<>();
final ScrollbarBundle scroll;
double position, offset, velocity, prevPos, prevTime, delta;
boolean run, vertical;
* potentially need to set the widths for the cells for the
* first time.
*/
- Map<Integer, Double> colWidths = new HashMap<Integer, Double>();
+ Map<Integer, Double> colWidths = new HashMap<>();
for (int i = 0; i < getColumnConfiguration()
.getColumnCount(); i++) {
Double width = Double.valueOf(
final int visualIndex, final int numberOfRows) {
assert isAttached() : "Can't paint rows if Escalator is not attached";
- final List<TableRowElement> addedRows = new ArrayList<TableRowElement>();
+ final List<TableRowElement> addedRows = new ArrayList<>();
if (numberOfRows < 1) {
return addedRows;
*
* @see #sortDomElements()
*/
- private final LinkedList<TableRowElement> visualRowOrder = new LinkedList<TableRowElement>();
+ private final LinkedList<TableRowElement> visualRowOrder = new LinkedList<>();
/**
* The logical index of the topmost row.
* it's faster to just move idx[9] to the beginning.
*/
- final List<TableRowElement> removedRows = new ArrayList<TableRowElement>(
+ final List<TableRowElement> removedRows = new ArrayList<>(
visualSourceRange.length());
for (int i = 0; i < visualSourceRange.length(); i++) {
final TableRowElement tr = visualRowOrder
* the first child.
*/
- List<TableRowElement> orderedBodyRows = new ArrayList<TableRowElement>(
+ List<TableRowElement> orderedBodyRows = new ArrayList<>(
visualRowOrder);
Map<Integer, SpacerContainer.SpacerImpl> spacers = body.spacerContainer
.getSpacers();
}
}
- private final List<Column> columns = new ArrayList<Column>();
+ private final List<Column> columns = new ArrayList<>();
private int frozenColumns = 0;
/*
if (header.getRowCount() > 0 || body.getRowCount() > 0
|| footer.getRowCount() > 0) {
- Map<Integer, Double> colWidths = new HashMap<Integer, Double>();
+ Map<Integer, Double> colWidths = new HashMap<>();
Double width = Double.valueOf(Column.DEFAULT_COLUMN_WIDTH_PX);
for (int i = index; i < index + numberOfColumns; i++) {
Integer col = Integer.valueOf(i);
}
}
- private final TreeMap<Integer, SpacerImpl> rowIndexToSpacer = new TreeMap<Integer, SpacerImpl>();
+ private final TreeMap<Integer, SpacerImpl> rowIndexToSpacer = new TreeMap<>();
private SpacerUpdater spacerUpdater = SpacerUpdater.NULL;
}
public Map<Integer, SpacerImpl> getSpacers() {
- return new HashMap<Integer, SpacerImpl>(rowIndexToSpacer);
+ return new HashMap<>(rowIndexToSpacer);
}
/**
@SuppressWarnings("boxing")
public Collection<SpacerImpl> getSpacersForRowAndAfter(
int logicalRowIndex) {
- return new ArrayList<SpacerImpl>(
+ return new ArrayList<>(
rowIndexToSpacer.tailMap(logicalRowIndex, true).values());
}
public Collection<SpacerImpl> getSpacersAfterPx(final double px,
final SpacerInclusionStrategy strategy) {
- ArrayList<SpacerImpl> spacers = new ArrayList<SpacerImpl>(
+ ArrayList<SpacerImpl> spacers = new ArrayList<>(
rowIndexToSpacer.values());
for (int i = 0; i < spacers.size(); i++) {
/**
* A map containing cached values of an element's current top position.
*/
- private final Map<Element, Double> elementTopPositionMap = new HashMap<Element, Double>();
- private final Map<Element, Double> elementLeftPositionMap = new HashMap<Element, Double>();
+ private final Map<Element, Double> elementTopPositionMap = new HashMap<>();
+ private final Map<Element, Double> elementLeftPositionMap = new HashMap<>();
public void set(final Element e, final double x, final double y) {
assert e != null : "Element was null";
*/
public abstract static class StaticRow<CELLTYPE extends StaticCell> {
- private Map<Column<?, ?>, CELLTYPE> cells = new HashMap<Column<?, ?>, CELLTYPE>();
+ private Map<Column<?, ?>, CELLTYPE> cells = new HashMap<>();
private StaticSection<?> section;
/**
* Map from set of spanned columns to cell meta data.
*/
- private Map<Set<Column<?, ?>>, CELLTYPE> cellGroups = new HashMap<Set<Column<?, ?>>, CELLTYPE>();
+ private Map<Set<Column<?, ?>>, CELLTYPE> cellGroups = new HashMap<>();
/**
* A custom style name for the row or null if none is set.
"You can't merge less than 2 columns together.");
}
- HashSet<Column<?, ?>> columnGroup = new HashSet<Column<?, ?>>();
+ HashSet<Column<?, ?>> columnGroup = new HashSet<>();
// NOTE: this doesn't care about hidden columns, those are
// filtered in calculateColspans()
for (Column<?, ?> column : columns) {
private boolean checkMergedCellIsContinuous(
Set<Column<?, ?>> mergedCell) {
// no matter if hidden or not, just check for continuous order
- final List<Column<?, ?>> columnOrder = new ArrayList<Column<?, ?>>(
+ final List<Column<?, ?>> columnOrder = new ArrayList<>(
section.grid.getColumns());
if (!columnOrder.containsAll(mergedCell)) {
*/
void detach() {
// Avoid calling detach twice for a merged cell
- HashSet<CELLTYPE> cells = new HashSet<CELLTYPE>();
+ HashSet<CELLTYPE> cells = new HashSet<>();
for (Column<?, ?> column : getSection().grid.getColumns()) {
cells.add(getCell(column));
}
private Grid<?> grid;
- private List<ROWTYPE> rows = new ArrayList<ROWTYPE>();
+ private List<ROWTYPE> rows = new ArrayList<>();
private boolean visible = true;
// Should only be added to the DOM when there's a message to show
private DivElement message = DivElement.as(DOM.createDiv());
- private Map<Column<?, T>, Widget> columnToWidget = new HashMap<Column<?, T>, Widget>();
- private List<HandlerRegistration> focusHandlers = new ArrayList<HandlerRegistration>();
+ private Map<Column<?, T>, Widget> columnToWidget = new HashMap<>();
+ private List<HandlerRegistration> focusHandlers = new ArrayList<>();
private boolean enabled = false;
private State state = State.INACTIVE;
};
/** A set of all the columns that display an error flag. */
- private final Set<Column<?, T>> columnErrors = new HashSet<Grid.Column<?, T>>();
+ private final Set<Column<?, T>> columnErrors = new HashSet<>();
private boolean buffered = true;
/** Original position of editor */
throw new IllegalStateException(
"Cannot cancel edit: editor is not in edit mode");
}
- handler.cancel(new EditorRequestImpl<T>(grid, rowIndex,
+ handler.cancel(new EditorRequestImpl<>(grid, rowIndex,
focusedColumnIndex, null));
doCancel();
}
state = State.SAVING;
setButtonsEnabled(false);
saveTimeout.schedule(SAVE_TIMEOUT_MS);
- EditorRequest<T> request = new EditorRequestImpl<T>(grid, rowIndex,
+ EditorRequest<T> request = new EditorRequestImpl<>(grid, rowIndex,
focusedColumnIndex, saveRequestCallback);
handler.save(request);
updateSelectionCheckboxesAsNeeded(true);
if (state == State.ACTIVATING) {
state = State.BINDING;
bindTimeout.schedule(BIND_TIMEOUT_MS);
- EditorRequest<T> request = new EditorRequestImpl<T>(grid,
+ EditorRequest<T> request = new EditorRequestImpl<>(grid,
rowIndex, columnIndex, bindRequestCallback);
handler.bind(request);
grid.getEscalator().setScrollLocked(Direction.VERTICAL,
extends KeyEvent<HANDLER> {
private Grid<?> grid;
- private final Type<HANDLER> associatedType = new Type<HANDLER>(
+ private final Type<HANDLER> associatedType = new Type<>(
getBrowserEventType(), this);
private final CellReference<?> targetCell;
private Grid<?> grid;
private final CellReference<?> targetCell;
- private final Type<HANDLER> associatedType = new Type<HANDLER>(
+ private final Type<HANDLER> associatedType = new Type<>(
getBrowserEventType(), this);
public AbstractGridMouseEvent(Grid<?> grid,
*/
private static final double DETAILS_ROW_INITIAL_HEIGHT = 50;
- private EventCellReference<T> eventCell = new EventCellReference<T>(this);
+ private EventCellReference<T> eventCell = new EventCellReference<>(this);
private GridKeyDownEvent keyDown = new GridKeyDownEvent(this, eventCell);
private GridKeyUpEvent keyUp = new GridKeyUpEvent(this, eventCell);
private GridKeyPressEvent keyPress = new GridKeyPressEvent(this, eventCell);
public void onValueChange(
ValueChangeEvent<Boolean> event) {
if (event.getValue()) {
- fireEvent(new SelectAllEvent<T>(model));
+ fireEvent(new SelectAllEvent<>(model));
selected = true;
} else {
model.deselectAll();
/* Step 1: Apply all column widths as they are. */
- Map<Integer, Double> selfWidths = new LinkedHashMap<Integer, Double>();
+ Map<Integer, Double> selfWidths = new LinkedHashMap<>();
List<Column<?, T>> columns = getVisibleColumns();
for (int index = 0; index < columns.size(); index++) {
selfWidths.put(index, columns.get(index).getWidth());
* violated, fix it.
*/
- Map<Integer, Double> constrainedWidths = new LinkedHashMap<Integer, Double>();
+ Map<Integer, Double> constrainedWidths = new LinkedHashMap<>();
for (int index = 0; index < columns.size(); index++) {
Column<?, T> column = columns.get(index);
boolean defaultExpandRatios = true;
int totalRatios = 0;
double reservedPixels = 0;
- final Set<Column<?, T>> columnsToExpand = new HashSet<Column<?, T>>();
- List<Column<?, T>> nonFixedColumns = new ArrayList<Column<?, T>>();
- Map<Integer, Double> columnSizes = new HashMap<Integer, Double>();
+ final Set<Column<?, T>> columnsToExpand = new HashSet<>();
+ List<Column<?, T>> nonFixedColumns = new ArrayList<>();
+ Map<Integer, Double> columnSizes = new HashMap<>();
final List<Column<?, T>> visibleColumns = getVisibleColumns();
/*
private static final String STRIPE_CLASSNAME = "stripe";
- private final Map<Element, Widget> elementToWidgetMap = new HashMap<Element, Widget>();
+ private final Map<Element, Widget> elementToWidgetMap = new HashMap<>();
@Override
public void init(Spacer spacer) {
private final class ColumnHider {
/** Map from columns to their hiding toggles, component might change */
- private HashMap<Column<?, T>, MenuItem> columnToHidingToggleMap = new HashMap<Grid.Column<?, T>, MenuItem>();
+ private HashMap<Column<?, T>, MenuItem> columnToHidingToggleMap = new HashMap<>();
/**
* When column is being hidden with a toggle, do not refresh toggles for
/**
* List of columns in the grid. Order defines the visible order.
*/
- private List<Column<?, T>> columns = new ArrayList<Column<?, T>>();
+ private List<Column<?, T>> columns = new ArrayList<>();
/**
* The datasource currently in use. <em>Note:</em> it is <code>null</code>
* Current sort order. The (private) sort() method reads this list to
* determine the order in which to present rows.
*/
- private List<SortOrder> sortOrder = new ArrayList<SortOrder>();
+ private List<SortOrder> sortOrder = new ArrayList<>();
private Renderer<Boolean> selectColumnRenderer = null;
private DetailsGenerator detailsGenerator = DetailsGenerator.NULL;
private GridSpacerUpdater gridSpacerUpdater = new GridSpacerUpdater();
/** A set keeping track of the indices of all currently open details */
- private Set<Integer> visibleDetails = new HashSet<Integer>();
+ private Set<Integer> visibleDetails = new HashSet<>();
private boolean columnReorderingAllowed;
* Map of possible drop positions for the column and the corresponding
* column index.
*/
- private final TreeMap<Double, Integer> possibleDropPositions = new TreeMap<Double, Integer>();
+ private final TreeMap<Double, Integer> possibleDropPositions = new TreeMap<>();
/**
* Makes sure that drag cancel doesn't cause anything unwanted like sort
*/
&& latestColumnDropIndex != (draggedColumnIndex
+ colspan)) {
List<Column<?, T>> columns = getColumns();
- List<Column<?, T>> reordered = new ArrayList<Column<?, T>>();
+ List<Column<?, T>> reordered = new ArrayList<>();
if (draggedColumnIndex < latestColumnDropIndex) {
reordered.addAll(columns.subList(0, draggedColumnIndex));
reordered.addAll(
int leftBound = -1;
int rightBound = getColumnCount() + 1;
- final HashSet<Integer> unavailableColumnDropIndices = new HashSet<Integer>();
- final List<StaticRow<?>> rows = new ArrayList<StaticRow<?>>();
+ final HashSet<Integer> unavailableColumnDropIndices = new HashSet<>();
+ final List<StaticRow<?>> rows = new ArrayList<>();
rows.addAll(header.getRows());
rows.addAll(footer.getRows());
for (StaticRow<?> row : rows) {
grid.header.updateColSpans();
grid.footer.updateColSpans();
scheduleColumnWidthRecalculator();
- this.grid.fireEvent(new ColumnVisibilityChangeEvent<T>(this,
+ this.grid.fireEvent(new ColumnVisibilityChangeEvent<>(this,
hidden, userOriginated));
}
}
if (c.getWidth() < 0) {
c.setWidth(c.getWidthActual());
- fireEvent(new ColumnResizeEvent<T>(
+ fireEvent(new ColumnResizeEvent<>(
c));
}
}
@Override
public void onComplete() {
- fireEvent(new ColumnResizeEvent<T>(col));
+ fireEvent(new ColumnResizeEvent<>(col));
WidgetUtil.setTextSelectionEnabled(
getElement(), true);
escalator.getColumnConfiguration().setColumnWidth(colIndex,
minWidth);
- fireEvent(new ColumnResizeEvent<T>(column));
+ fireEvent(new ColumnResizeEvent<>(column));
}
}
column.reapplyWidth();
// Sink all renderer events
- Set<String> events = new HashSet<String>();
+ Set<String> events = new HashSet<>();
events.addAll(getConsumedEventsForRenderer(column.getRenderer()));
if (column.isHidable()) {
*/
public List<Column<?, T>> getColumns() {
return Collections
- .unmodifiableList(new ArrayList<Column<?, T>>(columns));
+ .unmodifiableList(new ArrayList<>(columns));
}
/**
* @return A unmodifiable list of the currently visible columns in the grid
*/
public List<Column<?, T>> getVisibleColumns() {
- ArrayList<Column<?, T>> visible = new ArrayList<Column<?, T>>();
+ ArrayList<Column<?, T>> visible = new ArrayList<>();
for (Column<?, T> c : columns) {
if (!c.isHidden()) {
visible.add(c);
int oldSize = body.getRowCount();
// Hide all details.
- Set<Integer> oldDetails = new HashSet<Integer>(
+ Set<Integer> oldDetails = new HashSet<>(
visibleDetails);
for (int i : oldDetails) {
setDetailsVisible(i, false);
}
private Set<String> getConsumedEventsForRenderer(Renderer<?> renderer) {
- Set<String> events = new HashSet<String>();
+ Set<String> events = new HashSet<>();
if (renderer instanceof ComplexRenderer) {
Collection<String> consumedEvents = ((ComplexRenderer<?>) renderer)
.getConsumedEvents();
w = editor.getWidget(getColumn(editor.focusedColumnIndex));
}
- EditorDomEvent<T> editorEvent = new EditorDomEvent<T>(event,
+ EditorDomEvent<T> editorEvent = new EditorDomEvent<>(event,
getEventCell(), w);
return getEditor().getEventHandler().handleEvent(editorEvent);
private Point rowEventTouchStartingPoint;
private CellStyleGenerator<T> cellStyleGenerator;
private RowStyleGenerator<T> rowStyleGenerator;
- private RowReference<T> rowReference = new RowReference<T>(this);
- private CellReference<T> cellReference = new CellReference<T>(rowReference);
+ private RowReference<T> rowReference = new RowReference<>(this);
+ private CellReference<T> cellReference = new CellReference<>(rowReference);
private RendererCellReference rendererCellReference = new RendererCellReference(
(RowReference<Object>) rowReference);
*/
private void sort(boolean userOriginated) {
refreshHeader();
- fireEvent(new SortEvent<T>(this,
+ fireEvent(new SortEvent<>(this,
Collections.unmodifiableList(sortOrder), userOriginated));
}
// Trigger ComplexRenderer.destroy for old content
conf.removeColumns(0, conf.getColumnCount());
- List<Column<?, T>> newOrder = new ArrayList<Column<?, T>>();
+ List<Column<?, T>> newOrder = new ArrayList<>();
if (selectionColumn != null) {
newOrder.add(selectionColumn);
}
@Override
protected void onDetach() {
- Set<Integer> details = new HashSet<Integer>(visibleDetails);
+ Set<Integer> details = new HashSet<>(visibleDetails);
for (int row : details) {
setDetailsVisible(row, false);
}
if (container != null) {
Cell cell = container.getCell(element);
if (cell != null) {
- EventCellReference<T> cellRef = new EventCellReference<T>(this);
+ EventCellReference<T> cellRef = new EventCellReference<>(this);
cellRef.set(cell, getSectionFromContainer(container));
return cellRef;
}
*/
private static final int POPUP_PANEL_ANIMATION_DURATION = 200;
- private List<Command> runOnClose = new ArrayList<Command>();
+ private List<Command> runOnClose = new ArrayList<>();
public Overlay() {
super();
final long MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
- static Map<Date, Integer> isoWeekNumbers = new HashMap<Date, Integer>();
+ static Map<Date, Integer> isoWeekNumbers = new HashMap<>();
static {
isoWeekNumbers.put(getDate(2005, 02, 02), 5);
@Test
public void testDataSourceConstruction() throws Exception {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3);
+ ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3);
assertEquals(4, ds.size());
assertEquals(0, (int) ds.getRow(0));
assertEquals(2, (int) ds.getRow(2));
assertEquals(3, (int) ds.getRow(3));
- ds = new ListDataSource<Integer>(Arrays.asList(0, 1, 2, 3));
+ ds = new ListDataSource<>(Arrays.asList(0, 1, 2, 3));
assertEquals(4, ds.size());
assertEquals(0, (int) ds.getRow(0));
@Test
public void testListAddOperation() throws Exception {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3);
+ ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3);
DataChangeHandler handler = EasyMock
.createNiceMock(DataChangeHandler.class);
@Test
public void testListAddAllOperation() throws Exception {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3);
+ ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3);
DataChangeHandler handler = EasyMock
.createNiceMock(DataChangeHandler.class);
@Test
public void testListRemoveOperation() throws Exception {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3);
+ ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3);
DataChangeHandler handler = EasyMock
.createNiceMock(DataChangeHandler.class);
@Test
public void testListRemoveAllOperation() throws Exception {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3);
+ ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3);
DataChangeHandler handler = EasyMock
.createNiceMock(DataChangeHandler.class);
@Test
public void testListClearOperation() throws Exception {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3);
+ ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3);
DataChangeHandler handler = EasyMock
.createNiceMock(DataChangeHandler.class);
@Test(expected = IllegalStateException.class)
public void testFetchingNonExistantItem() {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3);
+ ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3);
ds.ensureAvailability(5, 1);
}
@Test(expected = UnsupportedOperationException.class)
public void testUnsupportedIteratorRemove() {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3);
+ ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3);
ds.asList().iterator().remove();
}
@Test
public void sortColumn() {
- ListDataSource<Integer> ds = new ListDataSource<Integer>(3, 4, 2, 3, 1);
+ ListDataSource<Integer> ds = new ListDataSource<>(3, 4, 2, 3, 1);
// TODO Should be simplified to sort(). No point in providing these
// trivial comparators.
*/
public static <R> Result<R> error(String message) {
Objects.requireNonNull(message, "message cannot be null");
- return new SimpleResult<R>(null, message);
+ return new SimpleResult<>(null, message);
}
/**
++count;
}
- List<SortOrder> order = new ArrayList<SortOrder>(count);
+ List<SortOrder> order = new ArrayList<>(count);
s = this;
do {
@Override
public <T extends Action & Action.Listener> void addAction(T action) {
if (ownActions == null) {
- ownActions = new LinkedHashSet<Action>();
+ ownActions = new LinkedHashSet<>();
}
if (ownActions.add(action)) {
requestRepaint();
if (actionHandler != null) {
if (actionHandlers == null) {
- actionHandlers = new LinkedHashSet<Handler>();
+ actionHandlers = new LinkedHashSet<>();
}
if (actionHandlers.add(actionHandler)) {
* removed but still exist on client side
*/
if (!actions.isEmpty() || clientHasActions) {
- actionMapper = new KeyMapper<Action>();
+ actionMapper = new KeyMapper<>();
paintTarget.addVariable((VariableOwner) viewer, "action", "");
paintTarget.startTag("actions");
}
private LinkedHashSet<Action> getActionSet(Object target, Object sender) {
- LinkedHashSet<Action> actions = new LinkedHashSet<Action>();
+ LinkedHashSet<Action> actions = new LinkedHashSet<>();
if (ownActions != null) {
actions.addAll(ownActions);
@Override
public void addListener(Class<?> eventType, Object object, Method method) {
if (listenerList == null) {
- listenerList = new LinkedHashSet<ListenerMethod>();
+ listenerList = new LinkedHashSet<>();
}
listenerList.add(new ListenerMethod(eventType, object, method));
}
public void addListener(Class<?> eventType, Object object,
String methodName) {
if (listenerList == null) {
- listenerList = new LinkedHashSet<ListenerMethod>();
+ listenerList = new LinkedHashSet<>();
}
listenerList.add(new ListenerMethod(eventType, object, methodName));
}
* are found.
*/
public Collection<?> getListeners(Class<?> eventType) {
- List<Object> listeners = new ArrayList<Object>();
+ List<Object> listeners = new ArrayList<>();
if (listenerList != null) {
for (ListenerMethod lm : listenerList) {
if (lm.isOrExtendsType(eventType)) {
public SelectionEvent(Object source, Collection<Object> oldSelection,
Collection<Object> newSelection) {
super(source);
- this.oldSelection = new LinkedHashSet<Object>(oldSelection);
- this.newSelection = new LinkedHashSet<Object>(newSelection);
+ this.oldSelection = new LinkedHashSet<>(oldSelection);
+ this.newSelection = new LinkedHashSet<>(newSelection);
}
/**
if (set2.isEmpty()) {
return set1;
} else {
- LinkedHashSet<T> set = new LinkedHashSet<T>(set1);
+ LinkedHashSet<T> set = new LinkedHashSet<>(set1);
set.removeAll(set2);
return set;
}
* @since 6.3
*/
public class TransferableImpl implements Transferable {
- private Map<String, Object> rawVariables = new HashMap<String, Object>();
+ private Map<String, Object> rawVariables = new HashMap<>();
private Component sourceComponent;
public TransferableImpl(Component sourceComponent,
@SuppressWarnings("serial")
public class TargetDetailsImpl implements TargetDetails {
- private HashMap<String, Object> data = new HashMap<String, Object>();
+ private HashMap<String, Object> data = new HashMap<>();
private DropTarget dropTarget;
protected TargetDetailsImpl(Map<String, Object> rawDropData) {
private NavigationStateManager stateManager;
private ViewDisplay display;
private View currentView = null;
- private List<ViewChangeListener> listeners = new LinkedList<ViewChangeListener>();
- private List<ViewProvider> providers = new LinkedList<ViewProvider>();
+ private List<ViewChangeListener> listeners = new LinkedList<>();
+ private List<ViewProvider> providers = new LinkedList<>();
private String currentNavigationState = null;
private ViewProvider errorProvider;
// a copy of the listener list is needed to avoid
// ConcurrentModificationException as a listener can add/remove
// listeners
- for (ViewChangeListener l : new ArrayList<ViewChangeListener>(
+ for (ViewChangeListener l : new ArrayList<>(
listeners)) {
if (!l.beforeViewChange(event)) {
return false;
// a copy of the listener list is needed to avoid
// ConcurrentModificationException as a listener can add/remove
// listeners
- for (ViewChangeListener l : new ArrayList<ViewChangeListener>(
+ for (ViewChangeListener l : new ArrayList<>(
listeners)) {
l.afterViewChange(event);
}
* A map from client to server RPC interface class name to the RPC call
* manager that handles incoming RPC calls for that interface.
*/
- private Map<String, ServerRpcManager<?>> rpcManagerMap = new HashMap<String, ServerRpcManager<?>>();
+ private Map<String, ServerRpcManager<?>> rpcManagerMap = new HashMap<>();
/**
* A map from server to client RPC interface class to the RPC proxy that
* sends ourgoing RPC calls for that interface.
*/
- private Map<Class<?>, ClientRpc> rpcProxyMap = new HashMap<Class<?>, ClientRpc>();
+ private Map<Class<?>, ClientRpc> rpcProxyMap = new HashMap<>();
/**
* Shared state object to be communicated from the server to the client when
/**
* Pending RPC method invocations to be sent.
*/
- private ArrayList<ClientMethodInvocation> pendingInvocations = new ArrayList<ClientMethodInvocation>();
+ private ArrayList<ClientMethodInvocation> pendingInvocations = new ArrayList<>();
private String connectorId;
- private ArrayList<Extension> extensions = new ArrayList<Extension>();
+ private ArrayList<Extension> extensions = new ArrayList<>();
/**
* The EventRouter used for the event model.
private ErrorHandler errorHandler = null;
- private static final ConcurrentHashMap<Class<? extends AbstractClientConnector>, Class<? extends SharedState>> stateTypeCache = new ConcurrentHashMap<Class<? extends AbstractClientConnector>, Class<? extends SharedState>>();
+ private static final ConcurrentHashMap<Class<? extends AbstractClientConnector>, Class<? extends SharedState>> stateTypeCache = new ConcurrentHashMap<>();
@Override
public void addAttachListener(AttachListener listener) {
protected <T extends ServerRpc> void registerRpc(T implementation,
Class<T> rpcInterfaceType) {
rpcManagerMap.put(rpcInterfaceType.getName(),
- new ServerRpcManager<T>(implementation, rpcInterfaceType));
+ new ServerRpcManager<>(implementation, rpcInterfaceType));
}
/**
return Collections.emptyList();
} else {
List<ClientMethodInvocation> result = pendingInvocations;
- pendingInvocations = new ArrayList<ClientMethodInvocation>();
+ pendingInvocations = new ArrayList<>();
return Collections.unmodifiableList(result);
}
}
*/
private ErrorLevel level = ErrorLevel.ERROR;
- private List<ErrorMessage> causes = new ArrayList<ErrorMessage>();
+ private List<ErrorMessage> causes = new ArrayList<>();
protected AbstractErrorMessage(String message) {
this.message = message;
.getBootstrapResponse();
if (vaadinService.isStandalone(request)) {
- Map<String, Object> headers = new LinkedHashMap<String, Object>();
+ Map<String, Object> headers = new LinkedHashMap<>();
Document document = Document.createShell("");
BootstrapPageResponse pageResponse = new BootstrapPageResponse(this,
request, context.getSession(), context.getUIClass(),
parent.addError(error);
} else {
if (errors == null) {
- errors = new LinkedList<InvalidLayout>();
+ errors = new LinkedList<>();
}
errors.add(error);
}
private final boolean invalidHeight;
private final boolean invalidWidth;
- private final Vector<InvalidLayout> subErrors = new Vector<InvalidLayout>();
+ private final Vector<InvalidLayout> subErrors = new Vector<>();
public InvalidLayout(Component component, boolean height,
boolean width) {
private static Stack<ComponentInfo> getHeightAttributes(
Component component) {
- Stack<ComponentInfo> attributes = new Stack<ComponentInfo>();
+ Stack<ComponentInfo> attributes = new Stack<>();
attributes
.add(new ComponentInfo(component, getHeightString(component)));
Component parent = component.getParent();
private static Stack<ComponentInfo> getWidthAttributes(
Component component) {
- Stack<ComponentInfo> attributes = new Stack<ComponentInfo>();
+ Stack<ComponentInfo> attributes = new Stack<>();
attributes.add(new ComponentInfo(component, getWidthString(component)));
Component parent = component.getParent();
attributes.add(new ComponentInfo(parent, getWidthString(parent)));
}
- private static Map<Object, FileLocation> creationLocations = new HashMap<Object, FileLocation>();
- private static Map<Object, FileLocation> widthLocations = new HashMap<Object, FileLocation>();
- private static Map<Object, FileLocation> heightLocations = new HashMap<Object, FileLocation>();
+ private static Map<Object, FileLocation> creationLocations = new HashMap<>();
+ private static Map<Object, FileLocation> widthLocations = new HashMap<>();
+ private static Map<Object, FileLocation> heightLocations = new HashMap<>();
public static class FileLocation implements Serializable {
public String method;
*/
public void setParameter(String name, String value) {
if (params == null) {
- params = new HashMap<String, String>();
+ params = new HashMap<>();
}
params.put(name, value);
}
getLogger().log(Level.INFO,
"Vaadin cleanup deleting {0} expired Vaadin sessions.",
entities.size());
- List<Key> keys = new ArrayList<Key>();
+ List<Key> keys = new ArrayList<>();
for (Entity e : entities) {
keys.add(e.getKey());
}
getLogger().log(Level.INFO,
"Vaadin cleanup deleting {0} expired appengine sessions.",
entities.size());
- List<Key> keys = new ArrayList<Key>();
+ List<Key> keys = new ArrayList<>();
for (Entity e : entities) {
keys.add(e.getKey());
}
/**
* Used to detect when a resource is no longer used by any connector.
*/
- private final Map<Resource, Set<ClientConnector>> resourceUsers = new HashMap<Resource, Set<ClientConnector>>();
+ private final Map<Resource, Set<ClientConnector>> resourceUsers = new HashMap<>();
/**
* Used to find the resources that might not be needed any more when a
* connector is unregistered.
*/
- private final Map<ClientConnector, Set<Resource>> usedResources = new HashMap<ClientConnector, Set<Resource>>();
+ private final Map<ClientConnector, Set<Resource>> usedResources = new HashMap<>();
- private final Map<ConnectorResource, String> legacyResourceKeys = new HashMap<ConnectorResource, String>();
- private final Map<String, ConnectorResource> legacyResources = new HashMap<String, ConnectorResource>();
+ private final Map<ConnectorResource, String> legacyResourceKeys = new HashMap<>();
+ private final Map<String, ConnectorResource> legacyResources = new HashMap<>();
private int nextLegacyId = 0;
// APP/global/[uiid]/[type]/[id]
private <K, V> void ensureInSet(Map<K, Set<V>> map, K key, V value) {
Set<V> set = map.get(key);
if (set == null) {
- set = new HashSet<V>();
+ set = new HashSet<>();
map.put(key, set);
}
set.add(value);
JavaScriptCallbackRpc.class, "call", String.class, JsonArray.class);
private AbstractClientConnector connector;
- private Map<String, JavaScriptFunction> callbacks = new HashMap<String, JavaScriptFunction>();
+ private Map<String, JavaScriptFunction> callbacks = new HashMap<>();
private JavaScriptCallbackRpc javascriptCallbackRpc;
public JavaScriptCallbackHelper(AbstractClientConnector connector) {
.getRpcInterfaces();
String interfaceName = rpcInterfaceType.getName();
if (!rpcInterfaces.containsKey(interfaceName)) {
- Set<String> methodNames = new HashSet<String>();
+ Set<String> methodNames = new HashSet<>();
for (Method method : rpcInterfaceType.getMethods()) {
methodNames.add(method.getName());
public static Collection<FieldProperty> find(Class<?> type)
throws IntrospectionException {
Field[] fields = type.getFields();
- Collection<FieldProperty> properties = new ArrayList<FieldProperty>(
+ Collection<FieldProperty> properties = new ArrayList<>(
fields.length);
for (Field field : fields) {
if (!Modifier.isStatic(field.getModifiers())) {
public static Collection<MethodProperty> find(Class<?> type)
throws IntrospectionException {
- Collection<MethodProperty> properties = new ArrayList<MethodProperty>();
+ Collection<MethodProperty> properties = new ArrayList<>();
for (PropertyDescriptor pd : Introspector.getBeanInfo(type)
.getPropertyDescriptors()) {
* happens to process Vaadin requests, so it must be protected from
* corruption caused by concurrent access.
*/
- private static ConcurrentMap<Class<?>, Collection<BeanProperty>> typePropertyCache = new ConcurrentHashMap<Class<?>, Collection<BeanProperty>>();
+ private static ConcurrentMap<Class<?>, Collection<BeanProperty>> typePropertyCache = new ConcurrentHashMap<>();
- private static Map<Class<?>, String> typeToTransportType = new HashMap<Class<?>, String>();
+ private static Map<Class<?>, String> typeToTransportType = new HashMap<>();
/**
* Note! This does not contain primitives.
* <p>
*/
- private static Map<String, Class<?>> transportTypeToType = new HashMap<String, Class<?>>();
+ private static Map<String, Class<?>> transportTypeToType = new HashMap<>();
- private static Map<Class<?>, JSONSerializer<?>> customSerializers = new HashMap<Class<?>, JSONSerializer<?>>();
+ private static Map<Class<?>, JSONSerializer<?>> customSerializers = new HashMap<>();
static {
customSerializers.put(Date.class, new DateSerializer());
}
// See #8906.
JsonArray jsonArray = (JsonArray) jsonMap;
if (jsonArray.length() == 0) {
- return new HashMap<Object, Object>();
+ return new HashMap<>();
}
}
assert (keys.length() == values.length());
- Map<Object, Object> map = new HashMap<Object, Object>(
+ Map<Object, Object> map = new HashMap<>(
keys.length() * 2);
for (int i = 0; i < keys.length(); i++) {
Object key = decodeInternalOrCustomType(keyType, keys.get(i),
private static Map<Object, Object> decodeConnectorMap(Type valueType,
JsonObject jsonMap, ConnectorTracker connectorTracker) {
- Map<Object, Object> map = new HashMap<Object, Object>();
+ Map<Object, Object> map = new HashMap<>();
for (String key : jsonMap.keys()) {
Object value = decodeInternalOrCustomType(valueType,
private static Map<Object, Object> decodeStringMap(Type valueType,
JsonObject jsonMap, ConnectorTracker connectorTracker) {
- Map<Object, Object> map = new HashMap<Object, Object>();
+ Map<Object, Object> map = new HashMap<>();
for (String key : jsonMap.keys()) {
Object value = decodeInternalOrCustomType(valueType,
boolean restrictToInternalTypes, JsonArray jsonArray,
ConnectorTracker connectorTracker) {
int arrayLength = jsonArray.length();
- List<Object> list = new ArrayList<Object>(arrayLength);
+ List<Object> list = new ArrayList<>(arrayLength);
for (int i = 0; i < arrayLength; ++i) {
// each entry always has two elements: type and value
JsonValue encodedValue = jsonArray.get(i);
private static Set<Object> decodeSet(Type targetType,
boolean restrictToInternalTypes, JsonArray jsonArray,
ConnectorTracker connectorTracker) {
- HashSet<Object> set = new HashSet<Object>();
+ HashSet<Object> set = new HashSet<>();
set.addAll(decodeList(targetType, restrictToInternalTypes, jsonArray,
connectorTracker));
return set;
if (cachedProperties != null) {
return cachedProperties;
}
- Collection<BeanProperty> properties = new ArrayList<BeanProperty>();
+ Collection<BeanProperty> properties = new ArrayList<>();
properties.addAll(MethodProperty.find(type));
properties.addAll(FieldProperty.find(type));
private int changes = 0;
- private final Set<Object> usedResources = new HashSet<Object>();
+ private final Set<Object> usedResources = new HashSet<>();
private boolean customLayoutArgumentsOpen = false;
private boolean cacheEnabled = false;
- private final Set<Class<? extends ClientConnector>> usedClientConnectors = new HashSet<Class<? extends ClientConnector>>();
+ private final Set<Class<? extends ClientConnector>> usedClientConnectors = new HashSet<>();
/**
* Creates a new JsonPaintTarget.
uidlBuffer = new PrintWriter(outWriter);
// Initialize tag-writing
- mOpenTags = new Stack<String>();
- openJsonTags = new Stack<JsonTag>();
+ mOpenTags = new Stack<>();
+ openJsonTags = new Stack<>();
- openPaintables = new Stack<ClientConnector>();
- openPaintableTags = new Stack<String>();
+ openPaintables = new Stack<>();
+ openPaintableTags = new Stack<>();
cacheEnabled = cachingRequired;
}
class JsonTag implements Serializable {
boolean firstField = false;
- Vector<Object> variables = new Vector<Object>();
+ Vector<Object> variables = new Vector<>();
- Vector<Object> children = new Vector<Object>();
+ Vector<Object> children = new Vector<>();
- Vector<Object> attr = new Vector<Object>();
+ Vector<Object> attr = new Vector<>();
StringBuilder data = new StringBuilder();
private int lastKey = 0;
- private final HashMap<V, String> objectKeyMap = new HashMap<V, String>();
+ private final HashMap<V, String> objectKeyMap = new HashMap<>();
- private final HashMap<String, V> keyObjectMap = new HashMap<String, V>();
+ private final HashMap<String, V> keyObjectMap = new HashMap<>();
/**
* Gets key for an object.
private LegacyWindow mainWindow;
private String theme;
- private Map<String, LegacyWindow> legacyUINames = new HashMap<String, LegacyWindow>();
+ private Map<String, LegacyWindow> legacyUINames = new HashMap<>();
private boolean isRunning = true;
public class LegacyCommunicationManager implements Serializable {
// TODO Refactor (#11410)
- private final HashMap<Integer, ClientCache> uiToClientCache = new HashMap<Integer, ClientCache>();
+ private final HashMap<Integer, ClientCache> uiToClientCache = new HashMap<>();
/**
* The session this communication manager is used for
private String requestThemeName;
// TODO Refactor (#11413)
- private Map<String, Class<?>> publishedFileContexts = new HashMap<String, Class<?>>();
+ private Map<String, Class<?>> publishedFileContexts = new HashMap<>();
/**
* TODO New constructor - document me!
return session;
}
- private static final ConcurrentHashMap<Class<? extends SharedState>, JsonValue> referenceDiffStates = new ConcurrentHashMap<Class<? extends SharedState>, JsonValue>();
+ private static final ConcurrentHashMap<Class<? extends SharedState>, JsonValue> referenceDiffStates = new ConcurrentHashMap<>();
/**
* @deprecated As of 7.1. See #11411.
}
}
- private final HashMap<Class<? extends ClientConnector>, Integer> typeToKey = new HashMap<Class<? extends ClientConnector>, Integer>();
+ private final HashMap<Class<? extends ClientConnector>, Integer> typeToKey = new HashMap<>();
private int nextTypeKey = 0;
/**
@Deprecated
public class ClientCache implements Serializable {
- private final Set<Object> res = new HashSet<Object>();
+ private final Set<Object> res = new HashSet<>();
/**
*
* Resources to be opened automatically on next repaint. The list is
* automatically cleared when it has been sent to the client.
*/
- private final LinkedList<OpenResource> openList = new LinkedList<OpenResource>();
+ private final LinkedList<OpenResource> openList = new LinkedList<>();
/**
* A list of notifications that are waiting to be sent to the client.
*/
public static class Styles implements Serializable {
- private LinkedHashSet<InjectedStyle> injectedStyles = new LinkedHashSet<InjectedStyle>();
+ private LinkedHashSet<InjectedStyle> injectedStyles = new LinkedHashSet<>();
- private LinkedHashSet<InjectedStyle> pendingInjections = new LinkedHashSet<InjectedStyle>();
+ private LinkedHashSet<InjectedStyle> pendingInjections = new LinkedHashSet<>();
private final UI ui;
if (target.isFullRepaint()) {
injectedStyles.addAll(pendingInjections);
pendingInjections = injectedStyles;
- injectedStyles = new LinkedHashSet<InjectedStyle>();
+ injectedStyles = new LinkedHashSet<>();
}
if (!pendingInjections.isEmpty()) {
*/
private void addNotification(Notification notification) {
if (notifications == null) {
- notifications = new LinkedList<Notification>();
+ notifications = new LinkedList<>();
}
notifications.add(notification);
uI.markAsDirty();
}
- private static final Map<Class<?>, Class<?>> boxedTypes = new HashMap<Class<?>, Class<?>>();
+ private static final Map<Class<?>, Class<?>> boxedTypes = new HashMap<>();
static {
try {
Class<?>[] boxClasses = new Class<?>[] { Boolean.class, Byte.class,
public class ServerRpcMethodInvocation extends MethodInvocation {
- private static final Map<String, Method> invocationMethodCache = new ConcurrentHashMap<String, Method>(
+ private static final Map<String, Method> invocationMethodCache = new ConcurrentHashMap<>(
128, 0.75f, 1);
private final Method method;
@SuppressWarnings("serial")
public class VaadinPortletSession extends VaadinSession {
- private final Set<PortletListener> portletListeners = new LinkedHashSet<PortletListener>();
+ private final Set<PortletListener> portletListeners = new LinkedHashSet<>();
- private final Map<String, QName> eventActionDestinationMap = new HashMap<String, QName>();
- private final Map<String, Serializable> eventActionValueMap = new HashMap<String, Serializable>();
+ private final Map<String, QName> eventActionDestinationMap = new HashMap<>();
+ private final Map<String, Serializable> eventActionValueMap = new HashMap<>();
- private final Map<String, String> sharedParameterActionNameMap = new HashMap<String, String>();
- private final Map<String, String> sharedParameterActionValueMap = new HashMap<String, String>();
+ private final Map<String, String> sharedParameterActionNameMap = new HashMap<>();
+ private final Map<String, String> sharedParameterActionValueMap = new HashMap<>();
/**
* Create a portlet service session for the given portlet service
*/
public void firePortletRenderRequest(UI uI, RenderRequest request,
RenderResponse response) {
- for (PortletListener l : new ArrayList<PortletListener>(
+ for (PortletListener l : new ArrayList<>(
portletListeners)) {
l.handleRenderRequest(request,
new RestrictedRenderResponse(response), uI);
sharedParameterActionValueMap.remove(key);
} else {
// normal action request, notify listeners
- for (PortletListener l : new ArrayList<PortletListener>(
+ for (PortletListener l : new ArrayList<>(
portletListeners)) {
l.handleActionRequest(request, response, uI);
}
*/
public void firePortletEventRequest(UI uI, EventRequest request,
EventResponse response) {
- for (PortletListener l : new ArrayList<PortletListener>(
+ for (PortletListener l : new ArrayList<>(
portletListeners)) {
l.handleEventRequest(request, response, uI);
}
*/
public void firePortletResourceRequest(UI uI, ResourceRequest request,
ResourceResponse response) {
- for (PortletListener l : new ArrayList<PortletListener>(
+ for (PortletListener l : new ArrayList<>(
portletListeners)) {
l.handleResourceRequest(request, response, uI);
}
*/
protected List<RequestHandler> createRequestHandlers()
throws ServiceException {
- ArrayList<RequestHandler> handlers = new ArrayList<RequestHandler>();
+ ArrayList<RequestHandler> handlers = new ArrayList<>();
handlers.add(new SessionRequestHandler());
handlers.add(new PublishedFileHandler());
handlers.add(new HeartbeatHandler());
if (session.getState() == State.OPEN) {
closeSession(session);
}
- ArrayList<UI> uis = new ArrayList<UI>(session.getUIs());
+ ArrayList<UI> uis = new ArrayList<>(session.getUIs());
for (final UI ui : uis) {
ui.accessSynchronously(new Runnable() {
@Override
// Stores all attributes (security key, reference to this context
// instance) so they can be added to the new session
Set<String> attributeNames = oldSession.getAttributeNames();
- HashMap<String, Object> attrs = new HashMap<String, Object>(
+ HashMap<String, Object> attrs = new HashMap<>(
attributeNames.size() * 2);
for (String name : attributeNames) {
Object value = oldSession.getAttribute(name);
* @param session
*/
private void removeClosedUIs(final VaadinSession session) {
- ArrayList<UI> uis = new ArrayList<UI>(session.getUIs());
+ ArrayList<UI> uis = new ArrayList<>(session.getUIs());
for (final UI ui : uis) {
if (ui.isClosing()) {
ui.accessSynchronously(new Runnable() {
css = json.getString("css");
timestamp = Long.parseLong(json.getString("timestamp"));
- sourceUris = new ArrayList<String>();
+ sourceUris = new ArrayList<>();
JsonArray uris = json.getArray("uris");
for (int i = 0; i < uris.length(); i++) {
return sb.toString();
}
- private static final Collection<Character> CHAR_BLACKLIST = new HashSet<Character>(
+ private static final Collection<Character> CHAR_BLACKLIST = new HashSet<>(
Arrays.asList(new Character[] { '&', '"', '\'', '<', '>', '(', ')',
';' }));
* Global cache of scss compilation results. This map is protected from
* concurrent access by {@link #SCSS_MUTEX}.
*/
- private final Map<String, ScssCacheEntry> scssCache = new HashMap<String, ScssCacheEntry>();
+ private final Map<String, ScssCacheEntry> scssCache = new HashMap<>();
/**
* Keeps track of whether a warning about not being able to persist cache
@Deprecated
private Object converterFactory;
- private LinkedList<RequestHandler> requestHandlers = new LinkedList<RequestHandler>();
+ private LinkedList<RequestHandler> requestHandlers = new LinkedList<>();
private int nextUIId = 0;
- private Map<Integer, UI> uIs = new HashMap<Integer, UI>();
+ private Map<Integer, UI> uIs = new HashMap<>();
- private final Map<String, Integer> embedIdMap = new HashMap<String, Integer>();
+ private final Map<String, Integer> embedIdMap = new HashMap<>();
private final EventRouter eventRouter = new EventRouter();
private transient WrappedSession session;
- private final Map<String, Object> attributes = new HashMap<String, Object>();
+ private final Map<String, Object> attributes = new HashMap<>();
- private LinkedList<UIProvider> uiProviders = new LinkedList<UIProvider>();
+ private LinkedList<UIProvider> uiProviders = new LinkedList<>();
private transient VaadinService service;
* session is serialized as long as it doesn't happen while some other
* thread has the lock.
*/
- private transient ConcurrentLinkedQueue<FutureAccess> pendingAccessQueue = new ConcurrentLinkedQueue<FutureAccess>();
+ private transient ConcurrentLinkedQueue<FutureAccess> pendingAccessQueue = new ConcurrentLinkedQueue<>();
/**
* Creates a new VaadinSession tied to a VaadinService.
*/
public static Collection<VaadinSession> getAllSessions(
HttpSession httpSession) {
- Set<VaadinSession> sessions = new HashSet<VaadinSession>();
+ Set<VaadinSession> sessions = new HashSet<>();
Enumeration<String> attributeNames = httpSession.getAttributeNames();
while (attributeNames.hasMoreElements()) {
Map<Class<?>, CurrentInstance> old = CurrentInstance.setCurrent(this);
try {
stream.defaultReadObject();
- pendingAccessQueue = new ConcurrentLinkedQueue<FutureAccess>();
+ pendingAccessQueue = new ConcurrentLinkedQueue<>();
} finally {
CurrentInstance.restoreInstances(old);
}
// Helper shared with WrappedPortletSession
static <T> Set<T> enumerationToSet(Enumeration<T> values) {
- HashSet<T> set = new HashSet<T>();
+ HashSet<T> set = new HashSet<>();
while (values.hasMoreElements()) {
set.add(values.nextElement());
}
*/
private Collection<ClientMethodInvocation> collectPendingRpcCalls(
Collection<ClientConnector> rpcPendingQueue) {
- List<ClientMethodInvocation> pendingInvocations = new ArrayList<ClientMethodInvocation>();
+ List<ClientMethodInvocation> pendingInvocations = new ArrayList<>();
for (ClientConnector connector : rpcPendingQueue) {
List<ClientMethodInvocation> paintablePendingRpc = connector
.retrievePendingRpcCalls();
List<ClientMethodInvocation> oldPendingRpc = pendingInvocations;
int totalCalls = pendingInvocations.size()
+ paintablePendingRpc.size();
- pendingInvocations = new ArrayList<ClientMethodInvocation>(
+ pendingInvocations = new ArrayList<>(
totalCalls);
// merge two ordered comparable lists
Collection<ClientConnector> dirtyVisibleConnectors = ui
.getConnectorTracker().getDirtyVisibleConnectors();
- List<Component> legacyComponents = new ArrayList<Component>(
+ List<Component> legacyComponents = new ArrayList<>(
dirtyVisibleConnectors.size());
for (ClientConnector connector : dirtyVisibleConnectors) {
// All Components that want to use paintContent must implement
try {
ConnectorTracker connectorTracker = ui.getConnectorTracker();
- Set<Connector> enabledConnectors = new HashSet<Connector>();
+ Set<Connector> enabledConnectors = new HashSet<>();
List<MethodInvocation> invocations = parseInvocations(
ui.getConnectorTracker(), invocationsData,
ConnectorTracker connectorTracker, JsonArray invocationsJson,
int lastSyncIdSeenByClient) {
int invocationCount = invocationsJson.length();
- ArrayList<MethodInvocation> invocations = new ArrayList<MethodInvocation>(
+ ArrayList<MethodInvocation> invocations = new ArrayList<>(
invocationCount);
MethodInvocation previousInvocation = null;
session.lock();
ArrayList<RequestHandler> requestHandlers;
try {
- requestHandlers = new ArrayList<RequestHandler>(
+ requestHandlers = new ArrayList<>(
session.getRequestHandlers());
} finally {
session.unlock();
Collection<ClientConnector> dirtyVisibleConnectors = ui
.getConnectorTracker().getDirtyVisibleConnectors();
- Set<String> writtenConnectors = new HashSet<String>();
+ Set<String> writtenConnectors = new HashSet<>();
JsonObject sharedStates = Json.createObject();
for (ClientConnector connector : dirtyVisibleConnectors) {
// encode and send shared state
// to write out
service.runPendingAccessTasks(session);
- Set<ClientConnector> processedConnectors = new HashSet<ClientConnector>();
+ Set<ClientConnector> processedConnectors = new HashSet<>();
LegacyCommunicationManager manager = session.getCommunicationManager();
ClientCache clientCache = manager.getClientCache(ui);
getLogger().log(Level.FINE, "* Creating response to client");
while (true) {
- ArrayList<ClientConnector> connectorsToProcess = new ArrayList<ClientConnector>();
+ ArrayList<ClientConnector> connectorsToProcess = new ArrayList<>();
for (ClientConnector c : uiConnectorTracker.getDirtyConnectors()) {
if (!processedConnectors.contains(c)
&& LegacyCommunicationManager
.getUsedClientConnectors();
boolean typeMappingsOpen = false;
- List<Class<? extends ClientConnector>> newConnectorTypes = new ArrayList<Class<? extends ClientConnector>>();
+ List<Class<? extends ClientConnector>> newConnectorTypes = new ArrayList<>();
for (Class<? extends ClientConnector> class1 : usedClientConnectors) {
if (clientCache.cache(class1)) {
}
});
- List<String> scriptDependencies = new ArrayList<String>();
- List<String> styleDependencies = new ArrayList<String>();
+ List<String> scriptDependencies = new ArrayList<>();
+ List<String> styleDependencies = new ArrayList<>();
for (Class<? extends ClientConnector> class1 : newConnectorTypes) {
JavaScript jsAnnotation = class1
// Sort addon styles so that CSS imports are first and SCSS import
// last
- List<String> paths = new ArrayList<String>(addonThemes.keySet());
+ List<String> paths = new ArrayList<>(addonThemes.keySet());
Collections.sort(paths, new Comparator<String>() {
@Override
}
});
- List<String> mixins = new ArrayList<String>();
+ List<String> mixins = new ArrayList<>();
for (String path : paths) {
mixins.addAll(
addImport(printStream, path, addonThemes.get(path)));
// Add import comment
printImportComment(stream, location);
- List<String> foundMixins = new ArrayList<String>();
+ List<String> foundMixins = new ArrayList<>();
if (file.endsWith(".css")) {
stream.print("@import url(\"../../../" + file + "\");\n");
*/
public static LocationInfo getAvailableWidgetSetsAndStylesheets() {
long start = System.currentTimeMillis();
- Map<String, URL> widgetsets = new HashMap<String, URL>();
- Map<String, URL> themes = new HashMap<String, URL>();
+ Map<String, URL> widgetsets = new HashMap<>();
+ Map<String, URL> themes = new HashMap<>();
Set<String> keySet = classpathLocations.keySet();
for (String location : keySet) {
searchForWidgetSetsAndAddonStyles(location, widgetsets, themes);
*/
private final static List<String> getRawClasspathEntries() {
// try to keep the order of the classpath
- List<String> locations = new ArrayList<String>();
+ List<String> locations = new ArrayList<>();
String pathSep = System.getProperty("path.separator");
String classpath = System.getProperty("java.class.path");
List<String> rawClasspathEntries) {
long start = System.currentTimeMillis();
// try to keep the order of the classpath
- Map<String, URL> locations = new LinkedHashMap<String, URL>();
+ Map<String, URL> locations = new LinkedHashMap<>();
for (String classpathEntry : rawClasspathEntries) {
File file = new File(classpathEntry);
include(null, file, locations);
public static URL getWidgetsetSourceDirectory(String widgetsetFileName) {
if (debug) {
debug("classpathLocations values:");
- ArrayList<String> locations = new ArrayList<String>(
+ ArrayList<String> locations = new ArrayList<>(
classpathLocations.keySet());
for (String location : locations) {
debug(String.valueOf(classpathLocations.get(location)));
private static Collection<String> getCurrentInheritedWidgetsets(
String content) {
- HashSet<String> hashSet = new HashSet<String>();
+ HashSet<String> hashSet = new HashSet<>();
Pattern inheritsPattern = Pattern.compile(" name=\"([^\"]*)\"");
Matcher matcher = inheritsPattern.matcher(content);
}
};
// Maps each component to a position
- private LinkedHashMap<Component, ComponentPosition> componentToCoordinates = new LinkedHashMap<Component, ComponentPosition>();
+ private LinkedHashMap<Component, ComponentPosition> componentToCoordinates = new LinkedHashMap<>();
/**
* Creates an AbsoluteLayout with full size.
// Map<Connector,String> was supported. We cannot get the child
// connectorId unless the component is attached to the application so
// the String->String map cannot be populated in internal* either.
- Map<String, String> connectorToPosition = new HashMap<String, String>();
+ Map<String, String> connectorToPosition = new HashMap<>();
for (Iterator<Component> ci = getComponentIterator(); ci.hasNext();) {
Component c = ci.next();
connectorToPosition.put(c.getConnectorId(),
return;
}
if (getState().styles == null) {
- getState().styles = new ArrayList<String>();
+ getState().styles = new ArrayList<>();
}
List<String> styles = getState().styles;
styles.clear();
}
if (getState().styles == null) {
- getState().styles = new ArrayList<String>();
+ getState().styles = new ArrayList<>();
}
List<String> styles = getState().styles;
if (!styles.contains(style)) {
}
// check for unsupported attributes
- Set<String> supported = new HashSet<String>();
+ Set<String> supported = new HashSet<>();
supported.addAll(getDefaultAttributes());
supported.addAll(getCustomAttributes());
for (Attribute a : attr) {
}
} else {
// remove responsive extensions
- List<Extension> extensions = new ArrayList<Extension>(
+ List<Extension> extensions = new ArrayList<>(
getExtensions());
for (Extension e : extensions) {
if (e instanceof Responsive) {
* implementation
*/
protected Collection<String> getCustomAttributes() {
- ArrayList<String> l = new ArrayList<String>(
+ ArrayList<String> l = new ArrayList<>(
Arrays.asList(customAttributes));
if (this instanceof Focusable) {
l.add("tab-index");
*/
@Override
public void removeAllComponents() {
- final LinkedList<Component> l = new LinkedList<Component>();
+ final LinkedList<Component> l = new LinkedList<>();
// Adds all components
for (final Iterator<Component> i = getComponentIterator(); i
*/
@Override
public void moveComponentsFrom(ComponentContainer source) {
- final LinkedList<Component> components = new LinkedList<Component>();
+ final LinkedList<Component> components = new LinkedList<>();
for (final Iterator<Component> i = source.getComponentIterator(); i
.hasNext();) {
components.add(i.next());
: ComponentSizeValidator.checkWidths(component);
if (!valid) {
if (components == null) {
- components = new HashSet<Component>();
+ components = new HashSet<>();
}
components.add(component);
}
* @return The sources pointed to in this media.
*/
public List<Resource> getSources() {
- ArrayList<Resource> sources = new ArrayList<Resource>();
+ ArrayList<Resource> sources = new ArrayList<>();
for (URLReference ref : getState(false).sources) {
sources.add(((ResourceReference) ref).getResource());
}
/**
* Custom layout slots containing the components.
*/
- protected LinkedList<Component> components = new LinkedList<Component>();
+ protected LinkedList<Component> components = new LinkedList<>();
private Alignment defaultComponentAlignment = Alignment.TOP_LEFT;
*/
public class ConnectorTracker implements Serializable {
- private final HashMap<String, ClientConnector> connectorIdToConnector = new HashMap<String, ClientConnector>();
- private Set<ClientConnector> dirtyConnectors = new HashSet<ClientConnector>();
- private Set<ClientConnector> uninitializedConnectors = new HashSet<ClientConnector>();
+ private final HashMap<String, ClientConnector> connectorIdToConnector = new HashMap<>();
+ private Set<ClientConnector> dirtyConnectors = new HashSet<>();
+ private Set<ClientConnector> uninitializedConnectors = new HashSet<>();
/**
* Connectors that have been unregistered and should be cleaned up the next
* time {@link #cleanConnectorMap()} is invoked unless they have been
* registered again.
*/
- private final Set<ClientConnector> unregisteredConnectors = new HashSet<ClientConnector>();
+ private final Set<ClientConnector> unregisteredConnectors = new HashSet<>();
private boolean writingResponse = false;
private UI uI;
- private transient Map<ClientConnector, JsonObject> diffStates = new HashMap<ClientConnector, JsonObject>();
+ private transient Map<ClientConnector, JsonObject> diffStates = new HashMap<>();
/** Maps connectorIds to a map of named StreamVariables */
private Map<String, Map<String, StreamVariable>> pidToNameToStreamVariable;
* @see #getCurrentSyncId()
* @see #cleanConcurrentlyRemovedConnectorIds(long)
*/
- private TreeMap<Integer, Set<String>> syncIdToUnregisteredConnectorIds = new TreeMap<Integer, Set<String>>();
+ private TreeMap<Integer, Set<String>> syncIdToUnregisteredConnectorIds = new TreeMap<>();
/**
* Gets a logger for this class
Set<String> unregisteredConnectorIds = syncIdToUnregisteredConnectorIds
.get(currentSyncId);
if (unregisteredConnectorIds == null) {
- unregisteredConnectorIds = new HashSet<String>();
+ unregisteredConnectorIds = new HashSet<>();
syncIdToUnregisteredConnectorIds.put(currentSyncId,
unregisteredConnectorIds);
}
private boolean isHierarchyComplete() {
boolean noErrors = true;
- Set<ClientConnector> danglingConnectors = new HashSet<ClientConnector>(
+ Set<ClientConnector> danglingConnectors = new HashSet<>(
connectorIdToConnector.values());
- LinkedList<ClientConnector> stack = new LinkedList<ClientConnector>();
+ LinkedList<ClientConnector> stack = new LinkedList<>();
stack.add(uI);
while (!stack.isEmpty()) {
ClientConnector connector = stack.pop();
*/
public ArrayList<ClientConnector> getDirtyVisibleConnectors() {
Collection<ClientConnector> dirtyConnectors = getDirtyConnectors();
- ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<ClientConnector>(
+ ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<>(
dirtyConnectors.size());
for (ClientConnector c : dirtyConnectors) {
if (LegacyCommunicationManager.isConnectorVisibleToClient(c)) {
out.defaultWriteObject();
// Convert JsonObjects in diff state to String representation as
// JsonObject is not serializable
- HashMap<ClientConnector, String> stringDiffStates = new HashMap<ClientConnector, String>(
+ HashMap<ClientConnector, String> stringDiffStates = new HashMap<>(
diffStates.size() * 2);
for (ClientConnector key : diffStates.keySet()) {
stringDiffStates.put(key, diffStates.get(key).toString());
// Read String versions of JsonObjects and parse into JsonObjects as
// JsonObject is not serializable
- diffStates = new HashMap<ClientConnector, JsonObject>();
+ diffStates = new HashMap<>();
@SuppressWarnings("unchecked")
HashMap<ClientConnector, String> stringDiffStates = (HashMap<ClientConnector, String>) in
.readObject();
- diffStates = new HashMap<ClientConnector, JsonObject>(
+ diffStates = new HashMap<>(
stringDiffStates.size() * 2);
for (ClientConnector key : stringDiffStates.keySet()) {
try {
StreamVariable variable) {
assert getConnector(connectorId) != null;
if (pidToNameToStreamVariable == null) {
- pidToNameToStreamVariable = new HashMap<String, Map<String, StreamVariable>>();
+ pidToNameToStreamVariable = new HashMap<>();
}
Map<String, StreamVariable> nameToStreamVariable = pidToNameToStreamVariable
.get(connectorId);
if (nameToStreamVariable == null) {
- nameToStreamVariable = new HashMap<String, StreamVariable>();
+ nameToStreamVariable = new HashMap<>();
pidToNameToStreamVariable.put(connectorId, nameToStreamVariable);
}
nameToStreamVariable.put(variableName, variable);
if (streamVariableToSeckey == null) {
- streamVariableToSeckey = new HashMap<StreamVariable, String>();
+ streamVariableToSeckey = new HashMap<>();
}
String seckey = streamVariableToSeckey.get(variable);
if (seckey == null) {
/**
* Custom layout slots containing the components.
*/
- protected LinkedList<Component> components = new LinkedList<Component>();
+ protected LinkedList<Component> components = new LinkedList<>();
/**
* Constructs an empty CssLayout.
/**
* Custom layout slots containing the components.
*/
- private final HashMap<String, Component> slots = new HashMap<String, Component>();
+ private final HashMap<String, Component> slots = new HashMap<>();
/**
* Default constructor only used by subclasses. Subclasses are responsible
}
};
- private Map<String, ProxyReceiver> receivers = new HashMap<String, ProxyReceiver>();
+ private Map<String, ProxyReceiver> receivers = new HashMap<>();
public class WrapperTargetDetails extends TargetDetailsImpl {
COMPONENT_OTHER,
}
- private final Map<String, Object> html5DataFlavors = new LinkedHashMap<String, Object>();
+ private final Map<String, Object> html5DataFlavors = new LinkedHashMap<>();
private DragStartMode dragStartMode = DragStartMode.NONE;
private Component dragImageComponent = null;
- private Set<String> sentIds = new HashSet<String>();
+ private Set<String> sentIds = new HashSet<>();
/**
* This is an internal constructor. Use
/**
* Hash of object parameters.
*/
- private final Map<String, String> parameters = new HashMap<String, String>();
+ private final Map<String, String> parameters = new HashMap<>();
/**
* Applet or other client side runnable properties.
*/
public void setParameter(String name, String value) {
if (getState().embedParams == null) {
- getState().embedParams = new HashMap<String, String>();
+ getState().embedParams = new HashMap<>();
}
getState().embedParams.put(name, value);
requestRepaint();
super.writeDesign(design, designContext);
// Parameters, in alphabetic order
- ArrayList<String> paramNames = new ArrayList<String>();
+ ArrayList<String> paramNames = new ArrayList<>();
for (String param : getParameterNames()) {
paramNames.add(param);
}
*/
private int cursorY = 0;
- private final LinkedList<Component> components = new LinkedList<Component>();
+ private final LinkedList<Component> components = new LinkedList<>();
- private Map<Integer, Float> columnExpandRatio = new HashMap<Integer, Float>();
- private Map<Integer, Float> rowExpandRatio = new HashMap<Integer, Float>();
+ private Map<Integer, Float> columnExpandRatio = new HashMap<>();
+ private Map<Integer, Float> rowExpandRatio = new HashMap<>();
private Alignment defaultComponentAlignment = Alignment.TOP_LEFT;
/**
setMargin(readMargin(design, getMargin(), designContext));
- List<Element> rowElements = new ArrayList<Element>();
- List<Map<Integer, Component>> rows = new ArrayList<Map<Integer, Component>>();
+ List<Element> rowElements = new ArrayList<>();
+ List<Map<Integer, Component>> rows = new ArrayList<>();
// Prepare a 2D map for reading column contents
for (Element e : design.children()) {
if (e.tagName().equalsIgnoreCase("row")) {
}
}
setRows(Math.max(rows.size(), 1));
- Map<Component, Alignment> alignments = new HashMap<Component, Alignment>();
- List<Integer> columnExpandRatios = new ArrayList<Integer>();
+ Map<Component, Alignment> alignments = new HashMap<>();
+ List<Integer> columnExpandRatios = new ArrayList<>();
for (int row = 0; row < rowElements.size(); ++row) {
Element rowElement = rowElements.get(row);
}
// Reiterate through the 2D map and add components to GridLayout
- Set<Component> visited = new HashSet<Component>();
+ Set<Component> visited = new HashSet<>();
// Ignore any missing components
visited.add(null);
}
// Go through the map and write only needed column tags
- Set<Connector> visited = new HashSet<Connector>();
+ Set<Connector> visited = new HashSet<>();
// Skip the dummy placeholder
visited.add(dummyComponent);
* @since 7.0.0
*/
public class JavaScript extends AbstractExtension {
- private Map<String, JavaScriptFunction> functions = new HashMap<String, JavaScriptFunction>();
+ private Map<String, JavaScriptFunction> functions = new HashMap<>();
// Can not be defined in client package as this JSONArray is not available
// in GWT
* URL in the method or the password manager will not be triggered.
*/
private void login() {
- HashMap<String, String> params = new HashMap<String, String>();
+ HashMap<String, String> params = new HashMap<>();
params.put("username", getUsernameField().getValue());
params.put("password", getPasswordField().getValue());
LoginEvent event = new LoginEvent(LoginForm.this, params);
/** Deserialize changes received from client. */
@Override
public void changeVariables(Object source, Map<String, Object> variables) {
- Stack<MenuItem> items = new Stack<MenuItem>();
+ Stack<MenuItem> items = new Stack<>();
boolean found = false;
if (variables.containsKey("clickedId")) {
* Constructs an empty, horizontal menu
*/
public MenuBar() {
- menuItems = new ArrayList<MenuItem>();
+ menuItems = new ArrayList<>();
setMoreMenuItem(null);
}
}
if (itsChildren == null) {
- itsChildren = new ArrayList<MenuItem>();
+ itsChildren = new ArrayList<>();
}
MenuItem newItem = new MenuItem(caption, icon, command);
}
String caption = "";
- List<Element> subMenus = new ArrayList<Element>();
+ List<Element> subMenus = new ArrayList<>();
for (Node node : menuElement.childNodes()) {
if (node instanceof Element
&& ((Element) node).tagName().equals("menu")) {
}
if (!subMenus.isEmpty()) {
- menu.itsChildren = new ArrayList<MenuItem>();
+ menu.itsChildren = new ArrayList<>();
}
for (Element subMenu : subMenus) {
* there is a {@link Tab} object in tabs for each tab with meta-data about
* the tab.
*/
- private final ArrayList<Component> components = new ArrayList<Component>();
+ private final ArrayList<Component> components = new ArrayList<>();
/**
* Map containing information related to the tabs (caption, icon etc).
*/
- private final HashMap<Component, Tab> tabs = new HashMap<Component, Tab>();
+ private final HashMap<Component, Tab> tabs = new HashMap<>();
/**
* Selected tab content component.
* Mapper between server-side component instances (tab contents) and keys
* given to the client that identify tabs.
*/
- private final KeyMapper<Component> keyMapper = new KeyMapper<Component>();
+ private final KeyMapper<Component> keyMapper = new KeyMapper<>();
/**
* Handler to be called when a tab is closed.
/**
* List of windows in this UI.
*/
- private final LinkedHashSet<Window> windows = new LinkedHashSet<Window>();
+ private final LinkedHashSet<Window> windows = new LinkedHashSet<>();
/**
* The component that should be scrolled into view after the next repaint.
public Iterator<Component> iterator() {
// TODO could directly create some kind of combined iterator instead of
// creating a new ArrayList
- ArrayList<Component> components = new ArrayList<Component>();
+ ArrayList<Component> components = new ArrayList<>();
if (getContent() != null) {
components.add(getContent());
*/
public void addProgressListener(ProgressListener listener) {
if (progressListeners == null) {
- progressListeners = new LinkedHashSet<ProgressListener>();
+ progressListeners = new LinkedHashSet<>();
}
progressListeners.add(listener);
}
/**
* Holds registered CloseShortcut instances for query and later removal
*/
- private List<CloseShortcut> closeShortcuts = new ArrayList<CloseShortcut>(
+ private List<CloseShortcut> closeShortcuts = new ArrayList<>(
4);
/**
@Override
protected void readDesignChildren(Elements children,
DesignContext context) {
- List<Component> descriptions = new ArrayList<Component>();
+ List<Component> descriptions = new ArrayList<>();
Elements content = new Elements();
for (Element child : children) {
return Logger.getLogger(DesignAttributeHandler.class.getName());
}
- private static Map<Class<?>, AttributeCacheEntry> cache = new ConcurrentHashMap<Class<?>, AttributeCacheEntry>();
+ private static Map<Class<?>, AttributeCacheEntry> cache = new ConcurrentHashMap<>();
// translates string <-> object
private static DesignFormatter FORMATTER = new DesignFormatter();
for (Attribute a : attr.asList()) {
attr.remove(a.getKey());
}
- List<Node> children = new ArrayList<Node>();
+ List<Node> children = new ArrayList<>();
children.addAll(design.childNodes());
for (Node node : children) {
node.remove();
* @author Vaadin Ltd
*/
private static class AttributeCacheEntry implements Serializable {
- private Map<String, Method[]> accessMethods = new ConcurrentHashMap<String, Method[]>();
+ private Map<String, Method[]> accessMethods = new ConcurrentHashMap<>();
private void addAttribute(String attribute, Method getter,
Method setter) {
}
private Collection<String> getAttributes() {
- ArrayList<String> attributes = new ArrayList<String>();
+ ArrayList<String> attributes = new ArrayList<>();
attributes.addAll(accessMethods.keySet());
return attributes;
}
private static final String VAADIN7_UI_PACKAGE = "com.vaadin.v7.ui";
// cache for object instances
- private static Map<Class<?>, Component> instanceCache = new ConcurrentHashMap<Class<?>, Component>();
+ private static Map<Class<?>, Component> instanceCache = new ConcurrentHashMap<>();
// The root component of the component hierarchy
private Component rootComponent = null;
public static final String CAPTION_ATTRIBUTE = "caption";
public static final String LOCAL_ID_ATTRIBUTE = "_id";
// Mappings from ids to components. Modified when reading from design.
- private Map<String, Component> idToComponent = new HashMap<String, Component>();
- private Map<String, Component> localIdToComponent = new HashMap<String, Component>();
- private Map<String, Component> captionToComponent = new HashMap<String, Component>();
+ private Map<String, Component> idToComponent = new HashMap<>();
+ private Map<String, Component> localIdToComponent = new HashMap<>();
+ private Map<String, Component> captionToComponent = new HashMap<>();
// Mapping from components to local ids. Accessed when writing to
// design. Modified when reading from design.
- private Map<Component, String> componentToLocalId = new HashMap<Component, String>();
+ private Map<Component, String> componentToLocalId = new HashMap<>();
private Document doc; // required for calling createElement(String)
// namespace mappings
- private Map<String, String> packageToPrefix = new HashMap<String, String>();
- private Map<String, String> prefixToPackage = new HashMap<String, String>();
- private final Map<Component, Map<String, String>> customAttributes = new HashMap<Component, Map<String, String>>();
+ private Map<String, String> packageToPrefix = new HashMap<>();
+ private Map<String, String> prefixToPackage = new HashMap<>();
+ private final Map<Component, Map<String, String>> customAttributes = new HashMap<>();
// component creation listeners
- private List<ComponentCreationListener> listeners = new ArrayList<ComponentCreationListener>();
+ private List<ComponentCreationListener> listeners = new ArrayList<>();
private ShouldWriteDataDelegate shouldWriteDataDelegate = ShouldWriteDataDelegate.DEFAULT;
Map<String, String> map = customAttributes.get(component);
if (map == null) {
customAttributes.put(component,
- map = new HashMap<String, String>());
+ map = new HashMap<>());
}
map.put(attribute, value);
}
*/
public class DesignFormatter implements Serializable {
- private final Map<Class<?>, Converter<String, ?>> converterMap = new ConcurrentHashMap<Class<?>, Converter<String, ?>>();
+ private final Map<Class<?>, Converter<String, ?>> converterMap = new ConcurrentHashMap<>();
private final Converter<String, Object> stringObjectConverter = new DesignObjectConverter();
/**
// the instance containing the bound fields
private Object bindTarget;
// mapping between field names and Fields
- private Map<String, Field> fieldMap = new HashMap<String, Field>();
+ private Map<String, Field> fieldMap = new HashMap<>();
/**
* Creates a new instance of LayoutFieldBinder.
* @return a collection of fields assignable to Component that are not bound
*/
public Collection<String> getUnboundFields() throws FieldBindingException {
- List<String> unboundFields = new ArrayList<String>();
+ List<String> unboundFields = new ArrayList<>();
for (Field f : fieldMap.values()) {
try {
Object value = getFieldValue(bindTarget, f);
*/
protected static List<java.lang.reflect.Field> getFields(
Class<?> searchClass) {
- ArrayList<java.lang.reflect.Field> memberFields = new ArrayList<java.lang.reflect.Field>();
+ ArrayList<java.lang.reflect.Field> memberFields = new ArrayList<>();
for (java.lang.reflect.Field memberField : searchClass
.getDeclaredFields()) {
return ((ExternalResource) value).getURL();
}
- private static Map<Class<? extends Resource>, ResourceConverterByProtocol> typeToConverter = new HashMap<Class<? extends Resource>, ResourceConverterByProtocol>();
+ private static Map<Class<? extends Resource>, ResourceConverterByProtocol> typeToConverter = new HashMap<>();
static {
typeToConverter.put(ExternalResource.class, HTTP);
// ^ any of non-specialized would actually work
private final Map<String, Integer> presentationMap;
public DesignShortcutActionConverter() {
- HashMap<Integer, String> codes = new HashMap<Integer, String>();
+ HashMap<Integer, String> codes = new HashMap<>();
// map modifiers
codes.put(ModifierKey.ALT, "alt");
codes.put(ModifierKey.CTRL, "ctrl");
keyCodeMap = Collections.unmodifiableMap(codes);
- HashMap<String, Integer> presentations = new HashMap<String, Integer>();
+ HashMap<String, Integer> presentations = new HashMap<>();
for (Entry<Integer, String> entry : keyCodeMap.entrySet()) {
presentations.put(entry.getValue(), entry.getKey());
}
*/
public static final ShortcutKeyMapper DEFAULT = new ShortcutKeyMapper() {
- private final Map<Integer, String> keyCodeMap = new ConcurrentHashMap<Integer, String>();
- private final Map<String, Integer> presentationMap = new ConcurrentHashMap<String, Integer>();
+ private final Map<Integer, String> keyCodeMap = new ConcurrentHashMap<>();
+ private final Map<String, Integer> presentationMap = new ConcurrentHashMap<>();
{
// map modifiers
*/
public static void writeHierarchyInformation(ClientConnector connector,
StringBuilder builder) {
- LinkedList<ClientConnector> h = new LinkedList<ClientConnector>();
+ LinkedList<ClientConnector> h = new LinkedList<>();
h.add(connector);
ClientConnector parent = connector.getParent();
while (parent != null) {
return null;
}
- Map<Class<?>, CurrentInstance> value = new HashMap<Class<?>, CurrentInstance>();
+ Map<Class<?>, CurrentInstance> value = new HashMap<>();
// Copy all inheritable values to child map
for (Entry<Class<?>, CurrentInstance> e : parentValue.entrySet()) {
};
private CurrentInstance(Object instance, boolean inheritable) {
- this.instance = new WeakReference<Object>(instance);
+ this.instance = new WeakReference<>(instance);
this.inheritable = inheritable;
}
} else {
assert type.isInstance(instance) : "Invald instance type";
if (map == null) {
- map = new HashMap<Class<?>, CurrentInstance>();
+ map = new HashMap<>();
instances.set(map);
}
if (map == null) {
return Collections.emptyMap();
} else {
- Map<Class<?>, CurrentInstance> copy = new HashMap<Class<?>, CurrentInstance>();
+ Map<Class<?>, CurrentInstance> copy = new HashMap<>();
boolean removeStale = false;
for (Class<?> c : map.keySet()) {
CurrentInstance ci = map.get(c);
*/
public static Map<Class<?>, CurrentInstance> setCurrent(
VaadinSession session) {
- Map<Class<?>, CurrentInstance> old = new HashMap<Class<?>, CurrentInstance>();
+ Map<Class<?>, CurrentInstance> old = new HashMap<>();
old.put(VaadinSession.class, set(VaadinSession.class, session, true));
VaadinService service = null;
if (session != null) {
/**
* File extension to MIME type mapping. All extensions are in lower case.
*/
- static private Hashtable<String, String> extToMIMEMap = new Hashtable<String, String>();
+ static private Hashtable<String, String> extToMIMEMap = new Hashtable<>();
/**
* MIME type to Icon mapping.
*/
- static private Hashtable<String, Resource> MIMEToIconMap = new Hashtable<String, Resource>();
+ static private Hashtable<String, Resource> MIMEToIconMap = new Hashtable<>();
static {
@Override
public <S> Result<S> flatMap(Function<String, Result<S>> mapper) {
- return new SimpleResult<S>(null, "bar");
+ return new SimpleResult<>(null, "bar");
}
};
Result<String> mapResult = result.map(value -> {
@Test
public void changeVariables_isSourceConnectorEnabledCalled() {
- final List<Level> levels = new ArrayList<Level>();
+ final List<Level> levels = new ArrayList<>();
Logger.getLogger(DragAndDropService.class.getName())
.addHandler(new StreamHandler() {
@Override
levels.add(record.getLevel());
}
});
- Map<String, Object> variables = new HashMap<String, Object>();
+ Map<String, Object> variables = new HashMap<>();
final boolean[] isConnectorEnabledCalled = new boolean[1];
AbstractComponent component = new AbstractComponent() {
@Override
@Test
public void changeVariables_isTargetConnectorEnabledCalled() {
- final List<Level> levels = new ArrayList<Level>();
+ final List<Level> levels = new ArrayList<>();
Logger.getLogger(DragAndDropService.class.getName())
.addHandler(new StreamHandler() {
@Override
levels.add(record.getLevel());
}
});
- Map<String, Object> variables = new HashMap<String, Object>();
+ Map<String, Object> variables = new HashMap<>();
TestDropTarget target = new TestDropTarget();
variables.put("dhowner", target);
public void testStringToBeanMapSerialization() throws Exception {
Type mapType = getClass().getDeclaredField("stringToStateMap")
.getGenericType();
- stringToStateMap = new HashMap<String, AbstractSplitPanelState>();
+ stringToStateMap = new HashMap<>();
AbstractSplitPanelState s = new AbstractSplitPanelState();
AbstractSplitPanelState s2 = new AbstractSplitPanelState();
s.caption = "State 1";
public void testBeanToStringMapSerialization() throws Exception {
Type mapType = getClass().getDeclaredField("stateToStringMap")
.getGenericType();
- stateToStringMap = new HashMap<AbstractSplitPanelState, String>();
+ stateToStringMap = new HashMap<>();
AbstractSplitPanelState s = new AbstractSplitPanelState();
AbstractSplitPanelState s2 = new AbstractSplitPanelState();
s.caption = "State 1";
* chance of leaking memory if the session is not unlocked in the right way,
* but it should be acceptable for testing use.
*/
- private static final ThreadLocal<MockVaadinSession> referenceKeeper = new ThreadLocal<MockVaadinSession>();
+ private static final ThreadLocal<MockVaadinSession> referenceKeeper = new ThreadLocal<>();
public MockVaadinSession(VaadinService service) {
super(service);
}
public static List<StrBean> generateRandomBeans(int max) {
- List<StrBean> data = new ArrayList<StrBean>();
+ List<StrBean> data = new ArrayList<>();
Random r = new Random(13337);
data.add(new StrBean("Xyz", 10, max));
for (int i = 0; i < max - 1; ++i) {
private static <T> List<Class<? extends T>> findClasses(Class<T> baseClass,
String basePackage, String[] ignoredPackages) throws IOException {
- List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
+ List<Class<? extends T>> classes = new ArrayList<>();
String basePackageDirName = "/" + basePackage.replace('.', '/');
URL location = VaadinSession.class.getResource(basePackageDirName);
if (location.getProtocol().equals("file")) {
throws IOException {
List<Class<? extends T>> classes = findClasses(baseClass, basePackage,
ignoredPackages);
- List<Class<? extends T>> classesNoTests = new ArrayList<Class<? extends T>>();
+ List<Class<? extends T>> classesNoTests = new ArrayList<>();
for (Class<? extends T> clazz : classes) {
if (!clazz.getName().contains("Test")) {
boolean testPresent = false;
private static final ComponentFactory defaultFactory = Design
.getComponentFactory();
- private static final ThreadLocal<ComponentFactory> currentComponentFactory = new ThreadLocal<ComponentFactory>();
+ private static final ThreadLocal<ComponentFactory> currentComponentFactory = new ThreadLocal<>();
// Set static component factory that delegate to a thread local factory
static {
@Test
public void testComponentFactoryLogging() {
- final List<String> messages = new ArrayList<String>();
+ final List<String> messages = new ArrayList<>();
currentComponentFactory.set(new ComponentFactory() {
@Override
public Component createComponent(String fullyQualifiedClassName,
@Test
public void testGetDefaultInstanceUsesComponentFactory() {
- final List<String> classes = new ArrayList<String>();
+ final List<String> classes = new ArrayList<>();
currentComponentFactory.set(new ComponentFactory() {
@Override
public Component createComponent(String fullyQualifiedClassName,
private static final ComponentMapper defaultMapper = Design
.getComponentMapper();
- private static final ThreadLocal<ComponentMapper> currentMapper = new ThreadLocal<ComponentMapper>();
+ private static final ThreadLocal<ComponentMapper> currentMapper = new ThreadLocal<>();
static {
Design.setComponentMapper(new ComponentMapper() {
private static boolean debug = false;
- private final Map<Class<?>, EqualsAsserter<?>> comparators = new HashMap<Class<?>, EqualsAsserter<?>>();
+ private final Map<Class<?>, EqualsAsserter<?>> comparators = new HashMap<>();
private static EqualsAsserter standardEqualsComparator = new EqualsAsserter<Object>() {
@Override
}
private List<EqualsAsserter<Object>> getComparators(Object o1) {
- List<EqualsAsserter<Object>> result = new ArrayList<EqualsAsserter<Object>>();
+ List<EqualsAsserter<Object>> result = new ArrayList<>();
getComparators(o1.getClass(), result);
return result;
}
}
public static class TestLogHandler {
- final List<String> messages = new ArrayList<String>();
+ final List<String> messages = new ArrayList<>();
Handler handler = new Handler() {
@Override
public void publish(LogRecord record) {
* include close tags
*/
private String elementToHtml(Element producedElem, StringBuilder sb) {
- HashSet<String> booleanAttributes = new HashSet<String>();
- ArrayList<String> names = new ArrayList<String>();
+ HashSet<String> booleanAttributes = new HashSet<>();
+ ArrayList<String> names = new ArrayList<>();
for (Attribute a : producedElem.attributes().asList()) {
names.add(a.getKey());
if (a instanceof BooleanAttribute) {
&& SharedUtil.equals(other.getIcon(), act.getIcon())
&& act.getKeyCode() == other.getKeyCode()
&& act.getModifiers().length == other.getModifiers().length) {
- HashSet<Integer> thisSet = new HashSet<Integer>(
+ HashSet<Integer> thisSet = new HashSet<>(
act.getModifiers().length);
// this is a bit tricky comparison, but there is no nice way of
// making int[] into a Set
private void assertJsoupTreeEquals(Element expected, Element actual) {
Assert.assertEquals(expected.tagName(), actual.tagName());
- Set<String> keys = new HashSet<String>();
+ Set<String> keys = new HashSet<>();
for (Attribute attr : expected.attributes().asList()) {
keys.add(attr.getKey());
@Test
public void testHashCodeUniqueness() {
- HashSet<ShortcutAction> set = new HashSet<ShortcutAction>();
+ HashSet<ShortcutAction> set = new HashSet<>();
for (String modifier : new String[] { "^", "&", "_", "&^", "&_", "_^",
"&^_" }) {
for (String key : KEYS) {
&& SharedUtil.equals(other.getIcon(), act.getIcon())
&& act.getKeyCode() == other.getKeyCode()
&& act.getModifiers().length == other.getModifiers().length) {
- HashSet<Integer> thisSet = new HashSet<Integer>(
+ HashSet<Integer> thisSet = new HashSet<>(
act.getModifiers().length);
// this is a bit tricky comparison, but there is no nice way of
// making int[] into a Set
public void testClassesSerializable() throws Exception {
List<String> rawClasspathEntries = getRawClasspathEntries();
- List<String> classes = new ArrayList<String>();
+ List<String> classes = new ArrayList<>();
for (String location : rawClasspathEntries) {
classes.addAll(findServerClasses(location));
}
- ArrayList<Class<?>> nonSerializableClasses = new ArrayList<Class<?>>();
+ ArrayList<Class<?>> nonSerializableClasses = new ArrayList<>();
for (String className : classes) {
Class<?> cls = Class.forName(className);
// skip annotations and synthetic classes
//
private final static List<String> getRawClasspathEntries() {
// try to keep the order of the classpath
- List<String> locations = new ArrayList<String>();
+ List<String> locations = new ArrayList<>();
String pathSep = System.getProperty("path.separator");
String classpath = System.getProperty("java.class.path");
*/
private List<String> findServerClasses(String classpathEntry)
throws IOException {
- Collection<String> classes = new ArrayList<String>();
+ Collection<String> classes = new ArrayList<>();
File file = new File(classpathEntry);
if (file.isDirectory()) {
return Collections.emptyList();
}
- List<String> filteredClasses = new ArrayList<String>();
+ List<String> filteredClasses = new ArrayList<>();
for (String className : classes) {
boolean ok = false;
for (String basePackage : BASE_PACKAGES) {
* @throws IOException
*/
private Collection<String> findClassesInJar(File file) throws IOException {
- Collection<String> classes = new ArrayList<String>();
+ Collection<String> classes = new ArrayList<>();
JarFile jar = new JarFile(file);
Enumeration<JarEntry> e = jar.entries();
parentPackage += ".";
}
- Collection<String> classNames = new ArrayList<String>();
+ Collection<String> classNames = new ArrayList<>();
// add all directories recursively
File[] files = parent.listFiles();
@Test
public void testAdd() {
- KeyMapper<Object> mapper = new KeyMapper<Object>();
+ KeyMapper<Object> mapper = new KeyMapper<>();
Object o1 = new Object();
Object o2 = new Object();
Object o3 = new Object();
@Test
public void testRemoveAll() {
- KeyMapper<Object> mapper = new KeyMapper<Object>();
+ KeyMapper<Object> mapper = new KeyMapper<>();
Object o1 = new Object();
Object o2 = new Object();
Object o3 = new Object();
@Test
public void testRemove() {
- KeyMapper<Object> mapper = new KeyMapper<Object>();
+ KeyMapper<Object> mapper = new KeyMapper<>();
Object o1 = new Object();
Object o2 = new Object();
Object o3 = new Object();
}
public static <E extends ConnectorEvent> E eventEquals(E expected) {
- EasyMock.reportMatcher(new EventEquals<E>(expected));
+ EasyMock.reportMatcher(new EventEquals<>(expected));
return null;
}
}
private static void findAllListenerMethods() {
- Set<Class<?>> classes = new HashSet<Class<?>>();
+ Set<Class<?>> classes = new HashSet<>();
for (Class<?> c : VaadinClasses.getAllServerSideClasses()) {
while (c != null && c.getName().startsWith("com.vaadin.")) {
classes.add(c);
@Test
public void testThatComponentsHaveNoFinalMethods() {
- HashSet<Class<?>> tested = new HashSet<Class<?>>();
+ HashSet<Class<?>> tested = new HashSet<>();
for (Class<? extends Component> c : VaadinClasses.getComponents()) {
ensureNoFinalMethods(c, tested);
}
public class StateGetDoesNotMarkDirtyTest {
- private Set<String> excludedMethods = new HashSet<String>();
+ private Set<String> excludedMethods = new HashSet<>();
@Before
public void setUp() {
Component newInstance = construct(c);
prepareMockUI(newInstance);
- Set<Method> methods = new HashSet<Method>();
+ Set<Method> methods = new HashSet<>();
methods.addAll(Arrays.asList(c.getMethods()));
methods.addAll(Arrays.asList(c.getDeclaredMethods()));
for (Method method : methods) {
private Integer getBufferSize() throws IllegalAccessException {
Field[] fields = CustomLayout.class.getDeclaredFields();
- List<Field> list = new ArrayList<Field>(fields.length);
+ List<Field> list = new ArrayList<>(fields.length);
for (Field field : fields) {
if ((field.getModifiers() & Modifier.STATIC) > 0) {
list.add(field);
public void testResolutionHigherOrEqualToYear() {
Iterable<Resolution> higherOrEqual = Resolution
.getResolutionsHigherOrEqualTo(Resolution.YEAR);
- ArrayList<Resolution> expected = new ArrayList<Resolution>();
+ ArrayList<Resolution> expected = new ArrayList<>();
expected.add(Resolution.YEAR);
TestUtil.assertIterableEquals(expected, higherOrEqual);
}
public void testResolutionHigherOrEqualToDay() {
Iterable<Resolution> higherOrEqual = Resolution
.getResolutionsHigherOrEqualTo(Resolution.DAY);
- ArrayList<Resolution> expected = new ArrayList<Resolution>();
+ ArrayList<Resolution> expected = new ArrayList<>();
expected.add(Resolution.DAY);
expected.add(Resolution.MONTH);
expected.add(Resolution.YEAR);
public void testResolutionLowerThanDay() {
Iterable<Resolution> higherOrEqual = Resolution
.getResolutionsLowerThan(Resolution.DAY);
- ArrayList<Resolution> expected = new ArrayList<Resolution>();
+ ArrayList<Resolution> expected = new ArrayList<>();
expected.add(Resolution.HOUR);
expected.add(Resolution.MINUTE);
expected.add(Resolution.SECOND);
public void testResolutionLowerThanSecond() {
Iterable<Resolution> higherOrEqual = Resolution
.getResolutionsLowerThan(Resolution.SECOND);
- ArrayList<Resolution> expected = new ArrayList<Resolution>();
+ ArrayList<Resolution> expected = new ArrayList<>();
TestUtil.assertIterableEquals(expected, higherOrEqual);
}
public void testResolutionLowerThanYear() {
Iterable<Resolution> higherOrEqual = Resolution
.getResolutionsLowerThan(Resolution.YEAR);
- ArrayList<Resolution> expected = new ArrayList<Resolution>();
+ ArrayList<Resolution> expected = new ArrayList<>();
expected.add(Resolution.MONTH);
expected.add(Resolution.DAY);
expected.add(Resolution.HOUR);
private MenuItem menuFileOpen;
private MenuItem menuFileSave;
private MenuItem menuFileExit;
- private Set<MenuItem> menuItems = new HashSet<MenuItem>();
+ private Set<MenuItem> menuItems = new HashSet<>();
private MenuBar menuBar;
private static void assertUniqueIds(MenuBar menuBar) {
- Set<Object> ids = new HashSet<Object>();
+ Set<Object> ids = new HashSet<>();
for (MenuItem item : menuBar.getItems()) {
assertUniqueIds(ids, item);
*/
public class LoggingClassLoader extends ClassLoader {
- private List<String> requestedClasses = new ArrayList<String>();
+ private List<String> requestedClasses = new ArrayList<>();
@Override
protected synchronized Class<?> loadClass(String name, boolean resolve)
}
private void sendResize(Window window2) {
- Map<String, Object> variables = new HashMap<String, Object>();
+ Map<String, Object> variables = new HashMap<>();
variables.put("height", 1234);
window.changeVariables(window, variables);
}
private static void sendClose(Window window) {
- Map<String, Object> variables = new HashMap<String, Object>();
+ Map<String, Object> variables = new HashMap<>();
variables.put("close", true);
window.changeVariables(window, variables);
}
}
public static class ViewChangeTestListener implements ViewChangeListener {
- private final LinkedList<ViewChangeEvent> referenceEvents = new LinkedList<ViewChangeListener.ViewChangeEvent>();
- private final LinkedList<Boolean> referenceIsCheck = new LinkedList<Boolean>();
- private final LinkedList<Boolean> checkReturnValues = new LinkedList<Boolean>();
+ private final LinkedList<ViewChangeEvent> referenceEvents = new LinkedList<>();
+ private final LinkedList<Boolean> referenceIsCheck = new LinkedList<>();
+ private final LinkedList<Boolean> checkReturnValues = new LinkedList<>();
public void addExpectedIsViewChangeAllowed(ViewChangeEvent event,
boolean returnValue) {
StringBuilder sb = new StringBuilder();
- Set<Class> classesAndParents = new HashSet<Class>();
+ Set<Class> classesAndParents = new HashSet<>();
for (Class<?> cls : classes) {
addClassAndParents(classesAndParents, cls, packageToInclude);
}
- Set<Class> interfaces = new HashSet<Class>();
+ Set<Class> interfaces = new HashSet<>();
for (Object cls : classesAndParents.toArray()) {
for (Class<?> c : ((Class) cls).getInterfaces()) {
addClassAndParentInterfaces(classesAndParents, c,
private boolean closeIdleSessions = false;
private PushMode pushMode = PushMode.DISABLED;
private Properties initParameters = new Properties();
- private Map<String, String> applicationOrSystemProperty = new HashMap<String, String>();
+ private Map<String, String> applicationOrSystemProperty = new HashMap<>();
private boolean syncIdCheckEnabled = true;
private boolean sendUrlsAsParameters = true;
.setCurrent(session2);
// Use weak ref to verify object is collected
- WeakReference<VaadinSession> ref = new WeakReference<VaadinSession>(
+ WeakReference<VaadinSession> ref = new WeakReference<>(
session1);
session1 = null;
public class JavaScriptExtensionState extends SharedState
implements JavaScriptConnectorState {
- private Set<String> callbackNames = new HashSet<String>();
- private Map<String, Set<String>> rpcInterfaces = new HashMap<String, Set<String>>();
+ private Set<String> callbackNames = new HashSet<>();
+ private Map<String, Set<String>> rpcInterfaces = new HashMap<>();
@Override
public Set<String> getCallbackNames() {
import com.vaadin.shared.ApplicationConstants;
public class LegacyChangeVariablesInvocation extends MethodInvocation {
- private Map<String, Object> variableChanges = new HashMap<String, Object>();
+ private Map<String, Object> variableChanges = new HashMap<>();
public LegacyChangeVariablesInvocation(String connectorId,
String variableName, Object value) {
* com.vaadin.server.Resource)
* @see com.vaadin.client.ui.AbstractConnector#getResourceUrl(String)
*/
- public Map<String, URLReference> resources = new HashMap<String, URLReference>();
+ public Map<String, URLReference> resources = new HashMap<>();
public boolean enabled = true;
/**
import com.vaadin.shared.communication.SharedState;
public class JavaScriptManagerState extends SharedState {
- public Set<String> names = new HashSet<String>();
+ public Set<String> names = new HashSet<>();
}
@NoLayout
public boolean muted;
- public List<URLReference> sources = new ArrayList<URLReference>();
+ public List<URLReference> sources = new ArrayList<>();
- public List<String> sourceTypes = new ArrayList<String>();
+ public List<String> sourceTypes = new ArrayList<>();
}
public String uriFragment;
- public Map<String, String> parameters = new HashMap<String, String>();
+ public Map<String, String> parameters = new HashMap<>();
}
public static final void addRegisteredEventListener(SharedState state,
String eventListenerId) {
if (state.registeredEventListeners == null) {
- state.registeredEventListeners = new HashSet<String>();
+ state.registeredEventListeners = new HashSet<>();
}
state.registeredEventListeners.add(eventListenerId);
}
public class JavaScriptComponentState extends AbstractComponentState
implements JavaScriptConnectorState {
- private Set<String> callbackNames = new HashSet<String>();
- private Map<String, Set<String>> rpcInterfaces = new HashMap<String, Set<String>>();
+ private Set<String> callbackNames = new HashSet<>();
+ private Map<String, Set<String>> rpcInterfaces = new HashMap<>();
@Override
public Set<String> getCallbackNames() {
}
// Maps each component to a position
- public Map<String, String> connectorToCssPosition = new HashMap<String, String>();
+ public Map<String, String> connectorToCssPosition = new HashMap<>();
}
{
primaryStyleName = "v-csslayout";
}
- public Map<Connector, String> childCss = new HashMap<Connector, String>();
+ public Map<Connector, String> childCss = new HashMap<>();
}
{
primaryStyleName = "v-customlayout";
}
- public Map<Connector, String> childLocations = new HashMap<Connector, String>();
+ public Map<Connector, String> childLocations = new HashMap<>();
public String templateContents;
public String templateName;
}
*/
public static Iterable<Resolution> getResolutionsHigherOrEqualTo(
Resolution r) {
- List<Resolution> resolutions = new ArrayList<Resolution>();
+ List<Resolution> resolutions = new ArrayList<>();
Resolution[] values = Resolution.values();
for (int i = r.ordinal(); i < values.length; i++) {
resolutions.add(values[i]);
* @return An iterable for the resolutions lower than r
*/
public static List<Resolution> getResolutionsLowerThan(Resolution r) {
- List<Resolution> resolutions = new ArrayList<Resolution>();
+ List<Resolution> resolutions = new ArrayList<>();
Resolution[] values = Resolution.values();
for (int i = r.ordinal() - 1; i >= 0; i--) {
resolutions.add(values[i]);
/**
* Column order in grid.
*/
- public List<String> columnOrder = new ArrayList<String>();
+ public List<String> columnOrder = new ArrayList<>();
/** The number of frozen columns. */
@DelegateToWidget
public int columns = 0;
public int marginsBitmask = 0;
// Set of indexes of implicitly Ratios rows and columns
- public Set<Integer> explicitRowRatios = new HashSet<Integer>();;
- public Set<Integer> explicitColRatios = new HashSet<Integer>();
- public Map<Connector, ChildComponentData> childData = new HashMap<Connector, GridLayoutState.ChildComponentData>();
+ public Set<Integer> explicitRowRatios = new HashSet<>();;
+ public Set<Integer> explicitColRatios = new HashSet<>();
+ public Map<Connector, ChildComponentData> childData = new HashMap<>();
public boolean hideEmptyRowsAndColumns = false;
public float[] rowExpand;
public float[] colExpand;
public class AbstractOrderedLayoutState extends AbstractLayoutState {
public boolean spacing = false;
- public HashMap<Connector, ChildComponentData> childData = new HashMap<Connector, ChildComponentData>();
+ public HashMap<Connector, ChildComponentData> childData = new HashMap<>();
public int marginsBitmask = 0;
@NoLayout
public int tabIndex;
- public List<TabState> tabs = new ArrayList<TabState>();
+ public List<TabState> tabs = new ArrayList<>();
/** true to show the tab bar, false to only show the contained component */
public boolean tabsVisible = true;
// Informing users of assistive devices, that the content of this container
// is announced automatically and does not need to be navigated into
public String overlayContainerLabel = "This content is announced automatically and does not need to be navigated into.";
- public Map<String, NotificationTypeConfiguration> notificationConfigurations = new HashMap<String, NotificationTypeConfiguration>();
+ public Map<String, NotificationTypeConfiguration> notificationConfigurations = new HashMap<>();
{
notificationConfigurations.put("error",
new NotificationTypeConfiguration("Error: ",
public boolean alwaysUseXhrForServerRequests = false;
public PushMode mode = PushMode.DISABLED;
public String pushUrl = null;
- public Map<String, String> parameters = new HashMap<String, String>();
+ public Map<String, String> parameters = new HashMap<>();
{
parameters.put(TRANSPORT_PARAM,
Transport.WEBSOCKET.getIdentifier());
}
public static class LocaleServiceState implements Serializable {
- public List<LocaleData> localeData = new ArrayList<LocaleData>();
+ public List<LocaleData> localeData = new ArrayList<>();
}
public static class LocaleData implements Serializable {
* {@link #isPush()}.
*/
protected void openTestURL(Class<?> uiClass, String... parameters) {
- openTestURL(uiClass, new HashSet<String>(Arrays.asList(parameters)));
+ openTestURL(uiClass, new HashSet<>(Arrays.asList(parameters)));
}
private void openTestURL(Class<?> uiClass, Set<String> parameters) {
protected List<String> getLogs() {
VerticalLayoutElement log = $(VerticalLayoutElement.class).id("Log");
List<LabelElement> logLabels = log.$(LabelElement.class).all();
- List<String> logTexts = new ArrayList<String>();
+ List<String> logTexts = new ArrayList<>();
for (LabelElement label : logLabels) {
logTexts.add(label.getText());
protected List<DesiredCapabilities> getBrowserCapabilities(
Browser... browsers) {
- List<DesiredCapabilities> capabilities = new ArrayList<DesiredCapabilities>();
+ List<DesiredCapabilities> capabilities = new ArrayList<>();
for (Browser browser : browsers) {
capabilities.add(browser.getDesiredCapabilities());
}
* @author Vaadin Ltd
*/
public class ParallelScheduler implements RunnerScheduler {
- private final List<Future<Object>> fResults = new ArrayList<Future<Object>>();
+ private final List<Future<Object>> fResults = new ArrayList<>();
private ExecutorService fService;
/**
protected List<FrameworkMethod> computeTestMethods() {
List<FrameworkMethod> methods = super.computeTestMethods();
- Map<Method, Collection<String>> parameters = new LinkedHashMap<Method, Collection<String>>();
+ Map<Method, Collection<String>> parameters = new LinkedHashMap<>();
// Find all @Parameters methods and invoke them to find out permutations
// Add method permutations for all @Parameters
for (Method setter : parameters.keySet()) {
- List<FrameworkMethod> newMethods = new ArrayList<FrameworkMethod>();
+ List<FrameworkMethod> newMethods = new ArrayList<>();
for (FrameworkMethod m : methods) {
if (!(m instanceof TBMethod)) {
*/
@Before
public void setupScreenComparisonParameters() {
- screenshotFailures = new ArrayList<String>();
+ screenshotFailures = new ArrayList<>();
Parameters.setScreenshotErrorDirectory(getScreenshotErrorDirectory());
Parameters.setScreenshotReferenceDirectory(
File mainReference = getScreenshotReferenceFile(identifier);
List<File> referenceFiles = findReferenceAndAlternatives(mainReference);
- List<File> failedReferenceFiles = new ArrayList<File>();
+ List<File> failedReferenceFiles = new ArrayList<>();
for (File referenceFile : referenceFiles) {
boolean match = false;
* given files, including the given reference
*/
private List<File> findReferenceAndAlternatives(File reference) {
- List<File> files = new ArrayList<File>();
+ List<File> files = new ArrayList<>();
files.add(reference);
File screenshotDir = reference.getParentFile();
*/
protected <T> List<Class<? extends T>> findClasses(Class<T> baseClass,
String basePackage, String[] ignoredPackages) throws IOException {
- List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
+ List<Class<? extends T>> classes = new ArrayList<>();
String basePackageDirName = "/" + basePackage.replace('.', '/');
URL location = baseClass.getResource(basePackageDirName);
if (location.getProtocol().equals("file")) {
* The name of the application class currently used. Only valid within one
* request.
*/
- private LinkedHashSet<String> defaultPackages = new LinkedHashSet<String>();
+ private LinkedHashSet<String> defaultPackages = new LinkedHashSet<>();
- private transient final ThreadLocal<HttpServletRequest> request = new ThreadLocal<HttpServletRequest>();
+ private transient final ThreadLocal<HttpServletRequest> request = new ThreadLocal<>();
@Override
public void init(ServletConfig servletConfig) throws ServletException {
File uitestDir = new File("uitest/src");
if (uitestDir.isDirectory()) {
- LinkedList<File> stack = new LinkedList<File>();
+ LinkedList<File> stack = new LinkedList<>();
stack.add(uitestDir);
long lastModifiedTimestamp = Long.MIN_VALUE;
interval = Integer.parseInt(serverArgs.get("scaninterval"));
}
- List<File> classFolders = new ArrayList<File>();
+ List<File> classFolders = new ArrayList<>();
String[] paths = serverArgs.get("autoreload").split(",");
if (paths.length == 1 && "all".equals(paths[0])) {
ClassLoader cl = server.getClass().getClassLoader();
* @return map of arguments key value pairs.
*/
protected static Map<String, String> parseArguments(String[] args) {
- final Map<String, String> map = new HashMap<String, String>();
+ final Map<String, String> map = new HashMap<>();
for (int i = 0; i < args.length; i++) {
final int d = args[i].indexOf("=");
if (d > 0 && d < args[i].length() && args[i].startsWith("--")) {
}
});
- BeanItemContainer<ComparisonFailure> container = new BeanItemContainer<ComparisonFailure>(
+ BeanItemContainer<ComparisonFailure> container = new BeanItemContainer<>(
ComparisonFailure.class);
for (File failure : failures) {
container.addBean(new ComparisonFailure(failure));
public class Components extends LegacyApplication {
private static final Object CAPTION = "c";
- private Map<Class<? extends AbstractComponentTest>, String> tests = new HashMap<Class<? extends AbstractComponentTest>, String>();
+ private Map<Class<? extends AbstractComponentTest>, String> tests = new HashMap<>();
private Tree naviTree;
private HorizontalSplitPanel sp;
private LegacyWindow mainWindow;
private final Embedded applicationEmbedder = new Embedded();
private String baseUrl;
- private List<Class<? extends Component>> componentsWithoutTests = new ArrayList<Class<? extends Component>>();
+ private List<Class<? extends Component>> componentsWithoutTests = new ArrayList<>();
{
for (Class<?> c : VaadinClasses.getBasicComponentTests()) {
List<Class<? extends Component>> componentsWithoutTest = VaadinClasses
.getComponents();
- Set<String> availableTests = new HashSet<String>();
+ Set<String> availableTests = new HashSet<>();
for (String testName : tests.values()) {
availableTests.add(testName);
}
Select s1;
- HashMap<String, Integer> buttonListeners = new HashMap<String, Integer>();
+ HashMap<String, Integer> buttonListeners = new HashMap<>();
@Override
public void init() {
private final AbstractOrderedLayout main;
- ArrayList<MyComponent> order = new ArrayList<MyComponent>();
+ ArrayList<MyComponent> order = new ArrayList<>();
public OrderedLayoutSwapComponents() {
}
t.addContainerProperty("button", Button.class, null);
for (int i = 0; i < rows; i++) {
- final Vector<Object> content = new Vector<Object>();
+ final Vector<Object> content = new Vector<>();
for (int j = 0; j < cols; j++) {
content.add(rndString());
}
VerticalLayout bodyLayout = new VerticalLayout();
// TODO this could probably be a simple Set
- HashMap<Class<?>, String> itemCaptions = new HashMap<Class<?>, String>();
+ HashMap<Class<?>, String> itemCaptions = new HashMap<>();
@Override
public void init() {
*/
public static List<Class<?>> getTestableClassesForPackage(
String packageName) throws Exception {
- final ArrayList<File> directories = new ArrayList<File>();
+ final ArrayList<File> directories = new ArrayList<>();
try {
final ClassLoader cld = Thread.currentThread()
.getContextClassLoader();
packageName + " does not appear to be a valid package.");
}
- final ArrayList<Class<?>> classes = new ArrayList<Class<?>>();
+ final ArrayList<Class<?>> classes = new ArrayList<>();
// For every directory identified capture all the .class files
for (final Iterator<File> it = directories.iterator(); it.hasNext();) {
final File directory = it.next();
public void randomReorder() {
final Iterator<Component> it = main.getComponentIterator();
- final ArrayList<Component> components = new ArrayList<Component>();
+ final ArrayList<Component> components = new ArrayList<>();
while (it.hasNext()) {
components.add(it.next());
}
public void removeRandomComponent() {
final Iterator<Component> it = main.getComponentIterator();
- final ArrayList<Component> components = new ArrayList<Component>();
+ final ArrayList<Component> components = new ArrayList<>();
while (it.hasNext()) {
components.add(it.next());
}
public void randomReorder() {
final Iterator<Component> it = main.getComponentIterator();
- final ArrayList<Component> components = new ArrayList<Component>();
+ final ArrayList<Component> components = new ArrayList<>();
while (it.hasNext()) {
components.add(it.next());
}
public void removeRandomComponent() {
final Iterator<Component> it = main.getComponentIterator();
- final ArrayList<Component> components = new ArrayList<Component>();
+ final ArrayList<Component> components = new ArrayList<>();
while (it.hasNext()) {
components.add(it.next());
}
+ " on the browser. Currently changes are"
+ " visible only by inspecting DOM."));
- styleNames2 = new ArrayList<String>();
+ styleNames2 = new ArrayList<>();
styleNames2.add("red");
styleNames2.add("bold");
final String currentStyle = l.getStyleName();
final String[] tmp = currentStyle.split(" ");
- final ArrayList<String> curStyles = new ArrayList<String>();
+ final ArrayList<String> curStyles = new ArrayList<>();
for (int i = 0; i < tmp.length; i++) {
if (tmp[i] != "") {
curStyles.add(tmp[i]);
}
t.addContainerProperty("button", Button.class, null);
for (int i = 0; i < rows; i++) {
- final Vector<Object> content = new Vector<Object>();
+ final Vector<Object> content = new Vector<>();
for (int j = 0; j < cols; j++) {
content.add(rndString());
}
MyTest myTest = new MyTest();
- MethodProperty<Integer> methodProperty2 = new MethodProperty<Integer>(
+ MethodProperty<Integer> methodProperty2 = new MethodProperty<>(
Integer.TYPE, myTest, "getInt", "setInt", new Object[0],
new Object[] { null }, 0);
}
private Collection<String> getSelectOptions() {
- final Collection<String> opts = new Vector<String>(3);
+ final Collection<String> opts = new Vector<>(3);
opts.add(getCaption("opt 1"));
opts.add(getCaption("opt 2"));
opts.add(getCaption("opt 3"));
class Testable {
private Class<?> classToTest;
- private ArrayList<Configuration> configurations = new ArrayList<Configuration>();
+ private ArrayList<Configuration> configurations = new ArrayList<>();
Testable(Class<?> c) {
classToTest = c;
private final Label selectedTask = new Label("Selected task",
ContentMode.HTML);
- public LinkedList<?> exampleTasks = new LinkedList<Object>();
+ public LinkedList<?> exampleTasks = new LinkedList<>();
public static Random random = new Random(1);
private static <T> List<Class<? extends T>> findClasses(Class<T> baseClass,
String basePackage, String[] ignoredPackages) throws IOException {
- List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
+ List<Class<? extends T>> classes = new ArrayList<>();
String basePackageDirName = "/" + basePackage.replace('.', '/');
URL location = VaadinSession.class.getResource(basePackageDirName);
if (location.getProtocol().equals("file")) {
* @author Vaadin Ltd
*/
public class WindowWaiAriaRoles extends AbstractTestUI {
- Stack<Window> windows = new Stack<Window>();
+ Stack<Window> windows = new Stack<>();
/*
* (non-Javadoc)
List<String> messages = (List<String>) getSession()
.getAttribute(PERSISTENT_MESSAGES_ATTRIBUTE);
if (messages == null) {
- messages = new ArrayList<String>();
+ messages = new ArrayList<>();
if (storeIfNeeded) {
getSession().setAttribute(PERSISTENT_MESSAGES_ATTRIBUTE,
messages);
String subCategory = "Add component";
createCategory(subCategory, category);
- LinkedHashMap<String, Command<T, ComponentSize>> addCommands = new LinkedHashMap<String, AbstractComponentTestCase.Command<T, ComponentSize>>();
+ LinkedHashMap<String, Command<T, ComponentSize>> addCommands = new LinkedHashMap<>();
addCommands.put("Button", addButtonCommand);
addCommands.put("NativeButton", addNativeButtonCommand);
addCommands.put("TextField", addTextFieldCommand);
addCommands.put("VerticalSplitPanel", addVerticalSplitPanelCommand);
addCommands.put("HorizontalSplitPanel", addHorizontalSplitPanelCommand);
- HashSet<String> noVerticalSize = new HashSet<String>();
+ HashSet<String> noVerticalSize = new HashSet<>();
noVerticalSize.add("TextField");
noVerticalSize.add("Button");
private static final Resource SELECTED_ICON = new ThemeResource(
"../runo/icons/16/ok.png");
- private static final LinkedHashMap<String, String> sizeOptions = new LinkedHashMap<String, String>();
+ private static final LinkedHashMap<String, String> sizeOptions = new LinkedHashMap<>();
static {
sizeOptions.put("auto", null);
sizeOptions.put("50%", "50%");
// Used to determine if a menuItem should be selected and the other
// unselected on click
- private Set<MenuItem> parentOfSelectableMenuItem = new HashSet<MenuItem>();
+ private Set<MenuItem> parentOfSelectableMenuItem = new HashSet<>();
/**
* Maps the category name to a menu item
*/
- private Map<String, MenuItem> categoryToMenuItem = new HashMap<String, MenuItem>();
- private Map<MenuItem, String> menuItemToCategory = new HashMap<MenuItem, String>();
+ private Map<String, MenuItem> categoryToMenuItem = new HashMap<>();
+ private Map<MenuItem, String> menuItemToCategory = new HashMap<>();
// Logging
private Log log;
createBlurListener(CATEGORY_LISTENERS);
}
if (Focusable.class.isAssignableFrom(getTestClass())) {
- LinkedHashMap<String, Integer> tabIndexes = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> tabIndexes = new LinkedHashMap<>();
tabIndexes.put("0", 0);
tabIndexes.put("-1", -1);
tabIndexes.put("10", 10);
}
private void createStyleNameSelect(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put("Light blue background (background-lightblue)",
"background-lightblue");
}
private void createErrorMessageSelect(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put(TEXT_SHORT, TEXT_SHORT);
options.put("Medium", TEXT_MEDIUM);
}
private void createDescriptionSelect(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put(TEXT_SHORT, TEXT_SHORT);
options.put("Medium", TEXT_MEDIUM);
}
protected LinkedHashMap<String, String> createCaptionOptions() {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put("Short", TEXT_SHORT);
options.put("Medium", TEXT_MEDIUM);
}
private void createIconSelect(String category) {
- LinkedHashMap<String, Resource> options = new LinkedHashMap<String, Resource>();
+ LinkedHashMap<String, Resource> options = new LinkedHashMap<>();
options.put("-", null);
options.put("16x16", ICON_16_USER_PNG_CACHEABLE);
options.put("32x32", ICON_32_ATTENTION_PNG_CACHEABLE);
}
private void createLocaleSelect(String category) {
- LinkedHashMap<String, Locale> options = new LinkedHashMap<String, Locale>();
+ LinkedHashMap<String, Locale> options = new LinkedHashMap<>();
options.put("-", null);
options.put("fi_FI", new Locale("fi", "FI"));
options.put("en_US", Locale.US);
protected <TYPE extends Enum<TYPE>> void createSelectAction(String caption,
String category, Class<TYPE> enumType, TYPE initialValue,
com.vaadin.tests.components.ComponentTestCase.Command<T, TYPE> command) {
- LinkedHashMap<String, TYPE> options = new LinkedHashMap<String, TYPE>();
+ LinkedHashMap<String, TYPE> options = new LinkedHashMap<>();
for (TYPE value : EnumSet.allOf(enumType)) {
options.put(value.toString(), value);
}
com.vaadin.tests.components.ComponentTestCase.Command<T, Boolean> command,
boolean defaultValue) {
- LinkedHashMap<String, Boolean> defaultValues = new LinkedHashMap<String, Boolean>();
+ LinkedHashMap<String, Boolean> defaultValues = new LinkedHashMap<>();
for (String option : options.keySet()) {
defaultValues.put(option, defaultValue);
}
protected LinkedHashMap<String, Integer> createIntegerOptions(int max) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
for (int i = 0; i <= 9 && i <= max; i++) {
options.put(String.valueOf(i), i);
}
}
protected LinkedHashMap<String, Double> createDoubleOptions(double max) {
- LinkedHashMap<String, Double> options = new LinkedHashMap<String, Double>();
+ LinkedHashMap<String, Double> options = new LinkedHashMap<>();
for (double d = 0; d <= max && d < 10; d += 0.5) {
options.put(String.valueOf(d), d);
}
protected LinkedHashMap<String, Resource> createIconOptions(
boolean cacheable) {
- LinkedHashMap<String, Resource> options = new LinkedHashMap<String, Resource>();
+ LinkedHashMap<String, Resource> options = new LinkedHashMap<>();
options.put("-", null);
if (cacheable) {
options.put("16x16", ICON_16_USER_PNG_CACHEABLE);
protected static final ThemeResource ICON_64_EMAIL_REPLY_PNG_UNCACHEABLE = uncacheableThemeResource(
"../runo/icons/64/email-reply.png");
- private List<T> testComponents = new ArrayList<T>();
+ private List<T> testComponents = new ArrayList<>();
abstract protected Class<T> getTestClass();
}
private void createMarginsSelect(String category) {
- LinkedHashMap<String, MarginInfo> options = new LinkedHashMap<String, MarginInfo>();
+ LinkedHashMap<String, MarginInfo> options = new LinkedHashMap<>();
options.put("off", new MarginInfo(false));
options.put("all", new MarginInfo(true));
options.put("left", new MarginInfo(false, false, false, true));
String alignmentCategory = "Component alignment";
createCategory(alignmentCategory, category);
- LinkedHashMap<String, Alignment> options = new LinkedHashMap<String, Alignment>();
+ LinkedHashMap<String, Alignment> options = new LinkedHashMap<>();
options.put("Top left", Alignment.TOP_LEFT);
options.put("Top center", Alignment.TOP_CENTER);
options.put("Top right", Alignment.TOP_RIGHT);
String expandRatioCategory = "Component expand ratio";
createCategory(expandRatioCategory, category);
- LinkedHashMap<String, Float> options = new LinkedHashMap<String, Float>();
+ LinkedHashMap<String, Float> options = new LinkedHashMap<>();
options.put("0", 0f);
options.put("0.5", 0.5f);
for (float f = 1; f <= 5; f++) {
* @return A List with actions to which more actions can be added.
*/
protected List<Component> createActions() {
- ArrayList<Component> actions = new ArrayList<Component>();
+ ArrayList<Component> actions = new ArrayList<>();
actions.add(createEnabledAction(true));
actions.add(createReadonlyAction(false));
@Override
protected void setup() {
Button bb = new Button("Button with CompositeError");
- List<UserError> errors = new ArrayList<UserError>();
+ List<UserError> errors = new ArrayList<>();
errors.add(new UserError("Error 1"));
errors.add(new UserError("Error 2"));
bb.setComponentError(new CompositeErrorMessage(errors));
@Override
protected void setup(VaadinRequest request) {
- List<Class<? extends Component>> components = new ArrayList<Class<? extends Component>>();
+ List<Class<? extends Component>> components = new ArrayList<>();
components.add(Button.class);
components.add(NativeButton.class);
components.add(CssLayout.class);
}
private static int index = 0;
- private static Map<String, Integer> nameToId = new HashMap<String, Integer>();
+ private static Map<String, Integer> nameToId = new HashMap<>();
public static void addItem(IndexedContainer container, String string,
String parent) {
protected abstract void createFields();
- private Set<Component> fields = new HashSet<Component>();
+ private Set<Component> fields = new HashSet<>();
@Override
protected void addComponent(Component c) {
@Override
protected void setup() {
tf = new TextField("A field, must contain 1-2 chars",
- new ObjectProperty<String>("a"));
+ new ObjectProperty<>("a"));
tf.addValidator(
new StringLengthValidator("Invalid length", 1, 2, false));
tf.setBuffered(true);
public class AbstractFieldDataSourceReadOnly extends TestBase {
private static class StateHolder {
- private ObjectProperty<String> textField = new ObjectProperty<String>(
+ private ObjectProperty<String> textField = new ObjectProperty<>(
"");
public ObjectProperty<String> getTextField() {
DateField df = new DateField("Date field");
addComponent(df);
df.setPropertyDataSource(
- new com.vaadin.v7.data.util.ObjectProperty<String>(s,
+ new com.vaadin.v7.data.util.ObjectProperty<>(s,
String.class));
}
protected void createFields() {
PopupDateField pdf = new PopupDateField("DateField");
addComponent(pdf);
- property = new ObjectProperty<Long>(l, Long.class);
+ property = new ObjectProperty<>(l, Long.class);
pdf.setPropertyDataSource(property);
property.setValue(new Date(2011 - 1900, 4, 6).getTime());
tf = createIntegerTextField();
tf.setCaption("Enter a double");
- tf.setPropertyDataSource(new ObjectProperty<Double>(2.1));
+ tf.setPropertyDataSource(new ObjectProperty<>(2.1));
tf.addValidator(new DoubleValidator("Must be a Double"));
addComponent(tf);
}
private TextField createIntegerTextField() {
final TextField tf = new TextField("Enter an integer");
- tf.setPropertyDataSource(new ObjectProperty<Integer>(new Integer(2)));
+ tf.setPropertyDataSource(new ObjectProperty<>(new Integer(2)));
tf.setImmediate(true);
tf.addListener(new ValueChangeListener() {
}
private void createRequiredErrorSelect(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put(TEXT_SHORT, TEXT_SHORT);
options.put("Medium", TEXT_MEDIUM);
protected void createSetTextValueAction(String category) {
String subCategory = "Set text value";
createCategory(subCategory, category);
- List<String> values = new ArrayList<String>();
+ List<String> values = new ArrayList<>();
values.add("Test");
values.add("A little longer value");
values.add(
import com.vaadin.v7.ui.TextField;
public class RequiredIndicatorForFieldsWithoutCaption extends AbstractTestUI {
- private Set<Field> fields = new HashSet<Field>();
+ private Set<Field> fields = new HashSet<>();
@Override
protected void setup(VaadinRequest request) {
@Override
public void valueChange(ValueChangeEvent event) {
- tf.setPropertyDataSource(new ObjectProperty<Object>(o,
+ tf.setPropertyDataSource(new ObjectProperty<>(o,
(Class<Object>) dataType.getValue()));
}
});
AbstractComponentContainer container = accordion;
if (container != null) {
- List<Component> c = new ArrayList<Component>();
+ List<Component> c = new ArrayList<>();
Iterator<Component> i = container.iterator();
while (i.hasNext()) {
Component comp = i.next();
public static BeanItemContainer<TestBean> createContainer(int size,
long seed) {
- BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>(
+ BeanItemContainer<TestBean> container = new BeanItemContainer<>(
TestBean.class);
PortableRandom r = new PortableRandom(seed);
for (int i = 0; i < size; i++) {
Table t = new Table("Table containing Persons");
t.setPageLength(5);
t.setWidth("100%");
- List<Person> persons = new ArrayList<Person>();
+ List<Person> persons = new ArrayList<>();
persons.add(new Person("Jones", "Birchman", 35));
persons.add(new Person("Marc", "Smith", 30));
persons.add(new Person("Greg", "Sandman", 75));
- BeanItemContainer<Person> bic = new BeanItemContainer<Person>(persons);
+ BeanItemContainer<Person> bic = new BeanItemContainer<>(persons);
t.setContainerDataSource(bic);
addComponent(t);
private Table table;
- private BeanItemContainer<BasicEvent> events = new BeanItemContainer<BasicEvent>(
+ private BeanItemContainer<BasicEvent> events = new BeanItemContainer<>(
BasicEvent.class);
@SuppressWarnings("deprecation")
fieldGroup.bind(startField, ContainerEventProvider.STARTDATE_PROPERTY);
fieldGroup.bind(endField, ContainerEventProvider.ENDDATE_PROPERTY);
- fieldGroup.setItemDataSource(new BeanItem<BasicEvent>(event,
+ fieldGroup.setItemDataSource(new BeanItem<>(event,
Arrays.asList(ContainerEventProvider.CAPTION_PROPERTY,
ContainerEventProvider.DESCRIPTION_PROPERTY,
ContainerEventProvider.STARTDATE_PROPERTY,
public List<com.vaadin.v7.ui.components.calendar.event.CalendarEvent> getEvents(
Date startDate, Date endDate) {
- List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+ List<CalendarEvent> events = new ArrayList<>();
CalendarEvent event = null;
try {
public List<com.vaadin.v7.ui.components.calendar.event.CalendarEvent> getEvents(
Date startDate, Date endDate) {
- List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+ List<CalendarEvent> events = new ArrayList<>();
CalendarEvent event = null;
try {
@Override
public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
Date d = startDate;
- ArrayList<CalendarEvent> events = new ArrayList<CalendarEvent>();
+ ArrayList<CalendarEvent> events = new ArrayList<>();
while (d.before(endDate)) {
BasicEvent ce = new BasicEvent();
ce.setAllDay(false);
private static class DummyEventProvider implements CalendarEventProvider {
private int index;
- private List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+ private List<CalendarEvent> events = new ArrayList<>();
public void addEvent(Date date) {
BasicEvent e = new BasicEvent();
public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
- List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+ List<CalendarEvent> events = new ArrayList<>();
try {
java.util.Calendar today = java.util.Calendar.getInstance();
private static class DummyEventProvider implements CalendarEventProvider {
private int index;
- private List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+ private List<CalendarEvent> events = new ArrayList<>();
public void addEvent(Date date) {
BasicEvent e = new BasicEvent();
@Override
protected void setup(VaadinRequest request) {
- final List<String> items = new ArrayList<String>();
+ final List<String> items = new ArrayList<>();
items.add("A");
items.add("B");
items.add("C");
@Override
protected void setup() {
- List<Person> list = new ArrayList<Person>();
+ List<Person> list = new ArrayList<>();
Person p1 = new Person();
p1.setFirstName("John");
p1.setLastName("Doe");
p2.setLastName("Doe");
list.add(p2);
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
+ BeanItemContainer<Person> container = new BeanItemContainer<>(
Person.class);
container.addAll(list);
}
private void createFilteringModeAction(String category) {
- LinkedHashMap<String, FilteringMode> options = new LinkedHashMap<String, FilteringMode>();
+ LinkedHashMap<String, FilteringMode> options = new LinkedHashMap<>();
options.put("Off", FilteringMode.OFF);
options.put("Contains", FilteringMode.CONTAINS);
options.put("Starts with", FilteringMode.STARTSWITH);
}
private void createItemStyleGeneratorAction(String category) {
- LinkedHashMap<String, ItemStyleGenerator> options = new LinkedHashMap<String, ItemStyleGenerator>();
+ LinkedHashMap<String, ItemStyleGenerator> options = new LinkedHashMap<>();
options.put("-", null);
options.put("Bold fives", new ItemStyleGenerator() {
@Override
}
private void createInputPromptAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put("Enter a value", "Enter a value");
options.put("- Click here -", "- Click here -");
@Override
protected void setup() {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (int i = 0; i < 100; i++) {
list.add("Item " + i);
}
cb.setDescription("Some Combobox");
addComponent(cb);
- final ObjectProperty<String> log = new ObjectProperty<String>("");
+ final ObjectProperty<String> log = new ObjectProperty<>("");
cb.addFocusListener(new FieldEvents.FocusListener() {
@Override
@Override
protected void setup() {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (int i = 0; i < 100; i++) {
list.add("Item " + i);
}
cb.setDescription("Some Combobox");
addComponent(cb);
- final ObjectProperty<String> log = new ObjectProperty<String>("");
+ final ObjectProperty<String> log = new ObjectProperty<>("");
cb.addFocusListener(new FieldEvents.FocusListener() {
@Override
protected void setup(VaadinRequest request) {
HorizontalLayout layout = new HorizontalLayout();
layout.setSpacing(true);
- ArrayList<String> options = new ArrayList<String>();
+ ArrayList<String> options = new ArrayList<>();
options.add("1");
options.add("2");
options.add("3");
private Component createIconSelect() {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("<None>", null);
options.put("16x16", "../runo/icons/16/user.png");
options.put("32x32", "../runo/icons/32/attention.png");
}
- private Set<String> usedDebugIds = new HashSet<String>();
+ private Set<String> usedDebugIds = new HashSet<>();
private void addDateField(GridLayout gridLayout, String pattern,
Locale locale, String expectedDateFormat) {
@SuppressWarnings("deprecation")
public void buttonClick(ClickEvent event) {
log.log("Setting new object property (5.6.2000) to datefield");
- ObjectProperty<Date> dfProp = new ObjectProperty<Date>(
+ ObjectProperty<Date> dfProp = new ObjectProperty<>(
new Date(2000 - 1900, 6 - 1, 5), Date.class);
df.setPropertyDataSource(dfProp);
}
@SuppressWarnings("deprecation")
public void buttonClick(ClickEvent event) {
log.log("Setting object property (with value null) to datefield and set value of property to 27.8.2005");
- ObjectProperty<Date> dfProp = new ObjectProperty<Date>(null,
+ ObjectProperty<Date> dfProp = new ObjectProperty<>(null,
Date.class);
df.setPropertyDataSource(dfProp);
dfProp.setValue(new Date(2005 - 1900, 8 - 1, 27));
@Override
protected void setup() {
- BeanItem<Range> bi = new BeanItem<Range>(range);
+ BeanItem<Range> bi = new BeanItem<>(range);
range.setFrom(new Date(2011 - 1900, 12 - 1, 4));
range.setTo(new Date(2011 - 1900, 12 - 1, 15));
}
private void createSetValueAction(String category) {
- LinkedHashMap<String, Date> options = new LinkedHashMap<String, Date>();
+ LinkedHashMap<String, Date> options = new LinkedHashMap<>();
options.put("(null)", null);
options.put("(current time)", new Date());
Calendar c = Calendar.getInstance(new Locale("fi", "FI"));
}
private void createDateFormatSelectAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put("d M yyyy", "d M yyyy");
}
private void createResolutionSelectAction(String category) {
- LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>();
+ LinkedHashMap<String, Resolution> options = new LinkedHashMap<>();
options.put("Year", Resolution.YEAR);
options.put("Month", Resolution.MONTH);
options.put("Day", Resolution.DAY);
protected void setup() {
dateField.setResolution(Resolution.SECOND);
- ArrayList<String> timeZoneCodes = new ArrayList<String>();
+ ArrayList<String> timeZoneCodes = new ArrayList<>();
timeZoneCodes.add(nullValue);
timeZoneCodes.addAll(Arrays.asList(TimeZone.getAvailableIDs()));
ComboBox timezoneSelector = new ComboBox("Select time zone",
}
private Component createResolutionSelectAction() {
- LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>();
+ LinkedHashMap<String, Resolution> options = new LinkedHashMap<>();
options.put("Year", Resolution.YEAR);
options.put("Month", Resolution.MONTH);
options.put("Day", Resolution.DAY);
}
private Component createLocaleSelectAction() {
- LinkedHashMap<String, Locale> options = new LinkedHashMap<String, Locale>();
+ LinkedHashMap<String, Locale> options = new LinkedHashMap<>();
for (Locale locale : LOCALES) {
options.put(locale.toString(), locale);
}
}
private void createSetValueAction(String category) {
- LinkedHashMap<String, Date> options = new LinkedHashMap<String, Date>();
+ LinkedHashMap<String, Date> options = new LinkedHashMap<>();
options.put("(null)", null);
options.put("(current time)", new Date());
Calendar c = Calendar.getInstance(new Locale("fi", "FI"));
}
private void createDateFormatSelectAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put("d M yyyy", "d M yyyy");
}
private void createResolutionSelectAction(String category) {
- LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>();
+ LinkedHashMap<String, Resolution> options = new LinkedHashMap<>();
options.put("Year", Resolution.YEAR);
options.put("Month", Resolution.MONTH);
options.put("Day", Resolution.DAY);
}
private void createInputPromptSelectAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("<none>", null);
options.put("Please enter date", "Please enter date");
options.put("åäöÅÄÖ", "åäöÅÄÖ");
}
private void createInputPromptSelectAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("<none>", null);
options.put("Please enter date", "Please enter date");
options.put("åäöÅÄÖ", "åäöÅÄÖ");
}
private Component createResolutionSelectAction() {
- LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>();
+ LinkedHashMap<String, Resolution> options = new LinkedHashMap<>();
options.put("Year", Resolution.YEAR);
options.put("Month", Resolution.MONTH);
options.put("Day", Resolution.DAY);
}
private Component createInputPromptSelectAction() {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("<none>", null);
options.put("Please enter date", "Please enter date");
options.put("åäöÅÄÖ", "åäöÅÄÖ");
};
// not required
- Property<Date> dateProperty1 = new ObjectProperty<Date>(date);
+ Property<Date> dateProperty1 = new ObjectProperty<>(date);
DateField dateField1 = new DateField("Not required", dateProperty1);
dateField1.setLocale(new Locale("fi", "FI"));
dateField1.setResolution(DateField.RESOLUTION_DAY);
addComponent(dateField1);
// required
- Property<Date> dateProperty2 = new ObjectProperty<Date>(date);
+ Property<Date> dateProperty2 = new ObjectProperty<>(date);
DateField dateField2 = new DateField("Required", dateProperty2);
dateField2.setLocale(new Locale("fi", "FI"));
dateField2.setResolution(DateField.RESOLUTION_DAY);
import com.vaadin.v7.ui.PopupDateField;
public class ValueThroughProperty extends TestBase {
- private final Property<Date> dateProperty = new ObjectProperty<Date>(null,
+ private final Property<Date> dateProperty = new ObjectProperty<>(null,
Date.class);
@Override
}
public static class TestState extends JavaScriptComponentState {
- private List<String> messages = new ArrayList<String>();
+ private List<String> messages = new ArrayList<>();
private URLReference url;
public List<String> getMessages() {
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- ObjectProperty<String> p = new ObjectProperty<String>(
+ ObjectProperty<String> p = new ObjectProperty<>(
"This text should appear on the label after clicking the button.");
label.setPropertyDataSource(p);
private void createValueSelect(String category) {
String subCategory = "Set text value";
createCategory(subCategory, category);
- List<String> values = new ArrayList<String>();
+ List<String> values = new ArrayList<>();
values.add("Test");
values.add("A little longer value");
values.add(
@SuppressWarnings("deprecation")
private void createContentModeSelect(String category) {
- LinkedHashMap<String, ContentMode> options = new LinkedHashMap<String, ContentMode>();
+ LinkedHashMap<String, ContentMode> options = new LinkedHashMap<>();
options.put("Text", ContentMode.TEXT);
options.put("Preformatted", ContentMode.PREFORMATTED);
options.put("XHTML", ContentMode.HTML);
}
private void createTargetSelect(String category) {
- LinkedHashMap<String, Resource> options = new LinkedHashMap<String, Resource>();
+ LinkedHashMap<String, Resource> options = new LinkedHashMap<>();
options.put("-", null);
options.put("https://vaadin.com",
new ExternalResource("https://vaadin.com"));
+ "<li>Leave the Option #10 visible in the scroll window</li><li>Press the button</li></ol>"
+ "You will see the <code>ListSelect</code> scroll window jump back to the top.",
ContentMode.HTML));
- ArrayList<String> list = new ArrayList<String>();
+ ArrayList<String> list = new ArrayList<>();
for (int i = 1; i <= 25; i++) {
list.add("Option #" + i);
}
}
private void createMenuIconsSizeSelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("16x16", 16);
options.put("32x32", 32);
options.put("64x64", 64);
}
private void createMenuItemIconIntervalSelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("None", 0);
options.put("All", 1);
options.put("Every second", 2);
}
private void createSubMenuDensitySelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("All", 1);
options.put("Every second", 2);
options.put("Every third", 3);
}
private void createSubMenuSeparatorDensitySelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("No separators", null);
options.put("Between all", 1);
options.put("Between every second", 2);
}
private void createMenuItemDisabledDensitySelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("All enabled", null);
options.put("All disabled", 1);
options.put("Every second", 2);
}
private void createMenuItemInvisibleDensitySelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("All visible", null);
options.put("All invisible", 1);
options.put("Every second", 2);
}
private void createMenuItemCheckableDensitySelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("No items checkable", null);
options.put("All checkable", 1);
options.put("Every second", 2);
@Override
protected List<Component> createActions() {
- ArrayList<Component> actions = new ArrayList<Component>();
+ ArrayList<Component> actions = new ArrayList<>();
actions.add(createErrorIndicatorAction(false));
actions.add(createEnabledAction(true));
}
private void createIconToggle(String string) {
- LinkedHashMap<String, ThemeResource> options = new LinkedHashMap<String, ThemeResource>();
+ LinkedHashMap<String, ThemeResource> options = new LinkedHashMap<>();
options.put("-", null);
options.put("16x16", ICON_16_USER_PNG_CACHEABLE);
options.put("32x32", ICON_32_ATTENTION_PNG_CACHEABLE);
controls.addComponent(layout);
layout.addComponent(new Label("Layout"));
- ArrayList<String> sizes = new ArrayList<String>();
+ ArrayList<String> sizes = new ArrayList<>();
sizes.addAll(Arrays.asList("100px", "30em", "100%"));
final NativeSelect width = new NativeSelect(null, sizes);
controls.addComponent(cell);
cell.addComponent(new Label("Cell"));
- ArrayList<Alignment> alignments = new ArrayList<Alignment>();
+ ArrayList<Alignment> alignments = new ArrayList<>();
alignments.addAll(Arrays.asList(Alignment.TOP_LEFT,
Alignment.MIDDLE_LEFT, Alignment.BOTTOM_LEFT,
Alignment.TOP_CENTER, Alignment.MIDDLE_CENTER,
root.addComponent(component);
component.addComponent(new Label("Component"));
- sizes = new ArrayList<String>();
+ sizes = new ArrayList<>();
sizes.addAll(Arrays.asList("50px", "200px", "10em", "50%", "100%"));
componentWidth = new NativeSelect(null, sizes);
Tree tree = new Tree();
tree.setSizeFull();
tree.setContainerDataSource(
- new BeanItemContainer<String>(String.class));
+ new BeanItemContainer<>(String.class));
String a = "aaaaaaaaaaaaaaaaaaaaaaaa";
String b = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
String c = "ccccccccccccccccccccccccccccccccccccccccccccccccc";
// Why is Alignment not an enum? Now we have to use reflection just
// to get the different values as hardcoding is never an option! ;)
- List<String> alignmentValues = new ArrayList<String>();
+ List<String> alignmentValues = new ArrayList<>();
Field[] fields = Alignment.class.getDeclaredFields();
for (Field field : fields) {
if (field.getType() == Alignment.class) {
Tree tree = new Tree();
tree.setSizeFull();
tree.setContainerDataSource(
- new BeanItemContainer<String>(String.class));
+ new BeanItemContainer<>(String.class));
String a = "aaaaaaaaaaaaaaaaaaaaaaaa";
String b = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
String c = "ccccccccccccccccccccccccccccccccccccccccccccccccc";
actionHandlers.remove(actionHandlers.size() - 1));
}
- private List<Handler> actionHandlers = new ArrayList<Handler>();
+ private List<Handler> actionHandlers = new ArrayList<>();
public void add() {
panel.setCaption(panel.getCaption() + " - Added handler");
public class PopupViewOffScreen extends TestBase {
- private List<PopupView> popupViews = new ArrayList<PopupView>();
+ private List<PopupView> popupViews = new ArrayList<>();
@Override
protected String getDescription() {
* @since
*/
protected void createPrimaryStyleNameSelect() {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
String primaryStyle = getComponent().getPrimaryStyleName();
options.put(primaryStyle, primaryStyle);
options.put(primaryStyle + "-foo", primaryStyle + "-foo");
}
private void createValueSelection(String categorySelection) {
- LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> options = new LinkedHashMap<>();
options.put("null", null);
for (float f = 0; f <= 1; f += 0.1) {
options.put("" + f, f);
}
private void createPollingIntervalAction() {
- LinkedHashMap<String, Integer> valueOptions = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> valueOptions = new LinkedHashMap<>();
for (int i = 100; i <= 3000; i += 200) {
valueOptions.put(String.valueOf(i), i);
}
}
private void createSetValueAction() {
- LinkedHashMap<String, Float> valueOptions = new LinkedHashMap<String, Float>();
+ LinkedHashMap<String, Float> valueOptions = new LinkedHashMap<>();
for (float f = 0.0f; f <= 1.0f; f += 0.1) {
valueOptions.put(String.valueOf(f), f);
}
}
private void createNullRepresentationAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put("null", "null");
options.put("This is empty", "This is empty");
protected static class ContextMenu {
- private List<Action> items = new ArrayList<Action>();
+ private List<Action> items = new ArrayList<>();
public ContextMenu(String caption, Resource icon) {
addItem(caption, icon);
}
protected void createNullSelectItemId(String category) {
- LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> options = new LinkedHashMap<>();
options.put("- None -", null);
for (Object id : (getComponent()).getContainerDataSource()
.getContainerPropertyIds()) {
}
protected void createItemsInContainerSelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
for (int i = 0; i <= 10; i++) {
options.put(String.valueOf(i), i);
}
}
protected void createPropertiesInContainerSelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("0", 0);
for (int i = 0; i <= 10; i++) {
options.put(String.valueOf(i), i);
private Select controllerComboBox;
private Select slaveComboBox;
- private Map<Integer, String> controllerOptionMap = new HashMap<Integer, String>();
+ private Map<Integer, String> controllerOptionMap = new HashMap<>();
- private Map<String, List<String>> slaveOptionMapping = new HashMap<String, List<String>>();
+ private Map<String, List<String>> slaveOptionMapping = new HashMap<>();
private final Object NAME_PROPERTY_ID = "name";
public DynamicSelectTestCase() {
private void populateSlaveOptionMappings() {
for (String controllerOption : controllerOptionMap.values()) {
- List<String> slaveOptions = new ArrayList<String>();
+ List<String> slaveOptions = new ArrayList<>();
for (int i = 1; i <= 3; i++) {
slaveOptions.add(controllerOption + " - Slave " + i);
}
private void createOrientationSelect(String category) {
- LinkedHashMap<String, SliderOrientation> options = new LinkedHashMap<String, SliderOrientation>();
+ LinkedHashMap<String, SliderOrientation> options = new LinkedHashMap<>();
options.put("Horizontal", SliderOrientation.HORIZONTAL);
options.put("Vertical", SliderOrientation.VERTICAL);
createSelectAction("Orientation", category, options, "Horizontal",
@Override
protected void setup(VaadinRequest request) {
- List<TestBean> beanList = new ArrayList<TestBean>();
+ List<TestBean> beanList = new ArrayList<>();
beanList.add(new TestBean(1, "name1", "descr1"));
beanList.add(new TestBean(2, "name2", "descr2"));
beanList.add(new TestBean(3, "name3", "descr3"));
beanList.add(new TestBean(4, "name4", "descr4"));
beanList.add(new TestBean(5, "name5", "descr5"));
- BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>(
+ BeanItemContainer<TestBean> container = new BeanItemContainer<>(
TestBean.class, beanList);
VerticalLayout layout = new VerticalLayout();
new Action("action4") };
}
});
- BeanItemContainer<Bean> container = new BeanItemContainer<Bean>(
+ BeanItemContainer<Bean> container = new BeanItemContainer<>(
Bean.class);
container.addBean(new Bean());
table.setContainerDataSource(container);
createSourceTable();
Table target = new Table();
- BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>(
+ BeanItemContainer<TestBean> container = new BeanItemContainer<>(
TestBean.class);
container.addBean(new TestBean("target-item"));
target.setContainerDataSource(container);
table.setPageLength(1);
table.setDragMode(TableDragMode.ROW);
table.setWidth(100, Unit.PERCENTAGE);
- BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>(
+ BeanItemContainer<TestBean> container = new BeanItemContainer<>(
TestBean.class);
container.addBean(new TestBean("item"));
table.setContainerDataSource(container);
import com.vaadin.v7.ui.Table;
public class DoublesInTable extends TestBase {
- BeanItemContainer<Person> personBeanItemContainer = new BeanItemContainer<Person>(
+ BeanItemContainer<Person> personBeanItemContainer = new BeanItemContainer<>(
Person.class);
private Table table;
}
private static BeanItemContainer<Person> createContainer(int nr) {
- BeanItemContainer<Person> bic = new BeanItemContainer<Person>(
+ BeanItemContainer<Person> bic = new BeanItemContainer<>(
Person.class);
for (int i = 1; i <= nr; i++) {
Person p = new Person();
}
private static class CachingFieldFactory extends DefaultFieldFactory {
- private final HashMap<Object, HashMap<Object, Field<?>>> cache = new HashMap<Object, HashMap<Object, Field<?>>>();
+ private final HashMap<Object, HashMap<Object, Field<?>>> cache = new HashMap<>();
@Override
public Field<?> createField(Container container, Object itemId,
setCompositionRoot(mainLayout);
// Container with sample data
- BeanContainer<Integer, SimpleBean> container = new BeanContainer<Integer, SimpleBean>(
+ BeanContainer<Integer, SimpleBean> container = new BeanContainer<>(
SimpleBean.class);
container.setBeanIdProperty("id");
for (int i = 1; i <= 50; ++i) {
return null;
}
final int index = ((Integer) itemId).intValue();
- return new BeanItem<MyBean>(new MyBean(index));
+ return new BeanItem<>(new MyBean(index));
}
@Override
protected void setup(VaadinRequest request) {
Table table = new Table();
table.setContainerDataSource(
- new BeanItemContainer<TestBean>(TestBean.class));
+ new BeanItemContainer<>(TestBean.class));
for (int i = 0; i < 10; i++) {
table.addItem(new TestBean(i));
}
@Override
protected void setup() {
- ValueHolder<String> v1 = new ValueHolder<String>("test1");
- ValueHolder<String> v2 = new ValueHolder<String>("test2");
- ValueHolder<String> v3 = new ValueHolder<String>("test3");
+ ValueHolder<String> v1 = new ValueHolder<>("test1");
+ ValueHolder<String> v2 = new ValueHolder<>("test2");
+ ValueHolder<String> v3 = new ValueHolder<>("test3");
@SuppressWarnings("unchecked")
- final BeanItemContainer<ValueHolder<String>> bic = new BeanItemContainer<ValueHolder<String>>(
+ final BeanItemContainer<ValueHolder<String>> bic = new BeanItemContainer<>(
Arrays.asList(v1, v2, v3));
final Table t = new Table(null, bic);
t.setSelectable(true);
bic.removeAllItems();
ValueHolder<String> v4 = null;
for (int i = 4; i < 30; i++) {
- v4 = new ValueHolder<String>("test" + i);
+ v4 = new ValueHolder<>("test" + i);
bic.addBean(v4);
}
Button button = new Button("Update the first item");
Label nameLabel = new Label();
- HashSet<Object> markedRows = new HashSet<Object>();
+ HashSet<Object> markedRows = new HashSet<>();
Label selected = new Label();
public SelectionExample() {
protected void setup(VaadinRequest request) {
final Table table = new Table();
- BeanItemContainer<Bean> container = new BeanItemContainer<Bean>(
+ BeanItemContainer<Bean> container = new BeanItemContainer<>(
Bean.class);
Bean bean = new Bean();
bean.setName("property");
final Log log = new Log(5);
addComponent(log);
- final BeanItemContainer<Person> container = new BeanItemContainer<Person>(
+ final BeanItemContainer<Person> container = new BeanItemContainer<>(
Person.class,
Arrays.asList(new Person("Joe"), new Person("William"),
new Person("Jack"), new Person("Averell"),
t.setMultiSelect(true);
t.setPageLength(5);
t.addContainerProperty("Name", String.class, null);
- Set<Object> selected = new HashSet<Object>();
+ Set<Object> selected = new HashSet<>();
for (int i = 0; i < 30; i++) {
Item item = t.addItem(i);
item.getItemProperty("Name").setValue("Name " + i);
protected void setup(VaadinRequest request) {
final Table table = new Table(null,
- new BeanItemContainer<Bean>(Bean.class));
+ new BeanItemContainer<>(Bean.class));
table.setId("table");
table.setSizeFull();
private static List<Person> createData() {
int count = 500;
- List<Person> data = new ArrayList<Person>(count);
+ List<Person> data = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
data.add(new Person("Person", "" + i, "Email", "Phone", "Street",
12345, "City"));
table.setVisibleColumns(new String[] { "jobId" });
label.setValue("no Exception");
} catch (CacheUpdateException e) {
- ArrayList<String> propertyIds = new ArrayList<String>();
+ ArrayList<String> propertyIds = new ArrayList<>();
propertyIds.add("jobId");
table.setContainerDataSource(jobContainer, propertyIds);
label.setValue("Exception caught");
private List<JobsBean> getBeanList() {
- List<JobsBean> list = new ArrayList<JobsBean>();
+ List<JobsBean> list = new ArrayList<>();
JobsBean jobsBean = new JobsBean();
jobsBean.setJobId("1");
list.add(jobsBean);
@Override
protected void setup(VaadinRequest request) {
- BeanItemContainer<TestObj> container = new BeanItemContainer<TestObj>(
+ BeanItemContainer<TestObj> container = new BeanItemContainer<>(
TestObj.class);
for (int i = 0; i < 2; i++) {
container.addBean(new TestObj(i));
@Override
public void layoutClick(LayoutClickEvent event) {
if (t.isMultiSelect()) {
- Set<Object> values = new HashSet<Object>(
+ Set<Object> values = new HashSet<>(
(Set<Object>) t.getValue());
values.add(l.getData());
t.setValue(values);
}
private static List<TestObject> createData(int count) {
- ArrayList<TestObject> data = new ArrayList<TestObject>(count);
+ ArrayList<TestObject> data = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
data.add(new TestObject("string-" + i, new Date(), i));
}
@Override
protected void setup(VaadinRequest request) {
- final BeanItemContainer<TableItem> cont = new BeanItemContainer<TableItem>(
+ final BeanItemContainer<TableItem> cont = new BeanItemContainer<>(
TableItem.class);
- final List<TableItem> restoringItemList = new ArrayList<TableItem>();
+ final List<TableItem> restoringItemList = new ArrayList<>();
final Table table = new Table();
table.setWidth("400px");
@Override
public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
- List<TableItem> originalItemIds = new ArrayList<TableItem>(
+ List<TableItem> originalItemIds = new ArrayList<>(
cont.getItemIds());
cont.removeAllItems();
cont.addAll(originalItemIds);
cont.removeAllItems();
// create new collection (of different items) with other
// size
- List<TableItem> itemList = new ArrayList<TableItem>();
+ List<TableItem> itemList = new ArrayList<>();
for (int i = 0; i < 79; i++) {
TableItem ti = new TableItem();
ti.setName("AnotherItem1_" + i);
com.vaadin.ui.Button.ClickEvent event) {
cont.removeAllItems();
- List<TableItem> list = new ArrayList<TableItem>(
+ List<TableItem> list = new ArrayList<>(
restoringItemList);
TableItem ti = new TableItem();
ti.setName("AnotherItem3_" + 80);
@Override
public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
cont.removeAllItems();
- BeanItemContainer<TableItem> newContainer = new BeanItemContainer<TableItem>(
+ BeanItemContainer<TableItem> newContainer = new BeanItemContainer<>(
TableItem.class);
for (int i = 0; i < 50; i++) {
TableItem ti = new TableItem();
@Override
protected void setup() {
Table table = new Table();
- BeanItemContainer<MyBean> dataSource = new BeanItemContainer<MyBean>(
+ BeanItemContainer<MyBean> dataSource = new BeanItemContainer<>(
getBeans());
table.setContainerDataSource(dataSource);
table.setSelectable(true);
final Label showID = new Label("");
final Table testTable = new Table();
- BeanItemContainer<TestItem> cont = new BeanItemContainer<TestItem>(
+ BeanItemContainer<TestItem> cont = new BeanItemContainer<>(
TestItem.class);
for (int i = 0; i < 20; i++) {
}
private Container buildContainer() {
- BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>(
+ BeanItemContainer<TestBean> container = new BeanItemContainer<>(
TestBean.class);
for (int i = 0; i < 100; ++i) {
TestBean item = new TestBean();
table.setColumnReorderingAllowed(true);
table.setSizeFull();
- BeanItemContainer<TestItem> cont = new BeanItemContainer<TestItem>(
+ BeanItemContainer<TestItem> cont = new BeanItemContainer<>(
TestItem.class);
for (int i = 0; i < ROW_COUNT; i++) {
container.addContainerProperty(COL_B, String.class, "");
Item it = container.addItem("a");
- final ObjectProperty<String> valA = new ObjectProperty<String>(
+ final ObjectProperty<String> valA = new ObjectProperty<>(
"orgVal");
final TextField fieldA = new TextField(valA) {
@Override
private Command<T, Boolean> columnVisibleCommand = new Command<T, Boolean>() {
@Override
public void execute(Table c, Boolean visible, Object propertyId) {
- List<Object> visibleColumns = new ArrayList<Object>(
+ List<Object> visibleColumns = new ArrayList<>(
Arrays.asList(c.getVisibleColumns()));
if (visible) {
// Table should really check this... Completely fails without
}
private void createCellStyleAction(String categoryFeatures) {
- LinkedHashMap<String, CellStyleInfo> options = new LinkedHashMap<String, CellStyleInfo>();
+ LinkedHashMap<String, CellStyleInfo> options = new LinkedHashMap<>();
options.put("None", null);
options.put("Red row", new CellStyleInfo(
"tables-test-cell-style-red-row", "Item 2", null));
}
private void createGeneratedRowAction(String categoryFeatures) {
- LinkedHashMap<String, GeneratedRowInfo> options = new LinkedHashMap<String, GeneratedRowInfo>();
+ LinkedHashMap<String, GeneratedRowInfo> options = new LinkedHashMap<>();
options.put("None", null);
options.put("Every fifth row, spanned", new GeneratedRowInfo(5, false,
"foobarbaz this is a long one that should span."));
}
private void createColumnHeaderMode(String category) {
- LinkedHashMap<String, ColumnHeaderMode> columnHeaderModeOptions = new LinkedHashMap<String, ColumnHeaderMode>();
+ LinkedHashMap<String, ColumnHeaderMode> columnHeaderModeOptions = new LinkedHashMap<>();
columnHeaderModeOptions.put("Hidden", ColumnHeaderMode.HIDDEN);
columnHeaderModeOptions.put("Id", ColumnHeaderMode.ID);
columnHeaderModeOptions.put("Explicit", ColumnHeaderMode.EXPLICIT);
}
private void createValueSelection(String categorySelection) {
- LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> options = new LinkedHashMap<>();
options.put("null", null);
for (int i = 1; i <= 10; i++) {
options.put("Item " + i, "Item " + i);
}
private void createContextMenuAction(String category) {
- LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<String, ContextMenu>();
+ LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<>();
options.put("None", null);
options.put("Item without icon", new ContextMenu("No icon", null));
ContextMenu cm = new ContextMenu();
createBooleanAction("Collapsed", category, false, columnCollapsed,
propertyId);
t.log("Collapsed");
- LinkedHashMap<String, Align> options = new LinkedHashMap<String, Align>();
+ LinkedHashMap<String, Align> options = new LinkedHashMap<>();
options.put("Left", Align.LEFT);
options.put("Center", Align.CENTER);
options.put("Right", Align.RIGHT);
createSelectAction("Alignment", category, options, "Left",
columnAlignmentCommand, propertyId);
t.log("Alignment");
- LinkedHashMap<String, Integer> widthOptions = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> widthOptions = new LinkedHashMap<>();
widthOptions.put("- remove -", -1);
for (int i : new int[] { 0, 1, 10, 100, 200, 400 }) {
widthOptions.put(i + "px", i);
columnWidthCommand, propertyId);
t.log("Width");
- LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<String, Resource>();
+ LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<>();
iconOptions.put("- none -", null);
iconOptions.put("ok 16x16", ICON_16_USER_PNG_CACHEABLE);
iconOptions.put("help 16x16", ICON_16_HELP_PNG_CACHEABLE);
columnIconCommand, propertyId);
t.log("Icon");
- LinkedHashMap<String, String> columnHeaderOptions = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> columnHeaderOptions = new LinkedHashMap<>();
columnHeaderOptions.put("- none -", null);
columnHeaderOptions.put("A", "A");
columnHeaderOptions.put("A nice column", "A nice column");
createSelectAction("Column header", category, columnHeaderOptions,
"- none -", columnHeaderCommand, propertyId);
t.log("Header");
- LinkedHashMap<String, Float> expandOptions = new LinkedHashMap<String, Float>();
+ LinkedHashMap<String, Float> expandOptions = new LinkedHashMap<>();
expandOptions.put("- remove -", -1f);
for (float i : new float[] { 0, 1, 2, 3, 4, 5 }) {
expandOptions.put(i + "", i);
}
private void createRowHeaderModeSelect(String category) {
- LinkedHashMap<String, RowHeaderMode> options = new LinkedHashMap<String, RowHeaderMode>();
+ LinkedHashMap<String, RowHeaderMode> options = new LinkedHashMap<>();
options.put("Explicit", RowHeaderMode.EXPLICIT);
options.put("Explicit defaults id", RowHeaderMode.EXPLICIT_DEFAULTS_ID);
options.put("Hidden", RowHeaderMode.HIDDEN);
}
private void createFooterTextSelect(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("None", null);
options.put("Footer X", "Footer {id}");
options.put("X", "{id}");
}
private void createHeaderTextCheckbox(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("None", null);
options.put("Col: {id}", "Col: {id}");
options.put("Header {id} - every second", "Header {id}");
}
protected void createHeaderVisibilitySelect(String category) {
- LinkedHashMap<String, ColumnHeaderMode> options = new LinkedHashMap<String, ColumnHeaderMode>();
+ LinkedHashMap<String, ColumnHeaderMode> options = new LinkedHashMap<>();
options.put("Explicit", ColumnHeaderMode.EXPLICIT);
options.put("Explicit defaults id",
ColumnHeaderMode.EXPLICIT_DEFAULTS_ID);
}
protected void createPageLengthSelect(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("0", 0);
options.put("5", 5);
options.put("10", 10);
}
protected void createSelectionModeSelect(String category) {
- LinkedHashMap<String, SelectMode> options = new LinkedHashMap<String, SelectMode>();
+ LinkedHashMap<String, SelectMode> options = new LinkedHashMap<>();
options.put("None", SelectMode.NONE);
options.put("Single", SelectMode.SINGLE);
options.put("Multi - simple", SelectMode.MULTI_SIMPLE);
TabSheet tabsheet = new TabSheet();
String[] letters = { "A", "B", "C", "D" };
- HashMap<String, TabSheet.Tab> tabMap = new HashMap<String, TabSheet.Tab>();
+ HashMap<String, TabSheet.Tab> tabMap = new HashMap<>();
for (String letter : letters) {
VerticalLayout vLayout = new VerticalLayout();
AbstractComponentContainer container = tabsheet;
if (container != null) {
- List<Component> c = new ArrayList<Component>();
+ List<Component> c = new ArrayList<>();
Iterator<Component> i = container.getComponentIterator();
while (i.hasNext()) {
Component comp = i.next();
public class TabKeyboardNavigation extends AbstractTestUI {
int index = 1;
- ArrayList<Component> tabs = new ArrayList<Component>();
+ ArrayList<Component> tabs = new ArrayList<>();
TabSheet ts = new TabSheet();
Log focusblur = new Log(10);
public class TabKeyboardNavigationWaiAria extends AbstractTestUI {
int index = 1;
- ArrayList<Component> tabs = new ArrayList<Component>();
+ ArrayList<Component> tabs = new ArrayList<>();
TabSheet ts = new TabSheet();
@Override
String captionOptions[] = new String[] { "", "{id}", "Tab {id}",
"A long caption for tab {id}" };
- LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<String, Resource>();
+ LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<>();
iconOptions.put("-", null);
iconOptions.put("16x16 (cachable)", ICON_16_USER_PNG_CACHEABLE);
iconOptions.put("16x16 (uncachable)", ICON_16_USER_PNG_UNCACHEABLE);
setLocale(new Locale("fi", "FI"));
BeanBigDecimal beanBigDecimal = new BeanBigDecimal();
- BeanItem<BeanBigDecimal> beanItem = new BeanItem<BeanBigDecimal>(
+ BeanItem<BeanBigDecimal> beanItem = new BeanItem<>(
beanBigDecimal);
FormLayout formLayout = new FormLayout();
"TextField with null data source value");
textField2.setInputPrompt("Me is input prompt");
textField2.setNullRepresentation(null);
- BeanItem<Pojo> beanItem = new BeanItem<Pojo>(new Pojo());
+ BeanItem<Pojo> beanItem = new BeanItem<>(new Pojo());
textField2.setPropertyDataSource(beanItem.getItemProperty("string"));
addComponent(textField2);
}
final TextField tf1 = new TextField();
- final ObjectProperty<String> op = new ObjectProperty<String>("FOO");
+ final ObjectProperty<String> op = new ObjectProperty<>("FOO");
tf1.setPropertyDataSource(op);
}
private void createContextMenuAction(String category) {
- LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<String, ContextMenu>();
+ LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<>();
options.put("None", null);
options.put("Item without icon", new ContextMenu("No icon", null));
ContextMenu cm = new ContextMenu();
private void createItemStyleGenerator(String category) {
- LinkedHashMap<String, com.vaadin.v7.ui.Tree.ItemStyleGenerator> options = new LinkedHashMap<String, com.vaadin.v7.ui.Tree.ItemStyleGenerator>();
+ LinkedHashMap<String, com.vaadin.v7.ui.Tree.ItemStyleGenerator> options = new LinkedHashMap<>();
options.put("-", null);
options.put(rootGreenSecondLevelRed.toString(),
}
protected void createSelectionModeSelect(String category) {
- LinkedHashMap<String, SelectMode> options = new LinkedHashMap<String, SelectMode>();
+ LinkedHashMap<String, SelectMode> options = new LinkedHashMap<>();
options.put("None", SelectMode.NONE);
options.put("Single", SelectMode.SINGLE);
options.put("Multi - simple", SelectMode.MULTI_SIMPLE);
secondLevel++;
}
- List<Object> itemIds = new ArrayList<Object>(c.getItemIds());
+ List<Object> itemIds = new ArrayList<>(c.getItemIds());
int nextItemId = roots;
for (int rootIndex = 0; rootIndex < roots; rootIndex++) {
}
private void createRootItemSelectAction(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
for (int i = 1; i <= 10; i++) {
options.put(String.valueOf(i), i);
}
}
private void createExpandCollapseActions(String category) {
- LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> options = new LinkedHashMap<>();
for (Object id : getComponent().getItemIds()) {
options.put(id.toString(), id);
}
private void createChildrenAllowedAction(String category) {
- LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> options = new LinkedHashMap<>();
for (Object id : getComponent().getItemIds()) {
options.put(id.toString(), id);
secondLevel++;
}
- List<Object> itemIds = new ArrayList<Object>(c.getItemIds());
+ List<Object> itemIds = new ArrayList<>(c.getItemIds());
int nextItemId = roots;
for (int rootIndex = 0; rootIndex < roots; rootIndex++) {
private TreeTable treeTable = new TreeTable();
- private BeanItemContainer<User> container = new BeanItemContainer<User>(
+ private BeanItemContainer<User> container = new BeanItemContainer<>(
User.class);
@Override
if (c instanceof Container.Indexed) {
return ((Container.Indexed) source).indexOfId(itemId);
} else {
- ArrayList<Object> list = new ArrayList<Object>(source.getItemIds());
+ ArrayList<Object> list = new ArrayList<>(source.getItemIds());
return list.indexOf(itemId);
}
addComponent(cacheRateSelect);
treeTable = new TreeTable();
treeTable.addStyleName("table-equal-rowheight");
- testBeanContainer = new BeanItemContainer<TestBean>(TestBean.class);
+ testBeanContainer = new BeanItemContainer<>(TestBean.class);
- Map<String, Integer> hasChildren = new HashMap<String, Integer>();
+ Map<String, Integer> hasChildren = new HashMap<>();
hasChildren.put("1", 5);
hasChildren.put("3", 10);
hasChildren.put("5", 20);
public class TreeTableContainerHierarchicalWrapper extends AbstractTestUI {
TreeTable treetable = new TreeTable();
- BeanItemContainer<Bean> beanContainer = new BeanItemContainer<Bean>(
+ BeanItemContainer<Bean> beanContainer = new BeanItemContainer<>(
Bean.class);
ContainerHierarchicalWrapper hierarchicalWrapper = new ContainerHierarchicalWrapper(
beanContainer);
secondLevel++;
}
- List<Object> itemIds = new ArrayList<Object>(c.getItemIds());
+ List<Object> itemIds = new ArrayList<>(c.getItemIds());
int nextItemId = roots;
for (int rootIndex = 0; rootIndex < roots; rootIndex++) {
}
private void createRootItemSelectAction(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
for (int i = 1; i <= 10; i++) {
options.put(String.valueOf(i), i);
}
}
private void createExpandCollapseActions(String category) {
- LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> options = new LinkedHashMap<>();
for (Object id : getComponent().getItemIds()) {
options.put(id.toString(), id);
}
private void createChildrenAllowedAction(String category) {
- LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> options = new LinkedHashMap<>();
for (Object id : getComponent().getItemIds()) {
options.put(id.toString(), id);
}
private void createRowSelectAction() {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("-", 0);
for (int i = 1; i <= 10; i++) {
options.put(String.valueOf(i), i);
@Override
protected void setup(VaadinRequest request) {
- final ArrayList<UI> uiLog = new ArrayList<UI>();
- final ArrayList<Boolean> probeLog = new ArrayList<Boolean>();
+ final ArrayList<UI> uiLog = new ArrayList<>();
+ final ArrayList<Boolean> probeLog = new ArrayList<>();
final Thread thread = new Thread(new Runnable() {
@Override
public class UIsInMultipleTabs extends AbstractTestUIProvider {
// No cleanup -> will leak, but shouldn't matter for tests
- private static ConcurrentHashMap<VaadinSession, AtomicInteger> numberOfUIsOpened = new ConcurrentHashMap<VaadinSession, AtomicInteger>();
+ private static ConcurrentHashMap<VaadinSession, AtomicInteger> numberOfUIsOpened = new ConcurrentHashMap<>();
public static class TabUI extends UI {
@Override
public class TestSampler extends TabSheet {
public static final String ICON_URL = "../runo/icons/16/help.png";
- private List<Component> components = new ArrayList<Component>();
+ private List<Component> components = new ArrayList<>();
private ComponentContainer currentTab;
setWidth("100%");
VerticalLayout vl = new VerticalLayout();
- FieldGroup fg = new BeanFieldGroup<Person>(Person.class);
- fg.setItemDataSource(new BeanItem<Person>(new Person()));
+ FieldGroup fg = new BeanFieldGroup<>(Person.class);
+ fg.setItemDataSource(new BeanItem<>(new Person()));
for (Object propId : fg.getUnboundPropertyIds()) {
if (!"address".equals(propId)) {
vl.addComponent(fg.buildAndBind(propId));
}
private void createTableWith(String caption, String primaryStyleName) {
- final HashSet<Object> markedRows = new HashSet<Object>();
+ final HashSet<Object> markedRows = new HashSet<>();
final Table t;
if (caption != null) {
@Override
protected List<Component> createActions() {
- List<Component> actions = new ArrayList<Component>();
+ List<Component> actions = new ArrayList<>();
actions.add(createEnabledAction(true));
return actions;
@Override
protected List<Component> createActions() {
- List<Component> actions = new ArrayList<Component>();
+ List<Component> actions = new ArrayList<>();
actions.add(createButtonAction("Toggle Enabled",
new Command<Upload, Boolean>() {
p.setContent(content);
content.setHeight("500px");
- List<String> items = new ArrayList<String>();
+ List<String> items = new ArrayList<>();
items.add("1");
items.add("2");
items.add("3");
public class SubWindowOrder extends TestBase {
- private BeanItemContainer<Window> windowlist = new BeanItemContainer<Window>(
+ private BeanItemContainer<Window> windowlist = new BeanItemContainer<>(
Window.class);
@Override
}
private String elementToHtml(Element producedElem, StringBuilder sb) {
- ArrayList<String> names = new ArrayList<String>();
+ ArrayList<String> names = new ArrayList<>();
for (Attribute a : producedElem.attributes().asList()) {
names.add(a.getKey());
}
removeActionHandler(actionHandlers.remove(actionHandlers.size() - 1));
}
- private List<Handler> actionHandlers = new ArrayList<Handler>();
+ private List<Handler> actionHandlers = new ArrayList<>();
public void add() {
Handler actionHandler = new Handler() {
}
int windowCount = 0;
- Queue<Window> windows = new ArrayDeque<Window>();
+ Queue<Window> windows = new ArrayDeque<>();
@Override
protected void setup(VaadinRequest request) {
protected void setup() {
table = new Table();
try {
- container = new BeanItemContainer<TestBean>(TestBean.class);
+ container = new BeanItemContainer<>(TestBean.class);
table.setContainerDataSource(container);
table.setWidth(300, Sizeable.UNITS_PIXELS);
*/
public static void main(String[] args)
throws InstantiationException, IllegalAccessException {
- BeanItemContainer<Hello> c = new BeanItemContainer<Hello>(Hello.class);
+ BeanItemContainer<Hello> c = new BeanItemContainer<>(Hello.class);
c.addItem(new Hello());
- Collection<Hello> col = new LinkedList<Hello>();
+ Collection<Hello> col = new LinkedList<>();
for (int i = 0; i < 100; i++) {
col.add(new Hello());
}
col.add(new Hello2());
- c = new BeanItemContainer<Hello>(col);
+ c = new BeanItemContainer<>(col);
System.out.println(c + " contains " + c.size() + " objects");
if (c instanceof Container.Indexed) {
return ((Container.Indexed) source).indexOfId(itemId);
} else {
- ArrayList<Object> list = new ArrayList<Object>(source.getItemIds());
+ ArrayList<Object> list = new ArrayList<>(source.getItemIds());
return list.indexOf(itemId);
}
}
@Override
protected Set<Object> getAllowedItemIds(DragAndDropEvent dragEvent,
Tree tree) {
- return new HashSet<Object>(tree.getItemIds());
+ return new HashSet<>(tree.getItemIds());
}
};
tree1 = new Tree("Volume 1");
tree1.setImmediate(true);
- fs1 = new BeanItemContainer<File>(File.class);
+ fs1 = new BeanItemContainer<>(File.class);
tree1.setContainerDataSource(fs1);
for (int i = 0; i < files.length; i++) {
fs1.addBean(files[i]);
static class FolderView extends DragAndDropWrapper implements DropHandler {
- static final HashMap<Folder, FolderView> views = new HashMap<Folder, FolderView>();
+ static final HashMap<Folder, FolderView> views = new HashMap<>();
public static FolderView get(Folder f) {
// make modifiable
children = new HashSet<Object>(children);
}
- Set<Component> removed = new HashSet<Component>();
+ Set<Component> removed = new HashSet<>();
for (Iterator<Component> componentIterator = l
.getComponentIterator(); componentIterator.hasNext();) {
FileIcon next = (FileIcon) componentIterator.next();
.getItem(draggedItemId).getItemProperty("Weight")
.getValue();
- HashSet<Object> accepted = new HashSet<Object>();
+ HashSet<Object> accepted = new HashSet<>();
for (Object itemId : visibleItemIds) {
Item item = table.getItem(itemId);
Integer w = (Integer) item.getItemProperty("Weight")
if (sourceItemId instanceof BeanItem<?>) {
beanItem = (BeanItem<?>) sourceItemId;
} else if (sourceItemId instanceof InventoryObject) {
- beanItem = new BeanItem<InventoryObject>(
+ beanItem = new BeanItem<>(
(InventoryObject) sourceItemId);
}
table.setDragMode(TableDragMode.ROW);
// Initialize the table container
- ArrayList<InventoryObject> collection = new ArrayList<InventoryObject>();
+ ArrayList<InventoryObject> collection = new ArrayList<>();
collection.add(new InventoryObject("Dummy Item", 0.0, false));
- final BeanItemContainer<InventoryObject> tableContainer = new BeanItemContainer<InventoryObject>(
+ final BeanItemContainer<InventoryObject> tableContainer = new BeanItemContainer<>(
collection);
table.setContainerDataSource(tableContainer);
table.setVisibleColumns(new String[] { "name", "weight" });
}
}
- HashMap<String, InventoryObject> inventoryStore = new HashMap<String, InventoryObject>();
+ HashMap<String, InventoryObject> inventoryStore = new HashMap<>();
public HierarchicalContainer createTreeContent() {
final Object[] inventory = new Object[] {
BeanItem<InventoryObject> item;
if (data[i].getClass() == InventoryObject.class) {
InventoryObject object = (InventoryObject) data[i];
- item = new BeanItem<InventoryObject>(object);
+ item = new BeanItem<>(object);
container.addItem(item);
container.setParent(item, parent);
container.setChildrenAllowed(item, false);
} else {// It's an Object[]
Object[] sub = (Object[]) data[i];
InventoryObject object = (InventoryObject) sub[0];
- item = new BeanItem<InventoryObject>(object);
+ item = new BeanItem<>(object);
container.addItem(item);
container.setParent(item, parent);
private FieldGroup fg;
- private BeanItemContainer<Potus> potusContainer = new BeanItemContainer<Potus>(
+ private BeanItemContainer<Potus> potusContainer = new BeanItemContainer<>(
Potus.class);
public PotusCrud() {
@Override
protected void setup(VaadinRequest request) {
- List<Class<? extends Component>> components = new ArrayList<Class<? extends Component>>();
+ List<Class<? extends Component>> components = new ArrayList<>();
components.add(Button.class);
components.add(NativeButton.class);
components.add(Link.class);
Panel confPanel = new ConfigurationPanel();
addComponent(confPanel);
- final FieldGroup fieldGroup = new BeanFieldGroup<Person>(Person.class);
+ final FieldGroup fieldGroup = new BeanFieldGroup<>(Person.class);
fieldGroup.addCommitHandler(new CommitHandler() {
@Override
});
Person p = new Person("John", "Doe", "john@doe.com", 64, Sex.MALE,
new Address("John street", 11223, "John's town", Country.USA));
- fieldGroup.setItemDataSource(new BeanItem<Person>(p));
+ fieldGroup.setItemDataSource(new BeanItem<>(p));
}
@SuppressWarnings("unchecked")
}
public static BeanItemContainer<ComplexPerson> createContainer(int size) {
- BeanItemContainer<ComplexPerson> bic = new BeanItemContainer<ComplexPerson>(
+ BeanItemContainer<ComplexPerson> bic = new BeanItemContainer<>(
ComplexPerson.class);
Random r = new Random(size);
protected void setup(VaadinRequest request) {
setLocale(Locale.US);
addComponent(log);
- final FieldGroup fieldGroup = new BeanFieldGroup<DateObject>(
+ final FieldGroup fieldGroup = new BeanFieldGroup<>(
DateObject.class);
fieldGroup.setBuffered(true);
DateObject d = new DateObject(new Date(443457289789L),
new Date(443457289789L), new Date(443457289789L),
new Date(443457289789L));
- fieldGroup.setItemDataSource(new BeanItem<DateObject>(d));
+ fieldGroup.setItemDataSource(new BeanItem<>(d));
}
@SuppressWarnings("unchecked")
protected void setup() {
addComponent(log);
- final BeanFieldGroup<PersonWithBeanValidationAnnotations> fieldGroup = new BeanFieldGroup<PersonWithBeanValidationAnnotations>(
+ final BeanFieldGroup<PersonWithBeanValidationAnnotations> fieldGroup = new BeanFieldGroup<>(
PersonWithBeanValidationAnnotations.class);
fieldGroup.buildAndBindMemberFields(this);
"John", "Doe", "john@doe.com", 64, Sex.MALE,
new Address("John street", 11223, "John's town", Country.USA));
fieldGroup.setItemDataSource(
- new BeanItem<PersonWithBeanValidationAnnotations>(p));
+ new BeanItem<>(p));
}
public static PersonWithBeanValidationAnnotations getPerson(
@Override
protected void setup() {
- FieldGroup fieldGroup = new BeanFieldGroup<Person>(Person.class);
+ FieldGroup fieldGroup = new BeanFieldGroup<>(Person.class);
fieldGroup.buildAndBindMemberFields(this);
addComponent(firstName);
addComponent(lastName);
addComponent(streetAddress);
- fieldGroup.setItemDataSource(new BeanItem<Person>(new Person("Who",
+ fieldGroup.setItemDataSource(new BeanItem<>(new Person("Who",
"me?", "email", 1, Sex.MALE,
new Address("street name", 202020, "City", Country.FINLAND))));
}
protected void setup() {
super.setup();
- setFieldBinder(new BeanFieldGroup<Person>(Person.class));
+ setFieldBinder(new BeanFieldGroup<>(Person.class));
country = (NativeSelect) getFieldBinder().buildAndBind("country",
"address.country", NativeSelect.class);
getFieldBinder().bindMemberFields(this);
@Override
protected void setup(VaadinRequest request) {
- BeanItem<PersonBeanWithValidationAnnotations> item = new BeanItem<PersonBeanWithValidationAnnotations>(
+ BeanItem<PersonBeanWithValidationAnnotations> item = new BeanItem<>(
new PersonBeanWithValidationAnnotations());
final FieldGroup fieldGroup = new FieldGroup(item);
updateCaptions();
}
});
- fields = new ArrayList<Focusable>();
+ fields = new ArrayList<>();
Table t = new Table();
t.setSelectable(true);
t.addContainerProperty("foo", String.class, "bar");
private HorizontalLayout horizontalLayout;
private GridLayout gridLayout;
private FormLayout formLayout;
- private List<AbstractField<?>> components = new ArrayList<AbstractField<?>>();
+ private List<AbstractField<?>> components = new ArrayList<>();
private CssLayout cssLayout;
private HorizontalLayout layoutParent = new HorizontalLayout();
public class CssLayoutCustomCss extends TestBase implements ClickListener {
- protected Map<Component, String> css = new HashMap<Component, String>();
+ protected Map<Component, String> css = new HashMap<>();
private CssLayout layout;
@Override
}
private Collection<Class<? extends HasComponents>> getComponentContainers() {
- List<Class<? extends HasComponents>> list = new ArrayList<Class<? extends HasComponents>>();
+ List<Class<? extends HasComponents>> list = new ArrayList<>();
list.add(AbsoluteLayout.class);
list.add(Accordion.class);
list.add(CssLayout.class);
String valignName[] = new String[] { "top", "middle", "bottom" };
- Set<AbstractOrderedLayout> layouts = new HashSet<AbstractOrderedLayout>();
+ Set<AbstractOrderedLayout> layouts = new HashSet<>();
private AbstractOrderedLayout layoutContainer;
private int suffix = 0;
public class Broadcaster {
- private static final List<BroadcastListener> listeners = new CopyOnWriteArrayList<BroadcastListener>();
+ private static final List<BroadcastListener> listeners = new CopyOnWriteArrayList<>();
public static void register(BroadcastListener listener) {
listeners.add(listener);
public class GridExampleHelper {
public static BeanItemContainer<GridExampleBean> createContainer() {
- BeanItemContainer<GridExampleBean> container = new BeanItemContainer<GridExampleBean>(
+ BeanItemContainer<GridExampleBean> container = new BeanItemContainer<>(
GridExampleBean.class);
for (int i = 0; i < 1000; i++) {
container.addItem(new GridExampleBean("Bean " + i, i * i, i / 10d));
layout.setMargin(true);
setContent(layout);
- FieldGroup fieldGroup = new BeanFieldGroup<Person>(Person.class);
+ FieldGroup fieldGroup = new BeanFieldGroup<>(Person.class);
// We need an item data source before we create the fields to be able to
// find the properties, otherwise we have to specify them by hand
fieldGroup.setItemDataSource(
- new BeanItem<Person>(new Person("John", "Doe", 34)));
+ new BeanItem<>(new Person("John", "Doe", 34)));
// Loop through the properties, build fields for them and add the fields
// to this root
// Create a field group and use it to bind the fields in the layout
FieldGroup fieldGroup = new FieldGroup(
- new BeanItem<Notice>(new Notice("John", "Doe", "")));
+ new BeanItem<>(new Notice("John", "Doe", "")));
fieldGroup.bindMemberFields(myFormLayout);
addComponent(myFormLayout);
@Override
protected void setup(VaadinRequest request) {
final MyBean myBean = new MyBean();
- BeanItem<MyBean> beanItem = new BeanItem<MyBean>(myBean);
+ BeanItem<MyBean> beanItem = new BeanItem<>(myBean);
final Property<Integer> integerProperty = beanItem
.getItemProperty("value");
@Override
protected void init(VaadinRequest request) {
Person person = new Person("John", 26);
- BeanItem<Person> item = new BeanItem<Person>(person);
+ BeanItem<Person> item = new BeanItem<>(person);
TextField firstName = new TextField("First name",
item.getItemProperty("name"));
public class WidgetContainer extends AbstractComponentContainer {
- List<Component> children = new ArrayList<Component>();
+ List<Component> children = new ArrayList<>();
@Override
public void addComponent(Component c) {
@JavaScript("complex_types_connector.js")
public class ComplexTypesComponent extends AbstractJavaScriptComponent {
public void sendComplexTypes() {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
list.add("First string");
list.add(null);
list.add("Another string");
- Map<String, Integer> stringMap = new HashMap<String, Integer>();
+ Map<String, Integer> stringMap = new HashMap<>();
stringMap.put("one", 1);
stringMap.put("two", 2);
- Map<Integer, String> otherMap = new HashMap<Integer, String>();
+ Map<Integer, String> otherMap = new HashMap<>();
otherMap.put(3, "3");
otherMap.put(4, "4");
- Map<Connector, String> connectorMap = new HashMap<Connector, String>();
+ Map<Connector, String> connectorMap = new HashMap<>();
connectorMap.put(this, "this");
connectorMap.put(UI.getCurrent(), "root");
}
public void addSeries(double... points) {
- List<List<Double>> pointList = new ArrayList<List<Double>>();
+ List<List<Double>> pointList = new ArrayList<>();
for (int i = 0; i < points.length; i++) {
pointList.add(Arrays.asList(Double.valueOf(i),
Double.valueOf(points[i])));
import com.vaadin.shared.ui.JavaScriptComponentState;
public class FlotState extends JavaScriptComponentState {
- public List<List<List<Double>>> series = new ArrayList<List<List<Double>>>();
+ public List<List<List<Double>>> series = new ArrayList<>();
}
date.setImmediate(true);
layout.addComponent(date);
// pretend we have a datasource:
- date.setPropertyDataSource(new ObjectProperty<Date>(new Date()));
+ date.setPropertyDataSource(new ObjectProperty<>(new Date()));
date.setBuffered(true);
// show buttons when date is changed
date.addValueChangeListener(new ValueChangeListener() {
private void refreshStatus() {
PushConfiguration pc = ui.getPushConfiguration();
String value = "";
- ArrayList<String> names = new ArrayList<String>();
+ ArrayList<String> names = new ArrayList<>();
names.addAll(pc.getParameterNames());
Collections.sort(names);
for (String param : names) {
AbstractInMemoryContainer.class) {
@Override
public Collection<String> getContainerPropertyIds() {
- List<String> cpropIds = new ArrayList<String>(
+ List<String> cpropIds = new ArrayList<>(
super.getContainerPropertyIds());
cpropIds.add("testid");
return cpropIds;
public class RPCLoggerUI extends AbstractTestUIWithLog implements ErrorHandler {
- private List<Action> lastActions = new ArrayList<Action>();
+ private List<Action> lastActions = new ArrayList<>();
public static class Action {
public Action(ClientConnector connector, MethodInvocation invocation) {
// rpc.sendListArray(
// new List[] { Arrays.asList(1, 2), Arrays.asList(3, 4) },
// new List[] { Collections.singletonList(new SimpleTestBean(-1)) });
- rpc.sendSet(new HashSet<Integer>(Arrays.asList(4, 7, 12)),
+ rpc.sendSet(new HashSet<>(Arrays.asList(4, 7, 12)),
Collections.singleton((Connector) this),
- new HashSet<SimpleTestBean>(Arrays.asList(new SimpleTestBean(1),
+ new HashSet<>(Arrays.asList(new SimpleTestBean(1),
new SimpleTestBean(2))));
- state.intSet = new HashSet<Integer>(Arrays.asList(4, 7, 12));
+ state.intSet = new HashSet<>(Arrays.asList(4, 7, 12));
state.connectorSet = Collections.singleton((Connector) this);
- state.beanSet = new HashSet<SimpleTestBean>(
+ state.beanSet = new HashSet<>(
Arrays.asList(new SimpleTestBean(1), new SimpleTestBean(2)));
rpc.sendMap(new HashMap<String, SimpleTestBean>() {
@Override
public void sendSet(Set<Integer> intSet,
Set<Connector> connectorSet, Set<SimpleTestBean> beanSet) {
- List<Integer> intList = new ArrayList<Integer>(intSet);
+ List<Integer> intList = new ArrayList<>(intSet);
Collections.sort(intList);
- List<Connector> connectorList = new ArrayList<Connector>(
+ List<Connector> connectorList = new ArrayList<>(
connectorSet);
Collections.sort(connectorList, new ConnectorComparator());
- List<SimpleTestBean> beanList = new ArrayList<SimpleTestBean>(
+ List<SimpleTestBean> beanList = new ArrayList<>(
beanSet);
Collections.sort(beanList, new SimpleBeanComparator());
log.log("sendSet: " + intList + ", "
@Override
protected void setup(VaadinRequest request) {
Table table = new Table();
- BeanItemContainer<Bean> container = new BeanItemContainer<Bean>(
+ BeanItemContainer<Bean> container = new BeanItemContainer<>(
Bean.class);
Bean bean = new Bean();
bean.setName("name");
PropertysetItem item = new PropertysetItem();
item.addItemProperty("date",
- new ObjectProperty<Date>(getDefaultDate()));
+ new ObjectProperty<>(getDefaultDate()));
FormLayout form = new FormLayout();
form.setMargin(false);
}
private List<Component> createComponents() {
- final List<Component> components = new ArrayList<Component>();
+ final List<Component> components = new ArrayList<>();
final Label label = new Label(
"This is a long text block that will wrap.");
"../runo/icons/" + imageSize + "/document.png");
}
- static List<FontAwesome> ICONS = new ArrayList<FontAwesome>();
+ static List<FontAwesome> ICONS = new ArrayList<>();
static {
ICONS.add(FontAwesome.ADJUST);
ICONS.add(FontAwesome.ADN);
private boolean testMode = false;
- private static LinkedHashMap<String, String> themeVariants = new LinkedHashMap<String, String>();
+ private static LinkedHashMap<String, String> themeVariants = new LinkedHashMap<>();
static {
themeVariants.put("tests-valo", "Default");
themeVariants.put("tests-valo-dark", "Dark");
menu.setId("testMenu");
}
private Navigator navigator;
- private LinkedHashMap<String, String> menuItems = new LinkedHashMap<String, String>();
+ private LinkedHashMap<String, String> menuItems = new LinkedHashMap<>();
@Override
protected void init(VaadinRequest request) {
@Override
public Property<?> getItemProperty(Object propertyId) {
- ObjectProperty<String> property = new ObjectProperty<String>(
+ ObjectProperty<String> property = new ObjectProperty<>(
containerPropertyIdDefaults.get(propertyId) + " (item "
+ itemId + ")");
return property;
private int size = 1000;
- private Map<Object, Class<?>> containerPropertyIdTypes = new HashMap<Object, Class<?>>();
- private Map<Object, Object> containerPropertyIdDefaults = new HashMap<Object, Object>();
+ private Map<Object, Class<?>> containerPropertyIdTypes = new HashMap<>();
+ private Map<Object, Object> containerPropertyIdDefaults = new HashMap<>();
@Override
public Object nextItemId(Object itemId) {
import com.vaadin.ui.VerticalLayout;
public class Log extends VerticalLayout {
- List<Label> eventLabels = new ArrayList<Label>();
+ List<Label> eventLabels = new ArrayList<>();
private boolean numberLogRows = true;
private int nextLogNr = 1;
import java.util.List;
public class Millionaire extends Person {
- private List<Address> secondaryResidences = new ArrayList<Address>();
+ private List<Address> secondaryResidences = new ArrayList<>();
public Millionaire() {
}
public class Role implements Serializable {
private String name = "";
- private Set<User> users = new HashSet<User>();
+ private Set<User> users = new HashSet<>();
public Role() {
}
public class TestClickListener implements Button.ClickListener {
- private static final HashMap<String, Integer> buttonListeners = new HashMap<String, Integer>();
+ private static final HashMap<String, Integer> buttonListeners = new HashMap<>();
String name = "";
int count = 0;
public class User implements Serializable {
private String name = "";
- private Set<Role> roles = new HashSet<Role>();
+ private Set<Role> roles = new HashSet<>();
public User() {
}
private double lastPrintedTime = -1;
private int receivedPings = 0;
- private List<Double> throughputData = new ArrayList<Double>();
+ private List<Double> throughputData = new ArrayList<>();
private int payloadSize = 0;
@Override
@Override
public void sendWrappedGenerics(
Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> generics) {
- Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> updated = new HashMap<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>>();
+ Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> updated = new HashMap<>();
SimpleTestBean firstValue = generics.values().iterator().next()
.get(Integer.valueOf(1)).get(0);
- Set<SimpleTestBean> key = new HashSet<SimpleTestBean>(
+ Set<SimpleTestBean> key = new HashSet<>(
Arrays.asList(firstValue));
- Map<Integer, List<SimpleTestBean>> value = new HashMap<Integer, List<SimpleTestBean>>();
+ Map<Integer, List<SimpleTestBean>> value = new HashMap<>();
Set<SimpleTestBean> firstKeyValue = generics.keySet().iterator()
.next();
value.put(Integer.valueOf(1),
- new ArrayList<SimpleTestBean>(firstKeyValue));
+ new ArrayList<>(firstKeyValue));
updated.put(key, value);
Set<Connector> connectorSet, Set<SimpleTestBean> beanSet) {
beanSet.iterator().next().setValue(intSet.size());
- Set<Integer> updatedIntSet = new HashSet<Integer>();
+ Set<Integer> updatedIntSet = new HashSet<>();
for (Integer integer : intSet) {
updatedIntSet.add(Integer.valueOf(-integer.intValue()));
Map<Connector, SimpleTestBean> connectorMap,
Map<Integer, Connector> intMap,
Map<SimpleTestBean, SimpleTestBean> beanMap) {
- Map<SimpleTestBean, SimpleTestBean> updatedBeanMap = new HashMap<SimpleTestBean, SimpleTestBean>();
+ Map<SimpleTestBean, SimpleTestBean> updatedBeanMap = new HashMap<>();
for (Entry<SimpleTestBean, SimpleTestBean> entry : beanMap
.entrySet()) {
updatedBeanMap.put(entry.getValue(), entry.getKey());
Arrays.asList(simpleBean, updatedSimpleBean));
updatedComplexBean.setPrivimite(complexBean.getPrivimite() + 1);
- ArrayList<SimpleTestBean> arrayList = new ArrayList<SimpleTestBean>(
+ ArrayList<SimpleTestBean> arrayList = new ArrayList<>(
Arrays.asList(array));
Collections.reverse(arrayList);
List<Integer[]> objectArrayList,
List<SimpleTestBean[]> beanArrayList) {
Collections.reverse(beanArrayList);
- List<Integer[]> updatedObjectArrayList = new ArrayList<Integer[]>();
+ List<Integer[]> updatedObjectArrayList = new ArrayList<>();
for (int[] array : primitiveArrayList) {
updatedObjectArrayList
.add(new Integer[] { Integer.valueOf(array.length),
.create(TestWidgetRegistry.class);
public static abstract class TestWidgetRegistry {
- private Map<String, Invoker> creators = new HashMap<String, Invoker>();
+ private Map<String, Invoker> creators = new HashMap<>();
// Called by generated sub class
protected void register(String widgetClass, Invoker creator) {
private static final int MAX_LOG = 9;
private final HTML html = new HTML();
- private final List<String> logs = new ArrayList<String>();
+ private final List<String> logs = new ArrayList<>();
private Escalator escalator;
public LogWidget() {
private class Data {
private int columnCounter = 0;
private int rowCounter = 0;
- private final List<Integer> columns = new ArrayList<Integer>();
- private final List<Integer> rows = new ArrayList<Integer>();
+ private final List<Integer> columns = new ArrayList<>();
+ private final List<Integer> rows = new ArrayList<>();
@SuppressWarnings("boxing")
public void insertRows(final int offset, final int amount) {
- final List<Integer> newRows = new ArrayList<Integer>();
+ final List<Integer> newRows = new ArrayList<>();
for (int i = 0; i < amount; i++) {
newRows.add(rowCounter++);
}
@SuppressWarnings("boxing")
public void insertColumns(final int offset, final int amount) {
- final List<Integer> newColumns = new ArrayList<Integer>();
+ final List<Integer> newColumns = new ArrayList<>();
for (int i = 0; i < amount; i++) {
newColumns.add(columnCounter++);
}
private class TestEditorHandler implements EditorHandler<List<Data>> {
- private Map<Grid.Column<?, ?>, TextBox> widgets = new HashMap<Grid.Column<?, ?>, TextBox>();
+ private Map<Grid.Column<?, ?>, TextBox> widgets = new HashMap<>();
private Label log = new Label();
* @return
*/
private List<List<Data>> createData(int rowCount) {
- List<List<Data>> dataList = new ArrayList<List<Data>>();
+ List<List<Data>> dataList = new ArrayList<>();
Random rand = new Random();
rand.setSeed(13334);
long timestamp = 0;
* @return
*/
private List<Data> createDataRow(int cols) {
- List<Data> list = new ArrayList<Data>(cols);
+ List<Data> list = new ArrayList<>(cols);
for (int i = 0; i < cols; ++i) {
list.add(new Data());
}
// Initialize data source
data = createData(ROWS);
- ds = new ListDataSource<List<Data>>(data);
+ ds = new ListDataSource<>(data);
grid = getTestedWidget();
grid.getElement().setId("testComponent");
grid.setDataSource(ds);
grid.setSelectionMode(SelectionMode.NONE);
grid.setEditorHandler(new TestEditorHandler());
- sorter = new ListSorter<List<Data>>(grid);
+ sorter = new ListSorter<>(grid);
// Create a bunch of grid columns
@Override
public void execute() {
- List<Column> columns = new ArrayList<Column>(grid.getColumns());
+ List<Column> columns = new ArrayList<>(grid.getColumns());
Collections.reverse(columns);
grid.setColumnOrder(
columns.toArray(new Column[columns.size()]));
@Override
public void execute() {
List<Column<?, List<Data>>> cols = grid.getColumns();
- ArrayList<Column> reordered = new ArrayList<Column>(cols);
+ ArrayList<Column> reordered = new ArrayList<>(cols);
final int index = cols.indexOf(column);
if (index == 0) {
Column<?, List<Data>> col = reordered.remove(0);
* Creates a collection of handlers for all the grid key events
*/
private void createKeyHandlers() {
- final List<VLabel> labels = new ArrayList<VLabel>();
+ final List<VLabel> labels = new ArrayList<>();
for (int i = 0; i < 9; ++i) {
VLabel tmp = new VLabel();
addNorth(tmp, 20);
private void createSidebarMenu() {
String[] menupath = new String[] { "Component", "Sidebar" };
- final List<MenuItem> customMenuItems = new ArrayList<MenuItem>();
- final List<MenuItemSeparator> separators = new ArrayList<MenuItemSeparator>();
+ final List<MenuItem> customMenuItems = new ArrayList<>();
+ final List<MenuItemSeparator> separators = new ArrayList<>();
addMenuCommand("Add item to end", new ScheduledCommand() {
@Override
private Grid<String[]> grid;
private final class MyDataSource implements DataSource<String[]> {
- List<String[]> rows = new ArrayList<String[]>();
+ List<String[]> rows = new ArrayList<>();
int ROWS_MAX = 10;
int size = ROWS_MAX;
DataChangeHandler handler = null;
grid.setSelectionMode(Grid.SelectionMode.NONE);
// Generated some column data
- List<String> columnData = new ArrayList<String>();
+ List<String> columnData = new ArrayList<>();
for (int i = 0; i < 100; i++) {
columnData.add(String.valueOf(i));
}
// Provide data as data source
if (Location.getParameter("latency") != null) {
grid.setDataSource(new DelayedDataSource(
- new ListDataSource<String>(columnData),
+ new ListDataSource<>(columnData),
Integer.parseInt(Location.getParameter("latency"))));
} else {
- grid.setDataSource(new ListDataSource<String>(columnData));
+ grid.setDataSource(new ListDataSource<>(columnData));
}
// Add a column to display the data in
@SuppressWarnings("unchecked")
public void triggerClientSortingTest() {
Grid<String> grid = getWidget();
- ListSorter<String> sorter = new ListSorter<String>(
+ ListSorter<String> sorter = new ListSorter<>(
grid);
// Make sorter sort the numbers in natural order
@SuppressWarnings("unchecked")
public void shuffle() {
Grid<String> grid = getWidget();
- ListSorter<String> shuffler = new ListSorter<String>(
+ ListSorter<String> shuffler = new ListSorter<>(
grid);
// Make shuffler return random order
private List<String[]> fetchRows(int firstRowIndex,
int numberOfRows) {
- List<String[]> rows = new ArrayList<String[]>();
+ List<String[]> rows = new ArrayList<>();
for (int i = 0; i < numberOfRows; i++) {
String id = String.valueOf(firstRowIndex + i);
rows.add(new String[] { id,
grid.setSelectionMode(SelectionMode.NONE);
grid.setWidth("750px");
- List<List<String>> list = new ArrayList<List<String>>();
+ List<List<String>> list = new ArrayList<>();
list.add(Arrays.asList("equal length", "a very long cell content",
"short", "fixed width narrow", "fixed width wide"));
- grid.setDataSource(new ListDataSource<List<String>>(list));
+ grid.setDataSource(new ListDataSource<>(list));
addColumn("equal length");
addColumn("short");
public class GridDataChangeHandlerWidget extends Composite {
private final SimplePanel panel = new SimplePanel();
- private final Grid<String> grid = new Grid<String>();
+ private final Grid<String> grid = new Grid<>();
public static class DelayedDataSource extends ListDataSource<String> {
super(new Grid<String>());
grid = getTestedWidget();
- grid.setDataSource(new ListDataSource<String>(NULL_STRING, "string"));
+ grid.setDataSource(new ListDataSource<>(NULL_STRING, "string"));
grid.addColumn(new Column<String, String>() {
@Override
public String getValue(String row) {
public class GridHeightByRowOnInitWidget extends Composite {
private final SimplePanel panel = new SimplePanel();
- private final Grid<String> grid = new Grid<String>();
+ private final Grid<String> grid = new Grid<>();
public GridHeightByRowOnInitWidget() {
initWidget(panel);
panel.setWidget(grid);
- grid.setDataSource(new ListDataSource<String>(
+ grid.setDataSource(new ListDataSource<>(
Arrays.asList("A", "B", "C", "D", "E")));
grid.addColumn(new Column<String, String>("letter") {
@Override
@Override
protected void extend(ServerConnector target) {
super.extend(target);
- handler = new ClickSelectHandler<JsonObject>(getGrid());
+ handler = new ClickSelectHandler<>(getGrid());
}
@Override
title = "";
menubar = new MenuBar();
menubar.getElement().setId("menu");
- children = new ArrayList<Menu>();
- items = new ArrayList<Command>();
+ children = new ArrayList<>();
+ items = new ArrayList<>();
}
/**
public Menu(String title) {
this.title = title;
menubar = new MenuBar(true);
- children = new ArrayList<Menu>();
- items = new ArrayList<Command>();
+ children = new ArrayList<>();
+ items = new ArrayList<>();
}
/**
private List<JClassType> findTestWidgets(TreeLogger logger,
TypeOracle typeOracle) {
- List<JClassType> testWidgetTypes = new ArrayList<JClassType>();
+ List<JClassType> testWidgetTypes = new ArrayList<>();
JClassType[] widgetTypes = typeOracle.findType(Widget.class.getName())
.getSubtypes();
public class GridCheckBoxDisplay extends AbstractTestUI {
private static final long serialVersionUID = -5575892909354637168L;
- private BeanItemContainer<Todo> todoContainer = new BeanItemContainer<Todo>(
+ private BeanItemContainer<Todo> todoContainer = new BeanItemContainer<>(
Todo.class);
@Override
Indexed dataSource = grid.getContainerDataSource();
Object itemId = dataSource.getItemIds().iterator().next();
Item item = dataSource.getItem(itemId);
- ArrayList<Object> pIds = new ArrayList<Object>(
+ ArrayList<Object> pIds = new ArrayList<>(
item.getItemPropertyIds());
for (int i = 0; i < pIds.size() / 2; i++) {
int j = pIds.size() - 1 - i;
@Override
protected void setup(VaadinRequest request) {
persons = createPersons(10, new Random(1));
- container = new BeanItemContainer<ComplexPerson>(ComplexPerson.class,
+ container = new BeanItemContainer<>(ComplexPerson.class,
persons);
grid = new Grid(container);
}
public static List<ComplexPerson> createPersons(int count, Random r) {
- List<ComplexPerson> c = new ArrayList<ComplexPerson>();
+ List<ComplexPerson> c = new ArrayList<>();
for (int i = 0; i < count; ++i) {
c.add(ComplexPerson.create(r));
}
person2.setFirstName("person");
person2.setLastName("two");
- ArrayList<Person> items = new ArrayList<Person>();
+ ArrayList<Person> items = new ArrayList<>();
items.add(person1);
items.add(person2);
- final BeanItemContainer<Person> container = new BeanItemContainer<Person>(
+ final BeanItemContainer<Person> container = new BeanItemContainer<>(
Person.class, items);
final Grid grid = new Grid();
}
private Grid generateGrid() {
- BeanItemContainer<GridExampleBean> container = new BeanItemContainer<GridExampleBean>(
+ BeanItemContainer<GridExampleBean> container = new BeanItemContainer<>(
GridExampleBean.class);
for (int i = 0; i < 1000; i++) {
container.addItem(new GridExampleBean("Bean " + i, i * i, i / 10d));
@Override
protected void setup(VaadinRequest request) {
- BeanItemContainer<Person> datasource = new BeanItemContainer<Person>(
+ BeanItemContainer<Person> datasource = new BeanItemContainer<>(
Person.class);
final Grid grid;
static final String[] detailsRowHeights = { FULL, UNDEFINED, PX100 };
private Grid grid;
- private Map<Object, VerticalLayout> detailsLayouts = new HashMap<Object, VerticalLayout>();
+ private Map<Object, VerticalLayout> detailsLayouts = new HashMap<>();
private OptionGroup detailsHeightSelector;
@Override
}
private Indexed createContainer() {
- BeanItemContainer<Bean> bic = new BeanItemContainer<Bean>(Bean.class);
+ BeanItemContainer<Bean> bic = new BeanItemContainer<>(Bean.class);
bic.addBean(new Bean(1, "First item"));
bic.addBean(new Bean(2, "Second item"));
bic.addBean(new Bean(3, "Third item"));
@Override
public void sort(SortEvent event) {
- List<SortOrder> currentSortOrder = new ArrayList<SortOrder>(
+ List<SortOrder> currentSortOrder = new ArrayList<>(
event.getSortOrder());
if (currentSortOrder.size() == 1) {
// If the name column was clicked, set a new sort order for
// both columns. Otherwise, revert to oldSortDirection if it
// is not null.
- List<SortOrder> newSortOrder = new ArrayList<SortOrder>();
+ List<SortOrder> newSortOrder = new ArrayList<>();
SortDirection newSortDirection = oldSortDirection;
if (currentSortOrder.get(0).getPropertyId()
.equals("Name")) {
@Override
protected void setup(VaadinRequest request) {
addComponent(button);
- container = new BeanItemContainer<DataObject>(DataObject.class);
+ container = new BeanItemContainer<>(DataObject.class);
container.addBean(new DataObject("Foo", "Bar"));
Grid grid = new Grid(container);
grid.getColumn("foo").setWidth(248.525);
@Override
public void buttonClick(ClickEvent event) {
HeaderRow row = addHeaderRowAt(0);
- List<Object> pids = new ArrayList<Object>();
+ List<Object> pids = new ArrayList<>();
for (Column c : getColumns()) {
pids.add(c.getPropertyId());
}
}
};
- private Map<Object, Panel> detailsMap = new HashMap<Object, Panel>();
+ private Map<Object, Panel> detailsMap = new HashMap<>();
private final DetailsGenerator persistingDetailsGenerator = new DetailsGenerator() {
protected void createGridActions() {
- LinkedHashMap<String, String> primaryStyleNames = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> primaryStyleNames = new LinkedHashMap<>();
primaryStyleNames.put("v-grid", "v-grid");
primaryStyleNames.put("v-escalator", "v-escalator");
primaryStyleNames.put("my-grid", "my-grid");
}
}, primaryStyleNames.get("v-grid"));
- LinkedHashMap<String, SelectionMode> selectionModes = new LinkedHashMap<String, Grid.SelectionMode>();
+ LinkedHashMap<String, SelectionMode> selectionModes = new LinkedHashMap<>();
selectionModes.put("single", SelectionMode.SINGLE);
selectionModes.put("multi", SelectionMode.MULTI);
selectionModes.put("none", SelectionMode.NONE);
}
});
- LinkedHashMap<String, Integer> selectionLimits = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> selectionLimits = new LinkedHashMap<>();
selectionLimits.put("2", Integer.valueOf(2));
selectionLimits.put("1000", Integer.valueOf(1000));
selectionLimits.put("Integer.MAX_VALUE",
}
});
- LinkedHashMap<String, List<SortOrder>> sortableProperties = new LinkedHashMap<String, List<SortOrder>>();
+ LinkedHashMap<String, List<SortOrder>> sortableProperties = new LinkedHashMap<>();
for (Object propertyId : ds.getSortableContainerPropertyIds()) {
sortableProperties.put(propertyId + ", ASC",
Sort.by(propertyId).build());
@Override
public void execute(Grid c, Boolean value, Object data) {
- List<Object> ids = new ArrayList<Object>();
+ List<Object> ids = new ArrayList<>();
ids.addAll(ds.getContainerPropertyIds());
if (!value) {
c.setColumnOrder(ids.toArray());
}
});
- LinkedHashMap<String, CellStyleGenerator> cellStyleGenerators = new LinkedHashMap<String, CellStyleGenerator>();
- LinkedHashMap<String, RowStyleGenerator> rowStyleGenerators = new LinkedHashMap<String, RowStyleGenerator>();
+ LinkedHashMap<String, CellStyleGenerator> cellStyleGenerators = new LinkedHashMap<>();
+ LinkedHashMap<String, RowStyleGenerator> rowStyleGenerators = new LinkedHashMap<>();
rowStyleGenerators.put(ROW_STYLE_GENERATOR_NONE, null);
rowStyleGenerators.put(ROW_STYLE_GENERATOR_ROW_NUMBERS,
new RowStyleGenerator() {
}
});
- LinkedHashMap<String, Integer> frozenOptions = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> frozenOptions = new LinkedHashMap<>();
for (int i = -1; i <= COLUMNS; i++) {
frozenOptions.put(String.valueOf(i), Integer.valueOf(i));
}
}
});
- LinkedHashMap<String, Integer> containerDelayValues = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> containerDelayValues = new LinkedHashMap<>();
for (int delay : new int[] { 0, 500, 2000, 10000 }) {
containerDelayValues.put(String.valueOf(delay),
Integer.valueOf(delay));
}
});
- LinkedHashMap<String, String> defaultRows = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> defaultRows = new LinkedHashMap<>();
defaultRows.put("Top", "Top");
defaultRows.put("Bottom", "Bottom");
defaultRows.put("Unset", "Unset");
final String columnProperty = getColumnProperty(
(Integer) data);
List<Column> cols = grid.getColumns();
- List<Object> reordered = new ArrayList<Object>();
+ List<Object> reordered = new ArrayList<>();
boolean addAsLast = false;
for (int i = 0; i < cols.size(); i++) {
Column col = cols.get(i);
}, w, c);
}
- LinkedHashMap<String, GridStaticCellType> defaultRows = new LinkedHashMap<String, GridStaticCellType>();
+ LinkedHashMap<String, GridStaticCellType> defaultRows = new LinkedHashMap<>();
defaultRows.put("Text Header", GridStaticCellType.TEXT);
defaultRows.put("Html Header ", GridStaticCellType.HTML);
defaultRows.put("Widget Header", GridStaticCellType.WIDGET);
}, c);
- defaultRows = new LinkedHashMap<String, GridStaticCellType>();
+ defaultRows = new LinkedHashMap<>();
defaultRows.put("Text Footer", GridStaticCellType.TEXT);
defaultRows.put("Html Footer", GridStaticCellType.HTML);
defaultRows.put("Widget Footer", GridStaticCellType.WIDGET);
}
private void createNullRepresentationAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put("null", "null");
options.put("This is empty", "This is empty");
}
private void createSelectionRangeAction(String category) {
- List<Range> options = new ArrayList<Range>();
+ List<Range> options = new ArrayList<>();
options.add(new Range(0, 10));
options.add(new Range(0, 1));
options.add(new Range(0, 2));
}
private void createTextChangeEventTimeoutAction(String category) {
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<>();
options.put("0", 0);
options.put("100ms", 100);
options.put("500ms", 500);
}
private void createTextChangeEventModeAction(String category) {
- LinkedHashMap<String, TextChangeEventMode> options = new LinkedHashMap<String, AbstractTextField.TextChangeEventMode>();
+ LinkedHashMap<String, TextChangeEventMode> options = new LinkedHashMap<>();
for (TextChangeEventMode m : TextChangeEventMode.values()) {
options.put(m.toString(), m);
}
}
private void createInputPromptAction(String category) {
- LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> options = new LinkedHashMap<>();
options.put("-", null);
options.put("Enter a value", "Enter a value");
options.put("- Click here -", "- Click here -");
@Test
public void testParameters() {
openTestURL();
- List<String> texts = new ArrayList<String>(Arrays.asList(
+ List<String> texts = new ArrayList<>(Arrays.asList(
"Init parameters:", "widgetset: com.vaadin.v7.Vaadin7WidgetSet",
"closeIdleSessions: true", "productionMode: false",
"testParam: 42", "heartbeatInterval: 301",
.findElements(By.cssSelector(
".v-filterselect-suggestpopup .gwt-MenuItem span"));
- List<String> suggestions = new ArrayList<String>();
+ List<String> suggestions = new ArrayList<>();
for (WebElement suggestion : suggestionElements) {
suggestions.add(suggestion.getText());
}
List<WebElement> headerElements = popup
.findElement(By.className("v-datefield-calendarpanel-weekdays"))
.findElements(By.tagName("td"));
- List<WebElement> weekdays = new ArrayList<WebElement>();
+ List<WebElement> weekdays = new ArrayList<>();
for (WebElement headerElement : headerElements) {
if ("columnheader".equals(headerElement.getAttribute("role"))) {
weekdays.add(headerElement);
List<WebElement> headerElements = popup
.findElement(By.className("v-datefield-calendarpanel-weekdays"))
.findElements(By.tagName("td"));
- List<WebElement> weekdays = new ArrayList<WebElement>();
+ List<WebElement> weekdays = new ArrayList<>();
for (WebElement headerElement : headerElements) {
if ("columnheader".equals(headerElement.getAttribute("role"))) {
weekdays.add(headerElement);
List<WebElement> headerElements = popup
.findElement(By.className("v-datefield-calendarpanel-weekdays"))
.findElements(By.tagName("td"));
- List<WebElement> weekdays = new ArrayList<WebElement>();
+ List<WebElement> weekdays = new ArrayList<>();
for (WebElement headerElement : headerElements) {
if ("columnheader".equals(headerElement.getAttribute("role"))) {
weekdays.add(headerElement);
$(ComboBoxElement.class).first().findElement(By.vaadin("#textbox"))
.sendKeys("rus", Keys.ENTER);
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
// pick list items that are shown in suggestion popup
List<WebElement> elems = findElements(
}
private List<WebElement> getFieldElements() {
- List<WebElement> fieldElements = new ArrayList<WebElement>();
+ List<WebElement> fieldElements = new ArrayList<>();
fieldElements.add(getElement1());
fieldElements.add(getElement2());
fieldElements.add(getElement3());
@Parameters
public static Collection<String> getContextPaths() {
if (getServerName().equals("wildfly9-nginx")) {
- ArrayList<String> paths = new ArrayList<String>();
+ ArrayList<String> paths = new ArrayList<>();
paths.add("/buffering/demo");
paths.add("/nonbuffering/demo");
paths.add("/buffering-timeout/demo");
// Should now have two services with 2 + 1 UIs
List<UIData> threeUIs = getUIs();
assertEquals(3, threeUIs.size());
- Set<String> serviceNames = new HashSet<String>();
- Set<Integer> uiIds = new HashSet<Integer>();
+ Set<String> serviceNames = new HashSet<>();
+ Set<Integer> uiIds = new HashSet<>();
for (UIData uiData : threeUIs) {
serviceNames.add(uiData.serviceName);
uiIds.add(uiData.uiId);
}
private List<UIData> getUIs() {
- List<UIData> uis = new ArrayList<UIData>();
+ List<UIData> uis = new ArrayList<>();
getDriver().get(jspUrl);
List<WebElement> rows = getDriver()
testClasses
.addAll(getTestClassesWithAffectedPackageName(allTestClasses));
- List<Class<? extends T>> affectedTestClasses = new ArrayList<Class<? extends T>>();
+ List<Class<? extends T>> affectedTestClasses = new ArrayList<>();
affectedTestClasses.addAll(testClasses);
return affectedTestClasses;
private <T> List<Class<? extends T>> getTestClassesWithAffectedPackageName(
List<Class<? extends T>> classes) {
- List<Class<? extends T>> affectedTestClasses = new ArrayList<Class<? extends T>>();
+ List<Class<? extends T>> affectedTestClasses = new ArrayList<>();
List<String> affectedFiles = getAffectedFiles();
for (Class c : classes) {
}
private List<String> getAffectedFiles() {
- List<String> affectedFilePaths = new ArrayList<String>();
+ List<String> affectedFilePaths = new ArrayList<>();
for (String path : changedTB3TestLocator.getChangedFilePaths()) {
if (!path.toLowerCase().contains("test")) {
}
protected List<String> getChangedFilePaths() {
- List<String> filePaths = new ArrayList<String>();
+ List<String> filePaths = new ArrayList<>();
for (DiffEntry diff : getDiffs()) {
if (diff.getChangeType() != ChangeType.DELETE) {
Git git = new Git(repository);
DiffCommand diffCommand = git.diff();
- List<DiffEntry> diffsInWorkingTree = new ArrayList<DiffEntry>();
+ List<DiffEntry> diffsInWorkingTree = new ArrayList<>();
for (DiffEntry diff : diffCommand.call()) {
if (pathIsExcluded(diff.getNewPath())) {
private <T> List<Class<? extends T>> getChangedTestClasses(
Class<T> baseClass) {
List<String> changedTestFilePaths = getTestFilePaths();
- List<Class<? extends T>> testClasses = new ArrayList<Class<? extends T>>();
+ List<Class<? extends T>> testClasses = new ArrayList<>();
for (String filePath : changedTestFilePaths) {
String path = filePath.replace("uitest/src/", "").replace(".java",
}
private List<String> getTestFilePaths() {
- List<String> changedTestFilePaths = new ArrayList<String>();
+ List<String> changedTestFilePaths = new ArrayList<>();
for (String filePath : getChangedFilePaths()) {
if (filePath.toLowerCase().startsWith("uitest")
@Override
protected void openTestURL(Class<?> uiClass, String... parameters) {
- Set<String> params = new HashSet<String>(Arrays.asList(parameters));
+ Set<String> params = new HashSet<>(Arrays.asList(parameters));
params.add("theme=" + theme);
super.openTestURL(uiClass, params.toArray(new String[params.size()]));
}
@Override
protected void openTestURL(Class<?> uiClass, String... parameters) {
- Set<String> params = new HashSet<String>(Arrays.asList(parameters));
+ Set<String> params = new HashSet<>(Arrays.asList(parameters));
params.add("theme=" + theme);
super.openTestURL(uiClass, params.toArray(new String[params.size()]));
}
@RunWith(ServletIntegrationTestSuite.class)
public class ServletIntegrationTests {
- public static Set<String> notJSR356Compatible = new HashSet<String>();
- public static Set<String> notWebsocketCompatible = new HashSet<String>();
+ public static Set<String> notJSR356Compatible = new HashSet<>();
+ public static Set<String> notWebsocketCompatible = new HashSet<>();
static {
notJSR356Compatible.add("jetty8");
}
public static Collection<Param> parameters() {
- List<Param> data = new ArrayList<Param>();
+ List<Param> data = new ArrayList<>();
int[] params = new int[] { 0, 500, 999 };
private Map<AssertionError, Object[]> testGridHeightAndResizing(
Object gridHeight) throws InterruptedException {
- Map<AssertionError, Object[]> errors = new HashMap<AssertionError, Object[]>();
+ Map<AssertionError, Object[]> errors = new HashMap<>();
String caption;
if (GridHeight.ROW3.equals(gridHeight)) {
caption = gridHeight + " rows";
}
protected List<TestBenchElement> getGridHeaderRowCells() {
- List<TestBenchElement> headerCells = new ArrayList<TestBenchElement>();
+ List<TestBenchElement> headerCells = new ArrayList<>();
for (int i = 0; i < getGridElement().getHeaderCount(); ++i) {
headerCells.addAll(getGridElement().getHeaderCells(i));
}
}
protected List<TestBenchElement> getGridFooterRowCells() {
- List<TestBenchElement> footerCells = new ArrayList<TestBenchElement>();
+ List<TestBenchElement> footerCells = new ArrayList<>();
for (int i = 0; i < getGridElement().getFooterCount(); ++i) {
footerCells.addAll(getGridElement().getFooterCells(i));
}
GridElement gridElement = getGridElement();
List<GridCellElement> headerCells = gridElement.getHeaderCells(0);
- final List<Integer> columnWidths = new ArrayList<Integer>();
+ final List<Integer> columnWidths = new ArrayList<>();
for (GridCellElement cell : headerCells) {
columnWidths.add(cell.getSize().getWidth());
}