diff options
Diffstat (limited to 'server/src')
35 files changed, 1128 insertions, 252 deletions
diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index 92c235167c..bafecdabf4 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -243,7 +243,7 @@ public abstract class AbstractClientConnector implements ClientConnector, @Override public JSONObject encodeState() throws JSONException { - return LegacyCommunicationManager.encodeState(this, getState()); + return LegacyCommunicationManager.encodeState(this, getState(false)); } /** @@ -292,11 +292,13 @@ public abstract class AbstractClientConnector implements ClientConnector, Method m = class1.getDeclaredMethod("getState", (Class[]) null); Class<?> type = m.getReturnType(); - return type.asSubclass(SharedState.class); + if (!m.isSynthetic()) { + return type.asSubclass(SharedState.class); + } } catch (NoSuchMethodException nsme) { - // Try in superclass instead - class1 = class1.getSuperclass(); } + // Try in superclass instead + class1 = class1.getSuperclass(); } throw new NoSuchMethodException(getClass().getCanonicalName() + ".getState()"); @@ -664,7 +666,8 @@ public abstract class AbstractClientConnector implements ClientConnector, * @see #setResource(String, Resource) */ protected Resource getResource(String key) { - return ResourceReference.getResource(getState().resources.get(key)); + return ResourceReference + .getResource(getState(false).resources.get(key)); } /** diff --git a/server/src/com/vaadin/server/AbstractErrorMessage.java b/server/src/com/vaadin/server/AbstractErrorMessage.java index c733cc493e..b56521993a 100644 --- a/server/src/com/vaadin/server/AbstractErrorMessage.java +++ b/server/src/com/vaadin/server/AbstractErrorMessage.java @@ -126,7 +126,7 @@ public abstract class AbstractErrorMessage implements ErrorMessage { StringBuilder sb = new StringBuilder(); for (ErrorMessage cause : getCauses()) { String childMessage = cause.getFormattedHtmlMessage(); - if (null != childMessage) { + if (null != childMessage && !childMessage.isEmpty()) { sb.append("<div>"); sb.append(childMessage); sb.append("</div>\n"); diff --git a/server/src/com/vaadin/server/BrowserWindowOpener.java b/server/src/com/vaadin/server/BrowserWindowOpener.java index df03e76bcd..44679fbfbb 100644 --- a/server/src/com/vaadin/server/BrowserWindowOpener.java +++ b/server/src/com/vaadin/server/BrowserWindowOpener.java @@ -147,7 +147,7 @@ public class BrowserWindowOpener extends AbstractExtension { * @return the window target string */ public String getWindowName() { - return getState().target; + return getState(false).target; } // Avoid breaking url to multiple lines @@ -171,7 +171,7 @@ public class BrowserWindowOpener extends AbstractExtension { * @return */ public String getFeatures() { - return getState().features; + return getState(false).features; } @Override @@ -180,6 +180,11 @@ public class BrowserWindowOpener extends AbstractExtension { } @Override + protected BrowserWindowOpenerState getState(boolean markAsDirty) { + return (BrowserWindowOpenerState) super.getState(markAsDirty); + } + + @Override public void attach() { super.attach(); if (uiProvider != null @@ -226,7 +231,7 @@ public class BrowserWindowOpener extends AbstractExtension { * @see #setUriFragment(String) */ public String getUriFragment() { - return getState().uriFragment; + return getState(false).uriFragment; } /** @@ -301,7 +306,7 @@ public class BrowserWindowOpener extends AbstractExtension { if (name == null) { throw new IllegalArgumentException("Null not allowed"); } - return getState().parameters.get(name); + return getState(false).parameters.get(name); } } diff --git a/server/src/com/vaadin/server/FontAwesome.java b/server/src/com/vaadin/server/FontAwesome.java index 71a2249dca..c99f42fac1 100644 --- a/server/src/com/vaadin/server/FontAwesome.java +++ b/server/src/com/vaadin/server/FontAwesome.java @@ -25,6 +25,9 @@ package com.vaadin.server; * these icons, and all of them, so you might want to consider making a custom * icon font - either to get other icons, or to minimize the size of the font. * </p> + * <p> + * The Font Awesome version currently included is 4.0.3. + * </p> * * @since 7.2 * @author Vaadin Ltd diff --git a/server/src/com/vaadin/server/JsonCodec.java b/server/src/com/vaadin/server/JsonCodec.java index 08345714fd..93074abcdb 100644 --- a/server/src/com/vaadin/server/JsonCodec.java +++ b/server/src/com/vaadin/server/JsonCodec.java @@ -27,7 +27,6 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.lang.reflect.WildcardType; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -435,21 +434,6 @@ public class JsonCodec implements Serializable { return new UidlValue(decodedValue); } - private static boolean transportTypesCompatible( - String encodedTransportType, String transportType) { - if (encodedTransportType == null) { - return false; - } - if (encodedTransportType.equals(transportType)) { - return true; - } - if (encodedTransportType.equals(JsonConstants.VTYPE_NULL)) { - return true; - } - - return false; - } - private static Map<Object, Object> decodeMap(Type targetType, boolean restrictToInternalTypes, Object jsonMap, ConnectorTracker connectorTracker) throws JSONException { @@ -588,7 +572,8 @@ public class JsonCodec implements Serializable { private static Object[] decodeObjectArray(Type targetType, JSONArray jsonArray, ConnectorTracker connectorTracker) throws JSONException { - List list = decodeList(List.class, true, jsonArray, connectorTracker); + List<Object> list = decodeList(List.class, true, jsonArray, + connectorTracker); return list.toArray(new Object[list.size()]); } @@ -644,80 +629,59 @@ public class JsonCodec implements Serializable { Type valueType, ConnectorTracker connectorTracker) throws JSONException { - if (valueType == null) { - throw new IllegalArgumentException("type must be defined"); - } - - if (valueType instanceof WildcardType) { - throw new IllegalStateException( - "Can not serialize type with wildcard: " + valueType); - } - if (null == value) { return ENCODE_RESULT_NULL; } - if (value instanceof String[]) { - String[] array = (String[]) value; - JSONArray jsonArray = new JSONArray(); - for (int i = 0; i < array.length; ++i) { - jsonArray.put(array[i]); - } - return new EncodeResult(jsonArray); - } else if (value instanceof String) { - return new EncodeResult(value); - } else if (value instanceof Boolean) { - return new EncodeResult(value); - } else if (value instanceof Number) { - return new EncodeResult(value); - } else if (value instanceof Character) { - // Character is not a Number - return new EncodeResult(value); + // Storing a single reference and only returning the EncodeResult at the + // end the method is much shorter in bytecode which allows inlining + Object toReturn; + + if (value instanceof String || value instanceof Boolean + || value instanceof Number || value instanceof Character + || value instanceof JSONArray || value instanceof JSONObject) { + // all JSON compatible types are returned as is. + toReturn = value; + } else if (value instanceof String[]) { + toReturn = toJsonArray((String[]) value); } else if (value instanceof Collection) { - Collection<?> collection = (Collection<?>) value; - JSONArray jsonArray = encodeCollection(valueType, collection, - connectorTracker); - return new EncodeResult(jsonArray); - } else if (valueType instanceof Class<?> - && ((Class<?>) valueType).isArray()) { - JSONArray jsonArray = encodeArrayContents( - ((Class<?>) valueType).getComponentType(), value, - connectorTracker); - return new EncodeResult(jsonArray); - } else if (valueType instanceof GenericArrayType) { - Type componentType = ((GenericArrayType) valueType) - .getGenericComponentType(); - JSONArray jsonArray = encodeArrayContents(componentType, value, + toReturn = encodeCollection(valueType, (Collection<?>) value, connectorTracker); - return new EncodeResult(jsonArray); } else if (value instanceof Map) { - Object jsonMap = encodeMap(valueType, (Map<?, ?>) value, - connectorTracker); - return new EncodeResult(jsonMap); + toReturn = encodeMap(valueType, (Map<?, ?>) value, connectorTracker); } else if (value instanceof Connector) { - Connector connector = (Connector) value; if (value instanceof Component && !(LegacyCommunicationManager .isComponentVisibleToClient((Component) value))) { + // an encoded null is cached, return it directly. return ENCODE_RESULT_NULL; } - return new EncodeResult(connector.getConnectorId()); + // Connectors are simply serialized as ID. + toReturn = ((Connector) value).getConnectorId(); } else if (value instanceof Enum) { - return encodeEnum((Enum<?>) value, connectorTracker); - } else if (value instanceof JSONArray || value instanceof JSONObject) { - return new EncodeResult(value); + toReturn = ((Enum<?>) value).name(); } else if (customSerializers.containsKey(value.getClass())) { - JSONSerializer serializer = customSerializers.get(value.getClass()); - return new EncodeResult(serializer.serialize(value, - connectorTracker)); + toReturn = serializeJson(value, connectorTracker); + } else if (valueType instanceof GenericArrayType) { + toReturn = encodeArrayContents( + ((GenericArrayType) valueType).getGenericComponentType(), + value, connectorTracker); } else if (valueType instanceof Class<?>) { - // Any object that we do not know how to encode we encode by looping - // through fields - return encodeObject(value, (Class<?>) valueType, - (JSONObject) diffState, connectorTracker); + if (((Class<?>) valueType).isArray()) { + toReturn = encodeArrayContents( + ((Class<?>) valueType).getComponentType(), value, + connectorTracker); + } else { + // encodeObject returns an EncodeResult with a diff, thus it + // needs to return it directly rather than assigning it to + // toReturn. + return encodeObject(value, (Class<?>) valueType, + (JSONObject) diffState, connectorTracker); + } } else { - throw new JSONException("Can not encode " + valueType); + throw new JSONException("Can not encode type " + valueType); } + return new EncodeResult(toReturn); } public static Collection<BeanProperty> getProperties(Class<?> type) @@ -737,6 +701,9 @@ public class JsonCodec implements Serializable { return properties; } + /* + * Loops through the fields of value and encodes them. + */ private static EncodeResult encodeObject(Object value, Class<?> valueType, JSONObject referenceValue, ConnectorTracker connectorTracker) throws JSONException { @@ -812,11 +779,6 @@ public class JsonCodec implements Serializable { } } - private static EncodeResult encodeEnum(Enum<?> e, - ConnectorTracker connectorTracker) throws JSONException { - return new EncodeResult(e.name()); - } - private static JSONArray encodeArrayContents(Type componentType, Object array, ConnectorTracker connectorTracker) throws JSONException { @@ -830,7 +792,7 @@ public class JsonCodec implements Serializable { } private static JSONArray encodeCollection(Type targetType, - Collection collection, ConnectorTracker connectorTracker) + Collection<?> collection, ConnectorTracker connectorTracker) throws JSONException { JSONArray jsonArray = new JSONArray(); for (Object o : collection) { @@ -898,6 +860,9 @@ public class JsonCodec implements Serializable { return new JSONArray(Arrays.asList(keys, values)); } + /* + * Encodes a connector map. Invisible connectors are skipped. + */ private static JSONObject encodeConnectorMap(Type valueType, Map<?, ?> map, ConnectorTracker connectorTracker) throws JSONException { JSONObject jsonMap = new JSONObject(); @@ -929,21 +894,27 @@ public class JsonCodec implements Serializable { return jsonMap; } - /** - * Gets the transport type for the given class. Returns null if no transport - * type can be found. - * - * @param valueType - * The type that should be transported - * @return - * @throws JSONException + /* + * These methods looks good to inline, but are on a cold path of the + * otherwise hot encode method, which needed to be shorted to allow inlining + * of the hot part. */ private static String getInternalTransportType(Type valueType) { return typeToTransportType.get(getClassForType(valueType)); } - private static String getCustomTransportType(Class<?> targetType) { - return targetType.getName(); + private static Object serializeJson(Object value, + ConnectorTracker connectorTracker) { + JSONSerializer serializer = customSerializers.get(value.getClass()); + return serializer.serialize(value, connectorTracker); + } + + private static JSONArray toJsonArray(String[] array) { + JSONArray jsonArray = new JSONArray(); + for (int i = 0; i < array.length; ++i) { + jsonArray.put(array[i]); + } + return jsonArray; } } diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index 08bc6f5c79..e8cdcd7055 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -59,6 +59,7 @@ import com.vaadin.server.communication.HeartbeatHandler; import com.vaadin.server.communication.PublishedFileHandler; import com.vaadin.server.communication.SessionRequestHandler; import com.vaadin.server.communication.UidlRequestHandler; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.shared.JsonConstants; import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.ui.UI; @@ -1590,6 +1591,7 @@ public abstract class VaadinService implements Serializable { json.put("resources", new JSONObject()); json.put("locales", new JSONObject()); json.put("meta", meta); + json.put(ApplicationConstants.SERVER_SYNC_ID, -1); returnString = json.toString(); } catch (JSONException e) { getLogger().log(Level.WARNING, diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 81c3f374ea..12e7c28cd8 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -547,42 +547,6 @@ public class VaadinServlet extends HttpServlet implements Constants { return DEFAULT_THEME_NAME; } - private void handleServiceSecurityException(VaadinServletRequest request, - VaadinServletResponse response) throws IOException, - ServletException { - - try { - /* - * We might have a UI, but we don't want to leak any information in - * this case so just use the info provided in the request. - */ - SystemMessages ci = getService().getSystemMessages( - request.getLocale(), request); - if (ServletPortletHelper.isUIDLRequest(request)) { - // send uidl redirect - getService().writeStringResponse( - response, - JsonConstants.JSON_CONTENT_TYPE, - VaadinService.createCriticalNotificationJSON( - ci.getCommunicationErrorCaption(), - ci.getCommunicationErrorMessage(), - INVALID_SECURITY_KEY_MSG, - ci.getCommunicationErrorURL())); - } else if (ServletPortletHelper.isHeartbeatRequest(request)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, - "Forbidden"); - } else { - // 'plain' http req - e.g. browser reload; - // just go ahead redirect the browser - response.sendRedirect(ci.getCommunicationErrorURL()); - } - } catch (SystemMessageException ee) { - throw new ServletException(ee); - } - - log("Invalid security key received from " + request.getRemoteHost()); - } - /** * Check if this is a request for a static resource and, if it is, serve the * resource to the client. diff --git a/server/src/com/vaadin/server/communication/ClientRpcWriter.java b/server/src/com/vaadin/server/communication/ClientRpcWriter.java index 1090fdbab9..181bfbb882 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/ui/AbstractColorPicker.java b/server/src/com/vaadin/ui/AbstractColorPicker.java index db4239f8a6..acf3b2c042 100644 --- a/server/src/com/vaadin/ui/AbstractColorPicker.java +++ b/server/src/com/vaadin/ui/AbstractColorPicker.java @@ -189,7 +189,7 @@ public abstract class AbstractColorPicker extends AbstractComponent implements * currently selected color, e.g. #ffffff) if no other caption is available. */ public boolean isDefaultCaptionEnabled() { - return getState().showDefaultCaption; + return getState(false).showDefaultCaption; } /** @@ -358,6 +358,11 @@ public abstract class AbstractColorPicker extends AbstractComponent implements return (ColorPickerState) super.getState(); } + @Override + protected ColorPickerState getState(boolean markAsDirty) { + return (ColorPickerState) super.getState(markAsDirty); + } + /** * Sets the default styles of the component * @@ -462,6 +467,6 @@ public abstract class AbstractColorPicker extends AbstractComponent implements * <code>false</code> otherwise */ public boolean isHtmlContentAllowed() { - return getState().htmlContentAllowed; + return getState(false).htmlContentAllowed; } } diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index b6289e0b7d..9dbd9a093d 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -151,8 +151,8 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public String getStyleName() { String s = ""; - if (ComponentStateUtil.hasStyles(getState())) { - for (final Iterator<String> it = getState().styles.iterator(); it + if (ComponentStateUtil.hasStyles(getState(false))) { + for (final Iterator<String> it = getState(false).styles.iterator(); it .hasNext();) { s += it.next(); if (it.hasNext()) { @@ -191,7 +191,7 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public String getPrimaryStyleName() { - return getState().primaryStyleName; + return getState(false).primaryStyleName; } @Override diff --git a/server/src/com/vaadin/ui/AbstractEmbedded.java b/server/src/com/vaadin/ui/AbstractEmbedded.java index 8c574fd59e..66752aa5d7 100644 --- a/server/src/com/vaadin/ui/AbstractEmbedded.java +++ b/server/src/com/vaadin/ui/AbstractEmbedded.java @@ -34,6 +34,11 @@ public abstract class AbstractEmbedded extends AbstractComponent { return (AbstractEmbeddedState) super.getState(); } + @Override + protected AbstractEmbeddedState getState(boolean markAsDirty) { + return (AbstractEmbeddedState) super.getState(markAsDirty); + } + /** * Sets the object source resource. The dimensions are assumed if possible. * The type is guessed from resource. @@ -73,7 +78,7 @@ public abstract class AbstractEmbedded extends AbstractComponent { * @returns Alternate text */ public String getAlternateText() { - return getState().alternateText; + return getState(false).alternateText; } } diff --git a/server/src/com/vaadin/ui/AbstractMedia.java b/server/src/com/vaadin/ui/AbstractMedia.java index a841aa672e..0bd8c3ea77 100644 --- a/server/src/com/vaadin/ui/AbstractMedia.java +++ b/server/src/com/vaadin/ui/AbstractMedia.java @@ -47,6 +47,11 @@ public abstract class AbstractMedia extends AbstractComponent { return (AbstractMediaState) super.getState(); } + @Override + protected AbstractMediaState getState(boolean markAsDirty) { + return (AbstractMediaState) super.getState(markAsDirty); + } + /** * Sets a single media file as the source of the media component. * @@ -141,7 +146,7 @@ public abstract class AbstractMedia extends AbstractComponent { */ public List<Resource> getSources() { ArrayList<Resource> sources = new ArrayList<Resource>(); - for (URLReference ref : getState().sources) { + for (URLReference ref : getState(false).sources) { sources.add(((ResourceReference) ref).getResource()); } return sources; @@ -160,7 +165,7 @@ public abstract class AbstractMedia extends AbstractComponent { * @return true if the browser is to show native media controls. */ public boolean isShowControls() { - return getState().showControls; + return getState(false).showControls; } /** @@ -183,7 +188,7 @@ public abstract class AbstractMedia extends AbstractComponent { * HTML5. */ public String getAltText() { - return getState().altText; + return getState(false).altText; } /** @@ -201,7 +206,7 @@ public abstract class AbstractMedia extends AbstractComponent { * be rendered as HTML. */ public boolean isHtmlContentAllowed() { - return getState().htmlContentAllowed; + return getState(false).htmlContentAllowed; } /** @@ -218,7 +223,7 @@ public abstract class AbstractMedia extends AbstractComponent { * @return true if the media is set to automatically start playback. */ public boolean isAutoplay() { - return getState().autoplay; + return getState(false).autoplay; } /** @@ -234,7 +239,7 @@ public abstract class AbstractMedia extends AbstractComponent { * @return true if the audio is muted. */ public boolean isMuted() { - return getState().muted; + return getState(false).muted; } /** diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java index 039c87333e..27880db75f 100644 --- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -69,6 +69,11 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements return (AbstractOrderedLayoutState) super.getState(); } + @Override + protected AbstractOrderedLayoutState getState(boolean markAsDirty) { + return (AbstractOrderedLayoutState) super.getState(markAsDirty); + } + /** * Add a component into this container. The component is added to the right * or under the previous component. @@ -285,7 +290,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements */ @Override public boolean isSpacing() { - return getState().spacing; + return getState(false).spacing; } /** @@ -335,7 +340,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements * @return expand ratio of given component, 0.0f by default. */ public float getExpandRatio(Component component) { - ChildComponentData childData = getState().childData.get(component); + ChildComponentData childData = getState(false).childData.get(component); if (childData == null) { throw new IllegalArgumentException( "The given component is not a child of this layout"); @@ -413,7 +418,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements */ @Override public MarginInfo getMargin() { - return new MarginInfo(getState().marginsBitmask); + return new MarginInfo(getState(false).marginsBitmask); } /* diff --git a/server/src/com/vaadin/ui/AbstractSplitPanel.java b/server/src/com/vaadin/ui/AbstractSplitPanel.java index 3a1b7ca35a..1c69ebf87e 100644 --- a/server/src/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/com/vaadin/ui/AbstractSplitPanel.java @@ -186,7 +186,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @return the first component of this split panel */ public Component getFirstComponent() { - return (Component) getState().firstChild; + return (Component) getState(false).firstChild; } /** @@ -196,7 +196,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @return the second component of this split panel */ public Component getSecondComponent() { - return (Component) getState().secondChild; + return (Component) getState(false).secondChild; } /** @@ -534,7 +534,12 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { return (AbstractSplitPanelState) super.getState(); } + @Override + protected AbstractSplitPanelState getState(boolean markAsDirty) { + return (AbstractSplitPanelState) super.getState(markAsDirty); + } + private SplitterState getSplitterState() { - return getState().splitterState; + return getState(false).splitterState; } } diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java index 25b34ae19f..e0318ddf2b 100644 --- a/server/src/com/vaadin/ui/AbstractTextField.java +++ b/server/src/com/vaadin/ui/AbstractTextField.java @@ -96,6 +96,11 @@ public abstract class AbstractTextField extends AbstractField<String> implements } @Override + protected AbstractTextFieldState getState(boolean markAsDirty) { + return (AbstractTextFieldState) super.getState(markAsDirty); + } + + @Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); @@ -311,7 +316,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements * @return the maxLength */ public int getMaxLength() { - return getState().maxLength; + return getState(false).maxLength; } /** @@ -333,7 +338,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements * @return the number of columns in the editor. */ public int getColumns() { - return getState().columns; + return getState(false).columns; } /** @@ -358,7 +363,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements * @return the current input prompt, or null if not enabled */ public String getInputPrompt() { - return getState().inputPrompt; + return getState(false).inputPrompt; } /** diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java index 5a5d03a3ee..58b6f9de81 100644 --- a/server/src/com/vaadin/ui/Button.java +++ b/server/src/com/vaadin/ui/Button.java @@ -556,7 +556,7 @@ public class Button extends AbstractComponent implements * @return true if the button is disabled when clicked, false otherwise */ public boolean isDisableOnClick() { - return getState().disableOnClick; + return getState(false).disableOnClick; } /** @@ -582,7 +582,7 @@ public class Button extends AbstractComponent implements */ @Override public int getTabIndex() { - return getState().tabIndex; + return getState(false).tabIndex; } /* @@ -606,6 +606,11 @@ public class Button extends AbstractComponent implements return (ButtonState) super.getState(); } + @Override + protected ButtonState getState(boolean markAsDirty) { + return (ButtonState) super.getState(markAsDirty); + } + /** * Sets the component's icon and alt text. * @@ -628,7 +633,7 @@ public class Button extends AbstractComponent implements * @return String with the alt text */ public String getIconAlternateText() { - return getState().iconAltText; + return getState(false).iconAltText; } public void setIconAlternateText(String iconAltText) { @@ -658,7 +663,7 @@ public class Button extends AbstractComponent implements * <code>false</code> otherwise */ public boolean isHtmlContentAllowed() { - return getState().htmlContentAllowed; + return getState(false).htmlContentAllowed; } } diff --git a/server/src/com/vaadin/ui/CustomLayout.java b/server/src/com/vaadin/ui/CustomLayout.java index fd56ed9219..7f1aa1ce46 100644 --- a/server/src/com/vaadin/ui/CustomLayout.java +++ b/server/src/com/vaadin/ui/CustomLayout.java @@ -124,6 +124,11 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { return (CustomLayoutState) super.getState(); } + @Override + protected CustomLayoutState getState(boolean markAsDirty) { + return (CustomLayoutState) super.getState(markAsDirty); + } + /** * Adds the component into this container to given location. If the location * is already populated, the old component is removed. @@ -251,12 +256,12 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { /** Get the name of the template */ public String getTemplateName() { - return getState().templateName; + return getState(false).templateName; } /** Get the contents of the template */ public String getTemplateContents() { - return getState().templateContents; + return getState(false).templateContents; } /** @@ -292,7 +297,7 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { public void paintContent(PaintTarget target) throws PaintException { // Workaround to make the CommunicationManager read the template file // and send it to the client - String templateName = getState().templateName; + String templateName = getState(false).templateName; if (templateName != null && templateName.length() != 0) { Set<Object> usedResources = ((JsonPaintTarget) target) .getUsedResources(); diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java index 7ab7732079..e98b1e1b31 100644 --- a/server/src/com/vaadin/ui/DateField.java +++ b/server/src/com/vaadin/ui/DateField.java @@ -152,7 +152,8 @@ public class DateField extends AbstractField<Date> implements private String dateOutOfRangeMessage = "Date is out of allowed range"; private DateRangeValidator currentRangeValidator; - { + + static { variableNameForResolution.put(Resolution.SECOND, "sec"); variableNameForResolution.put(Resolution.MINUTE, "min"); variableNameForResolution.put(Resolution.HOUR, "hour"); diff --git a/server/src/com/vaadin/ui/DragAndDropWrapper.java b/server/src/com/vaadin/ui/DragAndDropWrapper.java index cb94a774a5..3d3356b338 100644 --- a/server/src/com/vaadin/ui/DragAndDropWrapper.java +++ b/server/src/com/vaadin/ui/DragAndDropWrapper.java @@ -187,6 +187,10 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, private Set<String> sentIds = new HashSet<String>(); + private DragAndDropWrapper() { + super(); + } + /** * Wraps given component in a {@link DragAndDropWrapper}. * @@ -194,7 +198,8 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, * the component to be wrapped */ public DragAndDropWrapper(Component root) { - super(root); + this(); + setCompositionRoot(root); } /** diff --git a/server/src/com/vaadin/ui/Flash.java b/server/src/com/vaadin/ui/Flash.java index 791202f4a9..bbbd4e3285 100644 --- a/server/src/com/vaadin/ui/Flash.java +++ b/server/src/com/vaadin/ui/Flash.java @@ -67,6 +67,11 @@ public class Flash extends AbstractEmbedded { return (FlashState) super.getState(); } + @Override + protected FlashState getState(boolean markAsDirty) { + return (FlashState) super.getState(markAsDirty); + } + /** * This attribute specifies the base path used to resolve relative URIs * specified by the classid, data, and archive attributes. When absent, its @@ -156,7 +161,7 @@ public class Flash extends AbstractEmbedded { * @return the Value of parameter or null if not found. */ public String getParameter(String name) { - return getState().embedParams != null ? getState().embedParams + return getState(false).embedParams != null ? getState(false).embedParams .get(name) : null; } diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java index 5653a83cee..391ee45536 100644 --- a/server/src/com/vaadin/ui/Form.java +++ b/server/src/com/vaadin/ui/Form.java @@ -198,6 +198,11 @@ public class Form extends AbstractField<Object> implements Item.Editor, return (FormState) super.getState(); } + @Override + protected FormState getState(boolean markAsDirty) { + return (FormState) super.getState(markAsDirty); + } + /* Documented in interface */ @Override public void paintContent(PaintTarget target) throws PaintException { @@ -775,7 +780,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, * @return the Layout of the form. */ public Layout getLayout() { - return (Layout) getState().layout; + return (Layout) getState(false).layout; } /** @@ -1054,8 +1059,9 @@ public class Form extends AbstractField<Object> implements Item.Editor, * @return the Field. */ private Field<?> getFirstFocusableField() { - if (getItemPropertyIds() != null) { - for (Object id : getItemPropertyIds()) { + Collection<?> itemPropertyIds = getItemPropertyIds(); + if (itemPropertyIds != null && itemPropertyIds.size() > 0) { + for (Object id : itemPropertyIds) { if (id != null) { Field<?> field = getField(id); if (field.isEnabled() && !field.isReadOnly()) { @@ -1065,7 +1071,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, } // fallback: first field if none of the fields is enabled and // writable - Object id = getItemPropertyIds().iterator().next(); + Object id = itemPropertyIds.iterator().next(); if (id != null) { return getField(id); } @@ -1214,7 +1220,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, * is used */ public Layout getFooter() { - return (Layout) getState().footer; + return (Layout) getState(false).footer; } /** diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java index 00e50aafc4..0c097abc83 100644 --- a/server/src/com/vaadin/ui/GridLayout.java +++ b/server/src/com/vaadin/ui/GridLayout.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 @@ -141,6 +141,11 @@ public class GridLayout extends AbstractLayout implements return (GridLayoutState) super.getState(); } + @Override + protected GridLayoutState getState(boolean markAsDirty) { + return (GridLayoutState) super.getState(markAsDirty); + } + /** * <p> * Adds a component to the grid in the specified area. The area is defined @@ -497,7 +502,6 @@ public class GridLayout extends AbstractLayout implements if (columnExpandRatioArray.length > 0) { columnExpandRatioArray[0] -= realColExpandRatioSum - 1000; } - target.addAttribute("colExpand", columnExpandRatioArray); target.addAttribute("rowExpand", rowExpandRatioArray); @@ -520,7 +524,7 @@ public class GridLayout extends AbstractLayout implements */ @Override public Alignment getComponentAlignment(Component childComponent) { - ChildComponentData childComponentData = getState().childData + ChildComponentData childComponentData = getState(false).childData .get(childComponent); if (childComponentData == null) { throw new IllegalArgumentException( @@ -781,7 +785,7 @@ public class GridLayout extends AbstractLayout implements * @return the number of columns in the grid. */ public int getColumns() { - return getState().columns; + return getState(false).columns; } /** @@ -825,7 +829,7 @@ public class GridLayout extends AbstractLayout implements * @return the number of rows in the grid. */ public int getRows() { - return getState().rows; + return getState(false).rows; } /** @@ -952,7 +956,7 @@ public class GridLayout extends AbstractLayout implements */ @Override public boolean isSpacing() { - return getState().spacing; + return getState(false).spacing; } /** @@ -1068,6 +1072,7 @@ public class GridLayout extends AbstractLayout implements */ public void setColumnExpandRatio(int columnIndex, float ratio) { columnExpandRatio.put(columnIndex, ratio); + getState().explicitColRatios.add(columnIndex); markAsDirty(); } @@ -1106,6 +1111,7 @@ public class GridLayout extends AbstractLayout implements */ public void setRowExpandRatio(int rowIndex, float ratio) { rowExpandRatio.put(rowIndex, ratio); + getState().explicitRowRatios.add(rowIndex); markAsDirty(); } @@ -1133,7 +1139,7 @@ public class GridLayout extends AbstractLayout implements * @return Component in given cell or null if empty */ public Component getComponent(int x, int y) { - for (Entry<Connector, ChildComponentData> entry : getState().childData + for (Entry<Connector, ChildComponentData> entry : getState(false).childData .entrySet()) { ChildComponentData childData = entry.getValue(); if (childData.column1 <= x && x <= childData.column2 @@ -1154,7 +1160,7 @@ public class GridLayout extends AbstractLayout implements * the grid */ public Area getComponentArea(Component component) { - ChildComponentData childComponentData = getState().childData + ChildComponentData childComponentData = getState(false).childData .get(component); if (childComponentData == null) { return null; @@ -1225,7 +1231,7 @@ public class GridLayout extends AbstractLayout implements */ @Override public MarginInfo getMargin() { - return new MarginInfo(getState().marginsBitmask); + return new MarginInfo(getState(false).marginsBitmask); } /* diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java index b4685adcea..c73840e6e9 100644 --- a/server/src/com/vaadin/ui/Label.java +++ b/server/src/com/vaadin/ui/Label.java @@ -155,6 +155,11 @@ public class Label extends AbstractComponent implements Property<String>, return (LabelState) super.getState(); } + @Override + protected LabelState getState(boolean markAsDirty) { + return (LabelState) super.getState(markAsDirty); + } + /** * Gets the value of the label. * <p> @@ -168,7 +173,7 @@ public class Label extends AbstractComponent implements Property<String>, public String getValue() { if (getPropertyDataSource() == null) { // Use internal value if we are running without a data source - return getState().text; + return getState(false).text; } return getDataSourceValue(); } @@ -196,7 +201,7 @@ public class Label extends AbstractComponent implements Property<String>, public void setValue(String newStringValue) { if (getPropertyDataSource() == null) { - LabelState state = (LabelState) getState(false); + LabelState state = getState(false); String oldTextValue = state.text; if (!SharedUtil.equals(oldTextValue, newStringValue)) { getState().text = newStringValue; @@ -281,7 +286,7 @@ public class Label extends AbstractComponent implements Property<String>, * @see ContentMode */ public ContentMode getContentMode() { - return getState().contentMode; + return getState(false).contentMode; } /** @@ -412,8 +417,7 @@ public class Label extends AbstractComponent implements Property<String>, private void updateValueFromDataSource() { // Update the internal value from the data source String newConvertedValue = getDataSourceValue(); - if (!SharedUtil.equals(newConvertedValue, - ((LabelState) getState(false)).text)) { + if (!SharedUtil.equals(newConvertedValue, getState(false).text)) { getState().text = newConvertedValue; fireValueChange(); } diff --git a/server/src/com/vaadin/ui/MenuBar.java b/server/src/com/vaadin/ui/MenuBar.java index 17a2f8e391..6b6555c0a2 100644 --- a/server/src/com/vaadin/ui/MenuBar.java +++ b/server/src/com/vaadin/ui/MenuBar.java @@ -57,6 +57,11 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, return (MenuBarState) super.getState(); } + @Override + protected MenuBarState getState(boolean markAsDirty) { + return (MenuBarState) super.getState(markAsDirty); + } + /** Paint (serialise) the component for the client. */ @Override public void paintContent(PaintTarget target) throws PaintException { @@ -396,7 +401,7 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, @Override public int getTabIndex() { - return getState().tabIndex; + return getState(false).tabIndex; } /* diff --git a/server/src/com/vaadin/ui/Panel.java b/server/src/com/vaadin/ui/Panel.java index 34ff6ec112..9b1d8fd5fa 100644 --- a/server/src/com/vaadin/ui/Panel.java +++ b/server/src/com/vaadin/ui/Panel.java @@ -171,7 +171,7 @@ public class Panel extends AbstractSingleComponentContainer implements */ @Override public int getScrollLeft() { - return getState().scrollLeft; + return getState(false).scrollLeft; } /* @@ -181,7 +181,7 @@ public class Panel extends AbstractSingleComponentContainer implements */ @Override public int getScrollTop() { - return getState().scrollTop; + return getState(false).scrollTop; } /* @@ -309,7 +309,7 @@ public class Panel extends AbstractSingleComponentContainer implements */ @Override public int getTabIndex() { - return getState().tabIndex; + return getState(false).tabIndex; } /** @@ -334,4 +334,9 @@ public class Panel extends AbstractSingleComponentContainer implements return (PanelState) super.getState(); } + @Override + protected PanelState getState(boolean markAsDirty) { + return (PanelState) super.getState(markAsDirty); + } + } diff --git a/server/src/com/vaadin/ui/PopupDateField.java b/server/src/com/vaadin/ui/PopupDateField.java index 61aac16a97..f07ac84160 100644 --- a/server/src/com/vaadin/ui/PopupDateField.java +++ b/server/src/com/vaadin/ui/PopupDateField.java @@ -93,6 +93,11 @@ public class PopupDateField extends DateField { return (PopupDateFieldState) super.getState(); } + @Override + protected PopupDateFieldState getState(boolean markAsDirty) { + return (PopupDateFieldState) super.getState(markAsDirty); + } + /** * Checks whether the text field is enabled (default) or not. * @@ -101,7 +106,7 @@ public class PopupDateField extends DateField { * @return <b>true</b> if the text field is enabled, <b>false</b> otherwise. */ public boolean isTextFieldEnabled() { - return getState().textFieldEnabled; + return getState(false).textFieldEnabled; } /** @@ -136,6 +141,6 @@ public class PopupDateField extends DateField { * @return String with the description */ public String getAssistiveText() { - return getState().descriptionForAssistiveDevices; + return getState(false).descriptionForAssistiveDevices; } } diff --git a/server/src/com/vaadin/ui/PopupView.java b/server/src/com/vaadin/ui/PopupView.java index b347576b22..90c60edc6e 100644 --- a/server/src/com/vaadin/ui/PopupView.java +++ b/server/src/com/vaadin/ui/PopupView.java @@ -61,6 +61,11 @@ public class PopupView extends AbstractComponent implements HasComponents { /* Constructors */ + private PopupView() { + registerRpc(rpc); + setHideOnMouseOut(true); + } + /** * A simple way to create a PopupPanel. Note that the minimal representation * may not be dynamically updated, in order to achieve this create your own @@ -94,9 +99,7 @@ public class PopupView extends AbstractComponent implements HasComponents { * the PopupView.Content that contains the information for this */ public PopupView(PopupView.Content content) { - super(); - registerRpc(rpc); - setHideOnMouseOut(true); + this(); setContent(content); } @@ -185,7 +188,7 @@ public class PopupView extends AbstractComponent implements HasComponents { * @return true if the popup is hidden on mouse out, false otherwise */ public boolean isHideOnMouseOut() { - return getState().hideOnMouseOut; + return getState(false).hideOnMouseOut; } /** @@ -234,6 +237,11 @@ public class PopupView extends AbstractComponent implements HasComponents { return (PopupViewState) super.getState(); } + @Override + protected PopupViewState getState(boolean markAsDirty) { + return (PopupViewState) super.getState(markAsDirty); + } + /** * Used to deliver customized content-packages to the PopupView. These are * dynamically loaded when they are redrawn. The user must take care that diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java index e108c74ba2..ff6c955e47 100644 --- a/server/src/com/vaadin/ui/Slider.java +++ b/server/src/com/vaadin/ui/Slider.java @@ -144,13 +144,18 @@ public class Slider extends AbstractField<Double> { return (SliderState) super.getState(); } + @Override + public SliderState getState(boolean markAsDirty) { + return (SliderState) super.getState(markAsDirty); + } + /** * Gets the maximum slider value * * @return the largest value the slider can have */ public double getMax() { - return getState().maxValue; + return getState(false).maxValue; } /** @@ -173,7 +178,7 @@ public class Slider extends AbstractField<Double> { * @return the smallest value the slider can have */ public double getMin() { - return getState().minValue; + return getState(false).minValue; } /** @@ -197,7 +202,7 @@ public class Slider extends AbstractField<Double> { * {@link SliderOrientation#VERTICAL} */ public SliderOrientation getOrientation() { - return getState().orientation; + return getState(false).orientation; } /** @@ -219,7 +224,7 @@ public class Slider extends AbstractField<Double> { * @return resolution */ public int getResolution() { - return getState().resolution; + return getState(false).resolution; } /** diff --git a/server/src/com/vaadin/ui/TextArea.java b/server/src/com/vaadin/ui/TextArea.java index 56c97f58eb..e38be8ad3c 100644 --- a/server/src/com/vaadin/ui/TextArea.java +++ b/server/src/com/vaadin/ui/TextArea.java @@ -85,6 +85,11 @@ public class TextArea extends AbstractTextField { return (TextAreaState) super.getState(); } + @Override + protected TextAreaState getState(boolean markAsDirty) { + return (TextAreaState) super.getState(markAsDirty); + } + /** * Sets the number of rows in the text area. * @@ -104,7 +109,7 @@ public class TextArea extends AbstractTextField { * @return number of explicitly set rows. */ public int getRows() { - return getState().rows; + return getState(false).rows; } /** @@ -125,7 +130,7 @@ public class TextArea extends AbstractTextField { * <code>false</code> if not. */ public boolean isWordwrap() { - return getState().wordwrap; + return getState(false).wordwrap; } } diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 562b30f81d..4bde8a95b3 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(false).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 + * @param theme + * The new theme name + */ + public void setTheme(String theme) { + getState().theme = theme; } /** @@ -1581,7 +1598,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements * @return the label of the container */ public String getOverlayContainerLabel() { - return getState().overlayContainerLabel; + return getState(false).overlayContainerLabel; } /** diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index 149fcd536f..35583c6052 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -36,9 +36,9 @@ import com.vaadin.server.PaintTarget; import com.vaadin.shared.Connector; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.window.WindowMode; +import com.vaadin.shared.ui.window.WindowRole; import com.vaadin.shared.ui.window.WindowServerRpc; import com.vaadin.shared.ui.window.WindowState; -import com.vaadin.shared.ui.window.WindowRole; import com.vaadin.util.ReflectTools; /** @@ -254,7 +254,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @since 4.0.0 */ public int getPositionX() { - return getState().positionX; + return getState(false).positionX; } /** @@ -283,7 +283,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @since 4.0.0 */ public int getPositionY() { - return getState().positionY; + return getState(false).positionY; } /** @@ -661,7 +661,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return true if this window is modal. */ public boolean isModal() { - return getState().modal; + return getState(false).modal; } /** @@ -679,7 +679,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return true if window is resizable by the end-user, otherwise false. */ public boolean isResizable() { - return getState().resizable; + return getState(false).resizable; } /** @@ -688,7 +688,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * sizes are recalculated immediately. */ public boolean isResizeLazy() { - return getState().resizeLazy; + return getState(false).resizeLazy; } /** @@ -764,7 +764,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * true if the window can be dragged by the user */ public boolean isDraggable() { - return getState().draggable; + return getState(false).draggable; } /** @@ -1034,7 +1034,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return array of previously set components */ public Component[] getAssistiveDescription() { - Connector[] contentDescription = getState().contentDescription; + Connector[] contentDescription = getState(false).contentDescription; if (contentDescription == null) { return null; } @@ -1068,7 +1068,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return The accessibility prefix */ public String getAssistivePrefix() { - return getState().assistivePrefix; + return getState(false).assistivePrefix; } /** @@ -1093,7 +1093,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return The accessibility postfix */ public String getAssistivePostfix() { - return getState().assistivePostfix; + return getState(false).assistivePostfix; } /** @@ -1124,7 +1124,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return WAI-ARIA role set for the window */ public WindowRole getAssistiveRole() { - return getState().role; + return getState(false).role; } /** @@ -1152,7 +1152,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * focus can leave the window */ public boolean isTabStopEnabled() { - return getState().assistiveTabStop; + return getState(false).assistiveTabStop; } /** @@ -1193,7 +1193,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return the top message */ public String getTabStopTopAssistiveText() { - return getState().assistiveTabStopTopText; + return getState(false).assistiveTabStopTopText; } /** @@ -1204,6 +1204,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return the bottom message */ public String getTabStopBottomAssistiveText() { - return getState().assistiveTabStopBottomText; + return getState(false).assistiveTabStopBottomText; } } diff --git a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerGradient.java b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerGradient.java index 6147fcdd96..81b178e4f0 100644 --- a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerGradient.java +++ b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerGradient.java @@ -56,7 +56,7 @@ public class ColorPickerGradient extends AbstractComponent implements }; /** The converter. */ - private final Coordinates2Color converter; + private Coordinates2Color converter; /** The foreground color. */ private Color color; @@ -67,6 +67,14 @@ public class ColorPickerGradient extends AbstractComponent implements /** The y-coordinate. */ private int y = 0; + private ColorPickerGradient() { + registerRpc(rpc); + // width and height must be set here instead of in theme, otherwise + // coordinate calculations fail + getState().width = "220px"; + getState().height = "220px"; + } + /** * Instantiates a new color picker gradient. * @@ -76,12 +84,8 @@ public class ColorPickerGradient extends AbstractComponent implements * the converter */ public ColorPickerGradient(String id, Coordinates2Color converter) { - registerRpc(rpc); + this(); addStyleName(id); - // width and height must be set here instead of in theme, otherwise - // coordinate calculations fail - getState().width = "220px"; - getState().height = "220px"; this.converter = converter; } diff --git a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java index e7b412f7eb..b9a8c001ce 100644 --- a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java +++ b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java @@ -143,14 +143,7 @@ public class ColorPickerPopup extends Window implements ClickListener, */ private boolean updatingColors = false; - /** - * Instantiates a new color picker popup. - */ - public ColorPickerPopup(Color initialColor) { - super(); - - selectedColor = initialColor; - + private ColorPickerPopup() { // Set the layout layout = new VerticalLayout(); layout.setSpacing(false); @@ -162,15 +155,21 @@ public class ColorPickerPopup extends Window implements ClickListener, setStyleName(STYLENAME); setResizable(false); setImmediate(true); + // Create the history + history = new ColorPickerHistory(); + history.addColorChangeListener(this); + } + /** + * Instantiates a new color picker popup. + */ + public ColorPickerPopup(Color initialColor) { + this(); + selectedColor = initialColor; initContents(); } private void initContents() { - // Create the history - history = new ColorPickerHistory(); - history.addColorChangeListener(this); - // Create the preview on the rgb tab rgbPreview = new ColorPickerPreview(selectedColor); rgbPreview.setWidth("240px"); diff --git a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java index ae00b267ce..21a3630de2 100644 --- a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java +++ b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java @@ -56,24 +56,23 @@ public class ColorPickerPreview extends CssLayout implements ColorSelector, /** The old value. */ private String oldValue; - /** - * Instantiates a new color picker preview. - */ - public ColorPickerPreview(Color color) { + private ColorPickerPreview() { setStyleName("v-colorpicker-preview"); setImmediate(true); - - this.color = color; - field = new TextField(); field.setImmediate(true); field.setSizeFull(); field.setStyleName("v-colorpicker-preview-textfield"); field.setData(this); field.addValueChangeListener(this); - addComponent(field); + } + /** + * Instantiates a new color picker preview. + */ + public ColorPickerPreview(Color color) { + this(); setColor(color); } diff --git a/server/src/com/vaadin/ui/themes/ValoTheme.java b/server/src/com/vaadin/ui/themes/ValoTheme.java new file mode 100644 index 0000000000..51e2e283f2 --- /dev/null +++ b/server/src/com/vaadin/ui/themes/ValoTheme.java @@ -0,0 +1,809 @@ +/* + * 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 + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.ui.themes; + +import com.vaadin.ui.Notification.Type; +import com.vaadin.ui.Table.ColumnHeaderMode; + +/** + * <p> + * Additional style names which can be used with the Valo theme. + * </p> + * + * <p> + * These styles are only available if the Valo theme (or any of it's variants) + * is built with the <code>$valo-include-common-stylenames</code> Sass variable + * set to <code>true</code>. + * </p> + * + * <p> + * Most of these additional style names can be included individually into your + * custom theme using the component specific Sass mixins, in which case you can + * also define the style names yourself. See the Valo theme Sass API + * documentation for additional information. + * </p> + * + * TODO link to Sass API documentation + * + * @since 7.3.0 + * @author Vaadin Ltd + */ +public class ValoTheme { + + public static final String THEME_NAME = "valo"; + + /*************************************************************************** + * + * Notification styles + * + **************************************************************************/ + + /** + * Styles the notification to look like {@link Type#TRAY_NOTIFICATION}, + * without setting the position and delay. Can be combined with any other + * Notification style. + */ + public static final String NOTIFICATION_TRAY = "tray"; + + /** + * Styles the notification to look like {@link Type#WARNING_MESSAGE}, + * without setting the position and delay. Can be combined with any other + * Notification style. + */ + public static final String NOTIFICATION_WARNING = "warning"; + + /** + * Styles the notification to look like {@link Type#ERROR_MESSAGE}, without + * setting the position and delay. Can be combined with any other + * Notification style. + */ + public static final String NOTIFICATION_ERROR = "error"; + + /** + * Styles the notification to look like a system notification. Can be + * combined with any other Notification style. + */ + public static final String NOTIFICATION_SYSTEM = "system"; + + /** + * Styles the notification to span the entire width of the viewport. Can be + * combined with any other Notification style. + */ + public static final String NOTIFICATION_BAR = "bar"; + + /** + * Smaller padding and font size for the notification. Can be combined with + * any other Notification style. + */ + public static final String NOTIFICATION_SMALL = "small"; + + /** + * Adds a close button to the notification to imply that the user must click + * on the notification to dismiss it. Use in combination with an infinite + * delay (<code>-1</code>). Can be combined with any other Notification + * style. + */ + public static final String NOTIFICATION_CLOSABLE = "closable"; + + /** + * Success notification style. Adds a border around the notification and an + * icon next to the title. Can be combined with any other Label style. + */ + public static final String NOTIFICATION_SUCCESS = "success"; + + /** + * Failure notification style. Adds a border around the notification and an + * icon next to the title. Can be combined with any other Label style. + */ + public static final String NOTIFICATION_FAILURE = "failure"; + + /*************************************************************************** + * + * Label styles + * + **************************************************************************/ + + /** + * Header style for main application headings. Can be combined with any + * other Label style. + */ + public static final String LABEL_H1 = "h1"; + + /** + * Header style for different sections in the application. Can be combined + * with any other Label style. + */ + public static final String LABEL_H2 = "h2"; + + /** + * Header style for different sub-sections in the application. Can be + * combined with any other Label style. + */ + public static final String LABEL_H3 = "h3"; + + /** + * Header style for different sub-sections in the application. Can be + * combined with any other Label style. + */ + public static final String LABEL_H4 = "h4"; + + /** + * A utility style that can be combined with the {@link #LABEL_H1}, + * {@link #LABEL_H2}, {@link #LABEL_H3} and {@link #LABEL_H4} styles to + * remove the default margins from the header. + */ + public static final String LABEL_NO_MARGIN = "no-margin"; + + /** + * Small font size. Suitable for additional/supplementary UI text. Can be + * combined with any other Label style. + */ + public static final String LABEL_SMALL = "small"; + + /** + * Large font size. Suitable for important/prominent UI text. Can be + * combined with any other Label style. + */ + public static final String LABEL_LARGE = "large"; + + /** + * Lighter font weight. Suitable for additional/supplementary UI text. Can + * be combined with any other Label style. + */ + public static final String LABEL_LIGHT = "light"; + + /** + * Bolder font weight. Suitable for important/prominent UI text. Can be + * combined with any other Label style. + */ + public static final String LABEL_BOLD = "bold"; + + /** + * Success badge style. Adds a border around the label and an icon next to + * the text. Suitable for UI notifications that need to in the direct + * context of some component. Can be combined with any other Label style. + */ + public static final String LABEL_SUCCESS = "success"; + + /** + * Failure badge style. Adds a border around the label and an icon next to + * the text. Suitable for UI notifications that need to in the direct + * context of some component. Can be combined with any other Label style. + */ + public static final String LABEL_FAILURE = "failure"; + + /*************************************************************************** + * + * Button styles + * + **************************************************************************/ + + /** + * Primary action button (e.g. the button that should get activated when the + * user presses the <code>enter</code> key in a form). Use sparingly, only + * one default button per view should be visible. Can be combined with any + * other Button style. + */ + public static final String BUTTON_PRIMARY = "primary"; + + /** + * A prominent button that can be used instead of the + * {@link #BUTTON_PRIMARY} for primary actions when the action is considered + * <b>safe</b> for the user (i.e. does not cause any data loss or any other + * irreversible action). Can be combined with any other Button style. + */ + public static final String BUTTON_FRIENDLY = "friendly"; + + /** + * A prominent button that can be used when the action is considered + * <b>unsafe</b> for the user (i.e. it causes data loss or some other + * irreversible action). Can be combined with any other Button style. + */ + public static final String BUTTON_DANGER = "danger"; + + /** + * Borderless button. Can be combined with any other Button style. + */ + public static final String BUTTON_BORDERLESS = "borderless"; + + /** + * Borderless button with a colored caption text. Can be combined with any + * other Button style. + */ + public static final String BUTTON_BORDERLESS_COLORED = "borderless-colored"; + + /** + * "Quiet" button, which looks like {@link #BUTTON_BORDERLESS} until you + * hover over it with the mouse. Can be combined with any other Button + * style. + */ + public static final String BUTTON_QUIET = "quiet"; + + /** + * Makes the button look like the Link component. Can be combined with any + * other Button style. + */ + public static final String BUTTON_LINK = "link"; + + /** + * Small size button. Can be combined with any other Button style. + */ + public static final String BUTTON_SMALL = "small"; + + /** + * Large size button. Can be combined with any other Button style. + */ + public static final String BUTTON_LARGE = "large"; + + /** + * Align the icon to the right side of the button caption. Can be combined + * with any other Button style. + */ + public static final String BUTTON_ICON_ALIGN_RIGHT = "icon-align-right"; + + /** + * Stack the icon on top of the button caption. Can be combined with any + * other Button style. + */ + public static final String BUTTON_ICON_ALIGN_TOP = "icon-align-top"; + + /** + * Only show the icon in the button, and size the button to a square shape. + */ + public static final String BUTTON_ICON_ONLY = "icon-only"; + + /*************************************************************************** + * + * Link styles + * + **************************************************************************/ + + /** + * Small size link. + */ + public static final String LINK_SMALL = "small"; + + /** + * Large size link. + */ + public static final String LINK_LARGE = "large"; + + /*************************************************************************** + * + * TextField styles + * + **************************************************************************/ + + /** + * Small size text field. Can be combined with any other TextField style. + */ + public static final String TEXTFIELD_SMALL = "small"; + + /** + * Large size text field. Can be combined with any other TextField style. + */ + public static final String TEXTFIELD_LARGE = "large"; + + /** + * Removes the border and background from the text field. Can be combined + * with any other TextField style. + */ + public static final String TEXTFIELD_BORDERLESS = "borderless"; + + /** + * Align the text inside the field to the right. Can be combined with any + * other TextField style. + */ + public static final String TEXTFIELD_ALIGN_RIGHT = "align-right"; + + /** + * Align the text inside the field to center. Can be combined with any other + * TextField style. + */ + public static final String TEXTFIELD_ALIGN_CENTER = "align-center"; + + /** + * Move the default caption icon inside the text field. Can be combined with + * any other TextField style. + */ + public static final String TEXTFIELD_INLINE_ICON = "inline-icon"; + + /*************************************************************************** + * + * TextArea styles + * + **************************************************************************/ + + /** + * Small size text area. Can be combined with any other TextArea style. + */ + public static final String TEXTAREA_SMALL = "small"; + + /** + * Large size text area. Can be combined with any other TextArea style. + */ + public static final String TEXTAREA_LARGE = "large"; + + /** + * Removes the border and background from the text area. Can be combined + * with any other TextArea style. + */ + public static final String TEXTAREA_BORDERLESS = "borderless"; + + /** + * Align the text inside the area to the right. Can be combined with any + * other TextArea style. + */ + public static final String TEXTAREA_ALIGN_RIGHT = "align-right"; + + /** + * Align the text inside the area to center. Can be combined with any other + * TextArea style. + */ + public static final String TEXTAREA_ALIGN_CENTER = "align-center"; + + /*************************************************************************** + * + * DateField styles + * + **************************************************************************/ + + /** + * Small size date field. Can be combined with any other DateField style. + */ + public static final String DATEFIELD_SMALL = "small"; + + /** + * Large size date field. Can be combined with any other DateField style. + */ + public static final String DATEFIELD_LARGE = "large"; + + /** + * Removes the border and background from the date field. Can be combined + * with any other DateField style. + */ + public static final String DATEFIELD_BORDERLESS = "borderless"; + + /** + * Align the text inside the field to the right. Can be combined with any + * other DateField style. + */ + public static final String DATEFIELD_ALIGN_RIGHT = "align-right"; + + /** + * Align the text inside the field to center. Can be combined with any other + * DateField style. + */ + public static final String DATEFIELD_ALIGN_CENTER = "align-center"; + + /*************************************************************************** + * + * ComboBox styles + * + **************************************************************************/ + + /** + * Small size combo box. Can be combined with any other ComboBox style. + */ + public static final String COMBOBOX_SMALL = "small"; + + /** + * Large size combo box. Can be combined with any other ComboBox style. + */ + public static final String COMBOBOX_LARGE = "large"; + + /** + * Removes the border and background from the combo box. Can be combined + * with any other ComboBox style. + */ + public static final String COMBOBOX_BORDERLESS = "borderless"; + + /** + * Align the text inside the combo box to the right. Can be combined with + * any other TextField style. + */ + public static final String COMBOBOX_ALIGN_RIGHT = "align-right"; + + /** + * Align the text inside the combo box to center. Can be combined with any + * other TextField style. + */ + public static final String COMBOBOX_ALIGN_CENTER = "align-center"; + + /*************************************************************************** + * + * CheckBox styles + * + **************************************************************************/ + + /** + * Small size check box. Can be combined with any other CheckBox style. + */ + public static final String CHECKBOX_SMALL = "small"; + + /** + * Large size check box. Can be combined with any other CheckBox style. + */ + public static final String CHECKBOX_LARGE = "large"; + + /*************************************************************************** + * + * OptionGroup styles + * + **************************************************************************/ + + /** + * Small size option group. Can be combined with any other OptionGroup + * style. + */ + public static final String OPTIONGROUP_SMALL = "small"; + + /** + * Large size option group. Can be combined with any other OptionGroup + * style. + */ + public static final String OPTIONGROUP_LARGE = "large"; + + /*************************************************************************** + * + * Slider styles + * + **************************************************************************/ + + /** + * Hide the indicator bar from the slider. Can be combined with any other + * Slider style. + */ + public static final String SLIDER_NO_INDICATOR = "no-indicator"; + + /*************************************************************************** + * + * ProgressBar styles + * + **************************************************************************/ + + /** + * Make the progress bar indicator appear as a dot which progresses over the + * progress bar track (instead of a growing bar). + */ + public static final String PROBRESSBAR_POINT = "point"; + + /*************************************************************************** + * + * MenuBar styles + * + **************************************************************************/ + + /** + * Small size menu bar. Can be combined with any other MenuBar style. + */ + public static final String MENUBAR_SMALL = "small"; + + /** + * Borderless menu bar. Can be combined with any other MenuBar style. + */ + public static final String MENUBAR_BORDERLESS = "borderless"; + + /*************************************************************************** + * + * Table and TreeTable styles + * + **************************************************************************/ + + /** + * Remove the alternating row colors. Can be combined with any other + * Table/TreeTable style. + */ + public static final String TABLE_NO_STRIPES = "no-stripes"; + + /** + * See {@link #TABLE_NO_STRIPES} + */ + public static final String TREETABLE_NO_STRIPES = TABLE_NO_STRIPES; + + /** + * Remove the vertical divider lines between the table columns. Can be + * combined with any other Table/TreeTable style. + */ + public static final String TABLE_NO_VERTICAL_LINES = "no-vertical-lines"; + + /** + * See {@link #TABLE_NO_VERTICAL_LINES} + */ + public static final String TREETABLE_NO_VERTICAL_LINES = TABLE_NO_VERTICAL_LINES; + + /** + * Remove the horizontal divider lines between the table rows. Can be + * combined with any other Table/TreeTable style. + */ + public static final String TABLE_NO_HORIZONTAL_LINES = "no-horizontal-lines"; + + /** + * See {@link #TABLE_NO_HORIZONTAL_LINES} + */ + public static final String TREETABLE_NO_HORIZONTAL_LINES = TABLE_NO_HORIZONTAL_LINES; + + /** + * Hide the table column headers (effectively the same as + * {@link ColumnHeaderMode#HIDDEN}). Can be combined with any other + * Table/TreeTable style. + */ + public static final String TABLE_NO_HEADER = "no-header"; + + /** + * See {@link #TABLE_NO_HEADER} + */ + public static final String TREETABLE_NO_HEADER = TABLE_NO_HEADER; + + /** + * Remove the outer border of the table. Can be combined with any other + * Table/TreeTable style. + */ + public static final String TABLE_BORDERLESS = "borderless"; + + /** + * See {@link #TABLE_BORDERLESS} + */ + public static final String TREETABLE_BORDERLESS = TABLE_BORDERLESS; + + /** + * Reduce the white space inside the table cells. Can be combined with any + * other Table/TreeTable style. + */ + public static final String TABLE_COMPACT = "compact"; + + /** + * See {@link #TABLE_COMPACT} + */ + public static final String TREETABLE_COMPACT = TABLE_COMPACT; + + /** + * Small font size and reduced the white space inside the table cells. Can + * be combined with any other Table/TreeTable style. + */ + public static final String TABLE_SMALL = "small"; + + /** + * See {@link #TABLE_SMALL} + */ + public static final String TREETABLE_SMALL = TABLE_SMALL; + + /*************************************************************************** + * + * DragAndDropWrapper styles + * + **************************************************************************/ + + /** + * Hide the "box drag hints" (i.e. the style which gets applied when the + * drag is in the middle/center area of the drag target). + */ + public static final String DRAG_AND_DROP_WRAPPER_NO_BOX_DRAG_HINTS = "no-box-drag-hints"; + + /** + * Hide the "vertical drag hints" (i.e. the style which gets applied when + * the drag is in the top/bottom part of the drag target). + */ + public static final String DRAG_AND_DROP_WRAPPER_NO_VERTICAL_DRAG_HINTS = "no-vertical-drag-hints"; + + /** + * Hide the "horizontal drag hints" (i.e. the style which gets applied when + * the drag is in the left/right part of the drag target). + */ + public static final String DRAG_AND_DROP_WRAPPER_NO_HORIZONTAL_DRAG_HINTS = "no-horizontal-drag-hints"; + + /*************************************************************************** + * + * Panel styles + * + **************************************************************************/ + + /** + * Remove borders and the background color of the panel. Can be combined + * with any other Panel style. + */ + public static final String PANEL_BORDERLESS = "borderless"; + + /** + * Show a divider between the panel caption and content when the content + * area is scrolled. Suitable with the {@link #PANEL_BORDERLESS} style. Can + * be combined with any other Panel style. + */ + public static final String PANEL_SCROLL_INDICATOR = "scroll-indicator"; + + /** + * Inset panel style. Can be combined with any other Panel style. + */ + public static final String PANEL_WELL = "well"; + + /*************************************************************************** + * + * SplitPanel styles + * + **************************************************************************/ + + /** + * Make the split handle wider. + */ + public static final String SPLITPANEL_LARGE = "large"; + + /*************************************************************************** + * + * TabSheet styles + * + **************************************************************************/ + + /** + * Adds a border around the whole component as well as around individual + * tabs in the tab bar. Can be combined with any other TabSheet style. + */ + public static final String TABSHEET_FRAMED = "framed"; + + /** + * Center the tabs inside the tab bar. Works best if all the tabs fit + * completely in the tab bar (i.e. no tab bar scrolling). Can be combined + * with any other TabSheet style. + */ + public static final String TABSHEET_CENTERED_TABS = "centered-tabs"; + + /** + * Give equal amount of space to all tabs in the tab bar (.i.e expand ratio + * == 1 for all tabs). The tab captions will be truncated if they do not fit + * in to the tab. Tab scrolling will be disabled when this style is applied + * (all tabs will be visible at the same time). Can be combined with any + * other TabSheet style. + */ + public static final String TABSHEET_EQUAL_WIDTH_TABS = "equal-width-tabs"; + + /** + * Add a small amount of padding around the tabs in the tab bar, so that + * they don't touch the outer edges of the component. Can be combined with + * any other TabSheet style. + */ + public static final String TABSHEET_PADDED_TABBAR = "padded-tabbar"; + + /** + * Reduce the whitespace around the tabs in the tab bar. Can be combined + * with any other TabSheet style. + */ + public static final String TABSHEET_COMPACT_TABBAR = "compact-tabbar"; + + /** + * Display tab icons on top of the tab captions (by default the icons are + * place on the left side of the caption). Can be combined with any other + * TabSheet style. + */ + public static final String TABSHEET_ICONS_ON_TOP = "icons-on-top"; + + /** + * Only the selected tab has the close button visible. Does not prevent + * closing the tab programmatically, it only hides the button from the end + * user. Can be combined with any other TabSheet style. + */ + public static final String TABSHEET_ONLY_SELECTED_TAB_IS_CLOSABLE = "only-selected-closable"; + + /*************************************************************************** + * + * Accordion styles + * + **************************************************************************/ + + /** + * Remove the outer border from the accordion. Can be combined with any + * other Accordion style. + */ + public static final String ACCORDION_BORDERLESS = "borderless"; + + /*************************************************************************** + * + * Window and related styles + * + **************************************************************************/ + + /** + * Add this style to any layout component (e.g. CssLayout, VerticalLayout or + * HorizontalLayout) and place it inside the root layout of the window to + * create a toolbar area for the window. You can then place any other + * components inside the toolbar layout, e.g. a MenuBar. + */ + public static final String WINDOW_TOP_TOOLBAR = "v-window-top-toolbar"; + + /** + * Add this style to any layout component (e.g. CssLayout, VerticalLayout or + * HorizontalLayout) and place it inside the root layout of the window to + * create a toolbar area for the window. You can then place any other + * components inside the toolbar layout, e.g. a MenuBar. + */ + public static final String WINDOW_BOTTOM_TOOLBAR = "v-window-bottom-toolbar"; + + /*************************************************************************** + * + * FormLayout styles + * + **************************************************************************/ + + /** + * 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. + */ + public static final String FORMLAYOUT_LIGHT = "light"; + + /*************************************************************************** + * + * Layout styles + * + **************************************************************************/ + + /** + * Make a layout look like the Panel component (resembles visually a card). + * Add an additional <code>v-panel-caption</code> style name to any layout + * inside the card layout to make it look like a Panel's caption. + */ + public static final String LAYOUT_CARD = "card"; + + /** + * Make a layout look like the {@link #PANEL_WELL} style. Add an additional + * <code>v-panel-caption</code> style name to any layout inside the card + * layout to make it look like a Panel's caption. + */ + public static final String LAYOUT_WELL = "well"; + + /*************************************************************************** + * + * Valo menu styles + * + **************************************************************************/ + + /** + * Set the primary style name of a CssLayout to this, and add any number of + * layouts with the {@link #MENU_PART} style inside it. + */ + public static final String MENU_ROOT = "valo-menu"; + + /** + * 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. + */ + public static final String MENU_PART = "valo-menu-part"; + + /** + * TODO + */ + public static final String MENU_TITLE = "valo-menu-title"; + + /** + * TODO + */ + public static final String MENU_SUBTITLE = "valo-menu-subtitle"; + + /** + * TODO + */ + public static final String MENU_ITEM = "valo-menu-title"; + + /** + * TODO + */ + public static final String MENU_BADGE = "valo-menu-badge"; + + /** + * TODO + */ + public static final String MENU_LOGO = "valo-menu-logo"; + +} |