From e85d933b25cc3c5cc85eb7eb4b13b950fd8e1569 Mon Sep 17 00:00:00 2001
From: Artur Signell
+ * The contents of a window is set using {@link #setContent(ComponentContainer)} + * or by using the {@link #Window(String, ComponentContainer)} constructor. The + * contents can in turn contain other components. By default, a + * {@link VerticalLayout} is used as content. + *
+ *+ * A window can be positioned on the screen using absolute coordinates (pixels) + * or set to be centered using {@link #center()} + *
+ *+ * The caption is displayed in the window header. + *
+ *+ * In Vaadin versions prior to 7.0.0, Window was also used as application level + * windows. This function is now covered by the {@link Root} class. + *
+ * + * @author Vaadin Ltd. + * @version + * @VERSION@ + * @since 3.0 + */ +@SuppressWarnings("serial") +public class Window extends Panel implements FocusNotifier, BlurNotifier, + Vaadin6Component { + + private WindowServerRpc rpc = new WindowServerRpc() { + + @Override + public void click(MouseEventDetails mouseDetails) { + fireEvent(new ClickEvent(Window.this, mouseDetails)); + } + }; + + private int browserWindowWidth = -1; + + private int browserWindowHeight = -1; + + /** + * Creates a new unnamed window with a default layout. + */ + public Window() { + this("", null); + } + + /** + * Creates a new unnamed window with a default layout and given title. + * + * @param caption + * the title of the window. + */ + public Window(String caption) { + this(caption, null); + } + + /** + * Creates a new unnamed window with the given content and title. + * + * @param caption + * the title of the window. + * @param content + * the contents of the window + */ + public Window(String caption, ComponentContainer content) { + super(caption, content); + registerRpc(rpc); + setSizeUndefined(); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Panel#addComponent(com.vaadin.ui.Component) + */ + + @Override + public void addComponent(Component c) { + if (c instanceof Window) { + throw new IllegalArgumentException( + "Window cannot be added to another via addComponent. " + + "Use addWindow(Window) instead."); + } + super.addComponent(c); + } + + /* ********************************************************************* */ + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Panel#paintContent(com.vaadin.terminal.PaintTarget) + */ + + @Override + public synchronized void paintContent(PaintTarget target) + throws PaintException { + if (bringToFront != null) { + target.addAttribute("bringToFront", bringToFront.intValue()); + bringToFront = null; + } + + // Contents of the window panel is painted + super.paintContent(target); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Panel#changeVariables(java.lang.Object, java.util.Map) + */ + + @Override + public void changeVariables(Object source, Map+ * By default, sub-windows are removed from their respective parent windows + * and thus visually closed on browser-side. Browser-level windows also + * closed on the client-side, but they are not implicitly removed from the + * application. + *
+ * + *+ * To explicitly close a sub-window, use {@link #removeWindow(Window)}. To + * react to a window being closed (after it is closed), register a + * {@link CloseListener}. + *
+ */ + public void close() { + Root root = getRoot(); + + // Don't do anything if not attached to a root + if (root != null) { + // focus is restored to the parent window + root.focus(); + // subwindow is removed from the root + root.removeWindow(this); + } + } + + /** + * Gets the distance of Window left border in pixels from left border of the + * containing (main window). + * + * @return the Distance of Window left border in pixels from left border of + * the containing (main window). or -1 if unspecified. + * @since 4.0.0 + */ + public int getPositionX() { + return getState().getPositionX(); + } + + /** + * Sets the distance of Window left border in pixels from left border of the + * containing (main window). + * + * @param positionX + * the Distance of Window left border in pixels from left border + * of the containing (main window). or -1 if unspecified. + * @since 4.0.0 + */ + public void setPositionX(int positionX) { + setPositionX(positionX, true); + } + + /** + * Sets the distance of Window left border in pixels from left border of the + * containing (main window). + * + * @param positionX + * the Distance of Window left border in pixels from left border + * of the containing (main window). or -1 if unspecified. + * @param repaintRequired + * true if the window needs to be repainted, false otherwise + * @since 6.3.4 + */ + private void setPositionX(int positionX, boolean repaintRequired) { + getState().setPositionX(positionX); + getState().setCentered(false); + if (repaintRequired) { + requestRepaint(); + } + } + + /** + * Gets the distance of Window top border in pixels from top border of the + * containing (main window). + * + * @return Distance of Window top border in pixels from top border of the + * containing (main window). or -1 if unspecified . + * + * @since 4.0.0 + */ + public int getPositionY() { + return getState().getPositionY(); + } + + /** + * Sets the distance of Window top border in pixels from top border of the + * containing (main window). + * + * @param positionY + * the Distance of Window top border in pixels from top border of + * the containing (main window). or -1 if unspecified + * + * @since 4.0.0 + */ + public void setPositionY(int positionY) { + setPositionY(positionY, true); + } + + /** + * Sets the distance of Window top border in pixels from top border of the + * containing (main window). + * + * @param positionY + * the Distance of Window top border in pixels from top border of + * the containing (main window). or -1 if unspecified + * @param repaintRequired + * true if the window needs to be repainted, false otherwise + * + * @since 6.3.4 + */ + private void setPositionY(int positionY, boolean repaintRequired) { + getState().setPositionY(positionY); + getState().setCentered(false); + if (repaintRequired) { + requestRepaint(); + } + } + + private static final Method WINDOW_CLOSE_METHOD; + static { + try { + WINDOW_CLOSE_METHOD = CloseListener.class.getDeclaredMethod( + "windowClose", new Class[] { CloseEvent.class }); + } catch (final java.lang.NoSuchMethodException e) { + // This should never happen + throw new java.lang.RuntimeException( + "Internal error, window close method not found"); + } + } + + public class CloseEvent extends Component.Event { + + /** + * + * @param source + */ + public CloseEvent(Component source) { + super(source); + } + + /** + * Gets the Window. + * + * @return the window. + */ + public Window getWindow() { + return (Window) getSource(); + } + } + + /** + * An interface used for listening to Window close events. Add the + * CloseListener to a browser level window or a sub window and + * {@link CloseListener#windowClose(CloseEvent)} will be called whenever the + * user closes the window. + * + *+ * Since Vaadin 6.5, removing a window using {@link #removeWindow(Window)} + * fires the CloseListener. + *
+ */ + public interface CloseListener extends Serializable { + /** + * Called when the user closes a window. Use + * {@link CloseEvent#getWindow()} to get a reference to the + * {@link Window} that was closed. + * + * @param e + * Event containing + */ + public void windowClose(CloseEvent e); + } + + /** + * Adds a CloseListener to the window. + * + * For a sub window the CloseListener is fired when the user closes it + * (clicks on the close button). + * + * For a browser level window the CloseListener is fired when the browser + * level window is closed. Note that closing a browser level window does not + * mean it will be destroyed. Also note that Opera does not send events like + * all other browsers and therefore the close listener might not be called + * if Opera is used. + * + *+ * Since Vaadin 6.5, removing windows using {@link #removeWindow(Window)} + * does fire the CloseListener. + *
+ * + * @param listener + * the CloseListener to add. + */ + public void addListener(CloseListener listener) { + addListener(CloseEvent.class, listener, WINDOW_CLOSE_METHOD); + } + + /** + * Removes the CloseListener from the window. + * + *+ * For more information on CloseListeners see {@link CloseListener}. + *
+ * + * @param listener + * the CloseListener to remove. + */ + public void removeListener(CloseListener listener) { + removeListener(CloseEvent.class, listener, WINDOW_CLOSE_METHOD); + } + + protected void fireClose() { + fireEvent(new Window.CloseEvent(this)); + } + + /** + * Method for the resize event. + */ + private static final Method WINDOW_RESIZE_METHOD; + static { + try { + WINDOW_RESIZE_METHOD = ResizeListener.class.getDeclaredMethod( + "windowResized", new Class[] { ResizeEvent.class }); + } catch (final java.lang.NoSuchMethodException e) { + // This should never happen + throw new java.lang.RuntimeException( + "Internal error, window resized method not found"); + } + } + + /** + * Resize events are fired whenever the client-side fires a resize-event + * (e.g. the browser window is resized). The frequency may vary across + * browsers. + */ + public class ResizeEvent extends Component.Event { + + /** + * + * @param source + */ + public ResizeEvent(Component source) { + super(source); + } + + /** + * Get the window form which this event originated + * + * @return the window + */ + public Window getWindow() { + return (Window) getSource(); + } + } + + /** + * Listener for window resize events. + * + * @see com.vaadin.ui.Window.ResizeEvent + */ + public interface ResizeListener extends Serializable { + public void windowResized(ResizeEvent e); + } + + /** + * Add a resize listener. + * + * @param listener + */ + public void addListener(ResizeListener listener) { + addListener(ResizeEvent.class, listener, WINDOW_RESIZE_METHOD); + } + + /** + * Remove a resize listener. + * + * @param listener + */ + public void removeListener(ResizeListener listener) { + removeListener(ResizeEvent.class, listener); + } + + /** + * Fire the resize event. + */ + protected void fireResize() { + fireEvent(new ResizeEvent(this)); + } + + /** + * Used to keep the right order of windows if multiple windows are brought + * to front in a single changeset. If this is not used, the order is quite + * random (depends on the order getting to dirty list. e.g. which window got + * variable changes). + */ + private Integer bringToFront = null; + + /** + * If there are currently several windows visible, calling this method makes + * this window topmost. + *+ * This method can only be called if this window connected a root. Else an + * illegal state exception is thrown. Also if there are modal windows and + * this window is not modal, and illegal state exception is thrown. + *
+ */ + public void bringToFront() { + Root root = getRoot(); + if (root == null) { + throw new IllegalStateException( + "Window must be attached to parent before calling bringToFront method."); + } + int maxBringToFront = -1; + for (Window w : root.getWindows()) { + if (!isModal() && w.isModal()) { + throw new IllegalStateException( + "The root contains modal windows, non-modal window cannot be brought to front."); + } + if (w.bringToFront != null) { + maxBringToFront = Math.max(maxBringToFront, + w.bringToFront.intValue()); + } + } + bringToFront = Integer.valueOf(maxBringToFront + 1); + requestRepaint(); + } + + /** + * Sets sub-window modal, so that widgets behind it cannot be accessed. + * Note: affects sub-windows only. + * + * @param modal + * true if modality is to be turned on + */ + public void setModal(boolean modal) { + getState().setModal(modal); + center(); + requestRepaint(); + } + + /** + * @return true if this window is modal. + */ + public boolean isModal() { + return getState().isModal(); + } + + /** + * Sets sub-window resizable. Note: affects sub-windows only. + * + * @param resizable + * true if resizability is to be turned on + */ + public void setResizable(boolean resizable) { + getState().setResizable(resizable); + requestRepaint(); + } + + /** + * + * @return true if window is resizable by the end-user, otherwise false. + */ + public boolean isResizable() { + return getState().isResizable(); + } + + /** + * + * @return true if a delay is used before recalculating sizes, false if + * sizes are recalculated immediately. + */ + public boolean isResizeLazy() { + return getState().isResizeLazy(); + } + + /** + * Should resize operations be lazy, i.e. should there be a delay before + * layout sizes are recalculated. Speeds up resize operations in slow UIs + * with the penalty of slightly decreased usability. + * + * Note, some browser send false resize events for the browser window and + * are therefore always lazy. + * + * @param resizeLazy + * true to use a delay before recalculating sizes, false to + * calculate immediately. + */ + public void setResizeLazy(boolean resizeLazy) { + getState().setResizeLazy(resizeLazy); + requestRepaint(); + } + + /** + * Sets this window to be centered relative to its parent window. Affects + * sub-windows only. If the window is resized as a result of the size of its + * content changing, it will keep itself centered as long as its position is + * not explicitly changed programmatically or by the user. + *
+ * NOTE: This method has several issues as currently implemented. + * Please refer to http://dev.vaadin.com/ticket/8971 for details. + */ + public void center() { + getState().setCentered(true); + requestRepaint(); + } + + /** + * Returns the closable status of the sub window. If a sub window is + * closable it typically shows an X in the upper right corner. Clicking on + * the X sends a close event to the server. Setting closable to false will + * remove the X from the sub window and prevent the user from closing the + * window. + * + * Note! For historical reasons readonly controls the closability of the sub + * window and therefore readonly and closable affect each other. Setting + * readonly to true will set closable to false and vice versa. + *
+ * Closable only applies to sub windows, not to browser level windows. + * + * @return true if the sub window can be closed by the user. + */ + public boolean isClosable() { + return !isReadOnly(); + } + + /** + * Sets the closable status for the sub window. If a sub window is closable + * it typically shows an X in the upper right corner. Clicking on the X + * sends a close event to the server. Setting closable to false will remove + * the X from the sub window and prevent the user from closing the window. + * + * Note! For historical reasons readonly controls the closability of the sub + * window and therefore readonly and closable affect each other. Setting + * readonly to true will set closable to false and vice versa. + * + * Closable only applies to sub windows, not to browser level windows. + * + * @param closable + * determines if the sub window can be closed by the user. + */ + public void setClosable(boolean closable) { + setReadOnly(!closable); + } + + /** + * Indicates whether a sub window can be dragged or not. By default a sub + * window is draggable. + * + * Draggable only applies to sub windows, not to browser level windows. + * + * @param draggable + * true if the sub window can be dragged by the user + */ + public boolean isDraggable() { + return getState().isDraggable(); + } + + /** + * Enables or disables that a sub window can be dragged (moved) by the user. + * By default a sub window is draggable. + * + * Draggable only applies to sub windows, not to browser level windows. + * + * @param draggable + * true if the sub window can be dragged by the user + */ + public void setDraggable(boolean draggable) { + getState().setDraggable(draggable); + requestRepaint(); + } + + /* + * Actions + */ + protected CloseShortcut closeShortcut; + + /** + * Makes is possible to close the window by pressing the given + * {@link KeyCode} and (optional) {@link ModifierKey}s.
+ *
+ * // within the window using helper
+ * subWindow.setCloseShortcut(KeyCode.ESCAPE, null);
+ *
+ * // or globally
+ * getWindow().addAction(new Window.CloseShortcut(subWindow, KeyCode.ESCAPE));
+ *
+ *
+ *
+ */
+ public static class CloseShortcut extends ShortcutListener {
+ protected Window window;
+
+ /**
+ * Creates a keyboard shortcut for closing the given window using the
+ * shorthand notation defined in {@link ShortcutAction}.
+ *
+ * @param window
+ * to be closed when the shortcut is invoked
+ * @param shorthandCaption
+ * the caption with shortcut keycode and modifiers indicated
+ */
+ public CloseShortcut(Window window, String shorthandCaption) {
+ super(shorthandCaption);
+ this.window = window;
+ }
+
+ /**
+ * Creates a keyboard shortcut for closing the given window using the
+ * given {@link KeyCode} and {@link ModifierKey}s.
+ *
+ * @param window
+ * to be closed when the shortcut is invoked
+ * @param keyCode
+ * KeyCode to react to
+ * @param modifiers
+ * optional modifiers for shortcut
+ */
+ public CloseShortcut(Window window, int keyCode, int... modifiers) {
+ super(null, keyCode, modifiers);
+ this.window = window;
+ }
+
+ /**
+ * Creates a keyboard shortcut for closing the given window using the
+ * given {@link KeyCode}.
+ *
+ * @param window
+ * to be closed when the shortcut is invoked
+ * @param keyCode
+ * KeyCode to react to
+ */
+ public CloseShortcut(Window window, int keyCode) {
+ this(window, keyCode, null);
+ }
+
+ @Override
+ public void handleAction(Object sender, Object target) {
+ window.close();
+ }
+ }
+
+ /**
+ * Note, that focus/blur listeners in Window class are only supported by sub
+ * windows. Also note that Window is not considered focused if its contained
+ * component currently has focus.
+ *
+ * @see com.vaadin.event.FieldEvents.FocusNotifier#addListener(com.vaadin.event.FieldEvents.FocusListener)
+ */
+
+ @Override
+ public void addListener(FocusListener listener) {
+ addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener,
+ FocusListener.focusMethod);
+ }
+
+ @Override
+ public void removeListener(FocusListener listener) {
+ removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener);
+ }
+
+ /**
+ * Note, that focus/blur listeners in Window class are only supported by sub
+ * windows. Also note that Window is not considered focused if its contained
+ * component currently has focus.
+ *
+ * @see com.vaadin.event.FieldEvents.BlurNotifier#addListener(com.vaadin.event.FieldEvents.BlurListener)
+ */
+
+ @Override
+ public void addListener(BlurListener listener) {
+ addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener,
+ BlurListener.blurMethod);
+ }
+
+ @Override
+ public void removeListener(BlurListener listener) {
+ removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * If the window is a sub-window focusing will cause the sub-window to be
+ * brought on top of other sub-windows on gain keyboard focus.
+ */
+
+ @Override
+ public void focus() {
+ /*
+ * When focusing a sub-window it basically means it should be brought to
+ * the front. Instead of just moving the keyboard focus we focus the
+ * window and bring it top-most.
+ */
+ super.focus();
+ bringToFront();
+ }
+
+ @Override
+ public WindowState getState() {
+ return (WindowState) super.getState();
+ }
+}
--
cgit v1.2.3
From acf099b41fe1f983d416e598b5b49eaea9f35c66 Mon Sep 17 00:00:00 2001
From: Artur Signell onModuleLoad()
.
*/
public class ApplicationConnection {
- public static final String APP_REQUEST_PATH = "APP/";
-
- public static final String UIDL_REQUEST_PATH = "UIDL/";
-
- public static final String APP_PROTOCOL_PREFIX = "app://";
-
- public static final String V_RESOURCE_PATH = "v-resourcePath";
-
- public static final String CONNECTOR_PROTOCOL_PREFIX = "connector://";
-
- public static final String CONNECTOR_RESOURCE_PREFIX = APP_REQUEST_PATH
- + "CONNECTOR";
-
- // This indicates the whole page is generated by us (not embedded)
- public static final String GENERATED_BODY_CLASSNAME = "v-generated-body";
public static final String MODIFIED_CLASSNAME = "v-modified";
@@ -102,28 +88,10 @@ public class ApplicationConnection {
public static final String ERROR_CLASSNAME_EXT = "-error";
- public static final String UPDATE_VARIABLE_INTERFACE = "v";
- public static final String UPDATE_VARIABLE_METHOD = "v";
-
public static final char VAR_BURST_SEPARATOR = '\u001d';
public static final char VAR_ESCAPE_CHARACTER = '\u001b';
- public static final String UIDL_SECURITY_TOKEN_ID = "Vaadin-Security-Key";
-
- /**
- * Name of the parameter used to transmit root ids back and forth
- */
- public static final String ROOT_ID_PARAMETER = "rootId";
-
- /**
- * @deprecated use UIDL_SECURITY_TOKEN_ID instead
- */
- @Deprecated
- public static final String UIDL_SECURITY_HEADER = UIDL_SECURITY_TOKEN_ID;
-
- public static final String PARAM_UNLOADBURST = "onunloadburst";
-
private static SerializerMap serializerMap;
/**
@@ -520,13 +488,14 @@ public class ApplicationConnection {
final String payload = uidlSecurityKey + VAR_BURST_SEPARATOR
+ requestData;
VConsole.log("Making UIDL Request with params: " + payload);
- String uri = translateVaadinUri(APP_PROTOCOL_PREFIX + UIDL_REQUEST_PATH);
+ String uri = translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
+ + ApplicationConstants.UIDL_REQUEST_PATH);
if (extraParams != null && extraParams.length() > 0) {
uri = addGetParameters(uri, extraParams);
}
- uri = addGetParameters(uri,
- ROOT_ID_PARAMETER + "=" + configuration.getRootId());
+ uri = addGetParameters(uri, ApplicationConstants.ROOT_ID_PARAMETER
+ + "=" + configuration.getRootId());
doUidlRequest(uri, payload, forceSync);
@@ -651,8 +620,8 @@ public class ApplicationConnection {
} else {
// Synchronized call, discarded response (leaving the page)
SynchronousXHR syncXHR = (SynchronousXHR) SynchronousXHR.create();
- syncXHR.synchronousPost(uri + "&" + PARAM_UNLOADBURST + "=1",
- payload);
+ syncXHR.synchronousPost(uri + "&"
+ + ApplicationConstants.PARAM_UNLOADBURST + "=1", payload);
/*
* Although we are in theory leaving the page, the page may still
* stay open. End request properly here too. See #3289
@@ -1046,8 +1015,9 @@ public class ApplicationConnection {
final MultiStepDuration handleUIDLDuration = new MultiStepDuration();
// Get security key
- if (json.containsKey(UIDL_SECURITY_TOKEN_ID)) {
- uidlSecurityKey = json.getString(UIDL_SECURITY_TOKEN_ID);
+ if (json.containsKey(ApplicationConstants.UIDL_SECURITY_TOKEN_ID)) {
+ uidlSecurityKey = json
+ .getString(ApplicationConstants.UIDL_SECURITY_TOKEN_ID);
}
VConsole.log(" * Handling resources from server");
@@ -1714,8 +1684,9 @@ public class ApplicationConnection {
// note that type is now deduced from value
// TODO could eliminate invocations of same shared variable setter
addMethodInvocationToQueue(new MethodInvocation(connectorId,
- UPDATE_VARIABLE_INTERFACE, UPDATE_VARIABLE_METHOD,
- new Object[] { variableName, new UidlValue(value) }), immediate);
+ ApplicationConstants.UPDATE_VARIABLE_INTERFACE,
+ ApplicationConstants.UPDATE_VARIABLE_METHOD, new Object[] {
+ variableName, new UidlValue(value) }), immediate);
}
/**
@@ -1857,9 +1828,9 @@ public class ApplicationConnection {
}
private boolean isLegacyVariableChange(MethodInvocation invocation) {
- return ApplicationConnection.UPDATE_VARIABLE_METHOD.equals(invocation
+ return ApplicationConstants.UPDATE_VARIABLE_METHOD.equals(invocation
.getInterfaceName())
- && ApplicationConnection.UPDATE_VARIABLE_METHOD
+ && ApplicationConstants.UPDATE_VARIABLE_METHOD
.equals(invocation.getMethodName());
}
@@ -2304,17 +2275,21 @@ public class ApplicationConnection {
uidlUri = themeUri + uidlUri.substring(7);
}
- if (uidlUri.startsWith(CONNECTOR_PROTOCOL_PREFIX)) {
+ if (uidlUri.startsWith(ApplicationConstants.CONNECTOR_PROTOCOL_PREFIX)) {
// getAppUri *should* always end with /
// substring *should* always start with / (connector:///foo.bar
// without connector://)
- uidlUri = APP_PROTOCOL_PREFIX + CONNECTOR_RESOURCE_PREFIX
- + uidlUri.substring(CONNECTOR_PROTOCOL_PREFIX.length());
+ uidlUri = ApplicationConstants.APP_PROTOCOL_PREFIX
+ + ApplicationConstants.CONNECTOR_RESOURCE_PREFIX
+ + uidlUri
+ .substring(ApplicationConstants.CONNECTOR_PROTOCOL_PREFIX
+ .length());
// Let translation of app:// urls take care of the rest
}
- if (uidlUri.startsWith(APP_PROTOCOL_PREFIX)) {
+ if (uidlUri.startsWith(ApplicationConstants.APP_PROTOCOL_PREFIX)) {
String relativeUrl = uidlUri
- .substring(APP_PROTOCOL_PREFIX.length());
+ .substring(ApplicationConstants.APP_PROTOCOL_PREFIX
+ .length());
if (getConfiguration().usePortletURLs()) {
// Should put path in v-resourcePath parameter and append query
// params to base portlet url
@@ -2332,7 +2307,7 @@ public class ApplicationConnection {
if (!path.startsWith("/")) {
path = '/' + path;
}
- String pathParam = V_RESOURCE_PATH + "="
+ String pathParam = ApplicationConstants.V_RESOURCE_PATH + "="
+ URL.encodeQueryString(path);
url = addGetParameters(url, pathParam);
uidlUri = url;
diff --git a/client/src/com/vaadin/terminal/gwt/client/Util.java b/client/src/com/vaadin/terminal/gwt/client/Util.java
index a27c77fa45..04c83c353e 100644
--- a/client/src/com/vaadin/terminal/gwt/client/Util.java
+++ b/client/src/com/vaadin/terminal/gwt/client/Util.java
@@ -27,6 +27,7 @@ import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.ComponentState;
import com.vaadin.shared.communication.MethodInvocation;
import com.vaadin.terminal.gwt.client.RenderInformation.FloatSize;
@@ -841,7 +842,7 @@ public class Util {
for (MethodInvocation invocation : invocations) {
Object[] parameters = invocation.getParameters();
String formattedParams = null;
- if (ApplicationConnection.UPDATE_VARIABLE_METHOD.equals(invocation
+ if (ApplicationConstants.UPDATE_VARIABLE_METHOD.equals(invocation
.getMethodName()) && parameters.length == 2) {
// name, value
Object value = parameters[1];
diff --git a/client/src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java b/client/src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java
index 404f1238e0..e08aa37e73 100644
--- a/client/src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java
+++ b/client/src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java
@@ -18,6 +18,7 @@ import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.vaadin.shared.Connector;
+import com.vaadin.shared.JsonConstants;
import com.vaadin.shared.communication.UidlValue;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
@@ -34,20 +35,6 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection;
*/
public class JsonEncoder {
- public static final String VTYPE_CONNECTOR = "c";
- public static final String VTYPE_BOOLEAN = "b";
- public static final String VTYPE_DOUBLE = "d";
- public static final String VTYPE_FLOAT = "f";
- public static final String VTYPE_LONG = "l";
- public static final String VTYPE_INTEGER = "i";
- public static final String VTYPE_STRING = "s";
- public static final String VTYPE_ARRAY = "a";
- public static final String VTYPE_STRINGARRAY = "S";
- public static final String VTYPE_MAP = "m";
- public static final String VTYPE_LIST = "L";
- public static final String VTYPE_SET = "q";
- public static final String VTYPE_NULL = "n";
-
/**
* Encode a value to a JSON representation for transport from the client to
* the server.
@@ -252,34 +239,34 @@ public class JsonEncoder {
*/
private static String getTransportType(Object value) {
if (value == null) {
- return VTYPE_NULL;
+ return JsonConstants.VTYPE_NULL;
} else if (value instanceof String) {
- return VTYPE_STRING;
+ return JsonConstants.VTYPE_STRING;
} else if (value instanceof Connector) {
- return VTYPE_CONNECTOR;
+ return JsonConstants.VTYPE_CONNECTOR;
} else if (value instanceof Boolean) {
- return VTYPE_BOOLEAN;
+ return JsonConstants.VTYPE_BOOLEAN;
} else if (value instanceof Integer) {
- return VTYPE_INTEGER;
+ return JsonConstants.VTYPE_INTEGER;
} else if (value instanceof Float) {
- return VTYPE_FLOAT;
+ return JsonConstants.VTYPE_FLOAT;
} else if (value instanceof Double) {
- return VTYPE_DOUBLE;
+ return JsonConstants.VTYPE_DOUBLE;
} else if (value instanceof Long) {
- return VTYPE_LONG;
+ return JsonConstants.VTYPE_LONG;
} else if (value instanceof List) {
- return VTYPE_LIST;
+ return JsonConstants.VTYPE_LIST;
} else if (value instanceof Set) {
- return VTYPE_SET;
+ return JsonConstants.VTYPE_SET;
} else if (value instanceof String[]) {
- return VTYPE_STRINGARRAY;
+ return JsonConstants.VTYPE_STRINGARRAY;
} else if (value instanceof Object[]) {
- return VTYPE_ARRAY;
+ return JsonConstants.VTYPE_ARRAY;
} else if (value instanceof Map) {
- return VTYPE_MAP;
+ return JsonConstants.VTYPE_MAP;
} else if (value instanceof Enum>) {
// Enum value is processed as a string
- return VTYPE_STRING;
+ return JsonConstants.VTYPE_STRING;
}
return null;
}
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java b/client/src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java
index b7b6b13d3c..d1ed741590 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java
@@ -4,16 +4,15 @@
package com.vaadin.terminal.gwt.client.ui;
import com.google.gwt.dom.client.NativeEvent;
+import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
public abstract class ClickEventHandler extends AbstractClickEventHandler {
- public static final String CLICK_EVENT_IDENTIFIER = "click";
-
public ClickEventHandler(ComponentConnector connector) {
- this(connector, CLICK_EVENT_IDENTIFIER);
+ this(connector, EventId.CLICK_EVENT_IDENTIFIER);
}
public ClickEventHandler(ComponentConnector connector,
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java b/client/src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java
index 9aafaa0bbf..444e44495c 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java
@@ -5,6 +5,7 @@ package com.vaadin.terminal.gwt.client.ui;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.user.client.Element;
+import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.LayoutClickRpc;
import com.vaadin.terminal.gwt.client.ComponentConnector;
@@ -12,10 +13,8 @@ import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
public abstract class LayoutClickEventHandler extends AbstractClickEventHandler {
- public static final String LAYOUT_CLICK_EVENT_IDENTIFIER = "lClick";
-
public LayoutClickEventHandler(ComponentConnector connector) {
- this(connector, LAYOUT_CLICK_EVENT_IDENTIFIER);
+ this(connector, EventId.LAYOUT_CLICK_EVENT_IDENTIFIER);
}
public LayoutClickEventHandler(ComponentConnector connector,
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java b/client/src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java
index d9320787e8..53498d9108 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java
@@ -15,6 +15,7 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.UIDL;
@@ -22,7 +23,6 @@ import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate;
import com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate.TouchScrollHandler;
-import com.vaadin.terminal.gwt.client.ui.tabsheet.TabsheetBaseConnector;
import com.vaadin.terminal.gwt.client.ui.tabsheet.VTabsheetBase;
public class VAccordion extends VTabsheetBase {
@@ -442,11 +442,11 @@ public class VAccordion extends VTabsheetBase {
public void updateCaption(UIDL uidl) {
// TODO need to call this because the caption does not have an owner
caption.updateCaptionWithoutOwner(
- uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_CAPTION),
- uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DISABLED),
- uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION),
- uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_ERROR_MESSAGE),
- uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_ICON));
+ uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_CAPTION),
+ uidl.hasAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_DISABLED),
+ uidl.hasAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_DESCRIPTION),
+ uidl.hasAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_ERROR_MESSAGE),
+ uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_ICON));
}
public int getWidgetWidth() {
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java
index 0fa71bb7a6..65d9f3a09f 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java
@@ -6,6 +6,7 @@ package com.vaadin.terminal.gwt.client.ui.combobox;
import java.util.Iterator;
import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.combobox.ComboBoxConstants;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
@@ -46,8 +47,8 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
// Inverse logic here to make the default case (text input enabled)
// work without additional UIDL messages
boolean noTextInput = uidl
- .hasAttribute(VFilterSelect.ATTR_NO_TEXT_INPUT)
- && uidl.getBooleanAttribute(VFilterSelect.ATTR_NO_TEXT_INPUT);
+ .hasAttribute(ComboBoxConstants.ATTR_NO_TEXT_INPUT)
+ && uidl.getBooleanAttribute(ComboBoxConstants.ATTR_NO_TEXT_INPUT);
getWidget().setTextInputEnabled(!noTextInput);
// not a FocusWidget -> needs own tabindex handling
@@ -72,10 +73,10 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
getWidget().pageLength = uidl.getIntAttribute("pagelength");
}
- if (uidl.hasAttribute(VFilterSelect.ATTR_INPUTPROMPT)) {
+ if (uidl.hasAttribute(ComboBoxConstants.ATTR_INPUTPROMPT)) {
// input prompt changed from server
getWidget().inputPrompt = uidl
- .getStringAttribute(VFilterSelect.ATTR_INPUTPROMPT);
+ .getStringAttribute(ComboBoxConstants.ATTR_INPUTPROMPT);
} else {
getWidget().inputPrompt = "";
}
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java b/client/src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java
index 6e24a74e04..c7c071f225 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java
@@ -919,8 +919,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
// shown in unfocused empty field, disappears on focus (e.g "Search here")
private static final String CLASSNAME_PROMPT = "prompt";
- protected static final String ATTR_INPUTPROMPT = "prompt";
- public static final String ATTR_NO_TEXT_INPUT = "noInput";
protected String inputPrompt = "";
protected boolean prompting = false;
@@ -1688,9 +1686,9 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
@Override
public Element getSubPartElement(String subPart) {
if ("textbox".equals(subPart)) {
- return this.tb.getElement();
+ return tb.getElement();
} else if ("button".equals(subPart)) {
- return this.popupOpener.getElement();
+ return popupOpener.getElement();
}
return null;
}
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
index 159b5bc414..f0b3510a55 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
@@ -5,6 +5,7 @@ package com.vaadin.terminal.gwt.client.ui.datefield;
import java.util.Date;
+import com.vaadin.shared.ui.datefield.DateFieldConstants;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.LocaleNotLoadedException;
import com.vaadin.terminal.gwt.client.Paintable;
@@ -46,7 +47,7 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector
// We show week numbers only if the week starts with Monday, as ISO 8601
// specifies
getWidget().showISOWeekNumbers = uidl
- .getBooleanAttribute(VDateField.WEEK_NUMBERS)
+ .getBooleanAttribute(DateFieldConstants.ATTR_WEEK_NUMBERS)
&& getWidget().dts.getFirstDayOfWeek() == 1;
int newResolution;
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java b/client/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java
index 614c4febdd..130e3f2325 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java
@@ -28,8 +28,6 @@ public class VDateField extends FlowPanel implements Field {
public static final int RESOLUTION_MIN = 16;
public static final int RESOLUTION_SEC = 32;
- public static final String WEEK_NUMBERS = "wn";
-
static String resolutionToString(int res) {
if (res > RESOLUTION_DAY) {
return "full";
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
index 6914b451fa..4b7a0ae109 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
@@ -7,6 +7,7 @@ import java.util.HashMap;
import java.util.Set;
import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.draganddropwrapper.DragAndDropWrapperConstants;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
@@ -54,10 +55,10 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector
getWidget().startNextUpload();
getWidget().dragStartMode = uidl
- .getIntAttribute(VDragAndDropWrapper.DRAG_START_MODE);
+ .getIntAttribute(DragAndDropWrapperConstants.DRAG_START_MODE);
getWidget().initDragStartMode();
getWidget().html5DataFlavors = uidl
- .getMapAttribute(VDragAndDropWrapper.HTML5_DATA_FLAVORS);
+ .getMapAttribute(DragAndDropWrapperConstants.HTML5_DATA_FLAVORS);
// Used to prevent wrapper from stealing tooltips when not defined
getWidget().hasTooltip = getState().hasDescription();
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java b/client/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java
index e77055764e..0be1e899a3 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java
@@ -53,8 +53,6 @@ import com.vaadin.terminal.gwt.client.ui.dd.VTransferable;
*/
public class VDragAndDropWrapper extends VCustomComponent implements
VHasDropHandler {
- public static final String DRAG_START_MODE = "dragStartMode";
- public static final String HTML5_DATA_FLAVORS = "html5-data-flavors";
private static final String CLASSNAME = "v-ddwrapper";
protected static final String DRAGGABLE = "draggable";
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java
index a1851d9c84..9071324e56 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java
@@ -17,6 +17,7 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.embedded.EmbeddedConstants;
import com.vaadin.shared.ui.embedded.EmbeddedServerRpc;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
@@ -32,8 +33,6 @@ import com.vaadin.ui.Embedded;
public class EmbeddedConnector extends AbstractComponentConnector implements
Paintable {
- public static final String ALTERNATE_TEXT = "alt";
-
EmbeddedServerRpc rpc;
@Override
@@ -96,9 +95,10 @@ public class EmbeddedConnector extends AbstractComponentConnector implements
DOM.setElementProperty(el, "src",
getWidget().getSrc(uidl, client));
- if (uidl.hasAttribute(ALTERNATE_TEXT)) {
- el.setPropertyString(ALTERNATE_TEXT,
- uidl.getStringAttribute(ALTERNATE_TEXT));
+ if (uidl.hasAttribute(EmbeddedConstants.ALTERNATE_TEXT)) {
+ el.setPropertyString(
+ EmbeddedConstants.ALTERNATE_TEXT,
+ uidl.getStringAttribute(EmbeddedConstants.ALTERNATE_TEXT));
}
if (created) {
@@ -188,8 +188,9 @@ public class EmbeddedConnector extends AbstractComponentConnector implements
uidl.getStringAttribute("standby"));
}
getWidget().getElement().appendChild(obj);
- if (uidl.hasAttribute(ALTERNATE_TEXT)) {
- obj.setInnerText(uidl.getStringAttribute(ALTERNATE_TEXT));
+ if (uidl.hasAttribute(EmbeddedConstants.ALTERNATE_TEXT)) {
+ obj.setInnerText(uidl
+ .getStringAttribute(EmbeddedConstants.ALTERNATE_TEXT));
}
} else {
VConsole.log("Unknown Embedded mimetype '" + mime + "'");
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java b/client/src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java
index 1d2a5a156a..70703c1b06 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java
@@ -12,6 +12,7 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.shared.ui.embedded.EmbeddedConstants;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
@@ -153,9 +154,9 @@ public class VEmbedded extends HTML {
// End embed tag
html.append(">");
- if (uidl.hasAttribute(EmbeddedConnector.ALTERNATE_TEXT)) {
+ if (uidl.hasAttribute(EmbeddedConstants.ALTERNATE_TEXT)) {
html.append(uidl
- .getStringAttribute(EmbeddedConnector.ALTERNATE_TEXT));
+ .getStringAttribute(EmbeddedConstants.ALTERNATE_TEXT));
}
// End object tag
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
index 2a8923bbc0..539e6aa0e7 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
@@ -11,6 +11,7 @@ import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.Command;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.menubar.MenuBarConstants;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.TooltipInfo;
@@ -19,11 +20,11 @@ import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.terminal.gwt.client.ui.Icon;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
-import com.vaadin.terminal.gwt.client.ui.menubar.VMenuBar.CustomMenuItem;
@Connect(value = com.vaadin.ui.MenuBar.class, loadStyle = LoadStyle.LAZY)
public class MenuBarConnector extends AbstractComponentConnector implements
Paintable, SimpleManagedLayout {
+
/**
* This method must be implemented to update the client-side component from
* UIDL data received from server.
@@ -38,10 +39,10 @@ public class MenuBarConnector extends AbstractComponentConnector implements
}
getWidget().htmlContentAllowed = uidl
- .hasAttribute(VMenuBar.HTML_CONTENT_ALLOWED);
+ .hasAttribute(MenuBarConstants.HTML_CONTENT_ALLOWED);
getWidget().openRootOnHover = uidl
- .getBooleanAttribute(VMenuBar.OPEN_ROOT_MENU_ON_HOWER);
+ .getBooleanAttribute(MenuBarConstants.OPEN_ROOT_MENU_ON_HOWER);
getWidget().enabled = isEnabled();
@@ -74,7 +75,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements
}
itemHTML.append(moreItemText);
- getWidget().moreItem = GWT.create(CustomMenuItem.class);
+ getWidget().moreItem = GWT.create(VMenuBar.CustomMenuItem.class);
getWidget().moreItem.setHTML(itemHTML.toString());
getWidget().moreItem.setCommand(VMenuBar.emptyCommand);
@@ -92,13 +93,13 @@ public class MenuBarConnector extends AbstractComponentConnector implements
while (itr.hasNext()) {
UIDL item = (UIDL) itr.next();
- CustomMenuItem currentItem = null;
+ VMenuBar.CustomMenuItem currentItem = null;
final int itemId = item.getIntAttribute("id");
boolean itemHasCommand = item.hasAttribute("command");
boolean itemIsCheckable = item
- .hasAttribute(VMenuBar.ATTRIBUTE_CHECKED);
+ .hasAttribute(MenuBarConstants.ATTRIBUTE_CHECKED);
String itemHTML = getWidget().buildItemHTML(item);
@@ -138,7 +139,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements
while (!itr.hasNext() && !iteratorStack.empty()) {
boolean hasCheckableItem = false;
- for (CustomMenuItem menuItem : currentMenu.getItems()) {
+ for (VMenuBar.CustomMenuItem menuItem : currentMenu.getItems()) {
hasCheckableItem = hasCheckableItem
|| menuItem.isCheckable();
}
@@ -174,7 +175,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements
// Check content of widget to find tooltip for element
if (element != getWidget().getElement()) {
- CustomMenuItem item = getWidget().getMenuItemWithElement(
+ VMenuBar.CustomMenuItem item = getWidget().getMenuItemWithElement(
(com.google.gwt.user.client.Element) element);
if (item != null) {
info = item.getTooltip();
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java b/client/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
index 47bda81362..eaffb058d1 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
@@ -30,6 +30,7 @@ import com.google.gwt.user.client.ui.HasHTML;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.menubar.MenuBarConstants;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.LayoutManager;
@@ -66,16 +67,6 @@ public class VMenuBar extends SimpleFocusablePanel implements
// associated
protected static final Command emptyCommand = null;
- public static final String OPEN_ROOT_MENU_ON_HOWER = "ormoh";
-
- public static final String ATTRIBUTE_CHECKED = "checked";
- public static final String ATTRIBUTE_ITEM_DESCRIPTION = "description";
- public static final String ATTRIBUTE_ITEM_ICON = "icon";
- public static final String ATTRIBUTE_ITEM_DISABLED = "disabled";
- public static final String ATTRIBUTE_ITEM_STYLE = "style";
-
- public static final String HTML_CONTENT_ALLOWED = "usehtml";
-
/** Widget fields **/
protected boolean subMenu;
protected ArrayList
@@ -303,7 +303,8 @@ public class DateField extends AbstractField