diff options
Diffstat (limited to 'shared')
77 files changed, 4353 insertions, 0 deletions
diff --git a/shared/src/com/vaadin/shared/AbstractFieldState.java b/shared/src/com/vaadin/shared/AbstractFieldState.java new file mode 100644 index 0000000000..0389507f6c --- /dev/null +++ b/shared/src/com/vaadin/shared/AbstractFieldState.java @@ -0,0 +1,151 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared; + +import com.vaadin.shared.ui.TabIndexState; + +/** + * Shared state for {@link com.vaadin.ui.AbstractField}. + * + * @author Vaadin Ltd + * @since 7.0.0 + * + */ +public class AbstractFieldState extends ComponentState implements TabIndexState { + private boolean propertyReadOnly = false; + private boolean hideErrors = false; + private boolean required = false; + private boolean modified = false; + + /** + * The tab order number of this field. + */ + private int tabIndex = 0; + + /** + * Checks if the property data source for the Field is in read only mode. + * This affects the read only state of the field itself. + * + * @return true if there is a property data source and it is set to read + * only, false otherwise + */ + public boolean isPropertyReadOnly() { + return propertyReadOnly; + } + + /** + * Sets the read only state of the property data source. + * + * @param propertyReadOnly + * true if the property data source if read only, false otherwise + */ + public void setPropertyReadOnly(boolean propertyReadOnly) { + this.propertyReadOnly = propertyReadOnly; + } + + /** + * Returns true if the component will hide any errors even if the error + * message is set. + * + * @return true if error messages are disabled + */ + public boolean isHideErrors() { + return hideErrors; + } + + /** + * Sets whether the component should hide any errors even if the error + * message is set. + * + * This is used e.g. on forms to hide error messages for invalid fields + * before the first user actions. + * + * @param hideErrors + * true if error messages should be hidden + */ + public void setHideErrors(boolean hideErrors) { + this.hideErrors = hideErrors; + } + + /** + * Is the field required. Required fields must filled by the user. + * + * See {@link com.vaadin.ui.AbstractField#isRequired()} for more + * information. + * + * @return <code>true</code> if the field is required, otherwise + * <code>false</code>. + */ + public boolean isRequired() { + return required; + } + + /** + * Sets the field required. Required fields must filled by the user. + * + * See {@link com.vaadin.ui.AbstractField#setRequired(boolean)} for more + * information. + * + * @param required + * Is the field required. + */ + public void setRequired(boolean required) { + this.required = required; + } + + /** + * Has the contents of the field been modified, i.e. has the value been + * updated after it was read from the data source. + * + * @return true if the field has been modified, false otherwise + */ + public boolean isModified() { + return modified; + } + + /** + * Setter for the modified flag, toggled when the contents of the field is + * modified by the user. + * + * @param modified + * the new modified state + * + */ + public void setModified(boolean modified) { + this.modified = modified; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.terminal.gwt.client.ComponentState#getTabIndex() + */ + @Override + public int getTabIndex() { + return tabIndex; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.terminal.gwt.client.ui.TabIndexState#setTabIndex(int) + */ + @Override + public void setTabIndex(int tabIndex) { + this.tabIndex = tabIndex; + } + +} diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java new file mode 100644 index 0000000000..31e633a210 --- /dev/null +++ b/shared/src/com/vaadin/shared/ApplicationConstants.java @@ -0,0 +1,50 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared; + +public class ApplicationConstants { + // 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 APP_REQUEST_PATH = "APP/"; + + public static final String UIDL_REQUEST_PATH = "UIDL/"; + + public static final String CONNECTOR_RESOURCE_PREFIX = APP_REQUEST_PATH + + "CONNECTOR"; + + public static final String APP_PROTOCOL_PREFIX = "app://"; + public static final String CONNECTOR_PROTOCOL_PREFIX = "connector://"; + 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"; + + public static final String PARAM_UNLOADBURST = "onunloadburst"; + + @Deprecated + public static final String UPDATE_VARIABLE_INTERFACE = "v"; + @Deprecated + public static final String UPDATE_VARIABLE_METHOD = "v"; + + public static final String PORTLET_RESOUCE_URL_BASE = "portletAppURLBase"; + + public static final String V_RESOURCE_PATH = "v-resourcePath"; + + @Deprecated + public static final String DRAG_AND_DROP_CONNECTOR_ID = "DD"; +} diff --git a/shared/src/com/vaadin/shared/ComponentState.java b/shared/src/com/vaadin/shared/ComponentState.java new file mode 100644 index 0000000000..92afad0520 --- /dev/null +++ b/shared/src/com/vaadin/shared/ComponentState.java @@ -0,0 +1,393 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.vaadin.shared.communication.SharedState; +import com.vaadin.shared.communication.URLReference; + +/** + * Default shared state implementation for UI components. + * + * State classes of concrete components should extend this class. + * + * @since 7.0 + */ +public class ComponentState extends SharedState { + private String height = ""; + private String width = ""; + private boolean readOnly = false; + private boolean immediate = false; + private String description = ""; + // Note: for the caption, there is a difference between null and an empty + // string! + private String caption = null; + private boolean visible = true; + private URLReference icon = null; + private List<String> styles = null; + private String debugId = null; + /** + * A set of event identifiers with registered listeners. + */ + private Set<String> registeredEventListeners = null; + + // HTML formatted error message for the component + // TODO this could be an object with more information, but currently the UI + // only uses the message + private String errorMessage = null; + + /** + * Returns the component height as set by the server. + * + * Can be relative (containing the percent sign) or absolute, or empty + * string for undefined height. + * + * @return component height as defined by the server, not null + */ + public String getHeight() { + if (height == null) { + return ""; + } + return height; + } + + /** + * Sets the height of the component in the server format. + * + * Can be relative (containing the percent sign) or absolute, or null or + * empty string for undefined height. + * + * @param height + * component height + */ + public void setHeight(String height) { + this.height = height; + } + + /** + * Returns true if the component height is undefined, false if defined + * (absolute or relative). + * + * @return true if component height is undefined + */ + public boolean isUndefinedHeight() { + return "".equals(getHeight()); + } + + /** + * Returns the component width as set by the server. + * + * Can be relative (containing the percent sign) or absolute, or empty + * string for undefined height. + * + * @return component width as defined by the server, not null + */ + public String getWidth() { + if (width == null) { + return ""; + } + return width; + } + + /** + * Sets the width of the component in the server format. + * + * Can be relative (containing the percent sign) or absolute, or null or + * empty string for undefined width. + * + * @param width + * component width + */ + public void setWidth(String width) { + this.width = width; + } + + /** + * Returns true if the component width is undefined, false if defined + * (absolute or relative). + * + * @return true if component width is undefined + */ + public boolean isUndefinedWidth() { + return "".equals(getWidth()); + } + + /** + * Returns true if the component is in read-only mode. + * + * @see com.vaadin.ui.Component#isReadOnly() + * + * @return true if the component is in read-only mode + */ + public boolean isReadOnly() { + return readOnly; + } + + /** + * Sets or resets the read-only mode for a component. + * + * @see com.vaadin.ui.Component#setReadOnly() + * + * @param readOnly + * new mode for the component + */ + public void setReadOnly(boolean readOnly) { + this.readOnly = readOnly; + } + + /** + * Returns true if the component is in immediate mode. + * + * @see com.vaadin.terminal.VariableOwner#isImmediate() + * + * @return true if the component is in immediate mode + */ + public boolean isImmediate() { + return immediate; + } + + /** + * Sets or resets the immediate mode for a component. + * + * @see com.vaadin.terminal.VariableOwner#setImmediate() + * + * @param immediate + * new mode for the component + */ + public void setImmediate(boolean immediate) { + this.immediate = immediate; + } + + /** + * Returns true if the component has user-defined styles. + * + * @return true if the component has user-defined styles + */ + public boolean hasStyles() { + return styles != null && !styles.isEmpty(); + } + + /** + * Gets the description of the component (typically shown as tooltip). + * + * @see com.vaadin.ui.AbstractComponent#getDescription() + * + * @return component description (not null, can be empty string) + */ + public String getDescription() { + return description; + } + + /** + * Sets the description of the component (typically shown as tooltip). + * + * @see com.vaadin.ui.AbstractComponent#setDescription(String) + * + * @param description + * new component description (can be null) + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Returns true if the component has a description. + * + * @return true if the component has a description + */ + public boolean hasDescription() { + return getDescription() != null && !"".equals(getDescription()); + } + + /** + * Gets the caption of the component (typically shown by the containing + * layout). + * + * @see com.vaadin.ui.Component#getCaption() + * + * @return component caption - can be null (no caption) or empty string + * (reserve space for an empty caption) + */ + public String getCaption() { + return caption; + } + + /** + * Sets the caption of the component (typically shown by the containing + * layout). + * + * @see com.vaadin.ui.Component#setCaption(String) + * + * @param caption + * new component caption - can be null (no caption) or empty + * string (reserve space for an empty caption) + */ + public void setCaption(String caption) { + this.caption = caption; + } + + /** + * Returns the visibility state of the component. Note that this state is + * related to the component only, not its parent. This might differ from + * what {@link com.vaadin.ui.Component#isVisible()} returns as this takes + * the hierarchy into account. + * + * @return The visibility state. + */ + public boolean isVisible() { + return visible; + } + + /** + * Sets the visibility state of the component. + * + * @param visible + * The new visibility state. + */ + public void setVisible(boolean visible) { + this.visible = visible; + } + + public URLReference getIcon() { + return icon; + } + + public void setIcon(URLReference icon) { + this.icon = icon; + } + + /** + * Gets the style names for the component. + * + * @return A List of style names or null if no styles have been set. + */ + public List<String> getStyles() { + return styles; + } + + /** + * Sets the style names for the component. + * + * @param styles + * A list containing style names + */ + public void setStyles(List<String> styles) { + this.styles = styles; + } + + /** + * Gets the debug id for the component. The debugId is added as DOM id for + * the component. + * + * @return The debug id for the component or null if not set + */ + public String getDebugId() { + return debugId; + } + + /** + * Sets the debug id for the component. The debugId is added as DOM id for + * the component. + * + * @param debugId + * The new debugId for the component or null for no debug id + * + */ + public void setDebugId(String debugId) { + this.debugId = debugId; + } + + /** + * Gets the identifiers for the event listeners that have been registered + * for the component (using an event id) + * + * @return A set of event identifiers or null if no identifiers have been + * registered + */ + public Set<String> getRegisteredEventListeners() { + return registeredEventListeners; + } + + /** + * Sets the identifiers for the event listeners that have been registered + * for the component (using an event id) + * + * @param registeredEventListeners + * The new set of identifiers or null if no identifiers have been + * registered + */ + public void setRegisteredEventListeners(Set<String> registeredEventListeners) { + this.registeredEventListeners = registeredEventListeners; + } + + /** + * Adds an event listener id. + * + * @param eventListenerId + * The event identifier to add + */ + public void addRegisteredEventListener(String eventListenerId) { + if (registeredEventListeners == null) { + registeredEventListeners = new HashSet<String>(); + } + registeredEventListeners.add(eventListenerId); + + } + + /** + * Removes an event listener id. + * + * @param eventListenerId + * The event identifier to remove + */ + public void removeRegisteredEventListener(String eventIdentifier) { + if (registeredEventListeners == null) { + return; + } + registeredEventListeners.remove(eventIdentifier); + if (registeredEventListeners.size() == 0) { + registeredEventListeners = null; + } + } + + /** + * Returns the current error message for the component. + * + * @return HTML formatted error message to show for the component or null if + * none + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Sets the current error message for the component. + * + * TODO this could use an object with more details about the error + * + * @param errorMessage + * HTML formatted error message to show for the component or null + * for none + */ + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + +} diff --git a/shared/src/com/vaadin/shared/Connector.java b/shared/src/com/vaadin/shared/Connector.java new file mode 100644 index 0000000000..5a00f6cca2 --- /dev/null +++ b/shared/src/com/vaadin/shared/Connector.java @@ -0,0 +1,68 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared; + +import java.io.Serializable; + +import com.vaadin.shared.communication.SharedState; + +/** + * Interface implemented by all classes that are capable of communicating with + * the server or the client side. + * <p> + * A connector consists of a shared state (server sets the state and + * automatically communicates changes to the client) and the possibility to do + * RPC calls either from the server to the client or from the client to the + * server. + * </p> + * <p> + * No classes should implement this interface directly, client side classes + * wanting to communicate with server side should implement + * {@link com.vaadin.terminal.gwt.client.ServerConnector} and server side + * classes should implement + * {@link com.vaadin.terminal.gwt.server.ClientConnector}. + * </p> + * + * @author Vaadin Ltd + * @since 7.0.0 + */ +public interface Connector extends Serializable { + /** + * Gets the current shared state of the connector. + * + * @since 7.0. + * @return state The shared state object. Can be any sub type of + * {@link SharedState}. Never null. + */ + public SharedState getState(); + + /** + * Returns the id for this connector. This is set by the framework and does + * not change during the lifetime of a connector. + * + * @return The id for the connector. + */ + public String getConnectorId(); + + /** + * Gets the parent connector of this connector, or <code>null</code> if the + * connector is not attached to any parent. + * + * @return the parent connector, or <code>null</code> if there is no parent. + */ + public Connector getParent(); + +} diff --git a/shared/src/com/vaadin/shared/EventId.java b/shared/src/com/vaadin/shared/EventId.java new file mode 100644 index 0000000000..47ecd9f6aa --- /dev/null +++ b/shared/src/com/vaadin/shared/EventId.java @@ -0,0 +1,24 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared; + +public interface EventId { + public static final String BLUR = "blur"; + public static final String FOCUS = "focus"; + public static final String CLICK_EVENT_IDENTIFIER = "click"; + public static final String LAYOUT_CLICK_EVENT_IDENTIFIER = "lClick"; + +} diff --git a/shared/src/com/vaadin/shared/JavaScriptConnectorState.java b/shared/src/com/vaadin/shared/JavaScriptConnectorState.java new file mode 100644 index 0000000000..d2e606d1c6 --- /dev/null +++ b/shared/src/com/vaadin/shared/JavaScriptConnectorState.java @@ -0,0 +1,26 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared; + +import java.util.Map; +import java.util.Set; + +public interface JavaScriptConnectorState { + public Set<String> getCallbackNames(); + + public Map<String, Set<String>> getRpcInterfaces(); +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/JavaScriptExtensionState.java b/shared/src/com/vaadin/shared/JavaScriptExtensionState.java new file mode 100644 index 0000000000..3e97294f7d --- /dev/null +++ b/shared/src/com/vaadin/shared/JavaScriptExtensionState.java @@ -0,0 +1,49 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import com.vaadin.shared.communication.SharedState; + +public class JavaScriptExtensionState extends SharedState implements + JavaScriptConnectorState { + + private Set<String> callbackNames = new HashSet<String>(); + private Map<String, Set<String>> rpcInterfaces = new HashMap<String, Set<String>>(); + + @Override + public Set<String> getCallbackNames() { + return callbackNames; + } + + public void setCallbackNames(Set<String> callbackNames) { + this.callbackNames = callbackNames; + } + + @Override + public Map<String, Set<String>> getRpcInterfaces() { + return rpcInterfaces; + } + + public void setRpcInterfaces(Map<String, Set<String>> rpcInterfaces) { + this.rpcInterfaces = rpcInterfaces; + } +} diff --git a/shared/src/com/vaadin/shared/JsonConstants.java b/shared/src/com/vaadin/shared/JsonConstants.java new file mode 100644 index 0000000000..053b669583 --- /dev/null +++ b/shared/src/com/vaadin/shared/JsonConstants.java @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared; + +public class JsonConstants { + 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"; + +} diff --git a/shared/src/com/vaadin/shared/MouseEventDetails.java b/shared/src/com/vaadin/shared/MouseEventDetails.java new file mode 100644 index 0000000000..ccfaac3a00 --- /dev/null +++ b/shared/src/com/vaadin/shared/MouseEventDetails.java @@ -0,0 +1,171 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared; + +import java.io.Serializable; + +/** + * Helper class to store and transfer mouse event details. + */ +public class MouseEventDetails implements Serializable { + // From com.google.gwt.dom.client.NativeEvent + public static final int BUTTON_LEFT = 1; + public static final int BUTTON_MIDDLE = 4; + public static final int BUTTON_RIGHT = 2; + + private static final char DELIM = ','; + // From com.google.gwt.user.client.Event + private static final int ONDBLCLICK = 0x00002; + + private int button; + private int clientX; + private int clientY; + private boolean altKey; + private boolean ctrlKey; + private boolean metaKey; + private boolean shiftKey; + private int type; + private int relativeX = -1; + private int relativeY = -1; + + public int getButton() { + return button; + } + + public int getClientX() { + return clientX; + } + + public int getClientY() { + return clientY; + } + + public boolean isAltKey() { + return altKey; + } + + public boolean isCtrlKey() { + return ctrlKey; + } + + public boolean isMetaKey() { + return metaKey; + } + + public boolean isShiftKey() { + return shiftKey; + } + + public int getRelativeX() { + return relativeX; + } + + public int getRelativeY() { + return relativeY; + } + + public void setButton(int button) { + this.button = button; + } + + public void setClientX(int clientX) { + this.clientX = clientX; + } + + public void setClientY(int clientY) { + this.clientY = clientY; + } + + public void setAltKey(boolean altKey) { + this.altKey = altKey; + } + + public void setCtrlKey(boolean ctrlKey) { + this.ctrlKey = ctrlKey; + } + + public void setMetaKey(boolean metaKey) { + this.metaKey = metaKey; + } + + public void setShiftKey(boolean shiftKey) { + this.shiftKey = shiftKey; + } + + public void setType(int type) { + this.type = type; + } + + public void setRelativeX(int relativeX) { + this.relativeX = relativeX; + } + + public void setRelativeY(int relativeY) { + this.relativeY = relativeY; + } + + public MouseEventDetails() { + } + + @Override + public String toString() { + return serialize(); + } + + public String serialize() { + return "" + button + DELIM + clientX + DELIM + clientY + DELIM + altKey + + DELIM + ctrlKey + DELIM + metaKey + DELIM + shiftKey + DELIM + + type + DELIM + relativeX + DELIM + relativeY; + } + + public static MouseEventDetails deSerialize(String serializedString) { + MouseEventDetails instance = new MouseEventDetails(); + String[] fields = serializedString.split(","); + + instance.button = Integer.parseInt(fields[0]); + instance.clientX = Integer.parseInt(fields[1]); + instance.clientY = Integer.parseInt(fields[2]); + instance.altKey = Boolean.valueOf(fields[3]).booleanValue(); + instance.ctrlKey = Boolean.valueOf(fields[4]).booleanValue(); + instance.metaKey = Boolean.valueOf(fields[5]).booleanValue(); + instance.shiftKey = Boolean.valueOf(fields[6]).booleanValue(); + instance.type = Integer.parseInt(fields[7]); + instance.relativeX = Integer.parseInt(fields[8]); + instance.relativeY = Integer.parseInt(fields[9]); + return instance; + } + + public String getButtonName() { + if (button == BUTTON_LEFT) { + return "left"; + } else if (button == BUTTON_RIGHT) { + return "right"; + } else if (button == BUTTON_MIDDLE) { + return "middle"; + } + + return ""; + } + + public int getType() { + return type; + } + + public boolean isDoubleClick() { + return type == ONDBLCLICK; + } + +} diff --git a/shared/src/com/vaadin/shared/VBrowserDetails.java b/shared/src/com/vaadin/shared/VBrowserDetails.java new file mode 100644 index 0000000000..7646d2ba01 --- /dev/null +++ b/shared/src/com/vaadin/shared/VBrowserDetails.java @@ -0,0 +1,476 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared; + +import java.io.Serializable; + +/** + * Class that parses the user agent string from the browser and provides + * information about the browser. Used internally by + * {@link com.vaadin.terminal.gwt.client.BrowserInfo} and + * {@link com.vaadin.terminal.gwt.server.WebBrowser}. Should not be used + * directly. + * + * @author Vaadin Ltd. + * @since 6.3 + */ +public class VBrowserDetails implements Serializable { + + private boolean isGecko = false; + private boolean isWebKit = false; + private boolean isPresto = false; + + private boolean isChromeFrameCapable = false; + private boolean isChromeFrame = false; + + private boolean isSafari = false; + private boolean isChrome = false; + private boolean isFirefox = false; + private boolean isOpera = false; + private boolean isIE = false; + + private OperatingSystem os = OperatingSystem.UNKNOWN; + + public enum OperatingSystem { + UNKNOWN, WINDOWS, MACOSX, LINUX, IOS, ANDROID; + } + + private float browserEngineVersion = -1; + private int browserMajorVersion = -1; + private int browserMinorVersion = -1; + + private int osMajorVersion = -1; + private int osMinorVersion = -1; + + /** + * Create an instance based on the given user agent. + * + * @param userAgent + * User agent as provided by the browser. + */ + public VBrowserDetails(String userAgent) { + userAgent = userAgent.toLowerCase(); + + // browser engine name + isGecko = userAgent.indexOf("gecko") != -1 + && userAgent.indexOf("webkit") == -1; + isWebKit = userAgent.indexOf("applewebkit") != -1; + isPresto = userAgent.indexOf(" presto/") != -1; + + // browser name + isChrome = userAgent.indexOf(" chrome/") != -1; + isSafari = !isChrome && userAgent.indexOf("safari") != -1; + isOpera = userAgent.indexOf("opera") != -1; + isIE = userAgent.indexOf("msie") != -1 && !isOpera + && (userAgent.indexOf("webtv") == -1); + isFirefox = userAgent.indexOf(" firefox/") != -1; + + // chromeframe + isChromeFrameCapable = userAgent.indexOf("chromeframe") != -1; + isChromeFrame = isChromeFrameCapable && !isChrome; + + // Rendering engine version + try { + if (isGecko) { + int rvPos = userAgent.indexOf("rv:"); + if (rvPos >= 0) { + String tmp = userAgent.substring(rvPos + 3); + tmp = tmp.replaceFirst("(\\.[0-9]+).+", "$1"); + browserEngineVersion = Float.parseFloat(tmp); + } + } else if (isWebKit) { + String tmp = userAgent + .substring(userAgent.indexOf("webkit/") + 7); + tmp = tmp.replaceFirst("([0-9]+)[^0-9].+", "$1"); + browserEngineVersion = Float.parseFloat(tmp); + } + } catch (Exception e) { + // Browser engine version parsing failed + System.err.println("Browser engine version parsing failed for: " + + userAgent); + } + + // Browser version + try { + if (isIE) { + String ieVersionString = userAgent.substring(userAgent + .indexOf("msie ") + 5); + ieVersionString = safeSubstring(ieVersionString, 0, + ieVersionString.indexOf(";")); + parseVersionString(ieVersionString); + } else if (isFirefox) { + int i = userAgent.indexOf(" firefox/") + 9; + parseVersionString(safeSubstring(userAgent, i, i + 5)); + } else if (isChrome) { + int i = userAgent.indexOf(" chrome/") + 8; + parseVersionString(safeSubstring(userAgent, i, i + 5)); + } else if (isSafari) { + int i = userAgent.indexOf(" version/") + 9; + parseVersionString(safeSubstring(userAgent, i, i + 5)); + } else if (isOpera) { + int i = userAgent.indexOf(" version/"); + if (i != -1) { + // Version present in Opera 10 and newer + i += 9; // " version/".length + } else { + i = userAgent.indexOf("opera/") + 6; + } + parseVersionString(safeSubstring(userAgent, i, i + 5)); + } + } catch (Exception e) { + // Browser version parsing failed + System.err.println("Browser version parsing failed for: " + + userAgent); + } + + // Operating system + if (userAgent.contains("windows ")) { + os = OperatingSystem.WINDOWS; + } else if (userAgent.contains("linux")) { + if (userAgent.contains("android")) { + os = OperatingSystem.ANDROID; + parseAndroidVersion(userAgent); + } else { + os = OperatingSystem.LINUX; + + } + } else if (userAgent.contains("macintosh") + || userAgent.contains("mac osx") + || userAgent.contains("mac os x")) { + if (userAgent.contains("ipad") || userAgent.contains("ipod") + || userAgent.contains("iphone")) { + os = OperatingSystem.IOS; + parseIOSVersion(userAgent); + } else { + os = OperatingSystem.MACOSX; + } + } + } + + private void parseAndroidVersion(String userAgent) { + // Android 5.1; + if (!userAgent.contains("android")) { + return; + } + + String osVersionString = safeSubstring(userAgent, + userAgent.indexOf("android ") + "android ".length(), + userAgent.length()); + osVersionString = safeSubstring(osVersionString, 0, + osVersionString.indexOf(";")); + String[] parts = osVersionString.split("\\."); + parseOsVersion(parts); + } + + private void parseIOSVersion(String userAgent) { + // OS 5_1 like Mac OS X + if (!userAgent.contains("os ") || !userAgent.contains(" like mac")) { + return; + } + + String osVersionString = safeSubstring(userAgent, + userAgent.indexOf("os ") + 3, userAgent.indexOf(" like mac")); + String[] parts = osVersionString.split("_"); + parseOsVersion(parts); + } + + private void parseOsVersion(String[] parts) { + osMajorVersion = -1; + osMinorVersion = -1; + + if (parts.length >= 1) { + try { + osMajorVersion = Integer.parseInt(parts[0]); + } catch (Exception e) { + } + } + if (parts.length >= 2) { + try { + osMinorVersion = Integer.parseInt(parts[1]); + } catch (Exception e) { + } + // Some Androids report version numbers as "2.1-update1" + if (osMinorVersion == -1 && parts[1].contains("-")) { + try { + osMinorVersion = Integer.parseInt(parts[1].substring(0, + parts[1].indexOf('-'))); + } catch (Exception ee) { + } + } + } + + } + + private void parseVersionString(String versionString) { + int idx = versionString.indexOf('.'); + if (idx < 0) { + idx = versionString.length(); + } + browserMajorVersion = Integer.parseInt(safeSubstring(versionString, 0, + idx)); + + int idx2 = versionString.indexOf('.', idx + 1); + if (idx2 < 0) { + idx2 = versionString.length(); + } + try { + browserMinorVersion = Integer.parseInt(safeSubstring(versionString, + idx + 1, idx2).replaceAll("[^0-9].*", "")); + } catch (NumberFormatException e) { + // leave the minor version unmodified (-1 = unknown) + } + } + + private String safeSubstring(String string, int beginIndex, int endIndex) { + if (beginIndex < 0) { + beginIndex = 0; + } + if (endIndex < 0 || endIndex > string.length()) { + endIndex = string.length(); + } + return string.substring(beginIndex, endIndex); + } + + /** + * Tests if the browser is Firefox. + * + * @return true if it is Firefox, false otherwise + */ + public boolean isFirefox() { + return isFirefox; + } + + /** + * Tests if the browser is using the Gecko engine + * + * @return true if it is Gecko, false otherwise + */ + public boolean isGecko() { + return isGecko; + } + + /** + * Tests if the browser is using the WebKit engine + * + * @return true if it is WebKit, false otherwise + */ + public boolean isWebKit() { + return isWebKit; + } + + /** + * Tests if the browser is using the Presto engine + * + * @return true if it is Presto, false otherwise + */ + public boolean isPresto() { + return isPresto; + } + + /** + * Tests if the browser is Safari. + * + * @return true if it is Safari, false otherwise + */ + public boolean isSafari() { + return isSafari; + } + + /** + * Tests if the browser is Chrome. + * + * @return true if it is Chrome, false otherwise + */ + public boolean isChrome() { + return isChrome; + } + + /** + * Tests if the browser is capable of running ChromeFrame. + * + * @return true if it has ChromeFrame, false otherwise + */ + public boolean isChromeFrameCapable() { + return isChromeFrameCapable; + } + + /** + * Tests if the browser is running ChromeFrame. + * + * @return true if it is ChromeFrame, false otherwise + */ + public boolean isChromeFrame() { + return isChromeFrame; + } + + /** + * Tests if the browser is Opera. + * + * @return true if it is Opera, false otherwise + */ + public boolean isOpera() { + return isOpera; + } + + /** + * Tests if the browser is Internet Explorer. + * + * @return true if it is Internet Explorer, false otherwise + */ + public boolean isIE() { + return isIE; + } + + /** + * Returns the version of the browser engine. For WebKit this is an integer + * e.g., 532.0. For gecko it is a float e.g., 1.8 or 1.9. + * + * @return The version of the browser engine + */ + public float getBrowserEngineVersion() { + return browserEngineVersion; + } + + /** + * Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome + * 4, 8 for Internet Explorer 8. + * <p> + * Note that Internet Explorer 8 and newer will return the document mode so + * IE8 rendering as IE7 will return 7. + * </p> + * + * @return The major version of the browser. + */ + public final int getBrowserMajorVersion() { + return browserMajorVersion; + } + + /** + * Returns the browser minor version e.g., 5 for Firefox 3.5. + * + * @see #getBrowserMajorVersion() + * + * @return The minor version of the browser, or -1 if not known/parsed. + */ + public final int getBrowserMinorVersion() { + return browserMinorVersion; + } + + /** + * Sets the version for IE based on the documentMode. This is used to return + * the correct the correct IE version when the version from the user agent + * string and the value of the documentMode property do not match. + * + * @param documentMode + * The current document mode + */ + public void setIEMode(int documentMode) { + browserMajorVersion = documentMode; + browserMinorVersion = 0; + } + + /** + * Tests if the browser is run on Windows. + * + * @return true if run on Windows, false otherwise + */ + public boolean isWindows() { + return os == OperatingSystem.WINDOWS; + } + + /** + * Tests if the browser is run on Mac OSX. + * + * @return true if run on Mac OSX, false otherwise + */ + public boolean isMacOSX() { + return os == OperatingSystem.MACOSX; + } + + /** + * Tests if the browser is run on Linux. + * + * @return true if run on Linux, false otherwise + */ + public boolean isLinux() { + return os == OperatingSystem.LINUX; + } + + /** + * Tests if the browser is run on Android. + * + * @return true if run on Android, false otherwise + */ + public boolean isAndroid() { + return os == OperatingSystem.ANDROID; + } + + /** + * Tests if the browser is run in iOS. + * + * @return true if run in iOS, false otherwise + */ + public boolean isIOS() { + return os == OperatingSystem.IOS; + } + + /** + * Returns the major version of the operating system. Currently only + * supported for mobile devices (iOS/Android) + * + * @return The major version or -1 if unknown + */ + public int getOperatingSystemMajorVersion() { + return osMajorVersion; + } + + /** + * Returns the minor version of the operating system. Currently only + * supported for mobile devices (iOS/Android) + * + * @return The minor version or -1 if unknown + */ + public int getOperatingSystemMinorVersion() { + return osMinorVersion; + } + + /** + * Checks if the browser is so old that it simply won't work with a Vaadin + * application. NOTE that the browser might still be capable of running + * Crome Frame, so you might still want to check + * {@link #isChromeFrameCapable()} if this returns true. + * + * @return true if the browser won't work, false if not the browser is + * supported or might work + */ + public boolean isTooOldToFunctionProperly() { + if (isIE() && getBrowserMajorVersion() < 8) { + return true; + } + if (isSafari() && getBrowserMajorVersion() < 5) { + return true; + } + if (isFirefox() && getBrowserMajorVersion() < 4) { + return true; + } + if (isOpera() && getBrowserMajorVersion() < 11) { + return true; + } + + return false; + } + +} diff --git a/shared/src/com/vaadin/shared/Version.java b/shared/src/com/vaadin/shared/Version.java new file mode 100644 index 0000000000..9320698318 --- /dev/null +++ b/shared/src/com/vaadin/shared/Version.java @@ -0,0 +1,86 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared; + +import java.io.Serializable; + +public class Version implements Serializable { + /** + * The version number of this release. For example "6.2.0". Always in the + * format "major.minor.revision[.build]". The build part is optional. All of + * major, minor, revision must be integers. + */ + private static final String VERSION; + /** + * Major version number. For example 6 in 6.2.0. + */ + private static final int VERSION_MAJOR; + + /** + * Minor version number. For example 2 in 6.2.0. + */ + private static final int VERSION_MINOR; + + /** + * Version revision number. For example 0 in 6.2.0. + */ + private static final int VERSION_REVISION; + + /** + * Build identifier. For example "nightly-20091123-c9963" in + * 6.2.0.nightly-20091123-c9963. + */ + private static final String VERSION_BUILD; + + /* Initialize version numbers from string replaced by build-script. */ + static { + if ("7.0.0.dev-20120816-12".equals("@" + "VERSION" + "@")) { + VERSION = "9.9.9.INTERNAL-DEBUG-BUILD"; + } else { + VERSION = "7.0.0.dev-20120816-12"; + } + final String[] digits = VERSION.split("\\.", 4); + VERSION_MAJOR = Integer.parseInt(digits[0]); + VERSION_MINOR = Integer.parseInt(digits[1]); + VERSION_REVISION = Integer.parseInt(digits[2]); + if (digits.length == 4) { + VERSION_BUILD = digits[3]; + } else { + VERSION_BUILD = ""; + } + } + + public static String getFullVersion() { + return VERSION; + } + + public static int getMajorVersion() { + return VERSION_MAJOR; + } + + public static int getMinorVersion() { + return VERSION_MINOR; + } + + public static int getRevision() { + return VERSION_REVISION; + } + + public static String getBuildIdentifier() { + return VERSION_BUILD; + } + +} diff --git a/shared/src/com/vaadin/shared/communication/ClientRpc.java b/shared/src/com/vaadin/shared/communication/ClientRpc.java new file mode 100644 index 0000000000..7096cba342 --- /dev/null +++ b/shared/src/com/vaadin/shared/communication/ClientRpc.java @@ -0,0 +1,35 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.communication; + +import java.io.Serializable; + +/** + * Interface to be extended by all server to client RPC interfaces. + * + * On the server side, proxies of the interface can be obtained from + * AbstractComponent. On the client, RPC implementations can be registered with + * AbstractConnector.registerRpc(). + * + * Note: Currently, each RPC interface may not contain multiple methods with the + * same name, even if their parameter lists would differ. + * + * @since 7.0 + */ +public interface ClientRpc extends Serializable { + +} diff --git a/shared/src/com/vaadin/shared/communication/FieldRpc.java b/shared/src/com/vaadin/shared/communication/FieldRpc.java new file mode 100644 index 0000000000..5e87975d63 --- /dev/null +++ b/shared/src/com/vaadin/shared/communication/FieldRpc.java @@ -0,0 +1,31 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.communication; + +public class FieldRpc { + public interface FocusServerRpc extends ServerRpc { + public void focus(); + } + + public interface BlurServerRpc extends ServerRpc { + public void blur(); + } + + public interface FocusAndBlurServerRpc extends FocusServerRpc, + BlurServerRpc { + + } +} diff --git a/shared/src/com/vaadin/shared/communication/MethodInvocation.java b/shared/src/com/vaadin/shared/communication/MethodInvocation.java new file mode 100644 index 0000000000..720ce09fcb --- /dev/null +++ b/shared/src/com/vaadin/shared/communication/MethodInvocation.java @@ -0,0 +1,74 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.communication; + +import java.io.Serializable; +import java.util.Arrays; + +/** + * Information needed by the framework to send an RPC method invocation from the + * client to the server or vice versa. + * + * @since 7.0 + */ +public class MethodInvocation implements Serializable { + + private final String connectorId; + private final String interfaceName; + private final String methodName; + private Object[] parameters; + + public MethodInvocation(String connectorId, String interfaceName, + String methodName) { + this.connectorId = connectorId; + this.interfaceName = interfaceName; + this.methodName = methodName; + } + + public MethodInvocation(String connectorId, String interfaceName, + String methodName, Object[] parameters) { + this(connectorId, interfaceName, methodName); + setParameters(parameters); + } + + public String getConnectorId() { + return connectorId; + } + + public String getInterfaceName() { + return interfaceName; + } + + public String getMethodName() { + return methodName; + } + + public Object[] getParameters() { + return parameters; + } + + public void setParameters(Object[] parameters) { + this.parameters = parameters; + } + + @Override + public String toString() { + return connectorId + ":" + interfaceName + "." + methodName + "(" + + Arrays.toString(parameters) + ")"; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/communication/ServerRpc.java b/shared/src/com/vaadin/shared/communication/ServerRpc.java new file mode 100644 index 0000000000..9e438f96b0 --- /dev/null +++ b/shared/src/com/vaadin/shared/communication/ServerRpc.java @@ -0,0 +1,27 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.communication; + +import java.io.Serializable; + +/** + * Interface to be extended by all client to server RPC interfaces. + * + * @since 7.0 + */ +public interface ServerRpc extends Serializable { +} diff --git a/shared/src/com/vaadin/shared/communication/SharedState.java b/shared/src/com/vaadin/shared/communication/SharedState.java new file mode 100644 index 0000000000..841e4579a2 --- /dev/null +++ b/shared/src/com/vaadin/shared/communication/SharedState.java @@ -0,0 +1,76 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.communication; + +import java.io.Serializable; + +import com.vaadin.shared.Connector; + +/** + * Interface to be implemented by all shared state classes used to communicate + * basic information about a {@link Connector} from server to client. + * + * Shared state classes have to be declared in shared package to be accessible + * both for server and client code. + * + * Shared state objects are only sent from the server to the client, and any + * modifications from the client should be performed via an RPC call that + * modifies the authoritative state on the server. + * + * A shared state class should be a bean with getters and setters for each + * field. Supported data types are simple Java types, other beans and maps and + * arrays of these. + * + * On the client side the connector should override + * {@link com.vaadin.terminal.gwt.client.ui.AbstractConnector#getState()} to + * return the correct state type. This automatically causes a correct state + * object to be created. + * + * Subclasses of a {@link Connector} using shared state should also provide a + * subclass of the shared state class of the parent class to extend the state. A + * single {@link Connector} can only have one shared state object. + * + * @since 7.0 + */ +public class SharedState implements Serializable { + + private boolean enabled = true; + + /** + * Returns true if the component is enabled. + * + * @see com.vaadin.ui.Component#isEnabled() + * + * @return true if the component is enabled + */ + public boolean isEnabled() { + return enabled; + } + + /** + * Enables or disables the component. + * + * @see com.vaadin.ui.Component#setEnabled(boolean) + * + * @param enabled + * new mode for the component + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + +} diff --git a/shared/src/com/vaadin/shared/communication/URLReference.java b/shared/src/com/vaadin/shared/communication/URLReference.java new file mode 100644 index 0000000000..4f04dba4e6 --- /dev/null +++ b/shared/src/com/vaadin/shared/communication/URLReference.java @@ -0,0 +1,43 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.communication; + +import java.io.Serializable; + +public class URLReference implements Serializable { + + private String URL; + + /** + * Returns the URL that this object refers to. + * <p> + * Note that the URL can use special protocols like theme:// + * + * @return The URL for this reference or null if unknown. + */ + public String getURL() { + return URL; + } + + /** + * Sets the URL that this object refers to + * + * @param URL + */ + public void setURL(String URL) { + this.URL = URL; + } +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/communication/UidlValue.java b/shared/src/com/vaadin/shared/communication/UidlValue.java new file mode 100644 index 0000000000..cc6ddc181e --- /dev/null +++ b/shared/src/com/vaadin/shared/communication/UidlValue.java @@ -0,0 +1,37 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.communication; + +import java.io.Serializable; + +public class UidlValue implements Serializable { + private Object value; + + public UidlValue(Object value) { + this.value = value; + } + + public Object getValue() { + return value; + } + + @Override + public String toString() { + return "" + value; + } + +} diff --git a/shared/src/com/vaadin/shared/extension/javascriptmanager/ExecuteJavaScriptRpc.java b/shared/src/com/vaadin/shared/extension/javascriptmanager/ExecuteJavaScriptRpc.java new file mode 100644 index 0000000000..33c4c83667 --- /dev/null +++ b/shared/src/com/vaadin/shared/extension/javascriptmanager/ExecuteJavaScriptRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.extension.javascriptmanager; + +import com.vaadin.shared.communication.ClientRpc; + +public interface ExecuteJavaScriptRpc extends ClientRpc { + public void executeJavaScript(String script); +} diff --git a/shared/src/com/vaadin/shared/extension/javascriptmanager/JavaScriptManagerState.java b/shared/src/com/vaadin/shared/extension/javascriptmanager/JavaScriptManagerState.java new file mode 100644 index 0000000000..7d1938d735 --- /dev/null +++ b/shared/src/com/vaadin/shared/extension/javascriptmanager/JavaScriptManagerState.java @@ -0,0 +1,34 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.extension.javascriptmanager; + +import java.util.HashSet; +import java.util.Set; + +import com.vaadin.shared.communication.SharedState; + +public class JavaScriptManagerState extends SharedState { + private Set<String> names = new HashSet<String>(); + + public Set<String> getNames() { + return names; + } + + public void setNames(Set<String> names) { + this.names = names; + } +} diff --git a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java new file mode 100644 index 0000000000..675d11d0b7 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java @@ -0,0 +1,31 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui; + +import com.vaadin.shared.ComponentState; + +public class AbstractLayoutState extends ComponentState { + private int marginsBitmask; + + public int getMarginsBitmask() { + return marginsBitmask; + } + + public void setMarginsBitmask(int marginsBitmask) { + this.marginsBitmask = marginsBitmask; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java new file mode 100644 index 0000000000..2731529caf --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java @@ -0,0 +1,94 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui; + +import java.util.ArrayList; +import java.util.List; + +import com.vaadin.shared.ComponentState; +import com.vaadin.shared.communication.URLReference; + +public class AbstractMediaState extends ComponentState { + private boolean showControls; + + private String altText; + + private boolean htmlContentAllowed; + + private boolean autoplay; + + private boolean muted; + + private List<URLReference> sources = new ArrayList<URLReference>(); + private List<String> sourceTypes = new ArrayList<String>(); + + public boolean isShowControls() { + return showControls; + } + + public void setShowControls(boolean showControls) { + this.showControls = showControls; + } + + public String getAltText() { + return altText; + } + + public void setAltText(String altText) { + this.altText = altText; + } + + public boolean isHtmlContentAllowed() { + return htmlContentAllowed; + } + + public void setHtmlContentAllowed(boolean htmlContentAllowed) { + this.htmlContentAllowed = htmlContentAllowed; + } + + public boolean isAutoplay() { + return autoplay; + } + + public void setAutoplay(boolean autoplay) { + this.autoplay = autoplay; + } + + public boolean isMuted() { + return muted; + } + + public void setMuted(boolean muted) { + this.muted = muted; + } + + public List<URLReference> getSources() { + return sources; + } + + public void setSources(List<URLReference> sources) { + this.sources = sources; + } + + public List<String> getSourceTypes() { + return sourceTypes; + } + + public void setSourceTypes(List<String> sourceTypes) { + this.sourceTypes = sourceTypes; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/AlignmentInfo.java b/shared/src/com/vaadin/shared/ui/AlignmentInfo.java new file mode 100644 index 0000000000..ba926b8d46 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/AlignmentInfo.java @@ -0,0 +1,101 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.ui; + +public final class AlignmentInfo { + /** Bitmask values for client server communication */ + public static class Bits { + public static final int ALIGNMENT_LEFT = 1; + public static final int ALIGNMENT_RIGHT = 2; + public static final int ALIGNMENT_TOP = 4; + public static final int ALIGNMENT_BOTTOM = 8; + public static final int ALIGNMENT_HORIZONTAL_CENTER = 16; + public static final int ALIGNMENT_VERTICAL_CENTER = 32; + } + + public static final AlignmentInfo LEFT = new AlignmentInfo( + Bits.ALIGNMENT_LEFT); + public static final AlignmentInfo RIGHT = new AlignmentInfo( + Bits.ALIGNMENT_RIGHT); + public static final AlignmentInfo TOP = new AlignmentInfo( + Bits.ALIGNMENT_TOP); + public static final AlignmentInfo BOTTOM = new AlignmentInfo( + Bits.ALIGNMENT_BOTTOM); + public static final AlignmentInfo CENTER = new AlignmentInfo( + Bits.ALIGNMENT_HORIZONTAL_CENTER); + public static final AlignmentInfo MIDDLE = new AlignmentInfo( + Bits.ALIGNMENT_VERTICAL_CENTER); + public static final AlignmentInfo TOP_LEFT = new AlignmentInfo( + Bits.ALIGNMENT_TOP + Bits.ALIGNMENT_LEFT); + + private final int bitMask; + + public AlignmentInfo(int bitMask) { + this.bitMask = bitMask; + } + + public AlignmentInfo(AlignmentInfo horizontal, AlignmentInfo vertical) { + this(horizontal.getBitMask() + vertical.getBitMask()); + } + + public int getBitMask() { + return bitMask; + } + + public boolean isTop() { + return (bitMask & Bits.ALIGNMENT_TOP) == Bits.ALIGNMENT_TOP; + } + + public boolean isBottom() { + return (bitMask & Bits.ALIGNMENT_BOTTOM) == Bits.ALIGNMENT_BOTTOM; + } + + public boolean isLeft() { + return (bitMask & Bits.ALIGNMENT_LEFT) == Bits.ALIGNMENT_LEFT; + } + + public boolean isRight() { + return (bitMask & Bits.ALIGNMENT_RIGHT) == Bits.ALIGNMENT_RIGHT; + } + + public boolean isVerticalCenter() { + return (bitMask & Bits.ALIGNMENT_VERTICAL_CENTER) == Bits.ALIGNMENT_VERTICAL_CENTER; + } + + public boolean isHorizontalCenter() { + return (bitMask & Bits.ALIGNMENT_HORIZONTAL_CENTER) == Bits.ALIGNMENT_HORIZONTAL_CENTER; + } + + public String getVerticalAlignment() { + if (isBottom()) { + return "bottom"; + } else if (isVerticalCenter()) { + return "middle"; + } + return "top"; + } + + public String getHorizontalAlignment() { + if (isRight()) { + return "right"; + } else if (isHorizontalCenter()) { + return "center"; + } + return "left"; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/ClickRpc.java b/shared/src/com/vaadin/shared/ui/ClickRpc.java new file mode 100644 index 0000000000..048bb06035 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/ClickRpc.java @@ -0,0 +1,30 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; + +public interface ClickRpc extends ServerRpc { + /** + * Called when a click event has occurred and there are server side + * listeners for the event. + * + * @param mouseDetails + * Details about the mouse when the event took place + */ + public void click(MouseEventDetails mouseDetails); +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/Connect.java b/shared/src/com/vaadin/shared/ui/Connect.java new file mode 100644 index 0000000000..d54374a0ec --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/Connect.java @@ -0,0 +1,105 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import com.vaadin.shared.Connector; + +/** + * Annotation defining the server side connector that this ClientSideConnector + * should connect to. The value must always by a class extending + * {@link com.vaadin.terminal.gwt.server.ClientConnector}. + * <p> + * With this annotation client side Vaadin connector is marked to have a server + * side counterpart. The value of the annotation is the class of server side + * implementation. + * + * @since 7.0 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Connect { + + /** + * @return the server side counterpart for the annotated component connector + */ + Class<? extends Connector> value(); + + /** + * Depending on the used WidgetMap generator, these optional hints may be + * used to define how the client side components are loaded by the browser. + * The default is to eagerly load all widgets + * {@link com.vaadin.terminal.gwt.widgetsetutils.EagerWidgetMapGenerator}, + * but if the + * {@link com.vaadin.terminal.gwt.widgetsetutils.WidgetMapGenerator} is used + * by the widgetset, these load style hints are respected. + * <p> + * Lazy loading of a widget implementation means the client side component + * is not included in the initial JavaScript application loaded when the + * application starts. Instead the implementation is loaded to the client + * when it is first needed. Lazy loaded widget can be achieved by giving + * {@link LoadStyle#LAZY} value in {@link Connect} annotation. + * <p> + * Lazy loaded widgets don't stress the size and startup time of the client + * side as much as eagerly loaded widgets. On the other hand there is a + * slight latency when lazy loaded widgets are first used as the client side + * needs to visit the server to fetch the client side implementation. + * <p> + * The {@link LoadStyle#DEFERRED} will also not stress the initially loaded + * JavaScript file. If this load style is defined, the widget implementation + * is preemptively loaded to the browser after the application is started + * and the communication to server idles. This load style kind of combines + * the best of both worlds. + * <p> + * Fine tunings to widget loading can also be made by overriding + * {@link com.vaadin.terminal.gwt.widgetsetutils.WidgetMapGenerator} in the + * GWT module. Tunings might be helpful if the end users have slow + * connections and especially if they have high latency in their network. + * The + * {@link com.vaadin.terminal.gwt.widgetsetutils.CustomWidgetMapGenerator} + * is an abstract generator implementation for easy customization. Vaadin + * package also includes + * {@link com.vaadin.terminal.gwt.widgetsetutils.LazyWidgetMapGenerator} + * that makes as many widgets lazily loaded as possible. + * + * @since 6.4 + * + * @return the hint for the widget set generator how the client side + * implementation should be loaded to the browser + */ + LoadStyle loadStyle() default LoadStyle.DEFERRED; + + public enum LoadStyle { + /** + * The widget is included in the initial JS sent to the client. + */ + EAGER, + /** + * Not included in the initial set of widgets, but added to queue from + * which it will be loaded when network is not busy or the + * implementation is required. + */ + DEFERRED, + /** + * Loaded to the client only if needed. + */ + LAZY + } +} diff --git a/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java b/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java new file mode 100644 index 0000000000..7a2eedd95d --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.ui; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import com.vaadin.shared.ComponentState; +import com.vaadin.shared.JavaScriptConnectorState; + +public class JavaScriptComponentState extends ComponentState implements + JavaScriptConnectorState { + + private Set<String> callbackNames = new HashSet<String>(); + private Map<String, Set<String>> rpcInterfaces = new HashMap<String, Set<String>>(); + + @Override + public Set<String> getCallbackNames() { + return callbackNames; + } + + public void setCallbackNames(Set<String> callbackNames) { + this.callbackNames = callbackNames; + } + + @Override + public Map<String, Set<String>> getRpcInterfaces() { + return rpcInterfaces; + } + + public void setRpcInterfaces(Map<String, Set<String>> rpcInterfaces) { + this.rpcInterfaces = rpcInterfaces; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/LayoutClickRpc.java b/shared/src/com/vaadin/shared/ui/LayoutClickRpc.java new file mode 100644 index 0000000000..844b695761 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/LayoutClickRpc.java @@ -0,0 +1,34 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui; + +import com.vaadin.shared.Connector; +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; + +public interface LayoutClickRpc extends ServerRpc { + /** + * Called when a layout click event has occurred and there are server side + * listeners for the event. + * + * @param mouseDetails + * Details about the mouse when the event took place + * @param clickedConnector + * The child component that was the target of the event + */ + public void layoutClick(MouseEventDetails mouseDetails, + Connector clickedConnector); +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/MediaControl.java b/shared/src/com/vaadin/shared/ui/MediaControl.java new file mode 100644 index 0000000000..7fcd85480a --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/MediaControl.java @@ -0,0 +1,36 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.ui; + +import com.vaadin.shared.communication.ClientRpc; + +/** + * Server to client RPC interface for controlling playback of the media. + * + * @since 7.0 + */ +public interface MediaControl extends ClientRpc { + /** + * Start playing the media. + */ + public void play(); + + /** + * Pause playback of the media. + */ + public void pause(); +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/TabIndexState.java b/shared/src/com/vaadin/shared/ui/TabIndexState.java new file mode 100644 index 0000000000..5f17b9b016 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/TabIndexState.java @@ -0,0 +1,40 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui; + +/** + * Interface implemented by state classes that support tab indexes. + * + * @author Vaadin Ltd + * @since 7.0.0 + * + */ +public interface TabIndexState { + /** + * Gets the <i>tabulator index</i> of the field. + * + * @return the tab index for the Field + */ + public int getTabIndex(); + + /** + * Sets the <i>tabulator index</i> of the field. + * + * @param tabIndex + * the tab index to set + */ + public void setTabIndex(int tabIndex); +} diff --git a/shared/src/com/vaadin/shared/ui/VMarginInfo.java b/shared/src/com/vaadin/shared/ui/VMarginInfo.java new file mode 100644 index 0000000000..9e9e0a4bb4 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/VMarginInfo.java @@ -0,0 +1,93 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.ui; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class VMarginInfo implements Serializable { + + private static final int TOP = 1; + private static final int RIGHT = 2; + private static final int BOTTOM = 4; + private static final int LEFT = 8; + + private int bitMask; + + public VMarginInfo(int bitMask) { + this.bitMask = bitMask; + } + + public VMarginInfo(boolean top, boolean right, boolean bottom, boolean left) { + setMargins(top, right, bottom, left); + } + + public void setMargins(boolean top, boolean right, boolean bottom, + boolean left) { + bitMask = top ? TOP : 0; + bitMask += right ? RIGHT : 0; + bitMask += bottom ? BOTTOM : 0; + bitMask += left ? LEFT : 0; + } + + public void setMargins(VMarginInfo marginInfo) { + bitMask = marginInfo.bitMask; + } + + public boolean hasLeft() { + return (bitMask & LEFT) == LEFT; + } + + public boolean hasRight() { + return (bitMask & RIGHT) == RIGHT; + } + + public boolean hasTop() { + return (bitMask & TOP) == TOP; + } + + public boolean hasBottom() { + return (bitMask & BOTTOM) == BOTTOM; + } + + public int getBitMask() { + return bitMask; + } + + public void setMargins(boolean enabled) { + if (enabled) { + bitMask = TOP + RIGHT + BOTTOM + LEFT; + } else { + bitMask = 0; + } + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof VMarginInfo)) { + return false; + } + + return ((VMarginInfo) obj).bitMask == bitMask; + } + + @Override + public int hashCode() { + return bitMask; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutServerRpc.java b/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutServerRpc.java new file mode 100644 index 0000000000..d0fb4abdbd --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutServerRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.absolutelayout; + +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.LayoutClickRpc; + +public interface AbsoluteLayoutServerRpc extends LayoutClickRpc, ServerRpc { + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java b/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java new file mode 100644 index 0000000000..a0e0f4d3c7 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java @@ -0,0 +1,41 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.absolutelayout; + +import java.util.HashMap; +import java.util.Map; + +import com.vaadin.shared.Connector; +import com.vaadin.shared.ui.AbstractLayoutState; + +public class AbsoluteLayoutState extends AbstractLayoutState { + // Maps each component to a position + private Map<String, String> connectorToCssPosition = new HashMap<String, String>(); + + public String getConnectorPosition(Connector connector) { + return connectorToCssPosition.get(connector.getConnectorId()); + } + + public Map<String, String> getConnectorToCssPosition() { + return connectorToCssPosition; + } + + public void setConnectorToCssPosition( + Map<String, String> componentToCssPosition) { + connectorToCssPosition = componentToCssPosition; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/button/ButtonServerRpc.java b/shared/src/com/vaadin/shared/ui/button/ButtonServerRpc.java new file mode 100644 index 0000000000..8efc082ff0 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/button/ButtonServerRpc.java @@ -0,0 +1,40 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.button; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; + +/** + * RPC interface for calls from client to server. + * + * @since 7.0 + */ +public interface ButtonServerRpc extends ServerRpc { + /** + * Button click event. + * + * @param mouseEventDetails + * serialized mouse event details + */ + public void click(MouseEventDetails mouseEventDetails); + + /** + * Indicate to the server that the client has disabled the button as a + * result of a click. + */ + public void disableOnClick(); +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/button/ButtonState.java b/shared/src/com/vaadin/shared/ui/button/ButtonState.java new file mode 100644 index 0000000000..7e76f5d1e8 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/button/ButtonState.java @@ -0,0 +1,134 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.ui.button; + +import com.vaadin.shared.ComponentState; +import com.vaadin.shared.ui.TabIndexState; + +/** + * Shared state for {@link com.vaadin.ui.Button} and + * {@link com.vaadin.ui.NativeButton}. + * + * @see ComponentState + * + * @since 7.0 + */ +public class ButtonState extends ComponentState implements TabIndexState { + private boolean disableOnClick = false; + private int clickShortcutKeyCode = 0; + /** + * The tab order number of this field. + */ + private int tabIndex = 0; + /** + * If caption should be rendered in HTML + */ + private boolean htmlContentAllowed = false; + + /** + * Checks whether the button should be disabled on the client side on next + * click. + * + * @return true if the button should be disabled on click + */ + public boolean isDisableOnClick() { + return disableOnClick; + } + + /** + * Sets whether the button should be disabled on the client side on next + * click. + * + * @param disableOnClick + * true if the button should be disabled on click + */ + public void setDisableOnClick(boolean disableOnClick) { + this.disableOnClick = disableOnClick; + } + + /** + * Returns the key code for activating the button via a keyboard shortcut. + * + * See {@link com.vaadin.ui.Button#setClickShortcut(int, int...)} for more + * information. + * + * @return key code or 0 for none + */ + public int getClickShortcutKeyCode() { + return clickShortcutKeyCode; + } + + /** + * Sets the key code for activating the button via a keyboard shortcut. + * + * See {@link com.vaadin.ui.Button#setClickShortcut(int, int...)} for more + * information. + * + * @param clickShortcutKeyCode + * key code or 0 for none + */ + public void setClickShortcutKeyCode(int clickShortcutKeyCode) { + this.clickShortcutKeyCode = clickShortcutKeyCode; + } + + /** + * Set whether the caption text is rendered as HTML or not. You might need + * to retheme button to allow higher content than the original text style. + * + * If set to true, the captions are passed to the browser as html and the + * developer is responsible for ensuring no harmful html is used. If set to + * false, the content is passed to the browser as plain text. + * + * @param htmlContentAllowed + * <code>true</code> if caption is rendered as HTML, + * <code>false</code> otherwise + */ + public void setHtmlContentAllowed(boolean htmlContentAllowed) { + this.htmlContentAllowed = htmlContentAllowed; + } + + /** + * Return HTML rendering setting. + * + * @return <code>true</code> if the caption text is to be rendered as HTML, + * <code>false</code> otherwise + */ + public boolean isHtmlContentAllowed() { + return htmlContentAllowed; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.terminal.gwt.client.ui.TabIndexState#getTabIndex() + */ + @Override + public int getTabIndex() { + return tabIndex; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.terminal.gwt.client.ui.TabIndexState#setTabIndex(int) + */ + @Override + public void setTabIndex(int tabIndex) { + this.tabIndex = tabIndex; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxServerRpc.java b/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxServerRpc.java new file mode 100644 index 0000000000..933ab639dc --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxServerRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.checkbox; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; + +public interface CheckBoxServerRpc extends ServerRpc { + public void setChecked(boolean checked, MouseEventDetails mouseEventDetails); +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxState.java b/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxState.java new file mode 100644 index 0000000000..1f48b8fe9e --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxState.java @@ -0,0 +1,31 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.checkbox; + +import com.vaadin.shared.AbstractFieldState; + +public class CheckBoxState extends AbstractFieldState { + private boolean checked = false; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/combobox/ComboBoxConstants.java b/shared/src/com/vaadin/shared/ui/combobox/ComboBoxConstants.java new file mode 100644 index 0000000000..3c763d5a0c --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/combobox/ComboBoxConstants.java @@ -0,0 +1,25 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.combobox; + +@Deprecated +public class ComboBoxConstants { + @Deprecated + public static final String ATTR_INPUTPROMPT = "prompt"; + @Deprecated + public static final String ATTR_NO_TEXT_INPUT = "noInput"; + +} diff --git a/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutServerRpc.java b/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutServerRpc.java new file mode 100644 index 0000000000..abfe98760d --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutServerRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.csslayout; + +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.LayoutClickRpc; + +public interface CssLayoutServerRpc extends LayoutClickRpc, ServerRpc { + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutState.java b/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutState.java new file mode 100644 index 0000000000..fc230a8e2f --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutState.java @@ -0,0 +1,35 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.csslayout; + +import java.util.HashMap; +import java.util.Map; + +import com.vaadin.shared.Connector; +import com.vaadin.shared.ui.AbstractLayoutState; + +public class CssLayoutState extends AbstractLayoutState { + private Map<Connector, String> childCss = new HashMap<Connector, String>(); + + public Map<Connector, String> getChildCss() { + return childCss; + } + + public void setChildCss(Map<Connector, String> childCss) { + this.childCss = childCss; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/customlayout/CustomLayoutState.java b/shared/src/com/vaadin/shared/ui/customlayout/CustomLayoutState.java new file mode 100644 index 0000000000..0c1aa24161 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/customlayout/CustomLayoutState.java @@ -0,0 +1,53 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.customlayout; + +import java.util.HashMap; +import java.util.Map; + +import com.vaadin.shared.Connector; +import com.vaadin.shared.ui.AbstractLayoutState; + +public class CustomLayoutState extends AbstractLayoutState { + Map<Connector, String> childLocations = new HashMap<Connector, String>(); + private String templateContents; + private String templateName; + + public String getTemplateContents() { + return templateContents; + } + + public void setTemplateContents(String templateContents) { + this.templateContents = templateContents; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public Map<Connector, String> getChildLocations() { + return childLocations; + } + + public void setChildLocations(Map<Connector, String> childLocations) { + this.childLocations = childLocations; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/datefield/DateFieldConstants.java b/shared/src/com/vaadin/shared/ui/datefield/DateFieldConstants.java new file mode 100644 index 0000000000..3be84839bb --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/datefield/DateFieldConstants.java @@ -0,0 +1,24 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.datefield; + +@Deprecated +public class DateFieldConstants { + + @Deprecated + public static final String ATTR_WEEK_NUMBERS = "wn"; + +} diff --git a/shared/src/com/vaadin/shared/ui/dd/AcceptCriterion.java b/shared/src/com/vaadin/shared/ui/dd/AcceptCriterion.java new file mode 100644 index 0000000000..e53f75e552 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/dd/AcceptCriterion.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.ui.dd; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * An annotation type used to point the server side counterpart for client side + * a {@link com.vaadin.terminal.gwt.client.ui.dd.VAcceptCriterion} class. + * <p> + * Annotations are used at GWT compilation phase, so remember to rebuild your + * widgetset if you do changes for {@link AcceptCriterion} mappings. + * + * Prior to Vaadin 7, the mapping was done with an annotation on server side + * classes. + * + * @since 7.0 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface AcceptCriterion { + /** + * @return the class of the server side counterpart for the annotated + * criterion + */ + Class<?> value(); + +} diff --git a/shared/src/com/vaadin/shared/ui/dd/DragEventType.java b/shared/src/com/vaadin/shared/ui/dd/DragEventType.java new file mode 100644 index 0000000000..a6aef5c853 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/dd/DragEventType.java @@ -0,0 +1,21 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.ui.dd; + +public enum DragEventType { + ENTER, LEAVE, OVER, DROP +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/dd/HorizontalDropLocation.java b/shared/src/com/vaadin/shared/ui/dd/HorizontalDropLocation.java new file mode 100644 index 0000000000..040cadf7e6 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/dd/HorizontalDropLocation.java @@ -0,0 +1,20 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.dd; + +public enum HorizontalDropLocation { + LEFT, RIGHT, CENTER +} diff --git a/shared/src/com/vaadin/shared/ui/dd/VerticalDropLocation.java b/shared/src/com/vaadin/shared/ui/dd/VerticalDropLocation.java new file mode 100644 index 0000000000..733b27e3ad --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/dd/VerticalDropLocation.java @@ -0,0 +1,20 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.dd; + +public enum VerticalDropLocation { + TOP, BOTTOM, MIDDLE +} diff --git a/shared/src/com/vaadin/shared/ui/draganddropwrapper/DragAndDropWrapperConstants.java b/shared/src/com/vaadin/shared/ui/draganddropwrapper/DragAndDropWrapperConstants.java new file mode 100644 index 0000000000..44d5c29217 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/draganddropwrapper/DragAndDropWrapperConstants.java @@ -0,0 +1,26 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.draganddropwrapper; + +@Deprecated +public class DragAndDropWrapperConstants { + + @Deprecated + public static final String HTML5_DATA_FLAVORS = "html5-data-flavors"; + @Deprecated + public static final String DRAG_START_MODE = "dragStartMode"; + +} diff --git a/shared/src/com/vaadin/shared/ui/embedded/EmbeddedConstants.java b/shared/src/com/vaadin/shared/ui/embedded/EmbeddedConstants.java new file mode 100644 index 0000000000..e1abc88904 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/embedded/EmbeddedConstants.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.embedded; + +@Deprecated +public class EmbeddedConstants { + @Deprecated + public static final String ALTERNATE_TEXT = "alt"; + +} diff --git a/shared/src/com/vaadin/shared/ui/embedded/EmbeddedServerRpc.java b/shared/src/com/vaadin/shared/ui/embedded/EmbeddedServerRpc.java new file mode 100644 index 0000000000..7e52aab985 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/embedded/EmbeddedServerRpc.java @@ -0,0 +1,22 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.embedded; + +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.ClickRpc; + +public interface EmbeddedServerRpc extends ClickRpc, ServerRpc { +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/form/FormState.java b/shared/src/com/vaadin/shared/ui/form/FormState.java new file mode 100644 index 0000000000..7e8b36707a --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/form/FormState.java @@ -0,0 +1,41 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.form; + +import com.vaadin.shared.AbstractFieldState; +import com.vaadin.shared.Connector; + +public class FormState extends AbstractFieldState { + private Connector layout; + private Connector footer; + + public Connector getLayout() { + return layout; + } + + public void setLayout(Connector layout) { + this.layout = layout; + } + + public Connector getFooter() { + return footer; + } + + public void setFooter(Connector footer) { + this.footer = footer; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutServerRpc.java b/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutServerRpc.java new file mode 100644 index 0000000000..c39df862c5 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutServerRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.gridlayout; + +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.LayoutClickRpc; + +public interface GridLayoutServerRpc extends LayoutClickRpc, ServerRpc { + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java b/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java new file mode 100644 index 0000000000..d2e685d8cb --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java @@ -0,0 +1,49 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.gridlayout; + +import com.vaadin.shared.ui.AbstractLayoutState; + +public class GridLayoutState extends AbstractLayoutState { + private boolean spacing = false; + private int rows = 0; + private int columns = 0; + + public boolean isSpacing() { + return spacing; + } + + public void setSpacing(boolean spacing) { + this.spacing = spacing; + } + + public int getRows() { + return rows; + } + + public void setRows(int rows) { + this.rows = rows; + } + + public int getColumns() { + return columns; + } + + public void setColumns(int cols) { + columns = cols; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/label/ContentMode.java b/shared/src/com/vaadin/shared/ui/label/ContentMode.java new file mode 100644 index 0000000000..1927b6c01b --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/label/ContentMode.java @@ -0,0 +1,58 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.label; + +/** + * Content modes defining how the client should interpret a Label's value. + * + * @since 7.0.0 + */ +public enum ContentMode { + /** + * Content mode, where the label contains only plain text. + */ + TEXT, + + /** + * Content mode, where the label contains pre formatted text. In this mode + * newlines are preserved when rendered on the screen. + */ + PREFORMATTED, + + /** + * Content mode, where the label contains XHTML. Care should be taken to + * ensure + */ + XHTML, + + /** + * Content mode, where the label contains well-formed or well-balanced XML. + * This is handled in the same way as {@link #XHTML}. + * + * @deprecated Use {@link #XHTML} instead + */ + @Deprecated + XML, + + /** + * Legacy content mode, where the label contains RAW output. This is handled + * in exactly the same way as {@link #XHTML}. + * + * @deprecated Use {@link #XHTML} instead + */ + @Deprecated + RAW; +} diff --git a/shared/src/com/vaadin/shared/ui/label/LabelState.java b/shared/src/com/vaadin/shared/ui/label/LabelState.java new file mode 100644 index 0000000000..35e27bc63d --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/label/LabelState.java @@ -0,0 +1,40 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.label; + +import com.vaadin.shared.ComponentState; + +public class LabelState extends ComponentState { + private ContentMode contentMode = ContentMode.TEXT; + private String text = ""; + + public ContentMode getContentMode() { + return contentMode; + } + + public void setContentMode(ContentMode contentMode) { + this.contentMode = contentMode; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/menubar/MenuBarConstants.java b/shared/src/com/vaadin/shared/ui/menubar/MenuBarConstants.java new file mode 100644 index 0000000000..153750b1c6 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/menubar/MenuBarConstants.java @@ -0,0 +1,35 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.menubar; + +@Deprecated +public class MenuBarConstants { + @Deprecated + public static final String ATTRIBUTE_CHECKED = "checked"; + @Deprecated + public static final String ATTRIBUTE_ITEM_DESCRIPTION = "description"; + @Deprecated + public static final String ATTRIBUTE_ITEM_ICON = "icon"; + @Deprecated + public static final String ATTRIBUTE_ITEM_DISABLED = "disabled"; + @Deprecated + public static final String ATTRIBUTE_ITEM_STYLE = "style"; + @Deprecated + public static final String HTML_CONTENT_ALLOWED = "usehtml"; + @Deprecated + public static final String OPEN_ROOT_MENU_ON_HOWER = "ormoh"; + +} diff --git a/shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupConstants.java b/shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupConstants.java new file mode 100644 index 0000000000..fd28cf4d6e --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupConstants.java @@ -0,0 +1,22 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.optiongroup; + +public class OptionGroupConstants { + public static final String HTML_CONTENT_ALLOWED = "usehtml"; + public static final String ATTRIBUTE_OPTION_DISABLED = "disabled"; + +} diff --git a/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutServerRpc.java b/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutServerRpc.java new file mode 100644 index 0000000000..893d7b5dc3 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutServerRpc.java @@ -0,0 +1,24 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.orderedlayout; + +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.LayoutClickRpc; + +public interface AbstractOrderedLayoutServerRpc extends LayoutClickRpc, + ServerRpc { + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java b/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java new file mode 100644 index 0000000000..235c9eab13 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java @@ -0,0 +1,68 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.orderedlayout; + +import java.io.Serializable; +import java.util.HashMap; + +import com.vaadin.shared.Connector; +import com.vaadin.shared.ui.AbstractLayoutState; +import com.vaadin.shared.ui.AlignmentInfo; + +public class AbstractOrderedLayoutState extends AbstractLayoutState { + private boolean spacing = false; + + public HashMap<Connector, ChildComponentData> childData = new HashMap<Connector, ChildComponentData>(); + + public static class ChildComponentData implements Serializable { + private int alignmentBitmask = AlignmentInfo.TOP_LEFT.getBitMask(); + private float expandRatio = 0.0f; + + public int getAlignmentBitmask() { + return alignmentBitmask; + } + + public void setAlignmentBitmask(int alignmentBitmask) { + this.alignmentBitmask = alignmentBitmask; + } + + public float getExpandRatio() { + return expandRatio; + } + + public void setExpandRatio(float expandRatio) { + this.expandRatio = expandRatio; + } + + } + + public HashMap<Connector, ChildComponentData> getChildData() { + return childData; + } + + public void setChildData(HashMap<Connector, ChildComponentData> childData) { + this.childData = childData; + } + + public boolean isSpacing() { + return spacing; + } + + public void setSpacing(boolean spacing) { + this.spacing = spacing; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/panel/PanelServerRpc.java b/shared/src/com/vaadin/shared/ui/panel/PanelServerRpc.java new file mode 100644 index 0000000000..ba42a2f452 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/panel/PanelServerRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.panel; + +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.ClickRpc; + +public interface PanelServerRpc extends ClickRpc, ServerRpc { + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/panel/PanelState.java b/shared/src/com/vaadin/shared/ui/panel/PanelState.java new file mode 100644 index 0000000000..d432de97ad --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/panel/PanelState.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.panel; + +import com.vaadin.shared.ComponentState; + +public class PanelState extends ComponentState { + private int tabIndex; + private int scrollLeft, scrollTop; + + public int getTabIndex() { + return tabIndex; + } + + public void setTabIndex(int tabIndex) { + this.tabIndex = tabIndex; + } + + public int getScrollLeft() { + return scrollLeft; + } + + public void setScrollLeft(int scrollLeft) { + this.scrollLeft = scrollLeft; + } + + public int getScrollTop() { + return scrollTop; + } + + public void setScrollTop(int scrollTop) { + this.scrollTop = scrollTop; + } + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/root/PageClientRpc.java b/shared/src/com/vaadin/shared/ui/root/PageClientRpc.java new file mode 100644 index 0000000000..b7d9419057 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/root/PageClientRpc.java @@ -0,0 +1,25 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.shared.ui.root; + +import com.vaadin.shared.communication.ClientRpc; + +public interface PageClientRpc extends ClientRpc { + + public void setTitle(String title); + +} diff --git a/shared/src/com/vaadin/shared/ui/root/RootConstants.java b/shared/src/com/vaadin/shared/ui/root/RootConstants.java new file mode 100644 index 0000000000..bc4f6017f6 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/root/RootConstants.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.root; + +public class RootConstants { + /** + * Attribute name for the lazy resize setting . + */ + @Deprecated + public static final String RESIZE_LAZY = "rL"; + @Deprecated + public static final String BROWSER_HEIGHT_VAR = "browserHeight"; + + @Deprecated + public static final String BROWSER_WIDTH_VAR = "browserWidth"; + @Deprecated + public static final String NOTIFICATION_HTML_CONTENT_NOT_ALLOWED = "useplain"; + + @Deprecated + public static final String FRAGMENT_VARIABLE = "fragment"; + + @Deprecated + public static final String ATTRIBUTE_NOTIFICATION_STYLE = "style"; + @Deprecated + public static final String ATTRIBUTE_NOTIFICATION_CAPTION = "caption"; + @Deprecated + public static final String ATTRIBUTE_NOTIFICATION_MESSAGE = "message"; + @Deprecated + public static final String ATTRIBUTE_NOTIFICATION_ICON = "icon"; + @Deprecated + public static final String ATTRIBUTE_NOTIFICATION_POSITION = "position"; + @Deprecated + public static final String ATTRIBUTE_NOTIFICATION_DELAY = "delay"; + +} diff --git a/shared/src/com/vaadin/shared/ui/root/RootServerRpc.java b/shared/src/com/vaadin/shared/ui/root/RootServerRpc.java new file mode 100644 index 0000000000..f074a8d3cc --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/root/RootServerRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.root; + +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.ClickRpc; + +public interface RootServerRpc extends ClickRpc, ServerRpc { + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/root/RootState.java b/shared/src/com/vaadin/shared/ui/root/RootState.java new file mode 100644 index 0000000000..07c71c8167 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/root/RootState.java @@ -0,0 +1,40 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.root; + +import com.vaadin.shared.ComponentState; +import com.vaadin.shared.Connector; + +public class RootState extends ComponentState { + private Connector content; + private int heartbeatInterval; + + public Connector getContent() { + return content; + } + + public void setContent(Connector content) { + this.content = content; + } + + public int getHeartbeatInterval() { + return heartbeatInterval; + } + + public void setHeartbeatInterval(int heartbeatInterval) { + this.heartbeatInterval = heartbeatInterval; + } +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelRpc.java b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelRpc.java new file mode 100644 index 0000000000..92d5b9c2cb --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelRpc.java @@ -0,0 +1,40 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.splitpanel; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; + +public interface AbstractSplitPanelRpc extends ServerRpc { + + /** + * Called when the position has been updated by the user. + * + * @param position + * The new position in % if the current unit is %, in px + * otherwise + */ + public void setSplitterPosition(float position); + + /** + * Called when a click event has occurred on the splitter. + * + * @param mouseDetails + * Details about the mouse when the event took place + */ + public void splitterClick(MouseEventDetails mouseDetails); + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java new file mode 100644 index 0000000000..46eb851edd --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java @@ -0,0 +1,136 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.splitpanel; + +import java.io.Serializable; + +import com.vaadin.shared.ComponentState; +import com.vaadin.shared.Connector; + +public class AbstractSplitPanelState extends ComponentState { + + private Connector firstChild = null; + private Connector secondChild = null; + private SplitterState splitterState = new SplitterState(); + + public boolean hasFirstChild() { + return firstChild != null; + } + + public boolean hasSecondChild() { + return secondChild != null; + } + + public Connector getFirstChild() { + return firstChild; + } + + public void setFirstChild(Connector firstChild) { + this.firstChild = firstChild; + } + + public Connector getSecondChild() { + return secondChild; + } + + public void setSecondChild(Connector secondChild) { + this.secondChild = secondChild; + } + + public SplitterState getSplitterState() { + return splitterState; + } + + public void setSplitterState(SplitterState splitterState) { + this.splitterState = splitterState; + } + + public static class SplitterState implements Serializable { + private float position; + private String positionUnit; + private float minPosition; + private String minPositionUnit; + private float maxPosition; + private String maxPositionUnit; + private boolean positionReversed = false; + private boolean locked = false; + + public float getPosition() { + return position; + } + + public void setPosition(float position) { + this.position = position; + } + + public String getPositionUnit() { + return positionUnit; + } + + public void setPositionUnit(String positionUnit) { + this.positionUnit = positionUnit; + } + + public float getMinPosition() { + return minPosition; + } + + public void setMinPosition(float minPosition) { + this.minPosition = minPosition; + } + + public String getMinPositionUnit() { + return minPositionUnit; + } + + public void setMinPositionUnit(String minPositionUnit) { + this.minPositionUnit = minPositionUnit; + } + + public float getMaxPosition() { + return maxPosition; + } + + public void setMaxPosition(float maxPosition) { + this.maxPosition = maxPosition; + } + + public String getMaxPositionUnit() { + return maxPositionUnit; + } + + public void setMaxPositionUnit(String maxPositionUnit) { + this.maxPositionUnit = maxPositionUnit; + } + + public boolean isPositionReversed() { + return positionReversed; + } + + public void setPositionReversed(boolean positionReversed) { + this.positionReversed = positionReversed; + } + + public boolean isLocked() { + return locked; + } + + public void setLocked(boolean locked) { + this.locked = locked; + } + + } +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/table/TableConstants.java b/shared/src/com/vaadin/shared/ui/table/TableConstants.java new file mode 100644 index 0000000000..084f436b53 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/table/TableConstants.java @@ -0,0 +1,36 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.table; + +public class TableConstants { + 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"; + + @Deprecated + public static final String ATTRIBUTE_PAGEBUFFER_FIRST = "pb-ft"; + @Deprecated + public static final String ATTRIBUTE_PAGEBUFFER_LAST = "pb-l"; + /** + * Tell the client that old keys are no longer valid because the server has + * cleared its key map. + */ + @Deprecated + public static final String ATTRIBUTE_KEY_MAPPER_RESET = "clearKeyMap"; + +} diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetBaseConstants.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetBaseConstants.java new file mode 100644 index 0000000000..3c6c9a5207 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetBaseConstants.java @@ -0,0 +1,31 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.tabsheet; + +@Deprecated +public class TabsheetBaseConstants { + @Deprecated + public static final String ATTRIBUTE_TAB_DISABLED = "disabled"; + @Deprecated + public static final String ATTRIBUTE_TAB_DESCRIPTION = "description"; + @Deprecated + public static final String ATTRIBUTE_TAB_ERROR_MESSAGE = "error"; + @Deprecated + public static final String ATTRIBUTE_TAB_CAPTION = "caption"; + @Deprecated + public static final String ATTRIBUTE_TAB_ICON = "icon"; + +} diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetConstants.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetConstants.java new file mode 100644 index 0000000000..bd00f653a4 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetConstants.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.tabsheet; + +@Deprecated +public class TabsheetConstants { + @Deprecated + public static final String TAB_STYLE_NAME = "tabstyle"; + +} diff --git a/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java b/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java new file mode 100644 index 0000000000..31cec77554 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.textarea; + +import com.vaadin.shared.ui.textfield.AbstractTextFieldState; + +public class TextAreaState extends AbstractTextFieldState { + + /** + * Number of visible rows in the text area. The default is 5. + */ + private int rows = 5; + + /** + * Tells if word-wrapping should be used in the text area. + */ + private boolean wordwrap = true; + + public int getRows() { + return rows; + } + + public void setRows(int rows) { + this.rows = rows; + } + + public boolean isWordwrap() { + return wordwrap; + } + + public void setWordwrap(boolean wordwrap) { + this.wordwrap = wordwrap; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java b/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java new file mode 100644 index 0000000000..cd3562606d --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java @@ -0,0 +1,73 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.textfield; + +import com.vaadin.shared.AbstractFieldState; + +public class AbstractTextFieldState extends AbstractFieldState { + /** + * Maximum character count in text field. + */ + private int maxLength = -1; + + /** + * Number of visible columns in the TextField. + */ + private int columns = 0; + + /** + * The prompt to display in an empty field. Null when disabled. + */ + private String inputPrompt = null; + + /** + * The text in the field + */ + private String text = null; + + public int getMaxLength() { + return maxLength; + } + + public void setMaxLength(int maxLength) { + this.maxLength = maxLength; + } + + public int getColumns() { + return columns; + } + + public void setColumns(int columns) { + this.columns = columns; + } + + public String getInputPrompt() { + return inputPrompt; + } + + public void setInputPrompt(String inputPrompt) { + this.inputPrompt = inputPrompt; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/textfield/TextFieldConstants.java b/shared/src/com/vaadin/shared/ui/textfield/TextFieldConstants.java new file mode 100644 index 0000000000..e7835d926b --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/textfield/TextFieldConstants.java @@ -0,0 +1,26 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.textfield; + +public class TextFieldConstants { + public static final String VAR_CUR_TEXT = "curText"; + public static final String ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS = "nvc"; + public static final String ATTR_TEXTCHANGE_TIMEOUT = "iet"; + public static final String VAR_CURSOR = "c"; + public static final String ATTR_TEXTCHANGE_EVENTMODE = "iem"; + public static final String TEXTCHANGE_MODE_EAGER = "EAGER"; + +} diff --git a/shared/src/com/vaadin/shared/ui/tree/TreeConstants.java b/shared/src/com/vaadin/shared/ui/tree/TreeConstants.java new file mode 100644 index 0000000000..c2f301d517 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/tree/TreeConstants.java @@ -0,0 +1,35 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.tree; + +@Deprecated +public class TreeConstants { + + @Deprecated + public static final String ATTRIBUTE_NODE_STYLE = "style"; + @Deprecated + public static final String ATTRIBUTE_NODE_CAPTION = "caption"; + @Deprecated + public static final String ATTRIBUTE_NODE_ICON = "icon"; + + @Deprecated + public static final String ATTRIBUTE_ACTION_CAPTION = "caption"; + @Deprecated + public static final String ATTRIBUTE_ACTION_ICON = ATTRIBUTE_NODE_ICON; + + public static final String ITEM_CLICK_EVENT_ID = "itemClick"; + +} diff --git a/shared/src/com/vaadin/shared/ui/treetable/TreeTableConstants.java b/shared/src/com/vaadin/shared/ui/treetable/TreeTableConstants.java new file mode 100644 index 0000000000..08d26f3a13 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/treetable/TreeTableConstants.java @@ -0,0 +1,23 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.treetable; + +@Deprecated +public class TreeTableConstants { + @Deprecated + public static final String ATTRIBUTE_HIERARCHY_COLUMN_INDEX = "hci"; + +} diff --git a/shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectConstants.java b/shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectConstants.java new file mode 100644 index 0000000000..f6805d6aee --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectConstants.java @@ -0,0 +1,25 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.twincolselect; + +@Deprecated +public class TwinColSelectConstants { + @Deprecated + public static final String ATTRIBUTE_LEFT_CAPTION = "lc"; + @Deprecated + public static final String ATTRIBUTE_RIGHT_CAPTION = "rc"; + +} diff --git a/shared/src/com/vaadin/shared/ui/video/VideoState.java b/shared/src/com/vaadin/shared/ui/video/VideoState.java new file mode 100644 index 0000000000..695d495e16 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/video/VideoState.java @@ -0,0 +1,32 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.video; + +import com.vaadin.shared.communication.URLReference; +import com.vaadin.shared.ui.AbstractMediaState; + +public class VideoState extends AbstractMediaState { + private URLReference poster; + + public URLReference getPoster() { + return poster; + } + + public void setPoster(URLReference poster) { + this.poster = poster; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java new file mode 100644 index 0000000000..b4ac869ac4 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java @@ -0,0 +1,22 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.window; + +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.ClickRpc; + +public interface WindowServerRpc extends ClickRpc, ServerRpc { +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/window/WindowState.java b/shared/src/com/vaadin/shared/ui/window/WindowState.java new file mode 100644 index 0000000000..526c5dacb0 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/window/WindowState.java @@ -0,0 +1,85 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.window; + +import com.vaadin.shared.ui.panel.PanelState; + +public class WindowState extends PanelState { + private boolean modal = false; + private boolean resizable = true; + private boolean resizeLazy = false; + private boolean draggable = true; + private boolean centered = false;; + private int positionX = -1; + private int positionY = -1; + + public boolean isModal() { + return modal; + } + + public void setModal(boolean modal) { + this.modal = modal; + } + + public boolean isResizable() { + return resizable; + } + + public void setResizable(boolean resizable) { + this.resizable = resizable; + } + + public boolean isResizeLazy() { + return resizeLazy; + } + + public void setResizeLazy(boolean resizeLazy) { + this.resizeLazy = resizeLazy; + } + + public boolean isDraggable() { + return draggable; + } + + public void setDraggable(boolean draggable) { + this.draggable = draggable; + } + + public boolean isCentered() { + return centered; + } + + public void setCentered(boolean centered) { + this.centered = centered; + } + + public int getPositionX() { + return positionX; + } + + public void setPositionX(int positionX) { + this.positionX = positionX; + } + + public int getPositionY() { + return positionY; + } + + public void setPositionY(int positionY) { + this.positionY = positionY; + } + +}
\ No newline at end of file |