summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/server/BootstrapHandler.java27
-rw-r--r--server/src/com/vaadin/server/Page.java3
-rw-r--r--server/src/com/vaadin/server/VaadinSession.java2
-rw-r--r--server/src/com/vaadin/server/communication/ClientRpcWriter.java6
-rw-r--r--server/src/com/vaadin/server/communication/PushHandler.java70
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java59
-rw-r--r--server/src/com/vaadin/ui/AbstractTextField.java12
-rw-r--r--server/src/com/vaadin/ui/NotificationConfiguration.java3
-rw-r--r--server/src/com/vaadin/ui/TabSheet.java9
-rw-r--r--server/src/com/vaadin/ui/Table.java439
-rw-r--r--server/src/com/vaadin/ui/UI.java27
-rw-r--r--server/src/com/vaadin/ui/themes/ValoTheme.java172
-rw-r--r--server/src/com/vaadin/util/CurrentInstance.java4
13 files changed, 540 insertions, 293 deletions
diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java
index 3c75764075..73bafcca25 100644
--- a/server/src/com/vaadin/server/BootstrapHandler.java
+++ b/server/src/com/vaadin/server/BootstrapHandler.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -45,10 +45,10 @@ import com.vaadin.shared.communication.PushMode;
import com.vaadin.ui.UI;
/**
- *
+ *
* @author Vaadin Ltd
* @since 7.0.0
- *
+ *
* @deprecated As of 7.0. Will likely change or be removed in a future version
*/
@Deprecated
@@ -336,9 +336,9 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
* Override this method if you want to add some custom html around around
* the div element into which the actual Vaadin application will be
* rendered.
- *
+ *
* @param context
- *
+ *
* @throws IOException
* @throws JSONException
*/
@@ -397,7 +397,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
"type", "text/javascript").attr("src", pushJS));
}
- String bootstrapLocation = vaadinLocation + "vaadinBootstrap.js";
+ String bootstrapLocation = vaadinLocation
+ + ApplicationConstants.VAADIN_BOOTSTRAP_JS;
fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr("type",
"text/javascript").attr("src", bootstrapLocation));
Element mainScriptTag = new Element(Tag.valueOf("script"), "").attr(
@@ -543,13 +544,13 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
/**
* Get the URI for the application theme.
- *
+ *
* A portal-wide default theme is fetched from the portal shared resource
* directory (if any), other themes from the portlet.
- *
+ *
* @param context
* @param themeName
- *
+ *
* @return
*/
public String getThemeUri(BootstrapContext context, String themeName) {
@@ -562,7 +563,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
/**
* Override if required
- *
+ *
* @param context
* @return
*/
@@ -574,7 +575,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
/**
* Don not override.
- *
+ *
* @param context
* @return
*/
diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index d58ba548e3..3acea97c0f 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -636,7 +636,8 @@ public class Page implements Serializable {
}
public void init(VaadinRequest request) {
- // NOTE: UI.refresh makes assumptions about the semantics of this method.
+ // NOTE: UI.refresh makes assumptions about the semantics of this
+ // method.
// It should be kept in sync if this method is changed.
// Extract special parameter sent by vaadinBootstrap.js
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 2ab8c52dad..f93cb8e070 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -114,7 +114,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
* deadlocks unless implemented very carefully. get(long, TimeUnit)
* does not have the same detection since a sensible timeout should
* avoid completely locking up the application.
- *
+ *
* Even though no deadlock could occur after the runnable has been
* run, the check is always done as the deterministic behavior makes
* it easier to detect potential problems.
diff --git a/server/src/com/vaadin/server/communication/ClientRpcWriter.java b/server/src/com/vaadin/server/communication/ClientRpcWriter.java
index 181bfbb882..1090fdbab9 100644
--- a/server/src/com/vaadin/server/communication/ClientRpcWriter.java
+++ b/server/src/com/vaadin/server/communication/ClientRpcWriter.java
@@ -81,9 +81,9 @@ public class ClientRpcWriter implements Serializable {
// + parameterType.getName());
// }
// }
- EncodeResult encodeResult = JsonCodec.encode(invocation.getParameters()[i],
- referenceParameter, parameterType,
- ui.getConnectorTracker());
+ EncodeResult encodeResult = JsonCodec.encode(
+ invocation.getParameters()[i], referenceParameter,
+ parameterType, ui.getConnectorTracker());
paramJson.put(encodeResult.getEncodedValue());
}
invocationJson.put(paramJson);
diff --git a/server/src/com/vaadin/server/communication/PushHandler.java b/server/src/com/vaadin/server/communication/PushHandler.java
index 5a7ae5b3e8..67e5f87153 100644
--- a/server/src/com/vaadin/server/communication/PushHandler.java
+++ b/server/src/com/vaadin/server/communication/PushHandler.java
@@ -18,6 +18,7 @@ package com.vaadin.server.communication;
import java.io.IOException;
import java.io.Reader;
+import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -48,7 +49,7 @@ import com.vaadin.ui.UI;
/**
* Establishes bidirectional ("push") communication channels
- *
+ *
* @author Vaadin Ltd
* @since 7.1
*/
@@ -70,9 +71,10 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter {
AtmosphereRequest req = resource.getRequest();
if (req.getMethod().equalsIgnoreCase("GET")) {
- callWithUi(resource, establishCallback);
+ callWithUi(resource, establishCallback, false);
} else if (req.getMethod().equalsIgnoreCase("POST")) {
- callWithUi(resource, receiveCallback);
+ callWithUi(resource, receiveCallback,
+ resource.transport() == TRANSPORT.WEBSOCKET);
}
}
@@ -194,20 +196,27 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter {
/**
* Find the UI for the atmosphere resource, lock it and invoke the callback.
- *
+ *
* @param resource
* the atmosphere resource for the current request
* @param callback
* the push callback to call when a UI is found and locked
+ * @param websocket
+ * true if this is a websocket message (as opposed to a HTTP
+ * request)
*/
private void callWithUi(final AtmosphereResource resource,
- final PushEventCallback callback) {
+ final PushEventCallback callback, boolean websocket) {
AtmosphereRequest req = resource.getRequest();
VaadinServletRequest vaadinRequest = new VaadinServletRequest(req,
service);
VaadinSession session = null;
- service.requestStart(vaadinRequest, null);
+ if (websocket) {
+ // For any HTTP request we have already started the request in the
+ // servlet
+ service.requestStart(vaadinRequest, null);
+ }
try {
try {
session = service.findVaadinSession(vaadinRequest);
@@ -278,7 +287,9 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter {
}
} finally {
try {
- service.requestEnd(vaadinRequest, null, session);
+ if (websocket) {
+ service.requestEnd(vaadinRequest, null, session);
+ }
} catch (Exception e) {
getLogger().log(Level.WARNING, "Error while ending request", e);
@@ -357,9 +368,31 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter {
// Sets UI.currentInstance
ui = service.findUI(vaadinRequest);
if (ui == null) {
- getLogger().log(Level.SEVERE,
- "Could not get UI. This should never happen");
- return;
+ /*
+ * UI not found, could be because FF has asynchronously closed
+ * the websocket connection and Atmosphere has already done
+ * cleanup of the request attributes.
+ *
+ * In that case, we still have a chance of finding the right UI
+ * by iterating through the UIs in the session looking for one
+ * using the same AtmosphereResource.
+ */
+ ui = findUiUsingResource(resource, session.getUIs());
+
+ if (ui == null) {
+ getLogger()
+ .log(Level.SEVERE,
+ "Could not get UI. This should never happen,"
+ + " except when reloading in Firefox -"
+ + " see http://dev.vaadin.com/ticket/14251.");
+ return;
+ } else {
+ getLogger()
+ .log(Level.INFO,
+ "No UI was found based on data in the request,"
+ + " but a slower lookup based on the AtmosphereResource succeeded."
+ + " See http://dev.vaadin.com/ticket/14251 for more details.");
+ }
}
PushMode pushMode = ui.getPushConfiguration().getPushMode();
@@ -411,6 +444,19 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter {
}
}
+ private static UI findUiUsingResource(AtmosphereResource resource,
+ Collection<UI> uIs) {
+ for (UI ui : uIs) {
+ PushConnection pushConnection = ui.getPushConnection();
+ if (pushConnection instanceof AtmospherePushConnection) {
+ if (((AtmospherePushConnection) pushConnection).getResource() == resource) {
+ return ui;
+ }
+ }
+ }
+ return null;
+ }
+
/**
* Sends a refresh message to the given atmosphere resource. Uses an
* AtmosphereResource instead of an AtmospherePushConnection even though it
@@ -419,10 +465,10 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter {
* two push connections which try to use the same UI. Using the
* AtmosphereResource directly guarantees the message goes to the correct
* recipient.
- *
+ *
* @param resource
* The atmosphere resource to send refresh to
- *
+ *
*/
private static void sendRefreshAndDisconnect(AtmosphereResource resource)
throws IOException {
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index 9dbd9a093d..c9639813ca 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -37,6 +37,7 @@ import com.vaadin.server.VaadinSession;
import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.ComponentConstants;
import com.vaadin.shared.ui.ComponentStateUtil;
+import com.vaadin.shared.util.SharedUtil;
import com.vaadin.ui.Field.ValueChangeEvent;
import com.vaadin.util.ReflectTools;
@@ -45,7 +46,7 @@ import com.vaadin.util.ReflectTools;
* {@link Component} interface. Basic UI components that are not derived from an
* external component can inherit this class to easily qualify as Vaadin
* components. Most components in Vaadin do just that.
- *
+ *
* @author Vaadin Ltd.
* @since 3.0
*/
@@ -83,7 +84,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
private Unit widthUnit = Unit.PIXELS;
private Unit heightUnit = Unit.PIXELS;
private static final Pattern sizePattern = Pattern
- .compile("^(-?\\d+(\\.\\d+)?)(%|px|em|rem|ex|in|cm|mm|pt|pc)?$");
+ .compile(SharedUtil.SIZE_PATTERN);
/**
* Keeps track of the Actions added to this component; the actual
@@ -240,7 +241,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
* Sets the component's caption <code>String</code>. Caption is the visible
* name of the component. This method will trigger a
* {@link RepaintRequestEvent}.
- *
+ *
* @param caption
* the new caption <code>String</code> for the component.
*/
@@ -271,7 +272,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Sets the locale of this component.
- *
+ *
* <pre>
* // Component for which the locale is meaningful
* InlineDateField date = new InlineDateField(&quot;Datum&quot;);
@@ -283,8 +284,8 @@ public abstract class AbstractComponent extends AbstractClientConnector
* date.setResolution(DateField.RESOLUTION_DAY);
* layout.addComponent(date);
* </pre>
- *
- *
+ *
+ *
* @param locale
* the locale to become this component's locale.
*/
@@ -310,7 +311,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Sets the component's icon. This method will trigger a
* {@link RepaintRequestEvent}.
- *
+ *
* @param icon
* the icon to be shown with the component's caption.
*/
@@ -376,7 +377,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Sets the component's immediate mode to the specified status.
- *
+ *
* @param immediate
* the boolean value specifying if the component should be in the
* immediate mode after the call.
@@ -437,11 +438,11 @@ public abstract class AbstractComponent extends AbstractClientConnector
* Sets the component's description. See {@link #getDescription()} for more
* information on what the description is. This method will trigger a
* {@link RepaintRequestEvent}.
- *
+ *
* The description is displayed as HTML in tooltips or directly in certain
* components so care should be taken to avoid creating the possibility for
* HTML injection and possibly XSS vulnerabilities.
- *
+ *
* @param description
* the new description string for the component.
*/
@@ -490,7 +491,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
* To find the Window that contains the component, use {@code Window w =
* getParent(Window.class);}
* </p>
- *
+ *
* @param <T>
* The type of the ancestor
* @param parentType
@@ -511,7 +512,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Gets the error message for this component.
- *
+ *
* @return ErrorMessage containing the description of the error state of the
* component or null, if the component contains no errors. Extending
* classes should override this method if they support other error
@@ -524,9 +525,9 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Gets the component's error message.
- *
+ *
* @link Terminal.ErrorMessage#ErrorMessage(String, int)
- *
+ *
* @return the component's error message.
*/
public ErrorMessage getComponentError() {
@@ -536,9 +537,9 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Sets the component's error message. The message may contain certain XML
* tags, for more information see
- *
+ *
* @link Component.ErrorMessage#ErrorMessage(String, int)
- *
+ *
* @param componentError
* the new <code>ErrorMessage</code> of the component.
*/
@@ -615,7 +616,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Build CSS compatible string representation of height.
- *
+ *
* @return CSS height
*/
private String getCSSHeight() {
@@ -624,7 +625,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Build CSS compatible string representation of width.
- *
+ *
* @return CSS width
*/
private String getCSSWidth() {
@@ -634,12 +635,12 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Returns the shared state bean with information to be sent from the server
* to the client.
- *
+ *
* Subclasses should override this method and set any relevant fields of the
* state returned by super.getState().
- *
+ *
* @since 7.0
- *
+ *
* @return updated component shared state
*/
@Override
@@ -730,7 +731,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Sets the data object, that can be used for any application specific data.
* The component does not use or modify this data.
- *
+ *
* @param data
* the Application specific data.
* @since 3.1
@@ -741,7 +742,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Gets the application specific data. See {@link #setData(Object)}.
- *
+ *
* @return the Application specific data set with setData function.
* @since 3.1
*/
@@ -916,7 +917,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
size = -1;
unit = Unit.PIXELS;
} else {
- String symbol = matcher.group(3);
+ String symbol = matcher.group(2);
unit = Unit.getUnitFromSymbol(symbol);
}
} else {
@@ -951,7 +952,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Gets the {@link ActionManager} used to manage the
* {@link ShortcutListener}s added to this {@link Field}.
- *
+ *
* @return the ActionManager in use
*/
protected ActionManager getActionManager() {
@@ -995,7 +996,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Determine whether a <code>content</code> component is equal to, or the
* ancestor of this component.
- *
+ *
* @param content
* the potential ancestor element
* @return <code>true</code> if the relationship holds
diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java
index e0318ddf2b..9293d38119 100644
--- a/server/src/com/vaadin/ui/AbstractTextField.java
+++ b/server/src/com/vaadin/ui/AbstractTextField.java
@@ -147,6 +147,18 @@ public abstract class AbstractTextField extends AbstractField<String> implements
try {
+ // Sets the height set by the user when resize the <textarea>.
+ String newHeight = (String) variables.get("height");
+ if (newHeight != null) {
+ setHeight(newHeight);
+ }
+
+ // Sets the width set by the user when resize the <textarea>.
+ String newWidth = (String) variables.get("width");
+ if (newWidth != null) {
+ setWidth(newWidth);
+ }
+
if (variables.containsKey(TextFieldConstants.VAR_CURSOR)) {
Integer object = (Integer) variables
.get(TextFieldConstants.VAR_CURSOR);
diff --git a/server/src/com/vaadin/ui/NotificationConfiguration.java b/server/src/com/vaadin/ui/NotificationConfiguration.java
index faab329f88..925c888a51 100644
--- a/server/src/com/vaadin/ui/NotificationConfiguration.java
+++ b/server/src/com/vaadin/ui/NotificationConfiguration.java
@@ -173,7 +173,8 @@ class NotificationConfigurationImpl implements NotificationConfiguration {
NotificationTypeConfiguration styleSetup = getTypeConf(type);
if (styleSetup == null) {
styleSetup = new NotificationTypeConfiguration();
- ui.getState().notificationConfigurations.put(type.getStyle(), styleSetup);
+ ui.getState().notificationConfigurations.put(type.getStyle(),
+ styleSetup);
}
return styleSetup;
diff --git a/server/src/com/vaadin/ui/TabSheet.java b/server/src/com/vaadin/ui/TabSheet.java
index 2fdb3b40a7..8b13ecf1a4 100644
--- a/server/src/com/vaadin/ui/TabSheet.java
+++ b/server/src/com/vaadin/ui/TabSheet.java
@@ -317,7 +317,8 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
* the position at where the the tab should be added.
* @return the created {@link Tab}
*/
- public Tab addTab(Component tabComponent, String caption, Resource icon, int position) {
+ public Tab addTab(Component tabComponent, String caption, Resource icon,
+ int position) {
if (tabComponent == null) {
return null;
} else if (tabs.containsKey(tabComponent)) {
@@ -1070,8 +1071,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
@Override
public Resource getIcon() {
- return getResource(ComponentConstants.ICON_RESOURCE
- + tabState.key);
+ return getResource(ComponentConstants.ICON_RESOURCE + tabState.key);
}
@Override
@@ -1211,8 +1211,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
@Override
public void setIcon(Resource icon, String iconAltText) {
- setResource(ComponentConstants.ICON_RESOURCE + tabState.key,
- icon);
+ setResource(ComponentConstants.ICON_RESOURCE + tabState.key, icon);
tabState.iconAltText = iconAltText;
}
}
diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java
index a8265662ea..84e4eaed13 100644
--- a/server/src/com/vaadin/ui/Table.java
+++ b/server/src/com/vaadin/ui/Table.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -68,7 +68,7 @@ import com.vaadin.shared.ui.table.TableConstants;
* <code>Table</code> is used for representing data or components in a pageable
* and selectable table.
* </p>
- *
+ *
* <p>
* Scalability of the Table is largely dictated by the container. A table does
* not have a limit for the number of items and is just as fast with hundreds of
@@ -76,11 +76,11 @@ import com.vaadin.shared.ui.table.TableConstants;
* scrolling however limits the number of rows to around 500000, depending on
* the browser and the pixel height of rows.
* </p>
- *
+ *
* <p>
* Components in a Table will not have their caption nor icon rendered.
* </p>
- *
+ *
* @author Vaadin Ltd.
* @since 3.0
*/
@@ -583,7 +583,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Creates a new empty table with caption.
- *
+ *
* @param caption
*/
public Table(String caption) {
@@ -593,7 +593,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Creates a new table with caption and connect it to a Container.
- *
+ *
* @param caption
* @param dataSource
*/
@@ -607,11 +607,11 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the array of visible column id:s, including generated columns.
- *
+ *
* <p>
* The columns are show in the order of their appearance in this array.
* </p>
- *
+ *
* @return an array of currently visible propertyIds and generated column
* ids.
*/
@@ -624,11 +624,11 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the array of visible column property id:s.
- *
+ *
* <p>
* The columns are show in the order of their appearance in this array.
* </p>
- *
+ *
* @param visibleColumns
* the Array of shown property id:s.
*/
@@ -690,7 +690,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the headers of the columns.
- *
+ *
* <p>
* The headers match the property id:s given my the set visible column
* headers. The table must be set in either
@@ -699,7 +699,7 @@ public class Table extends AbstractSelect implements Action.Container,
* headers. In the defaults mode any nulls in the headers array are replaced
* with id.toString().
* </p>
- *
+ *
* @return the Array of column headers.
*/
public String[] getColumnHeaders() {
@@ -717,7 +717,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the headers of the columns.
- *
+ *
* <p>
* The headers match the property id:s given my the set visible column
* headers. The table must be set in either
@@ -726,7 +726,7 @@ public class Table extends AbstractSelect implements Action.Container,
* headers. In the defaults mode any nulls in the headers array are replaced
* with id.toString() outputs when rendering.
* </p>
- *
+ *
* @param columnHeaders
* the Array of column headers that match the
* {@link #getVisibleColumns()} method.
@@ -750,7 +750,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the icons of the columns.
- *
+ *
* <p>
* The icons in headers match the property id:s given my the set visible
* column headers. The table must be set in either
@@ -758,7 +758,7 @@ public class Table extends AbstractSelect implements Action.Container,
* {@link #COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID} mode to show the headers
* with icons.
* </p>
- *
+ *
* @return the Array of icons that match the {@link #getVisibleColumns()}.
*/
public Resource[] getColumnIcons() {
@@ -777,7 +777,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the icons of the columns.
- *
+ *
* <p>
* The icons in headers match the property id:s given my the set visible
* column headers. The table must be set in either
@@ -785,7 +785,7 @@ public class Table extends AbstractSelect implements Action.Container,
* {@link #COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID} mode to show the headers
* with icons.
* </p>
- *
+ *
* @param columnIcons
* the Array of icons that match the {@link #getVisibleColumns()}
* .
@@ -809,7 +809,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the array of column alignments.
- *
+ *
* <p>
* The items in the array must match the properties identified by
* {@link #getVisibleColumns()}. The possible values for the alignments
@@ -822,7 +822,7 @@ public class Table extends AbstractSelect implements Action.Container,
* The alignments default to {@link Align#LEFT}: any null values are
* rendered as align lefts.
* </p>
- *
+ *
* @return the Column alignments array.
*/
public Align[] getColumnAlignments() {
@@ -841,7 +841,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the column alignments.
- *
+ *
* <p>
* The amount of items in the array must match the amount of properties
* identified by {@link #getVisibleColumns()}. The possible values for the
@@ -853,7 +853,7 @@ public class Table extends AbstractSelect implements Action.Container,
* </ul>
* The alignments default to {@link Align#LEFT}
* </p>
- *
+ *
* @param columnAlignments
* the Column alignments array.
*/
@@ -882,11 +882,11 @@ public class Table extends AbstractSelect implements Action.Container,
* Sets columns width (in pixels). Theme may not necessary respect very
* small or very big values. Setting width to -1 (default) means that theme
* will make decision of width.
- *
+ *
* <p>
* Column can either have a fixed width or expand ratio. The latter one set
* is used. See @link {@link #setColumnExpandRatio(Object, float)}.
- *
+ *
* @param propertyId
* colunmns property id
* @param width
@@ -920,27 +920,27 @@ public class Table extends AbstractSelect implements Action.Container,
* naturally. Excess space is the space that is not used by columns with
* explicit width (see {@link #setColumnWidth(Object, int)}) or with natural
* width (no width nor expand ratio).
- *
+ *
* <p>
* By default (without expand ratios) the excess space is divided
* proportionally to columns natural widths.
- *
+ *
* <p>
* Only expand ratios of visible columns are used in final calculations.
- *
+ *
* <p>
* Column can either have a fixed width or expand ratio. The latter one set
* is used.
- *
+ *
* <p>
* A column with expand ratio is considered to be minimum width by default
* (if no excess space exists). The minimum width is defined by terminal
* implementation.
- *
+ *
* <p>
* If terminal implementation supports re-sizable columns the column becomes
* fixed width column if users resizes the column.
- *
+ *
* @param propertyId
* columns property id
* @param expandRatio
@@ -969,7 +969,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the column expand ratio for a columnd. See
* {@link #setColumnExpandRatio(Object, float)}
- *
+ *
* @param propertyId
* columns property id
* @return the expandRatio used to divide excess space for this column
@@ -984,7 +984,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the pixel width of column
- *
+ *
* @param propertyId
* @return width of column or -1 when value not set
*/
@@ -1003,11 +1003,11 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the page length.
- *
+ *
* <p>
* Setting page length 0 disables paging.
* </p>
- *
+ *
* @return the Length of one page.
*/
public int getPageLength() {
@@ -1016,16 +1016,16 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the page length.
- *
+ *
* <p>
* Setting page length 0 disables paging. The page length defaults to 15.
* </p>
- *
+ *
* <p>
* If Table has width set ({@link #setWidth(float, int)} ) the client side
* may update the page length automatically the correct value.
* </p>
- *
+ *
* @param pageLength
* the length of one page.
*/
@@ -1039,18 +1039,18 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* This method adjusts a possible caching mechanism of table implementation.
- *
+ *
* <p>
* Table component may fetch and render some rows outside visible area. With
* complex tables (for example containing layouts and components), the
* client side may become unresponsive. Setting the value lower, UI will
* become more responsive. With higher values scrolling in client will hit
* server less frequently.
- *
+ *
* <p>
* The amount of cached rows will be cacheRate multiplied with pageLength (
* {@link #setPageLength(int)} both below and above visible area..
- *
+ *
* @param cacheRate
* a value over 0 (fastest rendering time). Higher value will
* cache more rows on server (smoother scrolling). Default value
@@ -1069,7 +1069,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* @see #setCacheRate(double)
- *
+ *
* @return the current cache rate value
*/
public double getCacheRate() {
@@ -1078,7 +1078,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Getter for property currentPageFirstItem.
- *
+ *
* @return the Value of property currentPageFirstItem.
*/
public Object getCurrentPageFirstItemId() {
@@ -1106,14 +1106,14 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Returns the item ID for the item represented by the index given. Assumes
* that the current container implements {@link Container.Indexed}.
- *
+ *
* See {@link Container.Indexed#getIdByIndex(int)} for more information
* about the exceptions that can be thrown.
- *
+ *
* @param index
* the index for which the item ID should be fetched
* @return the item ID for the given index
- *
+ *
* @throws ClassCastException
* if container does not implement {@link Container.Indexed}
* @throws IndexOutOfBoundsException
@@ -1126,7 +1126,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Setter for property currentPageFirstItemId.
- *
+ *
* @param currentPageFirstItemId
* the New value of property currentPageFirstItemId.
*/
@@ -1183,7 +1183,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the icon Resource for the specified column.
- *
+ *
* @param propertyId
* the propertyId indentifying the column.
* @return the icon for the specified column; null if the column has no icon
@@ -1198,7 +1198,7 @@ public class Table extends AbstractSelect implements Action.Container,
* <p>
* Throws IllegalArgumentException if the specified column is not visible.
* </p>
- *
+ *
* @param propertyId
* the propertyId identifying the column.
* @param icon
@@ -1217,7 +1217,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the header for the specified column.
- *
+ *
* @param propertyId
* the propertyId identifying the column.
* @return the header for the specified column if it has one.
@@ -1238,7 +1238,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the column header for the specified column;
- *
+ *
* @param propertyId
* the propertyId identifying the column.
* @param header
@@ -1257,7 +1257,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the specified column's alignment.
- *
+ *
* @param propertyId
* the propertyID identifying the column.
* @return the specified column's alignment if it as one; {@link Align#LEFT}
@@ -1270,13 +1270,13 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the specified column's alignment.
- *
+ *
* <p>
* Throws IllegalArgumentException if the alignment is not one of the
* following: {@link Align#LEFT}, {@link Align#CENTER} or
* {@link Align#RIGHT}
* </p>
- *
+ *
* @param propertyId
* the propertyID identifying the column.
* @param alignment
@@ -1296,7 +1296,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Checks if the specified column is collapsed.
- *
+ *
* @param propertyId
* the propertyID identifying the column.
* @return true if the column is collapsed; false otherwise;
@@ -1308,8 +1308,8 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets whether the specified column is collapsed or not.
- *
- *
+ *
+ *
* @param propertyId
* the propertyID identifying the column.
* @param collapsed
@@ -1338,7 +1338,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Checks if column collapsing is allowed.
- *
+ *
* @return true if columns can be collapsed; false otherwise.
*/
public boolean isColumnCollapsingAllowed() {
@@ -1347,7 +1347,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets whether column collapsing is allowed or not.
- *
+ *
* @param collapsingAllowed
* specifies whether column collapsing is allowed.
*/
@@ -1369,7 +1369,7 @@ public class Table extends AbstractSelect implements Action.Container,
* {@link #setColumnCollapsed(Object, boolean) setColumnCollapsed()}) if
* {@link #isColumnCollapsingAllowed()} is true. By default all columns are
* collapsible.
- *
+ *
* @param propertyId
* the propertyID identifying the column.
* @param collapsible
@@ -1391,7 +1391,7 @@ public class Table extends AbstractSelect implements Action.Container,
* UI or with {@link #setColumnCollapsed(Object, boolean)
* setColumnCollapsed()}) if {@link #isColumnCollapsingAllowed()} is also
* true.
- *
+ *
* @return true if the column can be collapsed; false otherwise.
*/
public boolean isColumnCollapsible(Object propertyId) {
@@ -1400,7 +1400,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Checks if column reordering is allowed.
- *
+ *
* @return true if columns can be reordered; false otherwise.
*/
public boolean isColumnReorderingAllowed() {
@@ -1409,7 +1409,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets whether column reordering is allowed or not.
- *
+ *
* @param columnReorderingAllowed
* specifies whether column reordering is allowed.
*/
@@ -1453,7 +1453,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Getter for property currentPageFirstItem.
- *
+ *
* @return the Value of property currentPageFirstItem.
*/
public int getCurrentPageFirstItemIndex() {
@@ -1513,7 +1513,22 @@ public class Table extends AbstractSelect implements Action.Container,
* position not be updated correctly when the lazy rows are
* finally rendered.
*/
- currentPageFirstItemIndexOnLastPage = indexOnLastPage;
+
+ boolean isLastRowPossiblyPartiallyVisible = true;
+ if (indexOnLastPage != -1) {
+ /*
+ * If the requested row was greater than maxIndex, the last
+ * row should be fully visible (See
+ * TestCurrentPageFirstItem).
+ */
+ isLastRowPossiblyPartiallyVisible = false;
+ }
+
+ int extraRows = isLastRowPossiblyPartiallyVisible ? 0 : 1;
+ currentPageFirstItemIndexOnLastPage = currentPageFirstItemIndex
+ + extraRows;
+ } else {
+ currentPageFirstItemIndexOnLastPage = -1;
}
} else {
@@ -1569,7 +1584,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Setter for property currentPageFirstItem.
- *
+ *
* @param newIndex
* the New value of property currentPageFirstItem.
*/
@@ -1579,11 +1594,11 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Getter for property selectable.
- *
+ *
* <p>
* The table is not selectable by default.
* </p>
- *
+ *
* @return the Value of property selectable.
*/
public boolean isSelectable() {
@@ -1592,11 +1607,11 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Setter for property selectable.
- *
+ *
* <p>
* The table is not selectable by default.
* </p>
- *
+ *
* @param selectable
* the New value of property selectable.
*/
@@ -1609,7 +1624,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Getter for property columnHeaderMode.
- *
+ *
* @return the Value of property columnHeaderMode.
*/
public ColumnHeaderMode getColumnHeaderMode() {
@@ -1618,7 +1633,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Setter for property columnHeaderMode.
- *
+ *
* @param columnHeaderMode
* the New value of property columnHeaderMode.
*/
@@ -1727,7 +1742,7 @@ public class Table extends AbstractSelect implements Action.Container,
* occurred exception is set as the cause of this exception. All occurred
* exceptions can be accessed using {@link #getCauses()}.
* </p>
- *
+ *
*/
public static class CacheUpdateException extends RuntimeException {
private Throwable[] causes;
@@ -1751,7 +1766,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Returns the cause(s) for this exception
- *
+ *
* @return the exception(s) which caused this exception
*/
public Throwable[] getCauses() {
@@ -1807,11 +1822,11 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Requests that the Table should be repainted as soon as possible.
- *
+ *
* Note that a {@code Table} does not necessarily repaint its contents when
* this method has been called. See {@link #refreshRowCache()} for forcing
* an update of the contents.
- *
+ *
* @deprecated As of 7.0, use {@link #markAsDirty()} instead
*/
@@ -1823,7 +1838,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Requests that the Table should be repainted as soon as possible.
- *
+ *
* Note that a {@code Table} does not necessarily repaint its contents when
* this method has been called. See {@link #refreshRowCache()} for forcing
* an update of the contents.
@@ -2110,9 +2125,9 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Render rows with index "firstIndex" to "firstIndex+rows-1" to a new
* buffer.
- *
+ *
* Reuses values from the current page buffer if the rows are found there.
- *
+ *
* @param firstIndex
* @param rows
* @param replaceListeners
@@ -2221,7 +2236,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Update a cache array for a row, register any relevant listeners etc.
- *
+ *
* This is an internal method extracted from
* {@link #getVisibleCellsNoCache(int, int, boolean)} and should be removed
* when the Table is rewritten.
@@ -2439,7 +2454,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Helper method to remove listeners and maintain correct component
* hierarchy. Detaches properties and components if those are no more
* rendered in client.
- *
+ *
* @param oldListenedProperties
* set of properties that where listened in last render
* @param oldVisibleComponents
@@ -2475,12 +2490,12 @@ public class Table extends AbstractSelect implements Action.Container,
* if it is a field, it needs to be detached from its property data source
* in order to allow garbage collection to take care of removing the unused
* component from memory.
- *
+ *
* Override this method and getPropertyValue(Object, Object, Property) with
* custom logic if you need to deal with buffered fields.
- *
+ *
* @see #getPropertyValue(Object, Object, Property)
- *
+ *
* @param oldVisibleComponents
* a set of components that should be unregistered.
*/
@@ -2531,7 +2546,7 @@ public class Table extends AbstractSelect implements Action.Container,
* </ul>
* The default value is {@link #ROW_HEADER_MODE_HIDDEN}
* </p>
- *
+ *
* @param mode
* the One of the modes listed above.
*/
@@ -2550,7 +2565,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the row header mode.
- *
+ *
* @return the Row header mode.
* @see #setRowHeaderMode(int)
*/
@@ -2561,7 +2576,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Adds the new row to table and fill the visible cells (except generated
* columns) with given values.
- *
+ *
* @param cells
* the Object array that is used for filling the visible cells
* new row. The types must be settable to visible column property
@@ -2630,7 +2645,7 @@ public class Table extends AbstractSelect implements Action.Container,
* <p>
* <i>Note that calling this method is not cheap so avoid calling it
* unnecessarily.</i>
- *
+ *
* @since 6.7.2
*/
public void refreshRowCache() {
@@ -2651,7 +2666,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Keeps propertyValueConverters if the corresponding id exists in the new
* data source and is of a compatible type.
* </p>
- *
+ *
* @param newDataSource
* the new data source.
*/
@@ -2689,11 +2704,11 @@ public class Table extends AbstractSelect implements Action.Container,
* Keeps propertyValueConverters if the corresponding id exists in the new
* data source and is of a compatible type.
* </p>
- *
+ *
* @see Table#setContainerDataSource(Container)
* @see Table#setVisibleColumns(Object[])
* @see Table#setConverter(Object, Converter<String, ?>)
- *
+ *
* @param newDataSource
* the new data source.
* @param visibleIds
@@ -2768,7 +2783,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Checks if class b can be safely assigned to class a.
- *
+ *
* @param a
* @param b
* @return
@@ -2782,7 +2797,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets items ids from a range of key values
- *
+ *
* @param startRowKey
* The start key
* @param endRowKey
@@ -2803,7 +2818,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Handles selection if selection is a multiselection
- *
+ *
* @param variables
* The variables
*/
@@ -2882,7 +2897,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Invoked when the value of a variable has changed.
- *
+ *
* @see com.vaadin.ui.Select#changeVariables(java.lang.Object,
* java.util.Map)
*/
@@ -3084,7 +3099,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Handles click event
- *
+ *
* @param variables
*/
private void handleClickEvent(Map<String, Object> variables) {
@@ -3138,7 +3153,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Handles the column resize event sent by the client.
- *
+ *
* @param variables
*/
private void handleColumnResizeEvent(Map<String, Object> variables) {
@@ -3197,7 +3212,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Go to mode where content updates are not done. This is due we want to
* bypass expensive content for some reason (like when we know we may have
* other content changes on their way).
- *
+ *
* @return true if content refresh flag was enabled prior this call
*/
protected boolean disableContentRefreshing() {
@@ -3208,7 +3223,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Go to mode where content content refreshing has effect.
- *
+ *
* @param refreshContent
* true if content refresh needs to be done
*/
@@ -3408,7 +3423,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Subclass and override this to enable partial row updates and additions,
* which bypass the normal caching mechanism. This is useful for e.g.
* TreeTable.
- *
+ *
* @return true if this update is a partial row update, false if not. For
* plain Table it is always false.
*/
@@ -3420,7 +3435,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Subclass and override this to enable partial row additions, bypassing the
* normal caching mechanism. This is useful for e.g. TreeTable, where
* expanding a node should only fetch and add the items inside of that node.
- *
+ *
* @return The index of the first added item. For plain Table it is always
* 0.
*/
@@ -3432,7 +3447,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Subclass and override this to enable partial row additions, bypassing the
* normal caching mechanism. This is useful for e.g. TreeTable, where
* expanding a node should only fetch and add the items inside of that node.
- *
+ *
* @return the number of rows to be added, starting at the index returned by
* {@link #getFirstAddedItemIndex()}. For plain Table it is always
* 0.
@@ -3445,11 +3460,11 @@ public class Table extends AbstractSelect implements Action.Container,
* Subclass and override this to enable removing of rows, bypassing the
* normal caching and lazy loading mechanism. This is useful for e.g.
* TreeTable, when you need to hide certain rows as a node is collapsed.
- *
+ *
* This should return true if the rows pointed to by
* {@link #getFirstAddedItemIndex()} and {@link #getAddedRowCount()} should
* be hidden instead of added.
- *
+ *
* @return whether the rows to add (see {@link #getFirstAddedItemIndex()}
* and {@link #getAddedRowCount()}) should be added or hidden. For
* plain Table it is always false.
@@ -3463,7 +3478,7 @@ public class Table extends AbstractSelect implements Action.Container,
* normal caching and lazy loading mechanism. This is useful for updating
* the state of certain rows, e.g. in the TreeTable the collapsed state of a
* single node is updated using this mechanism.
- *
+ *
* @return the index of the first item to be updated. For plain Table it is
* always 0.
*/
@@ -3476,7 +3491,7 @@ public class Table extends AbstractSelect implements Action.Container,
* normal caching and lazy loading mechanism. This is useful for updating
* the state of certain rows, e.g. in the TreeTable the collapsed state of a
* single node is updated using this mechanism.
- *
+ *
* @return the number of rows to update, starting at the index returned by
* {@link #getFirstUpdatedItemIndex()}. For plain table it is always
* 0.
@@ -3990,7 +4005,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* A method where extended Table implementations may add their custom
* attributes for rows.
- *
+ *
* @param target
* @param itemId
*/
@@ -4001,7 +4016,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the cached visible table contents.
- *
+ *
* @return the cached visible table contents.
*/
private Object[][] getVisibleCells() {
@@ -4013,11 +4028,11 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the value of property.
- *
+ *
* By default if the table is editable the fieldFactory is used to create
* editors for table cells. Otherwise formatPropertyValue is used to format
* the value representation.
- *
+ *
* @param rowId
* the Id of the row (same as item Id).
* @param colId
@@ -4049,7 +4064,7 @@ public class Table extends AbstractSelect implements Action.Container,
* default behavior is to bind property straight to Field. If
* Property.Viewer type property (e.g. PropertyFormatter) is already set for
* field, the property is bound to that Property.Viewer.
- *
+ *
* @param rowId
* @param colId
* @param property
@@ -4074,7 +4089,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Formats table cell property values. By default the property.toString()
* and return a empty string for null properties.
- *
+ *
* @param rowId
* the Id of the row (same as item Id).
* @param colId
@@ -4109,7 +4124,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Registers a new action handler for this container
- *
+ *
* @see com.vaadin.event.Action.Container#addActionHandler(Action.Handler)
*/
@@ -4137,7 +4152,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes a previously registered action handler for the contents of this
* container.
- *
+ *
* @see com.vaadin.event.Action.Container#removeActionHandler(Action.Handler)
*/
@@ -4176,9 +4191,9 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Notifies this listener that the Property's value has changed.
- *
+ *
* Also listens changes in rendered items to refresh content area.
- *
+ *
* @see com.vaadin.data.Property.ValueChangeListener#valueChange(Property.ValueChangeEvent)
*/
@@ -4209,7 +4224,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Notifies the component that it is connected to an application.
- *
+ *
* @see com.vaadin.ui.Component#attach()
*/
@@ -4222,7 +4237,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Notifies the component that it is detached from the application
- *
+ *
* @see com.vaadin.ui.Component#detach()
*/
@@ -4233,7 +4248,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes all Items from the Container.
- *
+ *
* @see com.vaadin.data.Container#removeAllItems()
*/
@@ -4246,7 +4261,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes the Item identified by <code>ItemId</code> from the Container.
- *
+ *
* @see com.vaadin.data.Container#removeItem(Object)
*/
@@ -4265,7 +4280,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes a Property specified by the given Property ID from the Container.
- *
+ *
* @see com.vaadin.data.Container#removeContainerProperty(Object)
*/
@@ -4287,7 +4302,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Adds a new property to the table and show it as a visible column.
- *
+ *
* @param propertyId
* the Id of the proprty.
* @param type
@@ -4322,7 +4337,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Adds a new property to the table and show it as a visible column.
- *
+ *
* @param propertyId
* the Id of the proprty
* @param type
@@ -4378,7 +4393,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Also note that getVisibleColumns() will return the generated columns,
* while getContainerPropertyIds() will not.
* </p>
- *
+ *
* @param id
* the id of the column to be added
* @param generatedColumn
@@ -4407,7 +4422,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Returns the ColumnGenerator used to generate the given column.
- *
+ *
* @param columnId
* The id of the generated column
* @return The ColumnGenerator used for the given columnId or null.
@@ -4419,7 +4434,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes a generated column previously added with addGeneratedColumn.
- *
+ *
* @param columnId
* id of the generated column to remove
* @return true if the column could be removed (existed in the Table)
@@ -4450,7 +4465,7 @@ public class Table extends AbstractSelect implements Action.Container,
* architecture. Using {@link #getCurrentPageFirstItemId()} combined with
* {@link #getPageLength()} may produce good enough estimates in some
* situations.
- *
+ *
* @see com.vaadin.ui.Select#getVisibleItemIds()
*/
@@ -4474,7 +4489,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Container datasource item set change. Table must flush its buffers on
* change.
- *
+ *
* @see com.vaadin.data.Container.ItemSetChangeListener#containerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent)
*/
@@ -4499,7 +4514,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Container datasource property set change. Table must flush its buffers on
* change.
- *
+ *
* @see com.vaadin.data.Container.PropertySetChangeListener#containerPropertySetChange(com.vaadin.data.Container.PropertySetChangeEvent)
*/
@@ -4545,7 +4560,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Adding new items is not supported.
- *
+ *
* @throws UnsupportedOperationException
* if set to true.
* @see com.vaadin.ui.Select#setNewItemsAllowed(boolean)
@@ -4561,7 +4576,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the ID of the Item following the Item that corresponds to itemId.
- *
+ *
* @see com.vaadin.data.Container.Ordered#nextItemId(java.lang.Object)
*/
@@ -4573,7 +4588,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the ID of the Item preceding the Item that corresponds to the
* itemId.
- *
+ *
* @see com.vaadin.data.Container.Ordered#prevItemId(java.lang.Object)
*/
@@ -4584,7 +4599,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the ID of the first Item in the Container.
- *
+ *
* @see com.vaadin.data.Container.Ordered#firstItemId()
*/
@@ -4595,7 +4610,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the ID of the last Item in the Container.
- *
+ *
* @see com.vaadin.data.Container.Ordered#lastItemId()
*/
@@ -4607,7 +4622,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Tests if the Item corresponding to the given Item ID is the first Item in
* the Container.
- *
+ *
* @see com.vaadin.data.Container.Ordered#isFirstId(java.lang.Object)
*/
@@ -4619,7 +4634,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Tests if the Item corresponding to the given Item ID is the last Item in
* the Container.
- *
+ *
* @see com.vaadin.data.Container.Ordered#isLastId(java.lang.Object)
*/
@@ -4630,7 +4645,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Adds new item after the given item.
- *
+ *
* @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object)
*/
@@ -4647,7 +4662,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Adds new item after the given item.
- *
+ *
* @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object,
* java.lang.Object)
*/
@@ -4665,10 +4680,10 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the TableFieldFactory that is used to create editor for table cells.
- *
+ *
* The TableFieldFactory is only used if the Table is editable. By default
* the DefaultFieldFactory is used.
- *
+ *
* @param fieldFactory
* the field factory to set.
* @see #isEditable
@@ -4683,9 +4698,9 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the TableFieldFactory that is used to create editor for table cells.
- *
+ *
* The FieldFactory is only used if the Table is editable.
- *
+ *
* @return TableFieldFactory used to create the Field instances.
* @see #isEditable
*/
@@ -4695,18 +4710,18 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Is table editable.
- *
+ *
* If table is editable a editor of type Field is created for each table
* cell. The assigned FieldFactory is used to create the instances.
- *
+ *
* To provide custom editors for table cells create a class implementins the
* FieldFactory interface, and assign it to table, and set the editable
* property to true.
- *
+ *
* @return true if table is editable, false oterwise.
* @see Field
* @see FieldFactory
- *
+ *
*/
public boolean isEditable() {
return editable;
@@ -4714,19 +4729,19 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the editable property.
- *
+ *
* If table is editable a editor of type Field is created for each table
* cell. The assigned FieldFactory is used to create the instances.
- *
+ *
* To provide custom editors for table cells create a class implementins the
* FieldFactory interface, and assign it to table, and set the editable
* property to true.
- *
+ *
* @param editable
* true if table should be editable by user.
* @see Field
* @see FieldFactory
- *
+ *
*/
public void setEditable(boolean editable) {
this.editable = editable;
@@ -4737,13 +4752,13 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sorts the table.
- *
+ *
* @throws UnsupportedOperationException
* if the container data source does not implement
* Container.Sortable
* @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[],
* boolean[])
- *
+ *
*/
@Override
@@ -4775,7 +4790,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sorts the table by currently selected sorting column.
- *
+ *
* @throws UnsupportedOperationException
* if the container data source does not implement
* Container.Sortable
@@ -4795,7 +4810,7 @@ public class Table extends AbstractSelect implements Action.Container,
* returns. Disabling sorting causes this method to always return an empty
* collection.
* </p>
- *
+ *
* @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds()
*/
@@ -4811,7 +4826,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the currently sorted column property ID.
- *
+ *
* @return the Container property id of the currently sorted column.
*/
public Object getSortContainerPropertyId() {
@@ -4820,7 +4835,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the currently sorted column property id.
- *
+ *
* @param propertyId
* the Container property id of the currently sorted column.
*/
@@ -4831,7 +4846,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Internal method to set currently sorted column property id. With doSort
* flag actual sorting may be bypassed.
- *
+ *
* @param propertyId
* @param doSort
*/
@@ -4852,7 +4867,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Is the table currently sorted in ascending order.
- *
+ *
* @return <code>true</code> if ascending, <code>false</code> if descending.
*/
public boolean isSortAscending() {
@@ -4861,7 +4876,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the table in ascending order.
- *
+ *
* @param ascending
* <code>true</code> if ascending, <code>false</code> if
* descending.
@@ -4873,7 +4888,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Internal method to set sort ascending. With doSort flag actual sort can
* be bypassed.
- *
+ *
* @param ascending
* @param doSort
*/
@@ -4891,10 +4906,10 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Is sorting disabled altogether.
- *
+ *
* True iff no sortable columns are given even in the case where data source
* would support this.
- *
+ *
* @return True iff sorting is disabled.
* @deprecated As of 7.0, use {@link #isSortEnabled()} instead
*/
@@ -4905,7 +4920,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Checks if sorting is enabled.
- *
+ *
* @return true if sorting by the user is allowed, false otherwise
*/
public boolean isSortEnabled() {
@@ -4914,7 +4929,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Disables the sorting by the user altogether.
- *
+ *
* @param sortDisabled
* True iff sorting is disabled.
* @deprecated As of 7.0, use {@link #setSortEnabled(boolean)} instead
@@ -4930,7 +4945,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Setting this to false disallows sorting by the user. It is still possible
* to call {@link #sort()}.
* </p>
- *
+ *
* @param sortEnabled
* true to allow the user to sort the table, false to disallow it
*/
@@ -4945,14 +4960,14 @@ public class Table extends AbstractSelect implements Action.Container,
* Used to create "generated columns"; columns that exist only in the Table,
* not in the underlying Container. Implement this interface and pass it to
* Table.addGeneratedColumn along with an id for the column to be generated.
- *
+ *
*/
public interface ColumnGenerator extends Serializable {
/**
* Called by Table when a cell in a generated column needs to be
* generated.
- *
+ *
* @param source
* the source Table
* @param itemId
@@ -4970,7 +4985,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Set cell style generator for Table.
- *
+ *
* @param cellStyleGenerator
* New cell style generator or null to remove generator.
*/
@@ -4984,7 +4999,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Get the current cell style generator.
- *
+ *
*/
public CellStyleGenerator getCellStyleGenerator() {
return cellStyleGenerator;
@@ -5001,7 +5016,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Called by Table when a cell (and row) is painted.
- *
+ *
* @param source
* the source Table
* @param itemId
@@ -5064,7 +5079,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the drag start mode of the Table. Drag start mode controls how Table
* behaves as a drag source.
- *
+ *
* @param newDragMode
*/
public void setDragMode(TableDragMode newDragMode) {
@@ -5083,9 +5098,9 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Concrete implementation of {@link DataBoundTransferable} for data
* transferred from a table.
- *
+ *
* @see {@link DataBoundTransferable}.
- *
+ *
* @since 6.3
*/
public class TableTransferable extends DataBoundTransferable {
@@ -5147,7 +5162,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Note, that on some clients the mode may not be respected. E.g. on touch
* based devices CTRL/SHIFT base selection method is invalid, so touch based
* browsers always use the {@link MultiSelectMode#SIMPLE}.
- *
+ *
* @param mode
* The select mode of the table
*/
@@ -5158,7 +5173,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Returns the select mode in which multi-select is used.
- *
+ *
* @return The multi select mode
*/
public MultiSelectMode getMultiSelectMode() {
@@ -5170,7 +5185,7 @@ public class Table extends AbstractSelect implements Action.Container,
* from server once per drag and drop operation. Developer must override one
* method that decides on which rows the currently dragged data can be
* dropped.
- *
+ *
* <p>
* Initially pretty much no data is sent to client. On first required
* criterion check (per drag request) the client side data structure is
@@ -5287,7 +5302,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the property id of the column which header was pressed
- *
+ *
* @return The column propety id
*/
public Object getPropertyId() {
@@ -5321,7 +5336,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Constructor
- *
+ *
* @param source
* The source of the component
* @param propertyId
@@ -5337,7 +5352,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the property id of the column which header was pressed
- *
+ *
* @return The column propety id
*/
public Object getPropertyId() {
@@ -5353,7 +5368,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Called when a user clicks a header column cell
- *
+ *
* @param event
* The event which contains information about the column and
* the mouse click event
@@ -5369,7 +5384,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Called when a user clicks a footer column cell
- *
+ *
* @param event
* The event which contains information about the column and
* the mouse click event
@@ -5384,7 +5399,7 @@ public class Table extends AbstractSelect implements Action.Container,
* The listener will receive events which contain information about which
* column was clicked and some details about the mouse event.
* </p>
- *
+ *
* @param listener
* The handler which should handle the header click events.
*/
@@ -5405,7 +5420,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes a header click listener
- *
+ *
* @param listener
* The listener to remove.
*/
@@ -5430,7 +5445,7 @@ public class Table extends AbstractSelect implements Action.Container,
* The listener will receive events which contain information about which
* column was clicked and some details about the mouse event.
* </p>
- *
+ *
* @param listener
* The handler which should handle the footer click events.
*/
@@ -5451,7 +5466,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes a footer click listener
- *
+ *
* @param listener
* The listener to remove.
*/
@@ -5471,7 +5486,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Gets the footer caption beneath the rows
- *
+ *
* @param propertyId
* The propertyId of the column *
* @return The caption of the footer or NULL if not set
@@ -5483,10 +5498,10 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the column footer caption. The column footer caption is the text
* displayed beneath the column if footers have been set visible.
- *
+ *
* @param propertyId
* The properyId of the column
- *
+ *
* @param footer
* The caption of the footer
*/
@@ -5506,7 +5521,7 @@ public class Table extends AbstractSelect implements Action.Container,
* The footer can be used to add column related data like sums to the bottom
* of the Table using setColumnFooter(Object propertyId, String footer).
* </p>
- *
+ *
* @param visible
* Should the footer be visible
*/
@@ -5519,7 +5534,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Is the footer currently visible?
- *
+ *
* @return Returns true if visible else false
*/
public boolean isFooterVisible() {
@@ -5551,7 +5566,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Constructor
- *
+ *
* @param source
* The source of the event
* @param propertyId
@@ -5571,7 +5586,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Get the column property id of the column that was resized.
- *
+ *
* @return The column property id
*/
public Object getPropertyId() {
@@ -5580,7 +5595,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Get the width in pixels of the column before the resize event
- *
+ *
* @return Width in pixels
*/
public int getPreviousWidth() {
@@ -5589,7 +5604,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Get the width in pixels of the column after the resize event
- *
+ *
* @return Width in pixels
*/
public int getCurrentWidth() {
@@ -5604,7 +5619,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* This method is triggered when the column has been resized
- *
+ *
* @param event
* The event which contains the column property id, the
* previous width of the column and the current width of the
@@ -5616,7 +5631,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Adds a column resize listener to the Table. A column resize listener is
* called when a user resizes a columns width.
- *
+ *
* @param listener
* The listener to attach to the Table
*/
@@ -5637,7 +5652,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes a column resize listener from the Table.
- *
+ *
* @param listener
* The listener to remove
*/
@@ -5674,7 +5689,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Constructor
- *
+ *
* @param source
* The source of the event
*/
@@ -5691,7 +5706,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* This method is triggered when the column has been reordered
- *
+ *
* @param event
*/
public void columnReorder(ColumnReorderEvent event);
@@ -5700,7 +5715,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Adds a column reorder listener to the Table. A column reorder listener is
* called when a user reorders columns.
- *
+ *
* @param listener
* The listener to attach to the Table
*/
@@ -5720,7 +5735,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Removes a column reorder listener from the Table.
- *
+ *
* @param listener
* The listener to remove
*/
@@ -5741,7 +5756,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Set the item description generator which generates tooltips for cells and
* rows in the Table
- *
+ *
* @param generator
* The generator to use or null to disable
*/
@@ -5766,7 +5781,7 @@ public class Table extends AbstractSelect implements Action.Container,
* Row generators can be used to replace certain items in a table with a
* generated string. The generator is called each time the table is
* rendered, which means that new strings can be generated each time.
- *
+ *
* Row generators can be used for e.g. summary rows or grouping of items.
*/
public interface RowGenerator extends Serializable {
@@ -5792,7 +5807,7 @@ public class Table extends AbstractSelect implements Action.Container,
* For custom styling of a generated row you can combine a RowGenerator
* with a CellStyleGenerator.
* <p>
- *
+ *
* @param table
* The Table that is being painted
* @param itemId
@@ -5811,7 +5826,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Creates a new generated row. If only one string is passed in, columns
* are automatically spanned.
- *
+ *
* @param text
*/
public GeneratedRow(String... text) {
@@ -5846,7 +5861,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* If set to true, all strings passed to {@link #setText(String...)}
* will be rendered as HTML.
- *
+ *
* @param htmlContentAllowed
*/
public void setHtmlContentAllowed(boolean htmlContentAllowed) {
@@ -5860,7 +5875,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* If set to true, only one string will be rendered, spanning the entire
* row.
- *
+ *
* @param spanColumns
*/
public void setSpanColumns(boolean spanColumns) {
@@ -5871,7 +5886,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Assigns a row generator to the table. The row generator will be able to
* replace rows in the table when it is rendered.
- *
+ *
* @param generator
* the new row generator
*/
@@ -5893,7 +5908,7 @@ public class Table extends AbstractSelect implements Action.Container,
* The converter is used to format the the data for the given property id
* before displaying it in the table.
* </p>
- *
+ *
* @param propertyId
* The propertyId to format using the converter
* @param converter
@@ -5918,7 +5933,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Checks if there is a converter set explicitly for the given property id.
- *
+ *
* @param propertyId
* The propertyId to check
* @return true if a converter has been set for the property id, false
@@ -5930,7 +5945,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Returns the converter used to format the given propertyId.
- *
+ *
* @param propertyId
* The propertyId to check
* @return The converter used to format the propertyId or null if no
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index a72cbe5c30..5abeea9480 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -549,8 +549,6 @@ public abstract class UI extends AbstractSingleComponentContainer implements
private boolean resizeLazy = false;
- private String theme;
-
private Navigator navigator;
private PushConnection pushConnection = null;
@@ -633,7 +631,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
this.embedId = embedId;
// Actual theme - used for finding CustomLayout templates
- theme = request.getParameter("theme");
+ getState().theme = request.getParameter("theme");
getPage().init(request);
@@ -1135,12 +1133,31 @@ public abstract class UI extends AbstractSingleComponentContainer implements
}
/**
- * Gets the theme that was used when the UI was initialized.
+ * Gets the theme currently in use by this UI
*
* @return the theme name
*/
public String getTheme() {
- return theme;
+ return getState(false).theme;
+ }
+
+ /**
+ * Sets the theme currently in use by this UI
+ * <p>
+ * Calling this method will remove the old theme (CSS file) from the
+ * application and add the new theme.
+ * <p>
+ * Note that this method is NOT SAFE to call in a portal environment or
+ * other environment where there are multiple UIs on the same page. The old
+ * CSS file will be removed even if there are other UIs on the page which
+ * are still using it.
+ *
+ * @since 7.3
+ * @param theme
+ * The new theme name
+ */
+ public void setTheme(String theme) {
+ getState().theme = theme;
}
/**
diff --git a/server/src/com/vaadin/ui/themes/ValoTheme.java b/server/src/com/vaadin/ui/themes/ValoTheme.java
index 63fa13dce4..ad949c6a32 100644
--- a/server/src/com/vaadin/ui/themes/ValoTheme.java
+++ b/server/src/com/vaadin/ui/themes/ValoTheme.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.ui.themes;
+import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Notification.Type;
import com.vaadin.ui.Table.ColumnHeaderMode;
@@ -185,6 +186,18 @@ public class ValoTheme {
*/
public static final String LABEL_FAILURE = "failure";
+ /**
+ * Spinner style. Add this style name to an empty Label to create a spinner.
+ *
+ * <h4>Example</h4>
+ *
+ * <pre>
+ * Label spinner = new Label();
+ * spinner.addStyleName(ValoTheme.LABEL_SPINNER);
+ * </pre>
+ */
+ public static final String LABEL_SPINNER = "spinner";
+
/***************************************************************************
*
* Button styles
@@ -457,6 +470,12 @@ public class ValoTheme {
*/
public static final String OPTIONGROUP_LARGE = "large";
+ /**
+ * Display the options horizontally in a row (by default the items are
+ * stacked vertically).
+ */
+ public static final String OPTIONGROUP_HORIZONTAL = "horizontal";
+
/***************************************************************************
*
* Slider styles
@@ -738,7 +757,7 @@ public class ValoTheme {
/**
* Removes the borders and background from any direct child field components
* (TextField, TextArea, DateField, ComboBox) in the layout. Reduces the
- * spacing between the form rows adds separator lines between them.
+ * spacing between the form rows and adds separator lines between them.
*/
public static final String FORMLAYOUT_LIGHT = "light";
@@ -762,6 +781,31 @@ public class ValoTheme {
*/
public static final String LAYOUT_WELL = "well";
+ /**
+ * Make a HorizontalLayout wrap contained components to a new line when the
+ * isn't enough space.
+ */
+ public static final String LAYOUT_HORIZONTAL_WRAPPING = "wrapping";
+
+ /**
+ * Add this style name to a CssLayout to create a grouped set of components,
+ * i.e. a row of components which are joined seamlessly together.
+ *
+ * <h4>Example</h4>
+ *
+ * <pre>
+ * CssLayout group = new CssLayout();
+ * group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
+ *
+ * TextField field = new TextField();
+ * group.addComponent(field);
+ *
+ * Button button = new Button(&quot;Action&quot;);
+ * group.addComponent(button);
+ * </pre>
+ */
+ public static final String LAYOUT_COMPONENT_GROUP = "v-component-group";
+
/***************************************************************************
*
* Valo menu styles
@@ -769,8 +813,25 @@ public class ValoTheme {
**************************************************************************/
/**
- * Set the primary style name of a CssLayout to this, and add any number of
- * layouts with the {@link #MENU_PART} style inside it.
+ * <p>
+ * Set the <em><b>primary</b></em> style name of a CssLayout to this, and
+ * add any number of layouts with the {@link #MENU_PART} style inside it.
+ * </p>
+ *
+ * <p>
+ * The menu style is used to create a sidebar navigation menu for the
+ * application, usually action as the main navigation for the different
+ * sections of the application. It usually consists of at least a number of
+ * {@link #MENU_ITEM}s, and possibly some {@link #MENU_SUBTITLE}s and a
+ * {@link #MENU_TITLE}.
+ * </p>
+ *
+ * <h4>Example</h4>
+ *
+ * <pre>
+ * CssLayout menuArea = new CssLayout();
+ * menuArea.setPrimaryStyleName(ValoTheme.MENU_ROOT);
+ * </pre>
*/
public static final String MENU_ROOT = "valo-menu";
@@ -778,31 +839,124 @@ public class ValoTheme {
* Add this style name to any layout and place it inside a layout with the
* {@link #MENU_ROOT} style to build a menu component. Use the additional
* MENU styles for individual components inside the layout.
+ *
+ * <h4>Example</h4>
+ *
+ * <pre>
+ * CssLayout menu = new CssLayout();
+ * menu.addStyleName(ValoTheme.MENU_PART);
+ * </pre>
*/
public static final String MENU_PART = "valo-menu-part";
/**
- * TODO
+ * Add this style name to any layout with the {@link #MENU_PART} style name
+ * to make any menu items inside the menu emphasize the icons more than the
+ * captions. Useful on narrower viewport widths, since the menu width is
+ * decreased quite dramatically, making more space for the content of the
+ * application.
+ *
+ * <h4>Example</h4>
+ *
+ * <pre>
+ * CssLayout menu = new CssLayout();
+ * menu.addStyleName(ValoTheme.MENU_PART);
+ * menu.addStyleName(ValoTheme.MENU_PART_LARGE_ICONS);
+ * </pre>
+ */
+ public static final String MENU_PART_LARGE_ICONS = "large-icons";
+
+ /**
+ * <p>
+ * Add this style name to any layout to make a header area for a menu
+ * (intended to be placed in side a {@link #MENU_PART} layout). You can add
+ * any components inside it, but usually you would place a Label inside.
+ * </p>
+ *
+ * <p>
+ * Any MenuBar component that you place inside this layout will match the
+ * style of the title, allowing an easy way to add a toolbar to the title
+ * layout.
+ * </p>
*/
public static final String MENU_TITLE = "valo-menu-title";
/**
- * TODO
+ * Set the <em><b>primary</b></em> style name of a Label or a Button to this
+ * style name to create a section divider in a menu.
*/
public static final String MENU_SUBTITLE = "valo-menu-subtitle";
/**
- * TODO
+ * <p>
+ * Set the <em><b>primary</b></em> style name of a Button to this style name
+ * to create a clickable menu item in the menu.
+ * </p>
+ *
+ * <h4>Selected item</h4>
+ * <p>
+ * Add an additional style name <b><code>selected</code></b> to it to make
+ * it the selected item in the menu.
+ * </p>
+ *
+ * <h4>Example</h4>
+ *
+ * <pre>
+ * Button item = new Button();
+ * item.setPrimaryStyleName(ValoTheme.MENU_ITEM);
+ * item.addStyleName(&quot;selected&quot;);
+ * </pre>
*/
- public static final String MENU_ITEM = "valo-menu-title";
+ public static final String MENU_ITEM = "valo-menu-item";
/**
- * TODO
+ * Add a SPAN element with this style name inside a {@link #MENU_SUBTITLE}
+ * or {@link #MENU_ITEM} to add an additional badge indicator to the
+ * subtitle/item. The Label/Button needs to allow HTML content in order to
+ * use this style name.
+ *
+ * <h4>Examples</h4>
+ *
+ * <pre>
+ * Button item = new Button();
+ * item.setPrimaryStyleName(ValoTheme.MENU_ITEM);
+ * item.setHtmlContentAllowed(true);
+ * item.setCaption(&quot;Item Caption &lt;span class=\&quot;&quot; + ValoTheme.MENU_BADGE
+ * + &quot;\&quot;&gt;Badge text&lt;/span&gt;&quot;);
+ * </pre>
+ *
+ * <pre>
+ * Label item = new Label();
+ * item.setPrimaryStyleName(ValoTheme.MENU_ITEM);
+ * item.setContentMode(ContentMode.HTML);
+ * item.setCaption(&quot;Item Caption &lt;span class=\&quot;&quot; + ValoTheme.MENU_BADGE
+ * + &quot;\&quot;&gt;Badge text&lt;/span&gt;&quot;);
+ * </pre>
*/
public static final String MENU_BADGE = "valo-menu-badge";
/**
- * TODO
+ * <p>
+ * Set the <em><b>primary</b></em> style name of a Label or a Button to this
+ * style name to create an application logo. The logo is designed to be
+ * placed inside a {@link #MENU_PART} layout.
+ * </p>
+ *
+ * <p>
+ * The text content of the logo should be very short, since the logo area
+ * only shows approximately three letters. Using one of the
+ * {@link FontAwesome} icons is a good way to quickly create a logo for your
+ * application.
+ * </p>
+ * </p>
+ *
+ * <h4>Example</h4>
+ *
+ * <pre>
+ * Label logo = new Label(FontAwesome.ROCKET.getHtml(), ContentMode.HTML);
+ * logo.setSizeUndefined();
+ * logo.setPrimaryStyleName(ValoTheme.MENU_LOGO);
+ * </pre>
*/
public static final String MENU_LOGO = "valo-menu-logo";
diff --git a/server/src/com/vaadin/util/CurrentInstance.java b/server/src/com/vaadin/util/CurrentInstance.java
index 6f2c0a2eca..d11fa175ac 100644
--- a/server/src/com/vaadin/util/CurrentInstance.java
+++ b/server/src/com/vaadin/util/CurrentInstance.java
@@ -112,7 +112,7 @@ public class CurrentInstance implements Serializable {
* ThreadLocal should only outlive the referenced object on
* threads that are not doing anything related to Vaadin, which
* should thus never invoke CurrentInstance.get().
- *
+ *
* At this point, there might also be other values that have
* been collected, so we'll scan the entire map and remove stale
* CurrentInstance objects. Using a ReferenceQueue could make
@@ -250,7 +250,7 @@ public class CurrentInstance implements Serializable {
* CurrentInstance. Without this a reference to an already
* collected instance may be left in the CurrentInstance when it
* really should be restored to null.
- *
+ *
* One example case that this fixes:
* VaadinService.runPendingAccessTasks() clears all current
* instances and then sets everything but the UI. This makes