From e85d933b25cc3c5cc85eb7eb4b13b950fd8e1569 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 13 Aug 2012 18:34:33 +0300 Subject: Moved server files to a server src folder (#9299) --- server/src/com/vaadin/ui/Window.java | 853 +++++++++++++++++++++++++++++++++++ 1 file changed, 853 insertions(+) create mode 100644 server/src/com/vaadin/ui/Window.java (limited to 'server/src/com/vaadin/ui/Window.java') diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java new file mode 100644 index 0000000000..e413d35e6d --- /dev/null +++ b/server/src/com/vaadin/ui/Window.java @@ -0,0 +1,853 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.ui; + +import java.io.Serializable; +import java.lang.reflect.Method; +import java.util.Map; + +import com.vaadin.event.FieldEvents.BlurEvent; +import com.vaadin.event.FieldEvents.BlurListener; +import com.vaadin.event.FieldEvents.BlurNotifier; +import com.vaadin.event.FieldEvents.FocusEvent; +import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.event.FieldEvents.FocusNotifier; +import com.vaadin.event.MouseEvents.ClickEvent; +import com.vaadin.event.ShortcutAction; +import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.event.ShortcutAction.ModifierKey; +import com.vaadin.event.ShortcutListener; +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.window.WindowServerRpc; +import com.vaadin.shared.ui.window.WindowState; +import com.vaadin.terminal.PaintException; +import com.vaadin.terminal.PaintTarget; +import com.vaadin.terminal.Vaadin6Component; +import com.vaadin.terminal.gwt.client.ui.root.VRoot; + +/** + * A component that represents a floating popup window that can be added to a + * {@link Root}. A window is added to a {@code Root} using + * {@link Root#addWindow(Window)}.

+ *

+ * 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 variables) { + + // TODO Are these for top level windows or sub windows? + boolean sizeHasChanged = false; + // size is handled in super class, but resize events only in windows -> + // so detect if size change occurs before super.changeVariables() + if (variables.containsKey("height") + && (getHeightUnits() != Unit.PIXELS || (Integer) variables + .get("height") != getHeight())) { + sizeHasChanged = true; + } + if (variables.containsKey("width") + && (getWidthUnits() != Unit.PIXELS || (Integer) variables + .get("width") != getWidth())) { + sizeHasChanged = true; + } + Integer browserHeightVar = (Integer) variables + .get(VRoot.BROWSER_HEIGHT_VAR); + if (browserHeightVar != null + && browserHeightVar.intValue() != browserWindowHeight) { + browserWindowHeight = browserHeightVar.intValue(); + sizeHasChanged = true; + } + Integer browserWidthVar = (Integer) variables + .get(VRoot.BROWSER_WIDTH_VAR); + if (browserWidthVar != null + && browserWidthVar.intValue() != browserWindowWidth) { + browserWindowWidth = browserWidthVar.intValue(); + sizeHasChanged = true; + } + + super.changeVariables(source, variables); + + // Positioning + final Integer positionx = (Integer) variables.get("positionx"); + if (positionx != null) { + final int x = positionx.intValue(); + // This is information from the client so it is already using the + // position. No need to repaint. + setPositionX(x < 0 ? -1 : x, false); + } + final Integer positiony = (Integer) variables.get("positiony"); + if (positiony != null) { + final int y = positiony.intValue(); + // This is information from the client so it is already using the + // position. No need to repaint. + setPositionY(y < 0 ? -1 : y, false); + } + + if (isClosable()) { + // Closing + final Boolean close = (Boolean) variables.get("close"); + if (close != null && close.booleanValue()) { + close(); + } + } + + // fire event if size has really changed + if (sizeHasChanged) { + fireResize(); + } + + if (variables.containsKey(FocusEvent.EVENT_ID)) { + fireEvent(new FocusEvent(this)); + } else if (variables.containsKey(BlurEvent.EVENT_ID)) { + fireEvent(new BlurEvent(this)); + } + + } + + /** + * Method that handles window closing (from UI). + * + *

+ * 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.
+ * Note that this shortcut only reacts while the window has focus, closing + * itself - if you want to close a subwindow from a parent window, use + * {@link #addAction(com.vaadin.event.Action)} of the parent window instead. + * + * @param keyCode + * the keycode for invoking the shortcut + * @param modifiers + * the (optional) modifiers for invoking the shortcut, null for + * none + */ + public void setCloseShortcut(int keyCode, int... modifiers) { + if (closeShortcut != null) { + removeAction(closeShortcut); + } + closeShortcut = new CloseShortcut(this, keyCode, modifiers); + addAction(closeShortcut); + } + + /** + * Removes the keyboard shortcut previously set with + * {@link #setCloseShortcut(int, int...)}. + */ + public void removeCloseShortcut() { + if (closeShortcut != null) { + removeAction(closeShortcut); + closeShortcut = null; + } + } + + /** + * A {@link ShortcutListener} specifically made to define a keyboard + * shortcut that closes the window. + * + *

+     * 
+     *  // 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 Date: Mon, 13 Aug 2012 19:13:24 +0300 Subject: Eliminated dependencies from server to client (#9279) --- .../gwt/client/ApplicationConfiguration.java | 7 +- .../terminal/gwt/client/ApplicationConnection.java | 75 ++++++++-------------- .../src/com/vaadin/terminal/gwt/client/Util.java | 3 +- .../gwt/client/communication/JsonEncoder.java | 43 +++++-------- .../terminal/gwt/client/ui/ClickEventHandler.java | 5 +- .../gwt/client/ui/LayoutClickEventHandler.java | 5 +- .../gwt/client/ui/accordion/VAccordion.java | 12 ++-- .../gwt/client/ui/combobox/ComboBoxConnector.java | 9 +-- .../gwt/client/ui/combobox/VFilterSelect.java | 6 +- .../ui/datefield/AbstractDateFieldConnector.java | 3 +- .../gwt/client/ui/datefield/VDateField.java | 2 - .../DragAndDropWrapperConnector.java | 5 +- .../ui/draganddropwrapper/VDragAndDropWrapper.java | 2 - .../gwt/client/ui/embedded/EmbeddedConnector.java | 15 +++-- .../terminal/gwt/client/ui/embedded/VEmbedded.java | 5 +- .../gwt/client/ui/menubar/MenuBarConnector.java | 17 ++--- .../terminal/gwt/client/ui/menubar/VMenuBar.java | 28 ++++---- .../gwt/client/ui/notification/VNotification.java | 38 ++++++----- .../ui/optiongroup/OptionGroupConnector.java | 3 +- .../gwt/client/ui/optiongroup/VOptionGroup.java | 7 +- .../terminal/gwt/client/ui/root/RootConnector.java | 10 +-- .../vaadin/terminal/gwt/client/ui/root/VRoot.java | 32 +++------ .../gwt/client/ui/table/TableConnector.java | 11 ++-- .../terminal/gwt/client/ui/table/VScrollTable.java | 34 ++++------ .../client/ui/tabsheet/TabsheetBaseConnector.java | 9 +-- .../gwt/client/ui/tabsheet/TabsheetConnector.java | 1 + .../terminal/gwt/client/ui/tabsheet/VTabsheet.java | 24 +++---- .../client/ui/textfield/TextFieldConnector.java | 9 +-- .../gwt/client/ui/textfield/VTextField.java | 14 ++-- .../terminal/gwt/client/ui/tree/TreeConnector.java | 27 ++++---- .../vaadin/terminal/gwt/client/ui/tree/VTree.java | 7 +- .../client/ui/treetable/TreeTableConnector.java | 7 +- .../client/ui/twincolselect/VTwinColSelect.java | 15 +++-- server/src/com/vaadin/Application.java | 4 +- server/src/com/vaadin/terminal/Page.java | 20 +++--- .../gwt/server/AbstractApplicationServlet.java | 6 +- .../gwt/server/AbstractCommunicationManager.java | 23 ++++--- .../gwt/server/AbstractWebApplicationContext.java | 10 +-- .../terminal/gwt/server/BootstrapHandler.java | 6 +- .../com/vaadin/terminal/gwt/server/JsonCodec.java | 64 +++++++++--------- .../server/LegacyChangeVariablesInvocation.java | 10 +-- .../gwt/server/PortletCommunicationManager.java | 4 +- .../terminal/gwt/server/ServletPortletHelper.java | 8 +-- .../terminal/gwt/server/WrappedPortletRequest.java | 4 +- server/src/com/vaadin/ui/AbsoluteLayout.java | 6 +- .../com/vaadin/ui/AbstractJavaScriptComponent.java | 2 - .../src/com/vaadin/ui/AbstractOrderedLayout.java | 6 +- server/src/com/vaadin/ui/AbstractSplitPanel.java | 9 ++- server/src/com/vaadin/ui/AbstractTextField.java | 18 +++--- server/src/com/vaadin/ui/ComboBox.java | 6 +- server/src/com/vaadin/ui/ConnectorTracker.java | 1 - server/src/com/vaadin/ui/CssLayout.java | 6 +- server/src/com/vaadin/ui/DateField.java | 5 +- server/src/com/vaadin/ui/DragAndDropWrapper.java | 6 +- server/src/com/vaadin/ui/Embedded.java | 14 ++-- server/src/com/vaadin/ui/GridLayout.java | 6 +- server/src/com/vaadin/ui/LoginForm.java | 4 +- server/src/com/vaadin/ui/MenuBar.java | 19 +++--- server/src/com/vaadin/ui/OptionGroup.java | 7 +- server/src/com/vaadin/ui/Panel.java | 10 +-- server/src/com/vaadin/ui/Root.java | 22 ++++--- server/src/com/vaadin/ui/TabSheet.java | 16 ++--- server/src/com/vaadin/ui/Table.java | 36 ++++++----- server/src/com/vaadin/ui/Tree.java | 19 +++--- server/src/com/vaadin/ui/TreeTable.java | 4 +- server/src/com/vaadin/ui/TwinColSelect.java | 8 ++- server/src/com/vaadin/ui/Window.java | 6 +- .../com/vaadin/shared/ApplicationConstants.java | 36 +++++++++++ shared/src/com/vaadin/shared/EventId.java | 3 + shared/src/com/vaadin/shared/JsonConstants.java | 21 ++++++ .../shared/ui/combobox/ComboBoxConstants.java | 13 ++++ .../shared/ui/datefield/DateFieldConstants.java | 12 ++++ .../DragAndDropWrapperConstants.java | 14 ++++ .../shared/ui/embedded/EmbeddedConstants.java | 11 ++++ .../vaadin/shared/ui/menubar/MenuBarConstants.java | 23 +++++++ .../ui/optiongroup/OptionGroupConstants.java | 10 +++ .../com/vaadin/shared/ui/root/RootConstants.java | 36 +++++++++++ .../com/vaadin/shared/ui/table/TableConstants.java | 24 +++++++ .../shared/ui/tabsheet/TabsheetBaseConstants.java | 19 ++++++ .../shared/ui/tabsheet/TabsheetConstants.java | 11 ++++ .../shared/ui/textfield/TextFieldConstants.java | 14 ++++ .../com/vaadin/shared/ui/tree/TreeConstants.java | 23 +++++++ .../shared/ui/treetable/TreeTableConstants.java | 11 ++++ .../ui/twincolselect/TwinColSelectConstants.java | 13 ++++ 84 files changed, 701 insertions(+), 478 deletions(-) create mode 100644 shared/src/com/vaadin/shared/ApplicationConstants.java create mode 100644 shared/src/com/vaadin/shared/JsonConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/combobox/ComboBoxConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/datefield/DateFieldConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/draganddropwrapper/DragAndDropWrapperConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/embedded/EmbeddedConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/menubar/MenuBarConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/root/RootConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/table/TableConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/tabsheet/TabsheetBaseConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/tabsheet/TabsheetConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/textfield/TextFieldConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/tree/TreeConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/treetable/TreeTableConstants.java create mode 100644 shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectConstants.java (limited to 'server/src/com/vaadin/ui/Window.java') diff --git a/client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index 71707e723a..ae5e8ed42e 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -19,12 +19,11 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector; public class ApplicationConfiguration implements EntryPoint { - public static final String PORTLET_RESOUCE_URL_BASE = "portletAppURLBase"; - /** * Helper class for reading configuration options from the bootstap * javascript @@ -230,8 +229,8 @@ public class ApplicationConfiguration implements EntryPoint { } public String getPortletResourceUrl() { - return getJsoConfiguration(id) - .getConfigString(PORTLET_RESOUCE_URL_BASE); + return getJsoConfiguration(id).getConfigString( + ApplicationConstants.PORTLET_RESOUCE_URL_BASE); } public String getRootPanelId() { diff --git a/client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index d757bf89a2..b7df9d5156 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -39,6 +39,7 @@ import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.ui.HasWidgets; 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.shared.communication.SharedState; @@ -78,21 +79,6 @@ import com.vaadin.terminal.gwt.server.AbstractCommunicationManager; * Entry point classes (widgetsets) define 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 items; @@ -905,26 +896,29 @@ public class VMenuBar extends SimpleFocusablePanel implements public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { setSeparator(uidl.hasAttribute("separator")); - setEnabled(!uidl.hasAttribute(ATTRIBUTE_ITEM_DISABLED)); + setEnabled(!uidl + .hasAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DISABLED)); - if (!isSeparator() && uidl.hasAttribute(ATTRIBUTE_CHECKED)) { + if (!isSeparator() + && uidl.hasAttribute(MenuBarConstants.ATTRIBUTE_CHECKED)) { // if the selected attribute is present (either true or false), // the item is selectable setCheckable(true); - setChecked(uidl.getBooleanAttribute(ATTRIBUTE_CHECKED)); + setChecked(uidl + .getBooleanAttribute(MenuBarConstants.ATTRIBUTE_CHECKED)); } else { setCheckable(false); } - if (uidl.hasAttribute(ATTRIBUTE_ITEM_STYLE)) { + if (uidl.hasAttribute(MenuBarConstants.ATTRIBUTE_ITEM_STYLE)) { String itemStyle = uidl - .getStringAttribute(ATTRIBUTE_ITEM_STYLE); + .getStringAttribute(MenuBarConstants.ATTRIBUTE_ITEM_STYLE); addStyleDependentName(itemStyle); } - if (uidl.hasAttribute(ATTRIBUTE_ITEM_DESCRIPTION)) { + if (uidl.hasAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION)) { description = uidl - .getStringAttribute(ATTRIBUTE_ITEM_DESCRIPTION); + .getStringAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION); } } diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java b/client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java index 1309155443..e48f504464 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java @@ -17,12 +17,12 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.shared.ui.root.RootConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.ui.VOverlay; -import com.vaadin.terminal.gwt.client.ui.root.VRoot; public class VNotification extends VOverlay { @@ -60,13 +60,6 @@ public class VNotification extends VOverlay { private ArrayList listeners; private static final int TOUCH_DEVICE_IDLE_DELAY = 1000; - public static final String ATTRIBUTE_NOTIFICATION_STYLE = "style"; - public static final String ATTRIBUTE_NOTIFICATION_CAPTION = "caption"; - public static final String ATTRIBUTE_NOTIFICATION_MESSAGE = "message"; - public static final String ATTRIBUTE_NOTIFICATION_ICON = "icon"; - public static final String ATTRIBUTE_NOTIFICATION_POSITION = "position"; - public static final String ATTRIBUTE_NOTIFICATION_DELAY = "delay"; - /** * Default constructor. You should use GWT.create instead. */ @@ -378,25 +371,29 @@ public class VNotification extends VOverlay { public static void showNotification(ApplicationConnection client, final UIDL notification) { boolean onlyPlainText = notification - .hasAttribute(VRoot.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED); + .hasAttribute(RootConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED); String html = ""; - if (notification.hasAttribute(ATTRIBUTE_NOTIFICATION_ICON)) { - final String parsedUri = client.translateVaadinUri(notification - .getStringAttribute(ATTRIBUTE_NOTIFICATION_ICON)); + if (notification + .hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_ICON)) { + final String parsedUri = client + .translateVaadinUri(notification + .getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_ICON)); html += ""; } - if (notification.hasAttribute(ATTRIBUTE_NOTIFICATION_CAPTION)) { + if (notification + .hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_CAPTION)) { String caption = notification - .getStringAttribute(ATTRIBUTE_NOTIFICATION_CAPTION); + .getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_CAPTION); if (onlyPlainText) { caption = Util.escapeHTML(caption); caption = caption.replaceAll("\\n", "
"); } html += "

" + caption + "

"; } - if (notification.hasAttribute(ATTRIBUTE_NOTIFICATION_MESSAGE)) { + if (notification + .hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_MESSAGE)) { String message = notification - .getStringAttribute(ATTRIBUTE_NOTIFICATION_MESSAGE); + .getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_MESSAGE); if (onlyPlainText) { message = Util.escapeHTML(message); message = message.replaceAll("\\n", "
"); @@ -405,12 +402,13 @@ public class VNotification extends VOverlay { } final String style = notification - .hasAttribute(ATTRIBUTE_NOTIFICATION_STYLE) ? notification - .getStringAttribute(ATTRIBUTE_NOTIFICATION_STYLE) : null; + .hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_STYLE) ? notification + .getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_STYLE) + : null; final int position = notification - .getIntAttribute(ATTRIBUTE_NOTIFICATION_POSITION); + .getIntAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_POSITION); final int delay = notification - .getIntAttribute(ATTRIBUTE_NOTIFICATION_DELAY); + .getIntAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_DELAY); createNotification(delay).show(html, position, style); } diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java index caf85348d4..3376ca3292 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java @@ -11,6 +11,7 @@ import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.Widget; import com.vaadin.shared.EventId; import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.optiongroup.OptionGroupConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.ui.OptionGroup; @@ -21,7 +22,7 @@ public class OptionGroupConnector extends OptionGroupBaseConnector { @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidget().htmlContentAllowed = uidl - .hasAttribute(VOptionGroup.HTML_CONTENT_ALLOWED); + .hasAttribute(OptionGroupConstants.HTML_CONTENT_ALLOWED); super.updateFromUIDL(uidl, client); diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java b/client/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java index a6cdf7e888..130282ac1b 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java @@ -26,6 +26,7 @@ import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.Widget; import com.vaadin.shared.EventId; +import com.vaadin.shared.ui.optiongroup.OptionGroupConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; @@ -35,12 +36,8 @@ import com.vaadin.terminal.gwt.client.ui.checkbox.VCheckBox; public class VOptionGroup extends VOptionGroupBase implements FocusHandler, BlurHandler { - public static final String HTML_CONTENT_ALLOWED = "usehtml"; - public static final String CLASSNAME = "v-select-optiongroup"; - public static final String ATTRIBUTE_OPTION_DISABLED = "disabled"; - protected final Panel panel; private final Map optionsToKeys; @@ -112,7 +109,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, op.addStyleName(CLASSNAME_OPTION); op.setValue(opUidl.getBooleanAttribute("selected")); boolean enabled = !opUidl - .getBooleanAttribute(ATTRIBUTE_OPTION_DISABLED) + .getBooleanAttribute(OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED) && !isReadonly() && !isDisabled(); op.setEnabled(enabled); setStyleName(op.getElement(), diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java index 7b5097ff77..6d339d2c13 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java @@ -23,6 +23,7 @@ import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.shared.ui.root.PageClientRpc; +import com.vaadin.shared.ui.root.RootConstants; import com.vaadin.shared.ui.root.RootServerRpc; import com.vaadin.shared.ui.root.RootState; import com.vaadin.terminal.gwt.client.ApplicationConnection; @@ -82,7 +83,7 @@ public class RootConnector extends AbstractComponentContainerConnector getWidget().connection = client; getWidget().immediate = getState().isImmediate(); - getWidget().resizeLazy = uidl.hasAttribute(VRoot.RESIZE_LAZY); + getWidget().resizeLazy = uidl.hasAttribute(RootConstants.RESIZE_LAZY); String newTheme = uidl.getStringAttribute("theme"); if (getWidget().theme != null && !newTheme.equals(getWidget().theme)) { // Complete page refresh is needed due css can affect layout @@ -238,9 +239,9 @@ public class RootConnector extends AbstractComponentContainerConnector scrollIntoView(connector); } - if (uidl.hasAttribute(VRoot.FRAGMENT_VARIABLE)) { + if (uidl.hasAttribute(RootConstants.FRAGMENT_VARIABLE)) { getWidget().currentFragment = uidl - .getStringAttribute(VRoot.FRAGMENT_VARIABLE); + .getStringAttribute(RootConstants.FRAGMENT_VARIABLE); if (!getWidget().currentFragment.equals(History.getToken())) { History.newItem(getWidget().currentFragment, true); } @@ -250,7 +251,8 @@ public class RootConnector extends AbstractComponentContainerConnector getWidget().currentFragment = History.getToken(); // Include current fragment in the next request - client.updateVariable(getWidget().id, VRoot.FRAGMENT_VARIABLE, + client.updateVariable(getWidget().id, + RootConstants.FRAGMENT_VARIABLE, getWidget().currentFragment, false); } diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java b/client/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java index fddb76e755..7b8a5091ba 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java @@ -19,6 +19,8 @@ import com.google.gwt.user.client.History; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.SimplePanel; +import com.vaadin.shared.ApplicationConstants; +import com.vaadin.shared.ui.root.RootConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.ComponentConnector; @@ -38,16 +40,8 @@ import com.vaadin.terminal.gwt.client.ui.textfield.VTextField; public class VRoot extends SimplePanel implements ResizeHandler, Window.ClosingHandler, ShortcutActionHandlerOwner, Focusable { - public static final String FRAGMENT_VARIABLE = "fragment"; - - public static final String BROWSER_HEIGHT_VAR = "browserHeight"; - - public static final String BROWSER_WIDTH_VAR = "browserWidth"; - private static final String CLASSNAME = "v-view"; - public static final String NOTIFICATION_HTML_CONTENT_NOT_ALLOWED = "useplain"; - private static int MONITOR_PARENT_TIMER_INTERVAL = 1000; String theme; @@ -73,9 +67,6 @@ public class VRoot extends SimplePanel implements ResizeHandler, ApplicationConnection connection; - /** Identifies the click event */ - public static final String CLICK_EVENT_ID = "click"; - /** * Keep track of possible parent size changes when an embedded application. * @@ -102,11 +93,6 @@ public class VRoot extends SimplePanel implements ResizeHandler, boolean resizeLazy = false; - /** - * Attribute name for the lazy resize setting . - */ - public static final String RESIZE_LAZY = "rL"; - private HandlerRegistration historyHandlerRegistration; private TouchScrollHandler touchScrollHandler; @@ -130,8 +116,8 @@ public class VRoot extends SimplePanel implements ResizeHandler, // Send the new fragment to the server if it has changed if (!newFragment.equals(currentFragment) && connection != null) { currentFragment = newFragment; - connection.updateVariable(id, FRAGMENT_VARIABLE, newFragment, - true); + connection.updateVariable(id, RootConstants.FRAGMENT_VARIABLE, + newFragment, true); } } }; @@ -311,7 +297,7 @@ public class VRoot extends SimplePanel implements ResizeHandler, */ public boolean isEmbedded() { return !getElement().getOwnerDocument().getBody().getClassName() - .contains(ApplicationConnection.GENERATED_BODY_CLASSNAME); + .contains(ApplicationConstants.GENERATED_BODY_CLASSNAME); } /** @@ -409,9 +395,10 @@ public class VRoot extends SimplePanel implements ResizeHandler, int windowWidth = Window.getClientWidth(); int windowHeight = Window.getClientHeight(); - connection.updateVariable(id, BROWSER_WIDTH_VAR, windowWidth, false); - connection.updateVariable(id, BROWSER_HEIGHT_VAR, windowHeight, - immediate); + connection.updateVariable(id, RootConstants.BROWSER_WIDTH_VAR, + windowWidth, false); + connection.updateVariable(id, RootConstants.BROWSER_HEIGHT_VAR, + windowHeight, immediate); } public native static void goTo(String url) @@ -458,4 +445,5 @@ public class VRoot extends SimplePanel implements ResizeHandler, } touchScrollHandler.addElement(getElement()); } + } diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java index 7721a3d763..2c5a36ee3c 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java @@ -13,6 +13,7 @@ import com.google.gwt.user.client.Command; import com.google.gwt.user.client.ui.Widget; import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.table.TableConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.ComponentConnector; @@ -53,11 +54,11 @@ public class TableConnector extends AbstractComponentContainerConnector // required. ContextMenuDetails contextMenuBeforeUpdate = getWidget().contextMenu; - if (uidl.hasAttribute(VScrollTable.ATTRIBUTE_PAGEBUFFER_FIRST)) { + if (uidl.hasAttribute(TableConstants.ATTRIBUTE_PAGEBUFFER_FIRST)) { getWidget().serverCacheFirst = uidl - .getIntAttribute(VScrollTable.ATTRIBUTE_PAGEBUFFER_FIRST); + .getIntAttribute(TableConstants.ATTRIBUTE_PAGEBUFFER_FIRST); getWidget().serverCacheLast = uidl - .getIntAttribute(VScrollTable.ATTRIBUTE_PAGEBUFFER_LAST); + .getIntAttribute(TableConstants.ATTRIBUTE_PAGEBUFFER_LAST); } else { getWidget().serverCacheFirst = -1; getWidget().serverCacheLast = -1; @@ -255,8 +256,8 @@ public class TableConnector extends AbstractComponentContainerConnector * be cleared a little later when the row focus has been restored. * (#8584) */ - if (uidl.hasAttribute(VScrollTable.ATTRIBUTE_KEY_MAPPER_RESET) - && uidl.getBooleanAttribute(VScrollTable.ATTRIBUTE_KEY_MAPPER_RESET) + if (uidl.hasAttribute(TableConstants.ATTRIBUTE_KEY_MAPPER_RESET) + && uidl.getBooleanAttribute(TableConstants.ATTRIBUTE_KEY_MAPPER_RESET) && getWidget().selectionRangeStart != null) { assert !getWidget().selectionRangeStart.isAttached(); getWidget().selectionRangeStart = getWidget().focusedRow; diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java b/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java index 8a58c28c5b..bab34768ce 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java @@ -63,6 +63,7 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.shared.ComponentState; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.dd.VerticalDropLocation; +import com.vaadin.shared.ui.table.TableConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.ComponentConnector; @@ -131,26 +132,11 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } } - /** - * Tell the client that old keys are no longer valid because the server has - * cleared its key map. - */ - public static final String ATTRIBUTE_KEY_MAPPER_RESET = "clearKeyMap"; - private static final String ROW_HEADER_COLUMN_KEY = "0"; public static final String CLASSNAME = "v-table"; public static final String CLASSNAME_SELECTION_FOCUS = CLASSNAME + "-focus"; - public static final String ATTRIBUTE_PAGEBUFFER_FIRST = "pb-ft"; - public static final String ATTRIBUTE_PAGEBUFFER_LAST = "pb-l"; - - public static final String ITEM_CLICK_EVENT_ID = "itemClick"; - public static final String HEADER_CLICK_EVENT_ID = "handleHeaderClick"; - public static final String FOOTER_CLICK_EVENT_ID = "handleFooterClick"; - public static final String COLUMN_RESIZE_EVENT_ID = "columnResize"; - public static final String COLUMN_REORDER_EVENT_ID = "columnReorder"; - private static final double CACHE_RATE_DEFAULT = 2; /** @@ -1624,7 +1610,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } } client.updateVariable(paintableId, "columnorder", columnOrder, false); - if (client.hasEventListeners(this, COLUMN_REORDER_EVENT_ID)) { + if (client.hasEventListeners(this, + TableConstants.COLUMN_REORDER_EVENT_ID)) { client.sendPendingVariableChanges(); } } @@ -2324,7 +2311,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, boolean stopPropagation = true; if (event.getTypeInt() == Event.ONCONTEXTMENU && !client.hasEventListeners(VScrollTable.this, - HEADER_CLICK_EVENT_ID)) { + TableConstants.HEADER_CLICK_EVENT_ID)) { // Prevent showing the browser's context menu only when // there is a header click listener. stopPropagation = false; @@ -2377,7 +2364,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ private void fireHeaderClickedEvent(Event event) { if (client.hasEventListeners(VScrollTable.this, - HEADER_CLICK_EVENT_ID)) { + TableConstants.HEADER_CLICK_EVENT_ID)) { MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event); client.updateVariable(paintableId, "headerClickEvent", @@ -3424,7 +3411,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, boolean stopPropagation = true; if (event.getTypeInt() == Event.ONCONTEXTMENU && !client.hasEventListeners(VScrollTable.this, - FOOTER_CLICK_EVENT_ID)) { + TableConstants.FOOTER_CLICK_EVENT_ID)) { // Show browser context menu if a footer click listener is // not present stopPropagation = false; @@ -3458,7 +3445,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ private void fireFooterClickedEvent(Event event) { if (client.hasEventListeners(VScrollTable.this, - FOOTER_CLICK_EVENT_ID)) { + TableConstants.FOOTER_CLICK_EVENT_ID)) { MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event); client.updateVariable(paintableId, "footerClickEvent", @@ -4786,7 +4773,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private boolean handleClickEvent(Event event, Element targetTdOrTr, boolean immediate) { if (!client.hasEventListeners(VScrollTable.this, - ITEM_CLICK_EVENT_ID)) { + TableConstants.ITEM_CLICK_EVENT_ID)) { // Don't send an event if nobody is listening return false; } @@ -4960,8 +4947,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, showContextMenu(event); if (enabled && (actionKeys != null || client - .hasEventListeners(VScrollTable.this, - ITEM_CLICK_EVENT_ID))) { + .hasEventListeners( + VScrollTable.this, + TableConstants.ITEM_CLICK_EVENT_ID))) { /* * Prevent browser context menu only if there are * action handlers or item click listeners diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java index ea0bea6b04..35d5b65b04 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Iterator; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.Paintable; @@ -16,12 +17,6 @@ import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector; public abstract class TabsheetBaseConnector extends AbstractComponentContainerConnector implements Paintable { - public static final String ATTRIBUTE_TAB_DISABLED = "disabled"; - public static final String ATTRIBUTE_TAB_DESCRIPTION = "description"; - public static final String ATTRIBUTE_TAB_ERROR_MESSAGE = "error"; - public static final String ATTRIBUTE_TAB_CAPTION = "caption"; - public static final String ATTRIBUTE_TAB_ICON = "icon"; - @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidget().client = client; @@ -55,7 +50,7 @@ public abstract class TabsheetBaseConnector extends final boolean selected = tab.getBooleanAttribute("selected"); final boolean hidden = tab.getBooleanAttribute("hidden"); - if (tab.getBooleanAttribute(ATTRIBUTE_TAB_DISABLED)) { + if (tab.getBooleanAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_DISABLED)) { getWidget().disabledTabKeys.add(key); } diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java index ce19f1e02a..86e73149c3 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java @@ -19,6 +19,7 @@ import com.vaadin.ui.TabSheet; public class TabsheetConnector extends TabsheetBaseConnector implements SimpleManagedLayout, MayScrollChildren { + // Can't use "style" as it's already in use @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java b/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java index 1f6314050e..517876db19 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java @@ -36,6 +36,8 @@ import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.impl.FocusImpl; import com.vaadin.shared.ComponentState; import com.vaadin.shared.EventId; +import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants; +import com.vaadin.shared.ui.tabsheet.TabsheetConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.ComponentConnector; @@ -187,7 +189,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, tabCaption.updateCaption(tabUidl); // Apply the styleName set for the tab - String newStyleName = tabUidl.getStringAttribute(TAB_STYLE_NAME); + String newStyleName = tabUidl + .getStringAttribute(TabsheetConstants.TAB_STYLE_NAME); // Find the nth td element if (newStyleName != null && newStyleName.length() != 0) { if (!newStyleName.equals(styleName)) { @@ -250,10 +253,10 @@ public class VTabsheet extends VTabsheetBase implements Focusable, } public boolean updateCaption(UIDL uidl) { - if (uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION)) { + if (uidl.hasAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_DESCRIPTION)) { setTooltipInfo(new TooltipInfo( - uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION), - uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_ERROR_MESSAGE))); + uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_DESCRIPTION), + uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_ERROR_MESSAGE))); } else { setTooltipInfo(null); } @@ -261,11 +264,11 @@ public class VTabsheet extends VTabsheetBase implements Focusable, // TODO need to call this instead of super because the caption does // not have an owner boolean ret = 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)); setClosable(uidl.hasAttribute("closable")); @@ -541,9 +544,6 @@ public class VTabsheet extends VTabsheetBase implements Focusable, public static final String TABS_CLASSNAME = "v-tabsheet-tabcontainer"; public static final String SCROLLER_CLASSNAME = "v-tabsheet-scroller"; - // Can't use "style" as it's already in use - public static final String TAB_STYLE_NAME = "tabstyle"; - final Element tabs; // tabbar and 'scroller' container Tab focusedTab; /** diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java index d98d27942a..10bfe75e7b 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java @@ -10,6 +10,7 @@ import com.google.gwt.user.client.Event; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.shared.ui.textfield.AbstractTextFieldState; +import com.vaadin.shared.ui.textfield.TextFieldConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.Paintable; import com.vaadin.terminal.gwt.client.UIDL; @@ -45,13 +46,13 @@ public class TextFieldConnector extends AbstractFieldConnector implements getWidget().listenTextChangeEvents = hasEventListener("ie"); if (getWidget().listenTextChangeEvents) { getWidget().textChangeEventMode = uidl - .getStringAttribute(VTextField.ATTR_TEXTCHANGE_EVENTMODE); + .getStringAttribute(TextFieldConstants.ATTR_TEXTCHANGE_EVENTMODE); if (getWidget().textChangeEventMode - .equals(VTextField.TEXTCHANGE_MODE_EAGER)) { + .equals(TextFieldConstants.TEXTCHANGE_MODE_EAGER)) { getWidget().textChangeEventTimeout = 1; } else { getWidget().textChangeEventTimeout = uidl - .getIntAttribute(VTextField.ATTR_TEXTCHANGE_TIMEOUT); + .getIntAttribute(TextFieldConstants.ATTR_TEXTCHANGE_TIMEOUT); if (getWidget().textChangeEventTimeout < 1) { // Sanitize and allow lazy/timeout with timeout set to 0 to // work as eager @@ -72,7 +73,7 @@ public class TextFieldConnector extends AbstractFieldConnector implements * value). */ if (!(uidl - .getBooleanAttribute(VTextField.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) + .getBooleanAttribute(TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) && getWidget().valueBeforeEdit != null && text .equals(getWidget().valueBeforeEdit))) { getWidget().updateFieldContent(text); diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java b/client/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java index 7f8e549550..2d817592d2 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java @@ -19,6 +19,7 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.ui.TextBoxBase; import com.vaadin.shared.EventId; +import com.vaadin.shared.ui.textfield.TextFieldConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.Util; @@ -33,9 +34,6 @@ import com.vaadin.terminal.gwt.client.ui.Field; public class VTextField extends TextBoxBase implements Field, ChangeHandler, FocusHandler, BlurHandler, KeyDownHandler { - public static final String VAR_CUR_TEXT = "curText"; - - public static final String ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS = "nvc"; /** * The input node CSS classname. */ @@ -62,10 +60,6 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, private int maxLength = -1; private static final String CLASSNAME_PROMPT = "prompt"; - public static final String ATTR_TEXTCHANGE_TIMEOUT = "iet"; - public static final String VAR_CURSOR = "c"; - public static final String ATTR_TEXTCHANGE_EVENTMODE = "iem"; - protected static final String TEXTCHANGE_MODE_EAGER = "EAGER"; private static final String TEXTCHANGE_MODE_TIMEOUT = "TIMEOUT"; private String inputPrompt = null; @@ -142,7 +136,8 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, client.sendPendingVariableChanges(); } else { // Default case - just send an immediate text change message - client.updateVariable(paintableId, VAR_CUR_TEXT, text, true); + client.updateVariable(paintableId, + TextFieldConstants.VAR_CUR_TEXT, text, true); // Shouldn't investigate valueBeforeEdit to avoid duplicate text // change events as the states are not in sync any more @@ -334,7 +329,8 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, if (Util.isAttachedAndDisplayed(this)) { int cursorPos = getCursorPos(); if (lastCursorPos != cursorPos) { - client.updateVariable(paintableId, VAR_CURSOR, cursorPos, false); + client.updateVariable(paintableId, + TextFieldConstants.VAR_CURSOR, cursorPos, false); lastCursorPos = cursorPos; return true; } diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java index def63edae9..991b81821c 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java @@ -10,6 +10,7 @@ import java.util.Map; import com.google.gwt.dom.client.Element; import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.tree.TreeConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.Paintable; @@ -24,13 +25,6 @@ import com.vaadin.ui.Tree; public class TreeConnector extends AbstractComponentConnector implements Paintable { - public static final String ATTRIBUTE_NODE_STYLE = "style"; - public static final String ATTRIBUTE_NODE_CAPTION = "caption"; - public static final String ATTRIBUTE_NODE_ICON = "icon"; - - public static final String ATTRIBUTE_ACTION_CAPTION = "caption"; - public static final String ATTRIBUTE_ACTION_ICON = ATTRIBUTE_NODE_ICON; - protected final Map tooltipMap = new HashMap(); @Override @@ -165,11 +159,12 @@ public class TreeConnector extends AbstractComponentConnector implements final UIDL action = (UIDL) it.next(); final String key = action.getStringAttribute("key"); final String caption = action - .getStringAttribute(ATTRIBUTE_ACTION_CAPTION); + .getStringAttribute(TreeConstants.ATTRIBUTE_ACTION_CAPTION); String iconUrl = null; - if (action.hasAttribute(ATTRIBUTE_ACTION_ICON)) { - iconUrl = getConnection().translateVaadinUri( - action.getStringAttribute(ATTRIBUTE_ACTION_ICON)); + if (action.hasAttribute(TreeConstants.ATTRIBUTE_ACTION_ICON)) { + iconUrl = getConnection() + .translateVaadinUri( + action.getStringAttribute(TreeConstants.ATTRIBUTE_ACTION_ICON)); } getWidget().registerAction(key, caption, iconUrl); } @@ -178,7 +173,8 @@ public class TreeConnector extends AbstractComponentConnector implements public void updateNodeFromUIDL(TreeNode treeNode, UIDL uidl) { String nodeKey = uidl.getStringAttribute("key"); - treeNode.setText(uidl.getStringAttribute(ATTRIBUTE_NODE_CAPTION)); + treeNode.setText(uidl + .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_CAPTION)); treeNode.key = nodeKey; getWidget().registerNode(treeNode); @@ -197,9 +193,9 @@ public class TreeConnector extends AbstractComponentConnector implements } else { treeNode.addStyleName(TreeNode.CLASSNAME + "-leaf"); } - if (uidl.hasAttribute(ATTRIBUTE_NODE_STYLE)) { + if (uidl.hasAttribute(TreeConstants.ATTRIBUTE_NODE_STYLE)) { treeNode.setNodeStyleName(uidl - .getStringAttribute(ATTRIBUTE_NODE_STYLE)); + .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_STYLE)); } String description = uidl.getStringAttribute("descr"); @@ -218,7 +214,8 @@ public class TreeConnector extends AbstractComponentConnector implements getWidget().selectedIds.add(nodeKey); } - treeNode.setIcon(uidl.getStringAttribute(ATTRIBUTE_NODE_ICON)); + treeNode.setIcon(uidl + .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_ICON)); } void renderChildNodes(TreeNode containerNode, Iterator i) { diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java b/client/src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java index f5fe6bce1a..430e8d81ba 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java @@ -39,6 +39,7 @@ import com.google.gwt.user.client.ui.UIObject; import com.google.gwt.user.client.ui.Widget; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.dd.VerticalDropLocation; +import com.vaadin.shared.ui.tree.TreeConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.ComponentConnector; @@ -71,8 +72,6 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, public static final String CLASSNAME = "v-tree"; - public static final String ITEM_CLICK_EVENT_ID = "itemClick"; - /** * Click selects the current node, ctrl/shift toggles multi selection */ @@ -663,8 +662,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, final boolean inCaption = isCaptionElement(target); if (inCaption - && client - .hasEventListeners(VTree.this, ITEM_CLICK_EVENT_ID) + && client.hasEventListeners(VTree.this, + TreeConstants.ITEM_CLICK_EVENT_ID) && (type == Event.ONDBLCLICK || type == Event.ONMOUSEUP)) { fireClick(event); diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java index 06e916fbc9..2cfbdf703e 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java @@ -4,6 +4,7 @@ package com.vaadin.terminal.gwt.client.ui.treetable; import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.treetable.TreeTableConstants; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.ui.FocusableScrollPanel; @@ -14,7 +15,6 @@ import com.vaadin.ui.TreeTable; @Connect(TreeTable.class) public class TreeTableConnector extends TableConnector { - public static final String ATTRIBUTE_HIERARCHY_COLUMN_INDEX = "hci"; @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { @@ -26,8 +26,9 @@ public class TreeTableConnector extends TableConnector { } getWidget().animationsEnabled = uidl.getBooleanAttribute("animate"); getWidget().colIndexOfHierarchy = uidl - .hasAttribute(ATTRIBUTE_HIERARCHY_COLUMN_INDEX) ? uidl - .getIntAttribute(ATTRIBUTE_HIERARCHY_COLUMN_INDEX) : 0; + .hasAttribute(TreeTableConstants.ATTRIBUTE_HIERARCHY_COLUMN_INDEX) ? uidl + .getIntAttribute(TreeTableConstants.ATTRIBUTE_HIERARCHY_COLUMN_INDEX) + : 0; int oldTotalRows = getWidget().getTotalRows(); super.updateFromUIDL(uidl, client); if (getWidget().collapseRequest) { diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java b/client/src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java index 1a2deae3b4..9c7ea76fb2 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java @@ -26,6 +26,7 @@ import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.ListBox; import com.google.gwt.user.client.ui.Panel; +import com.vaadin.shared.ui.twincolselect.TwinColSelectConstants; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.ui.SubPartAware; @@ -36,8 +37,6 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, MouseDownHandler, DoubleClickHandler, SubPartAware { private static final String CLASSNAME = "v-select-twincol"; - public static final String ATTRIBUTE_LEFT_CAPTION = "lc"; - public static final String ATTRIBUTE_RIGHT_CAPTION = "rc"; private static final int VISIBLE_COUNT = 10; @@ -157,10 +156,14 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, } protected void updateCaptions(UIDL uidl) { - String leftCaption = (uidl.hasAttribute(ATTRIBUTE_LEFT_CAPTION) ? uidl - .getStringAttribute(ATTRIBUTE_LEFT_CAPTION) : null); - String rightCaption = (uidl.hasAttribute(ATTRIBUTE_RIGHT_CAPTION) ? uidl - .getStringAttribute(ATTRIBUTE_RIGHT_CAPTION) : null); + String leftCaption = (uidl + .hasAttribute(TwinColSelectConstants.ATTRIBUTE_LEFT_CAPTION) ? uidl + .getStringAttribute(TwinColSelectConstants.ATTRIBUTE_LEFT_CAPTION) + : null); + String rightCaption = (uidl + .hasAttribute(TwinColSelectConstants.ATTRIBUTE_RIGHT_CAPTION) ? uidl + .getStringAttribute(TwinColSelectConstants.ATTRIBUTE_RIGHT_CAPTION) + : null); boolean hasCaptions = (leftCaption != null || rightCaption != null); diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index 1d31410185..c7f3462b05 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -38,6 +38,7 @@ import com.vaadin.data.util.converter.ConverterFactory; import com.vaadin.data.util.converter.DefaultConverterFactory; import com.vaadin.event.EventRouter; import com.vaadin.service.ApplicationContext; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.AbstractErrorMessage; import com.vaadin.terminal.ApplicationResource; import com.vaadin.terminal.CombinedRequest; @@ -48,7 +49,6 @@ import com.vaadin.terminal.VariableOwner; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedRequest.BrowserDetails; import com.vaadin.terminal.WrappedResponse; -import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; import com.vaadin.terminal.gwt.server.BootstrapFragmentResponse; import com.vaadin.terminal.gwt.server.BootstrapListener; @@ -2300,7 +2300,7 @@ public class Application implements Terminal.ErrorListener, Serializable { request = combinedRequest.getSecondRequest(); } String rootIdString = request - .getParameter(ApplicationConnection.ROOT_ID_PARAMETER); + .getParameter(ApplicationConstants.ROOT_ID_PARAMETER); Integer rootId = rootIdString == null ? null : new Integer(rootIdString); return rootId; diff --git a/server/src/com/vaadin/terminal/Page.java b/server/src/com/vaadin/terminal/Page.java index a068e7573e..5ae8f7b775 100644 --- a/server/src/com/vaadin/terminal/Page.java +++ b/server/src/com/vaadin/terminal/Page.java @@ -13,9 +13,8 @@ import java.util.List; import com.vaadin.event.EventRouter; import com.vaadin.shared.ui.root.PageClientRpc; +import com.vaadin.shared.ui.root.RootConstants; import com.vaadin.terminal.WrappedRequest.BrowserDetails; -import com.vaadin.terminal.gwt.client.ui.notification.VNotification; -import com.vaadin.terminal.gwt.client.ui.root.VRoot; import com.vaadin.terminal.gwt.server.WebApplicationContext; import com.vaadin.terminal.gwt.server.WebBrowser; import com.vaadin.tools.ReflectTools; @@ -467,31 +466,32 @@ public class Page implements Serializable { target.startTag("notification"); if (n.getCaption() != null) { target.addAttribute( - VNotification.ATTRIBUTE_NOTIFICATION_CAPTION, + RootConstants.ATTRIBUTE_NOTIFICATION_CAPTION, n.getCaption()); } if (n.getDescription() != null) { target.addAttribute( - VNotification.ATTRIBUTE_NOTIFICATION_MESSAGE, + RootConstants.ATTRIBUTE_NOTIFICATION_MESSAGE, n.getDescription()); } if (n.getIcon() != null) { target.addAttribute( - VNotification.ATTRIBUTE_NOTIFICATION_ICON, + RootConstants.ATTRIBUTE_NOTIFICATION_ICON, n.getIcon()); } if (!n.isHtmlContentAllowed()) { target.addAttribute( - VRoot.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED, true); + RootConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED, + true); } target.addAttribute( - VNotification.ATTRIBUTE_NOTIFICATION_POSITION, + RootConstants.ATTRIBUTE_NOTIFICATION_POSITION, n.getPosition()); - target.addAttribute(VNotification.ATTRIBUTE_NOTIFICATION_DELAY, + target.addAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_DELAY, n.getDelayMsec()); if (n.getStyleName() != null) { target.addAttribute( - VNotification.ATTRIBUTE_NOTIFICATION_STYLE, + RootConstants.ATTRIBUTE_NOTIFICATION_STYLE, n.getStyleName()); } target.endTag("notification"); @@ -501,7 +501,7 @@ public class Page implements Serializable { } if (fragment != null) { - target.addAttribute(VRoot.FRAGMENT_VARIABLE, fragment); + target.addAttribute(RootConstants.FRAGMENT_VARIABLE, fragment); } } diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java index 603bc74a21..6a6a00843c 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java @@ -37,12 +37,12 @@ import javax.servlet.http.HttpSession; import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.Application.SystemMessages; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.Terminal; import com.vaadin.terminal.ThemeResource; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; -import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.server.AbstractCommunicationManager.Callback; import com.vaadin.ui.Root; @@ -299,7 +299,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements // key). if (requestType == RequestType.UIDL && request.getParameterMap().containsKey( - ApplicationConnection.PARAM_UNLOADBURST) + ApplicationConstants.PARAM_UNLOADBURST) && request.getContentLength() < 1 && getExistingApplication(request, false) == null) { redirectToApplication(request, response); @@ -1204,7 +1204,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements } private boolean isOnUnloadRequest(HttpServletRequest request) { - return request.getParameter(ApplicationConnection.PARAM_UNLOADBURST) != null; + return request.getParameter(ApplicationConstants.PARAM_UNLOADBURST) != null; } /** diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index ba1b3cadb6..3143ba2e35 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -55,6 +55,7 @@ import com.vaadin.annotations.StyleSheet; import com.vaadin.external.json.JSONArray; import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.shared.Connector; import com.vaadin.shared.communication.MethodInvocation; import com.vaadin.shared.communication.SharedState; @@ -74,7 +75,6 @@ import com.vaadin.terminal.Vaadin6Component; import com.vaadin.terminal.VariableOwner; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; -import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.server.BootstrapHandler.BootstrapContext; import com.vaadin.terminal.gwt.server.ComponentSizeValidator.InvalidLayout; import com.vaadin.terminal.gwt.server.RpcManager.RpcInvocationException; @@ -90,7 +90,7 @@ import com.vaadin.ui.Window; * This is a common base class for the server-side implementations of the * communication system between the client code (compiled with GWT into * JavaScript) and the server side components. Its client side counterpart is - * {@link ApplicationConnection}. + * {@link ApplicationConstants}. * * TODO Document better! */ @@ -768,8 +768,8 @@ public abstract class AbstractCommunicationManager implements Serializable { public String getSecurityKeyUIDL(WrappedRequest request) { final String seckey = getSecurityKey(request); if (seckey != null) { - return "\"" + ApplicationConnection.UIDL_SECURITY_TOKEN_ID - + "\":\"" + seckey + "\","; + return "\"" + ApplicationConstants.UIDL_SECURITY_TOKEN_ID + "\":\"" + + seckey + "\","; } else { return ""; } @@ -784,11 +784,11 @@ public abstract class AbstractCommunicationManager implements Serializable { protected String getSecurityKey(WrappedRequest request) { String seckey = null; seckey = (String) request - .getSessionAttribute(ApplicationConnection.UIDL_SECURITY_TOKEN_ID); + .getSessionAttribute(ApplicationConstants.UIDL_SECURITY_TOKEN_ID); if (seckey == null) { seckey = UUID.randomUUID().toString(); request.setSessionAttribute( - ApplicationConnection.UIDL_SECURITY_TOKEN_ID, seckey); + ApplicationConstants.UIDL_SECURITY_TOKEN_ID, seckey); } return seckey; @@ -1286,7 +1286,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } } - return ApplicationConnection.CONNECTOR_PROTOCOL_PREFIX + "/" + name; + return ApplicationConstants.CONNECTOR_PROTOCOL_PREFIX + "/" + name; } /** @@ -1543,7 +1543,7 @@ public abstract class AbstractCommunicationManager implements Serializable { // ApplicationServlet has stored the security token in the // session; check that it matched the one sent in the UIDL String sessId = (String) request - .getSessionAttribute(ApplicationConnection.UIDL_SECURITY_TOKEN_ID); + .getSessionAttribute(ApplicationConstants.UIDL_SECURITY_TOKEN_ID); if (sessId == null || !sessId.equals(bursts[0])) { throw new InvalidUIDLSecurityKeyException( @@ -2342,7 +2342,7 @@ public abstract class AbstractCommunicationManager implements Serializable { streamVariableToSeckey.put(value, seckey); } - return ApplicationConnection.APP_PROTOCOL_PREFIX + return ApplicationConstants.APP_PROTOCOL_PREFIX + ServletPortletHelper.UPLOAD_URL_PREFIX + key + "/" + seckey; } @@ -2406,8 +2406,7 @@ public abstract class AbstractCommunicationManager implements Serializable { params.put("widgetset", widgetset); params.put("themeUri", themeUri); // Root id might have changed based on e.g. window.name - params.put(ApplicationConnection.ROOT_ID_PARAMETER, - root.getRootId()); + params.put(ApplicationConstants.ROOT_ID_PARAMETER, root.getRootId()); if (sendUIDL) { String initialUIDL = getInitialUIDL(combinedRequest, root); params.put("uidl", initialUIDL); @@ -2484,7 +2483,7 @@ public abstract class AbstractCommunicationManager implements Serializable { String pathInfo = request.getRequestPathInfo(); // + 2 to also remove beginning and ending slashes String resourceName = pathInfo - .substring(ApplicationConnection.CONNECTOR_RESOURCE_PREFIX + .substring(ApplicationConstants.CONNECTOR_RESOURCE_PREFIX .length() + 2); final String mimetype = response.getDeploymentConfiguration() diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java b/server/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java index 3a33621d10..33f4cd118d 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java @@ -23,8 +23,8 @@ import javax.servlet.http.HttpSessionBindingListener; import com.vaadin.Application; import com.vaadin.service.ApplicationContext; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.ApplicationResource; -import com.vaadin.terminal.gwt.client.ApplicationConnection; /** * Base class for web application contexts (including portlet contexts) that @@ -181,8 +181,8 @@ public abstract class AbstractWebApplicationContext implements final String filename = resource.getFilename(); if (filename == null) { - return ApplicationConnection.APP_PROTOCOL_PREFIX - + ApplicationConnection.APP_REQUEST_PATH + mapKey + "/"; + return ApplicationConstants.APP_PROTOCOL_PREFIX + + ApplicationConstants.APP_REQUEST_PATH + mapKey + "/"; } else { // #7738 At least Tomcat and JBoss refuses requests containing // encoded slashes or backslashes in URLs. Application resource URLs @@ -190,8 +190,8 @@ public abstract class AbstractWebApplicationContext implements // in the future. String encodedFileName = urlEncode(filename).replace("%2F", "/") .replace("%5C", "\\"); - return ApplicationConnection.APP_PROTOCOL_PREFIX - + ApplicationConnection.APP_REQUEST_PATH + mapKey + "/" + return ApplicationConstants.APP_PROTOCOL_PREFIX + + ApplicationConstants.APP_REQUEST_PATH + mapKey + "/" + encodedFileName; } diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java index e89737337b..4d278a55a1 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java @@ -29,12 +29,12 @@ import com.vaadin.RootRequiresMoreInformationException; import com.vaadin.Version; import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.RequestHandler; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; -import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.ui.Root; public abstract class BootstrapHandler implements RequestHandler { @@ -256,7 +256,7 @@ public abstract class BootstrapHandler implements RequestHandler { Element body = document.body(); body.attr("scroll", "auto"); - body.addClass(ApplicationConnection.GENERATED_BODY_CLASSNAME); + body.addClass(ApplicationConstants.GENERATED_BODY_CLASSNAME); } public BootstrapContext createContext(WrappedRequest request, @@ -410,7 +410,7 @@ public abstract class BootstrapHandler implements RequestHandler { JSONObject appConfig = new JSONObject(); if (rootId != null) { - appConfig.put(ApplicationConnection.ROOT_ID_PARAMETER, rootId); + appConfig.put(ApplicationConstants.ROOT_ID_PARAMETER, rootId); } if (context.getThemeName() != null) { diff --git a/server/src/com/vaadin/terminal/gwt/server/JsonCodec.java b/server/src/com/vaadin/terminal/gwt/server/JsonCodec.java index 8199bc6ada..7df4e3e7c4 100644 --- a/server/src/com/vaadin/terminal/gwt/server/JsonCodec.java +++ b/server/src/com/vaadin/terminal/gwt/server/JsonCodec.java @@ -30,8 +30,8 @@ import com.vaadin.external.json.JSONArray; import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; import com.vaadin.shared.Connector; +import com.vaadin.shared.JsonConstants; import com.vaadin.shared.communication.UidlValue; -import com.vaadin.terminal.gwt.client.communication.JsonEncoder; import com.vaadin.ui.Component; import com.vaadin.ui.ConnectorTracker; @@ -52,24 +52,24 @@ public class JsonCodec implements Serializable { private static Map> transportTypeToType = new HashMap>(); static { - registerType(String.class, JsonEncoder.VTYPE_STRING); - registerType(Connector.class, JsonEncoder.VTYPE_CONNECTOR); - registerType(Boolean.class, JsonEncoder.VTYPE_BOOLEAN); - registerType(boolean.class, JsonEncoder.VTYPE_BOOLEAN); - registerType(Integer.class, JsonEncoder.VTYPE_INTEGER); - registerType(int.class, JsonEncoder.VTYPE_INTEGER); - registerType(Float.class, JsonEncoder.VTYPE_FLOAT); - registerType(float.class, JsonEncoder.VTYPE_FLOAT); - registerType(Double.class, JsonEncoder.VTYPE_DOUBLE); - registerType(double.class, JsonEncoder.VTYPE_DOUBLE); - registerType(Long.class, JsonEncoder.VTYPE_LONG); - registerType(long.class, JsonEncoder.VTYPE_LONG); - registerType(String[].class, JsonEncoder.VTYPE_STRINGARRAY); - registerType(Object[].class, JsonEncoder.VTYPE_ARRAY); - registerType(Map.class, JsonEncoder.VTYPE_MAP); - registerType(HashMap.class, JsonEncoder.VTYPE_MAP); - registerType(List.class, JsonEncoder.VTYPE_LIST); - registerType(Set.class, JsonEncoder.VTYPE_SET); + registerType(String.class, JsonConstants.VTYPE_STRING); + registerType(Connector.class, JsonConstants.VTYPE_CONNECTOR); + registerType(Boolean.class, JsonConstants.VTYPE_BOOLEAN); + registerType(boolean.class, JsonConstants.VTYPE_BOOLEAN); + registerType(Integer.class, JsonConstants.VTYPE_INTEGER); + registerType(int.class, JsonConstants.VTYPE_INTEGER); + registerType(Float.class, JsonConstants.VTYPE_FLOAT); + registerType(float.class, JsonConstants.VTYPE_FLOAT); + registerType(Double.class, JsonConstants.VTYPE_DOUBLE); + registerType(double.class, JsonConstants.VTYPE_DOUBLE); + registerType(Long.class, JsonConstants.VTYPE_LONG); + registerType(long.class, JsonConstants.VTYPE_LONG); + registerType(String[].class, JsonConstants.VTYPE_STRINGARRAY); + registerType(Object[].class, JsonConstants.VTYPE_ARRAY); + registerType(Map.class, JsonConstants.VTYPE_MAP); + registerType(HashMap.class, JsonConstants.VTYPE_MAP); + registerType(List.class, JsonConstants.VTYPE_LIST); + registerType(Set.class, JsonConstants.VTYPE_SET); } private static void registerType(Class type, String transportType) { @@ -215,24 +215,24 @@ public class JsonCodec implements Serializable { } // Collections - if (JsonEncoder.VTYPE_LIST.equals(transportType)) { + if (JsonConstants.VTYPE_LIST.equals(transportType)) { return decodeList(targetType, restrictToInternalTypes, (JSONArray) encodedJsonValue, connectorTracker); - } else if (JsonEncoder.VTYPE_SET.equals(transportType)) { + } else if (JsonConstants.VTYPE_SET.equals(transportType)) { return decodeSet(targetType, restrictToInternalTypes, (JSONArray) encodedJsonValue, connectorTracker); - } else if (JsonEncoder.VTYPE_MAP.equals(transportType)) { + } else if (JsonConstants.VTYPE_MAP.equals(transportType)) { return decodeMap(targetType, restrictToInternalTypes, encodedJsonValue, connectorTracker); } // Arrays - if (JsonEncoder.VTYPE_ARRAY.equals(transportType)) { + if (JsonConstants.VTYPE_ARRAY.equals(transportType)) { return decodeObjectArray(targetType, (JSONArray) encodedJsonValue, connectorTracker); - } else if (JsonEncoder.VTYPE_STRINGARRAY.equals(transportType)) { + } else if (JsonConstants.VTYPE_STRINGARRAY.equals(transportType)) { return decodeStringArray((JSONArray) encodedJsonValue); } @@ -240,23 +240,23 @@ public class JsonCodec implements Serializable { String stringValue = String.valueOf(encodedJsonValue); - if (JsonEncoder.VTYPE_CONNECTOR.equals(transportType)) { + if (JsonConstants.VTYPE_CONNECTOR.equals(transportType)) { return connectorTracker.getConnector(stringValue); } // Legacy types - if (JsonEncoder.VTYPE_STRING.equals(transportType)) { + if (JsonConstants.VTYPE_STRING.equals(transportType)) { return stringValue; - } else if (JsonEncoder.VTYPE_INTEGER.equals(transportType)) { + } else if (JsonConstants.VTYPE_INTEGER.equals(transportType)) { return Integer.valueOf(stringValue); - } else if (JsonEncoder.VTYPE_LONG.equals(transportType)) { + } else if (JsonConstants.VTYPE_LONG.equals(transportType)) { return Long.valueOf(stringValue); - } else if (JsonEncoder.VTYPE_FLOAT.equals(transportType)) { + } else if (JsonConstants.VTYPE_FLOAT.equals(transportType)) { return Float.valueOf(stringValue); - } else if (JsonEncoder.VTYPE_DOUBLE.equals(transportType)) { + } else if (JsonConstants.VTYPE_DOUBLE.equals(transportType)) { return Double.valueOf(stringValue); - } else if (JsonEncoder.VTYPE_BOOLEAN.equals(transportType)) { + } else if (JsonConstants.VTYPE_BOOLEAN.equals(transportType)) { return Boolean.valueOf(stringValue); } @@ -280,7 +280,7 @@ public class JsonCodec implements Serializable { if (encodedTransportType.equals(transportType)) { return true; } - if (encodedTransportType.equals(JsonEncoder.VTYPE_NULL)) { + if (encodedTransportType.equals(JsonConstants.VTYPE_NULL)) { return true; } diff --git a/server/src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java b/server/src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java index 9dba05d2c1..a6b72a3fb5 100644 --- a/server/src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java +++ b/server/src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java @@ -6,24 +6,24 @@ package com.vaadin.terminal.gwt.server; import java.util.HashMap; import java.util.Map; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.shared.communication.MethodInvocation; -import com.vaadin.terminal.gwt.client.ApplicationConnection; public class LegacyChangeVariablesInvocation extends MethodInvocation { private Map variableChanges = new HashMap(); public LegacyChangeVariablesInvocation(String connectorId, String variableName, Object value) { - super(connectorId, ApplicationConnection.UPDATE_VARIABLE_INTERFACE, - ApplicationConnection.UPDATE_VARIABLE_METHOD); + super(connectorId, ApplicationConstants.UPDATE_VARIABLE_INTERFACE, + ApplicationConstants.UPDATE_VARIABLE_METHOD); setVariableChange(variableName, value); } public static boolean isLegacyVariableChange(String interfaceName, String methodName) { - return ApplicationConnection.UPDATE_VARIABLE_METHOD + return ApplicationConstants.UPDATE_VARIABLE_METHOD .equals(interfaceName) - && ApplicationConnection.UPDATE_VARIABLE_METHOD + && ApplicationConstants.UPDATE_VARIABLE_METHOD .equals(methodName); } diff --git a/server/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java b/server/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java index 39c27d05fe..b082cd4729 100644 --- a/server/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java @@ -17,11 +17,11 @@ import javax.portlet.ResourceURL; import com.vaadin.Application; import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; -import com.vaadin.terminal.gwt.client.ApplicationConfiguration; import com.vaadin.ui.Root; /** @@ -91,7 +91,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { .createResourceURL(); portletResourceUrl .setResourceID(AbstractApplicationPortlet.RESOURCE_URL_ID); - defaults.put(ApplicationConfiguration.PORTLET_RESOUCE_URL_BASE, + defaults.put(ApplicationConstants.PORTLET_RESOUCE_URL_BASE, portletResourceUrl.toString()); defaults.put("pathInfo", ""); diff --git a/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java b/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java index 2a1dc31897..ce8e8946ce 100644 --- a/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java @@ -3,9 +3,9 @@ package com.vaadin.terminal.gwt.server; import java.io.Serializable; import com.vaadin.Application; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.WrappedRequest; -import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.ui.Root; /* @@ -106,15 +106,15 @@ class ServletPortletHelper implements Serializable { public static boolean isConnectorResourceRequest(WrappedRequest request) { return hasPathPrefix(request, - ApplicationConnection.CONNECTOR_RESOURCE_PREFIX + "/"); + ApplicationConstants.CONNECTOR_RESOURCE_PREFIX + "/"); } public static boolean isUIDLRequest(WrappedRequest request) { - return hasPathPrefix(request, ApplicationConnection.UIDL_REQUEST_PATH); + return hasPathPrefix(request, ApplicationConstants.UIDL_REQUEST_PATH); } public static boolean isApplicationResourceRequest(WrappedRequest request) { - return hasPathPrefix(request, ApplicationConnection.APP_REQUEST_PATH); + return hasPathPrefix(request, ApplicationConstants.APP_REQUEST_PATH); } } diff --git a/server/src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java b/server/src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java index a3fa172034..0a3623f987 100644 --- a/server/src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java +++ b/server/src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java @@ -14,10 +14,10 @@ import javax.portlet.PortletRequest; import javax.portlet.ResourceRequest; import com.vaadin.Application; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.CombinedRequest; import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.WrappedRequest; -import com.vaadin.terminal.gwt.client.ApplicationConnection; /** * Wrapper for {@link PortletRequest} and its subclasses. @@ -94,7 +94,7 @@ public class WrappedPortletRequest implements WrappedRequest { String resourceID = resourceRequest.getResourceID(); if (AbstractApplicationPortlet.RESOURCE_URL_ID.equals(resourceID)) { String resourcePath = resourceRequest - .getParameter(ApplicationConnection.V_RESOURCE_PATH); + .getParameter(ApplicationConstants.V_RESOURCE_PATH); return resourcePath; } return resourceID; diff --git a/server/src/com/vaadin/ui/AbsoluteLayout.java b/server/src/com/vaadin/ui/AbsoluteLayout.java index 1c84ca2865..687f7452c5 100644 --- a/server/src/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/com/vaadin/ui/AbsoluteLayout.java @@ -13,11 +13,11 @@ import com.vaadin.event.LayoutEvents.LayoutClickEvent; import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.event.LayoutEvents.LayoutClickNotifier; import com.vaadin.shared.Connector; +import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.absolutelayout.AbsoluteLayoutServerRpc; import com.vaadin.shared.ui.absolutelayout.AbsoluteLayoutState; import com.vaadin.terminal.Sizeable; -import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler; /** * AbsoluteLayout is a layout implementation that mimics html absolute @@ -618,14 +618,14 @@ public class AbsoluteLayout extends AbstractLayout implements @Override public void addListener(LayoutClickListener listener) { - addListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER, + addListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener, LayoutClickListener.clickMethod); } @Override public void removeListener(LayoutClickListener listener) { - removeListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER, + removeListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener); } diff --git a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java index 5ec80573ab..12f1f83968 100644 --- a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java +++ b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java @@ -5,8 +5,6 @@ package com.vaadin.ui; import com.vaadin.shared.ui.JavaScriptComponentState; import com.vaadin.terminal.JavaScriptCallbackHelper; -import com.vaadin.terminal.gwt.client.ApplicationConnection; -import com.vaadin.terminal.gwt.client.ui.JavaScriptWidget; /** * Base class for Components with all client-side logic implemented using diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java index 0581d0a279..1a3b9407e8 100644 --- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -11,12 +11,12 @@ import com.vaadin.event.LayoutEvents.LayoutClickEvent; import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.event.LayoutEvents.LayoutClickNotifier; import com.vaadin.shared.Connector; +import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutServerRpc; import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState; import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState.ChildComponentData; import com.vaadin.terminal.Sizeable; -import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler; @SuppressWarnings("serial") public abstract class AbstractOrderedLayout extends AbstractLayout implements @@ -345,14 +345,14 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements @Override public void addListener(LayoutClickListener listener) { - addListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER, + addListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener, LayoutClickListener.clickMethod); } @Override public void removeListener(LayoutClickListener listener) { - removeListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER, + removeListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener); } diff --git a/server/src/com/vaadin/ui/AbstractSplitPanel.java b/server/src/com/vaadin/ui/AbstractSplitPanel.java index 90dc38ff65..3b51e6099b 100644 --- a/server/src/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/com/vaadin/ui/AbstractSplitPanel.java @@ -10,12 +10,12 @@ import java.util.Iterator; import com.vaadin.event.ComponentEventListener; import com.vaadin.event.MouseEvents.ClickEvent; +import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelRpc; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState.SplitterState; import com.vaadin.terminal.Sizeable; -import com.vaadin.terminal.gwt.client.ui.ClickEventHandler; import com.vaadin.tools.ReflectTools; /** @@ -500,13 +500,12 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { } public void addListener(SplitterClickListener listener) { - addListener(ClickEventHandler.CLICK_EVENT_IDENTIFIER, - SplitterClickEvent.class, listener, - SplitterClickListener.clickMethod); + addListener(EventId.CLICK_EVENT_IDENTIFIER, SplitterClickEvent.class, + listener, SplitterClickListener.clickMethod); } public void removeListener(SplitterClickListener listener) { - removeListener(ClickEventHandler.CLICK_EVENT_IDENTIFIER, + removeListener(EventId.CLICK_EVENT_IDENTIFIER, SplitterClickEvent.class, listener); } diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java index 2326c07d97..2ded12d18d 100644 --- a/server/src/com/vaadin/ui/AbstractTextField.java +++ b/server/src/com/vaadin/ui/AbstractTextField.java @@ -16,10 +16,10 @@ import com.vaadin.event.FieldEvents.TextChangeEvent; import com.vaadin.event.FieldEvents.TextChangeListener; import com.vaadin.event.FieldEvents.TextChangeNotifier; import com.vaadin.shared.ui.textfield.AbstractTextFieldState; +import com.vaadin.shared.ui.textfield.TextFieldConstants; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.Vaadin6Component; -import com.vaadin.terminal.gwt.client.ui.textfield.VTextField; public abstract class AbstractTextField extends AbstractField implements BlurNotifier, FocusNotifier, TextChangeNotifier, Vaadin6Component { @@ -105,9 +105,9 @@ public abstract class AbstractTextField extends AbstractField implements } if (hasListeners(TextChangeEvent.class)) { - target.addAttribute(VTextField.ATTR_TEXTCHANGE_EVENTMODE, + target.addAttribute(TextFieldConstants.ATTR_TEXTCHANGE_EVENTMODE, getTextChangeEventMode().toString()); - target.addAttribute(VTextField.ATTR_TEXTCHANGE_TIMEOUT, + target.addAttribute(TextFieldConstants.ATTR_TEXTCHANGE_TIMEOUT, getTextChangeTimeout()); if (lastKnownTextContent != null) { /* @@ -118,7 +118,8 @@ public abstract class AbstractTextField extends AbstractField implements * the actual value, depending on its state. */ target.addAttribute( - VTextField.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS, true); + TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS, + true); } } @@ -130,12 +131,13 @@ public abstract class AbstractTextField extends AbstractField implements try { - if (variables.containsKey(VTextField.VAR_CURSOR)) { - Integer object = (Integer) variables.get(VTextField.VAR_CURSOR); + if (variables.containsKey(TextFieldConstants.VAR_CURSOR)) { + Integer object = (Integer) variables + .get(TextFieldConstants.VAR_CURSOR); lastKnownCursorPosition = object.intValue(); } - if (variables.containsKey(VTextField.VAR_CUR_TEXT)) { + if (variables.containsKey(TextFieldConstants.VAR_CUR_TEXT)) { /* * NOTE, we might want to develop this further so that on a * value change event the whole text content don't need to be @@ -439,7 +441,7 @@ public abstract class AbstractTextField extends AbstractField implements * some sort of diffs instead of always sending the whole text content. * Also on value change events we could use the mechanism. */ - String object = (String) variables.get(VTextField.VAR_CUR_TEXT); + String object = (String) variables.get(TextFieldConstants.VAR_CUR_TEXT); lastKnownTextContent = object; textChangeEventPending = true; } diff --git a/server/src/com/vaadin/ui/ComboBox.java b/server/src/com/vaadin/ui/ComboBox.java index 6286dad124..a4dcdc152d 100644 --- a/server/src/com/vaadin/ui/ComboBox.java +++ b/server/src/com/vaadin/ui/ComboBox.java @@ -7,9 +7,9 @@ package com.vaadin.ui; import java.util.Collection; import com.vaadin.data.Container; +import com.vaadin.shared.ui.combobox.ComboBoxConstants; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; -import com.vaadin.terminal.gwt.client.ui.combobox.VFilterSelect; /** * A filtering dropdown single-select. Suitable for newItemsAllowed, but it's @@ -75,12 +75,12 @@ public class ComboBox extends Select { @Override public void paintContent(PaintTarget target) throws PaintException { if (inputPrompt != null) { - target.addAttribute("prompt", inputPrompt); + target.addAttribute(ComboBoxConstants.ATTR_INPUTPROMPT, inputPrompt); } super.paintContent(target); if (!textInputAllowed) { - target.addAttribute(VFilterSelect.ATTR_NO_TEXT_INPUT, true); + target.addAttribute(ComboBoxConstants.ATTR_NO_TEXT_INPUT, true); } } diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index e3d1bf86db..0eeaa0d9e1 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -13,7 +13,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.vaadin.terminal.AbstractClientConnector; -import com.vaadin.terminal.gwt.client.ServerConnector; import com.vaadin.terminal.gwt.server.ClientConnector; /** diff --git a/server/src/com/vaadin/ui/CssLayout.java b/server/src/com/vaadin/ui/CssLayout.java index 356f0a3843..24f12e8403 100644 --- a/server/src/com/vaadin/ui/CssLayout.java +++ b/server/src/com/vaadin/ui/CssLayout.java @@ -10,10 +10,10 @@ import com.vaadin.event.LayoutEvents.LayoutClickEvent; import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.event.LayoutEvents.LayoutClickNotifier; import com.vaadin.shared.Connector; +import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.csslayout.CssLayoutServerRpc; import com.vaadin.shared.ui.csslayout.CssLayoutState; -import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler; /** * CssLayout is a layout component that can be used in browser environment only. @@ -270,14 +270,14 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { @Override public void addListener(LayoutClickListener listener) { - addListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER, + addListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener, LayoutClickListener.clickMethod); } @Override public void removeListener(LayoutClickListener listener) { - removeListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER, + removeListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener); } diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java index d0a22f3c29..ff597f8699 100644 --- a/server/src/com/vaadin/ui/DateField.java +++ b/server/src/com/vaadin/ui/DateField.java @@ -24,10 +24,10 @@ import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.shared.ui.datefield.DateFieldConstants; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.Vaadin6Component; -import com.vaadin.terminal.gwt.client.ui.datefield.VDateField; /** *

@@ -303,7 +303,8 @@ public class DateField extends AbstractField implements target.addAttribute("strict", true); } - target.addAttribute(VDateField.WEEK_NUMBERS, isShowISOWeekNumbers()); + target.addAttribute(DateFieldConstants.ATTR_WEEK_NUMBERS, + isShowISOWeekNumbers()); target.addAttribute("parsable", uiHasValidDateString); /* * TODO communicate back the invalid date string? E.g. returning back to diff --git a/server/src/com/vaadin/ui/DragAndDropWrapper.java b/server/src/com/vaadin/ui/DragAndDropWrapper.java index 67229a45fe..b5bd3097b2 100644 --- a/server/src/com/vaadin/ui/DragAndDropWrapper.java +++ b/server/src/com/vaadin/ui/DragAndDropWrapper.java @@ -20,11 +20,11 @@ import com.vaadin.event.dd.TargetDetailsImpl; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.dd.HorizontalDropLocation; import com.vaadin.shared.ui.dd.VerticalDropLocation; +import com.vaadin.shared.ui.draganddropwrapper.DragAndDropWrapperConstants; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.StreamVariable; import com.vaadin.terminal.Vaadin6Component; -import com.vaadin.terminal.gwt.client.ui.draganddropwrapper.VDragAndDropWrapper; @SuppressWarnings("serial") public class DragAndDropWrapper extends CustomComponent implements DropTarget, @@ -221,7 +221,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, @Override public void paintContent(PaintTarget target) throws PaintException { - target.addAttribute(VDragAndDropWrapper.DRAG_START_MODE, + target.addAttribute(DragAndDropWrapperConstants.DRAG_START_MODE, dragStartMode.ordinal()); if (getDropHandler() != null) { getDropHandler().getAcceptCriterion().paint(target); @@ -245,7 +245,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, } } } - target.addAttribute(VDragAndDropWrapper.HTML5_DATA_FLAVORS, + target.addAttribute(DragAndDropWrapperConstants.HTML5_DATA_FLAVORS, html5DataFlavors); } diff --git a/server/src/com/vaadin/ui/Embedded.java b/server/src/com/vaadin/ui/Embedded.java index 6088c5aa66..ffa47f60b8 100644 --- a/server/src/com/vaadin/ui/Embedded.java +++ b/server/src/com/vaadin/ui/Embedded.java @@ -10,14 +10,14 @@ import java.util.Map; import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.event.MouseEvents.ClickListener; +import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.embedded.EmbeddedConstants; import com.vaadin.shared.ui.embedded.EmbeddedServerRpc; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.Resource; import com.vaadin.terminal.Vaadin6Component; -import com.vaadin.terminal.gwt.client.ui.ClickEventHandler; -import com.vaadin.terminal.gwt.client.ui.embedded.EmbeddedConnector; /** * Component for embedding external objects. @@ -158,7 +158,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { target.addAttribute("archive", archive); } if (altText != null && !"".equals(altText)) { - target.addAttribute(EmbeddedConnector.ALTERNATE_TEXT, altText); + target.addAttribute(EmbeddedConstants.ALTERNATE_TEXT, altText); } // Params @@ -507,8 +507,8 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { * The listener to add */ public void addListener(ClickListener listener) { - addListener(ClickEventHandler.CLICK_EVENT_IDENTIFIER, ClickEvent.class, - listener, ClickListener.clickMethod); + addListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class, listener, + ClickListener.clickMethod); } /** @@ -519,8 +519,8 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { * The listener to remove */ public void removeListener(ClickListener listener) { - removeListener(ClickEventHandler.CLICK_EVENT_IDENTIFIER, - ClickEvent.class, listener); + removeListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class, + listener); } @Override diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java index 2391a9cd3a..49d4c26936 100644 --- a/server/src/com/vaadin/ui/GridLayout.java +++ b/server/src/com/vaadin/ui/GridLayout.java @@ -16,6 +16,7 @@ import com.vaadin.event.LayoutEvents.LayoutClickEvent; import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.event.LayoutEvents.LayoutClickNotifier; import com.vaadin.shared.Connector; +import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.gridlayout.GridLayoutServerRpc; import com.vaadin.shared.ui.gridlayout.GridLayoutState; @@ -23,7 +24,6 @@ import com.vaadin.terminal.LegacyPaint; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.Vaadin6Component; -import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler; /** * A layout where the components are laid out on a grid using cell coordinates. @@ -1401,14 +1401,14 @@ public class GridLayout extends AbstractLayout implements @Override public void addListener(LayoutClickListener listener) { - addListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER, + addListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener, LayoutClickListener.clickMethod); } @Override public void removeListener(LayoutClickListener listener) { - removeListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER, + removeListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener); } diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java index db7e5f9dd9..9a217f0c69 100644 --- a/server/src/com/vaadin/ui/LoginForm.java +++ b/server/src/com/vaadin/ui/LoginForm.java @@ -13,12 +13,12 @@ import java.util.Iterator; import java.util.Map; import com.vaadin.Application; +import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.ApplicationResource; import com.vaadin.terminal.DownloadStream; import com.vaadin.terminal.RequestHandler; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; -import com.vaadin.terminal.gwt.client.ApplicationConnection; /** * LoginForm is a Vaadin component to handle common problem among Ajax @@ -156,7 +156,7 @@ public class LoginForm extends CustomComponent { + " if (keycode == 13) {document.forms[0].submit();} } \n" + "" + "" + "

" + "