@@ -395,32 +395,6 @@ public class ApplicationConnection { | |||
} | |||
}-*/; | |||
/** | |||
* Get the active Console for writing debug messages. May return an actual | |||
* logging console, or the NullConsole if debugging is not turned on. | |||
* | |||
* @deprecated Developers should use {@link VConsole} since 6.4.5 | |||
* | |||
* @return the active Console | |||
*/ | |||
@Deprecated | |||
public static Console getConsole() { | |||
return VConsole.getImplementation(); | |||
} | |||
/** | |||
* Checks if client side is in debug mode. Practically this is invoked by | |||
* adding ?debug parameter to URI. | |||
* | |||
* @deprecated use ApplicationConfiguration isDebugMode instead. | |||
* | |||
* @return true if client side is currently been debugged | |||
*/ | |||
@Deprecated | |||
public static boolean isDebugMode() { | |||
return ApplicationConfiguration.isDebugMode(); | |||
} | |||
/** | |||
* Gets the application base URI. Using this other than as the download | |||
* action URI can cause problems in Portlet 2.0 deployments. | |||
@@ -2468,7 +2442,8 @@ public class ApplicationConnection { | |||
* The identifier for the event | |||
* @return true if at least one listener has been registered on server side | |||
* for the event identified by eventIdentifier. | |||
* @deprecated Use {@link ComponentState#hasEventListener(String)} instead | |||
* @deprecated as of Vaadin 7. Use | |||
* {@link ComponentState#hasEventListener(String)} instead | |||
*/ | |||
@Deprecated | |||
public boolean hasEventListeners(ComponentConnector paintable, | |||
@@ -2521,11 +2496,13 @@ public class ApplicationConnection { | |||
return connectorMap; | |||
} | |||
/** | |||
* @deprecated No longer needed in Vaadin 7 | |||
*/ | |||
@Deprecated | |||
public void unregisterPaintable(ServerConnector p) { | |||
System.out.println("unregisterPaintable (unnecessarily) called for " | |||
VConsole.log("unregisterPaintable (unnecessarily) called for " | |||
+ Util.getConnectorString(p)); | |||
// connectorMap.unregisterConnector(p); | |||
} | |||
/** | |||
@@ -2564,6 +2541,10 @@ public class ApplicationConnection { | |||
return false; | |||
} | |||
/** | |||
* @deprecated as of Vaadin 7. Use | |||
* {@link ComponentState#hasEventListener(String)} instead | |||
*/ | |||
@Deprecated | |||
public boolean hasEventListeners(Widget widget, String eventIdentifier) { | |||
return hasEventListeners(getConnectorMap().getConnector(widget), |
@@ -1,42 +0,0 @@ | |||
/* | |||
* 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.terminal.gwt.client; | |||
import com.google.gwt.core.client.GWT; | |||
@Deprecated | |||
public class ClientExceptionHandler { | |||
public static void displayError(Throwable e) { | |||
displayError(e.getClass().getName() + ": " + e.getMessage()); | |||
GWT.log(e.getMessage(), e); | |||
} | |||
@Deprecated | |||
public static void displayError(String msg) { | |||
VConsole.error(msg); | |||
GWT.log(msg); | |||
} | |||
@Deprecated | |||
public static void displayError(String msg, Throwable e) { | |||
displayError(msg); | |||
displayError(e); | |||
} | |||
} |
@@ -24,23 +24,6 @@ import com.vaadin.terminal.gwt.client.Util; | |||
public class DDUtil { | |||
/** | |||
* @deprecated use the version with the actual event instead of detected | |||
* clientY value | |||
* | |||
* @param element | |||
* @param clientY | |||
* @param topBottomRatio | |||
* @return | |||
*/ | |||
@Deprecated | |||
public static VerticalDropLocation getVerticalDropLocation(Element element, | |||
int clientY, double topBottomRatio) { | |||
int offsetHeight = element.getOffsetHeight(); | |||
return getVerticalDropLocation(element, offsetHeight, clientY, | |||
topBottomRatio); | |||
} | |||
public static VerticalDropLocation getVerticalDropLocation(Element element, | |||
NativeEvent event, double topBottomRatio) { | |||
int offsetHeight = element.getOffsetHeight(); | |||
@@ -76,21 +59,7 @@ public class DDUtil { | |||
public static HorizontalDropLocation getHorizontalDropLocation( | |||
Element element, NativeEvent event, double leftRightRatio) { | |||
int touchOrMouseClientX = Util.getTouchOrMouseClientX(event); | |||
return getHorizontalDropLocation(element, touchOrMouseClientX, | |||
leftRightRatio); | |||
} | |||
/** | |||
* @deprecated use the version with the actual event | |||
* @param element | |||
* @param clientX | |||
* @param leftRightRatio | |||
* @return | |||
*/ | |||
@Deprecated | |||
public static HorizontalDropLocation getHorizontalDropLocation( | |||
Element element, int clientX, double leftRightRatio) { | |||
int clientX = Util.getTouchOrMouseClientX(event); | |||
// Event coordinates are relative to the viewport, element absolute | |||
// position is relative to the document. Make element position relative |
@@ -53,14 +53,6 @@ public class VHtml5DragEvent extends NativeEvent { | |||
return null; | |||
}-*/; | |||
/** | |||
* @deprecated As of Vaadin 6.8, replaced by {@link #setDropEffect(String)}. | |||
*/ | |||
@Deprecated | |||
public final void setDragEffect(String effect) { | |||
setDropEffect(effect); | |||
} | |||
public final native void setDropEffect(String effect) | |||
/*-{ | |||
try { |
@@ -1,685 +0,0 @@ | |||
/* | |||
* 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.data.util; | |||
import java.sql.Connection; | |||
import java.sql.ResultSet; | |||
import java.sql.ResultSetMetaData; | |||
import java.sql.SQLException; | |||
import java.sql.Statement; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.Collections; | |||
import java.util.HashMap; | |||
import com.vaadin.data.Container; | |||
import com.vaadin.data.Item; | |||
import com.vaadin.data.Property; | |||
/** | |||
* <p> | |||
* The <code>QueryContainer</code> is the specialized form of Container which is | |||
* Ordered and Indexed. This is used to represent the contents of relational | |||
* database tables accessed through the JDBC Connection in the Vaadin Table. | |||
* This creates Items based on the queryStatement provided to the container. | |||
* </p> | |||
* | |||
* <p> | |||
* The <code>QueryContainer</code> can be visualized as a representation of a | |||
* relational database table.Each Item in the container represents the row | |||
* fetched by the query.All cells in a column have same data type and the data | |||
* type information is retrieved from the metadata of the resultset. | |||
* </p> | |||
* | |||
* <p> | |||
* Note : If data in the tables gets modified, Container will not get reflected | |||
* with the updates, we have to explicity invoke QueryContainer.refresh method. | |||
* {@link com.vaadin.data.util.QueryContainer#refresh() refresh()} | |||
* </p> | |||
* | |||
* @see com.vaadin.data.Container | |||
* | |||
* @author Vaadin Ltd. | |||
* @since 4.0 | |||
* | |||
* @deprecated will be removed in the future, use the SQLContainer add-on | |||
*/ | |||
@Deprecated | |||
@SuppressWarnings("serial") | |||
public class QueryContainer implements Container, Container.Ordered, | |||
Container.Indexed { | |||
// default ResultSet type | |||
public static final int DEFAULT_RESULTSET_TYPE = ResultSet.TYPE_SCROLL_INSENSITIVE; | |||
// default ResultSet concurrency | |||
public static final int DEFAULT_RESULTSET_CONCURRENCY = ResultSet.CONCUR_READ_ONLY; | |||
private int resultSetType = DEFAULT_RESULTSET_TYPE; | |||
private int resultSetConcurrency = DEFAULT_RESULTSET_CONCURRENCY; | |||
private final String queryStatement; | |||
private final Connection connection; | |||
private ResultSet result; | |||
private Collection<String> propertyIds; | |||
private final HashMap<String, Class<?>> propertyTypes = new HashMap<String, Class<?>>(); | |||
private int size = -1; | |||
private Statement statement; | |||
/** | |||
* Constructs new <code>QueryContainer</code> with the specified | |||
* <code>queryStatement</code>. | |||
* | |||
* @param queryStatement | |||
* Database query | |||
* @param connection | |||
* Connection object | |||
* @param resultSetType | |||
* @param resultSetConcurrency | |||
* @throws SQLException | |||
* when database operation fails | |||
*/ | |||
public QueryContainer(String queryStatement, Connection connection, | |||
int resultSetType, int resultSetConcurrency) throws SQLException { | |||
this.queryStatement = queryStatement; | |||
this.connection = connection; | |||
this.resultSetType = resultSetType; | |||
this.resultSetConcurrency = resultSetConcurrency; | |||
init(); | |||
} | |||
/** | |||
* Constructs new <code>QueryContainer</code> with the specified | |||
* queryStatement using the default resultset type and default resultset | |||
* concurrency. | |||
* | |||
* @param queryStatement | |||
* Database query | |||
* @param connection | |||
* Connection object | |||
* @see QueryContainer#DEFAULT_RESULTSET_TYPE | |||
* @see QueryContainer#DEFAULT_RESULTSET_CONCURRENCY | |||
* @throws SQLException | |||
* when database operation fails | |||
*/ | |||
public QueryContainer(String queryStatement, Connection connection) | |||
throws SQLException { | |||
this(queryStatement, connection, DEFAULT_RESULTSET_TYPE, | |||
DEFAULT_RESULTSET_CONCURRENCY); | |||
} | |||
/** | |||
* Fills the Container with the items and properties. Invoked by the | |||
* constructor. | |||
* | |||
* @throws SQLException | |||
* when parameter initialization fails. | |||
* @see QueryContainer#QueryContainer(String, Connection, int, int). | |||
*/ | |||
private void init() throws SQLException { | |||
refresh(); | |||
ResultSetMetaData metadata; | |||
metadata = result.getMetaData(); | |||
final int count = metadata.getColumnCount(); | |||
final ArrayList<String> list = new ArrayList<String>(count); | |||
for (int i = 1; i <= count; i++) { | |||
final String columnName = metadata.getColumnName(i); | |||
list.add(columnName); | |||
final Property<?> p = getContainerProperty(new Integer(1), | |||
columnName); | |||
propertyTypes.put(columnName, | |||
p == null ? Object.class : p.getType()); | |||
} | |||
propertyIds = Collections.unmodifiableCollection(list); | |||
} | |||
/** | |||
* <p> | |||
* Restores items in the container. This method will update the latest data | |||
* to the container. | |||
* </p> | |||
* Note: This method should be used to update the container with the latest | |||
* items. | |||
* | |||
* @throws SQLException | |||
* when database operation fails | |||
* | |||
*/ | |||
public void refresh() throws SQLException { | |||
close(); | |||
statement = connection.createStatement(resultSetType, | |||
resultSetConcurrency); | |||
result = statement.executeQuery(queryStatement); | |||
result.last(); | |||
size = result.getRow(); | |||
} | |||
/** | |||
* Releases and nullifies the <code>statement</code>. | |||
* | |||
* @throws SQLException | |||
* when database operation fails | |||
*/ | |||
public void close() throws SQLException { | |||
if (statement != null) { | |||
statement.close(); | |||
} | |||
statement = null; | |||
} | |||
/** | |||
* Gets the Item with the given Item ID from the Container. | |||
* | |||
* @param id | |||
* ID of the Item to retrieve | |||
* @return Item Id. | |||
*/ | |||
@Override | |||
public Item getItem(Object id) { | |||
return new Row(id); | |||
} | |||
/** | |||
* Gets the collection of propertyId from the Container. | |||
* | |||
* @return Collection of Property ID. | |||
*/ | |||
@Override | |||
public Collection<String> getContainerPropertyIds() { | |||
return propertyIds; | |||
} | |||
/** | |||
* Gets an collection of all the item IDs in the container. | |||
* | |||
* @return collection of Item IDs | |||
*/ | |||
@Override | |||
public Collection<?> getItemIds() { | |||
final Collection<Integer> c = new ArrayList<Integer>(size); | |||
for (int i = 1; i <= size; i++) { | |||
c.add(new Integer(i)); | |||
} | |||
return c; | |||
} | |||
/** | |||
* Gets the property identified by the given itemId and propertyId from the | |||
* container. If the container does not contain the property | |||
* <code>null</code> is returned. | |||
* | |||
* @param itemId | |||
* ID of the Item which contains the Property | |||
* @param propertyId | |||
* ID of the Property to retrieve | |||
* | |||
* @return Property with the given ID if exists; <code>null</code> | |||
* otherwise. | |||
*/ | |||
@Override | |||
public synchronized Property<?> getContainerProperty(Object itemId, | |||
Object propertyId) { | |||
if (!(itemId instanceof Integer && propertyId instanceof String)) { | |||
return null; | |||
} | |||
Object value; | |||
try { | |||
result.absolute(((Integer) itemId).intValue()); | |||
value = result.getObject((String) propertyId); | |||
} catch (final Exception e) { | |||
return null; | |||
} | |||
// Handle also null values from the database | |||
return new ObjectProperty<Object>(value != null ? value | |||
: new String("")); | |||
} | |||
/** | |||
* Gets the data type of all properties identified by the given type ID. | |||
* | |||
* @param id | |||
* ID identifying the Properties | |||
* | |||
* @return data type of the Properties | |||
*/ | |||
@Override | |||
public Class<?> getType(Object id) { | |||
return propertyTypes.get(id); | |||
} | |||
/** | |||
* Gets the number of items in the container. | |||
* | |||
* @return the number of items in the container. | |||
*/ | |||
@Override | |||
public int size() { | |||
return size; | |||
} | |||
/** | |||
* Tests if the list contains the specified Item. | |||
* | |||
* @param id | |||
* ID the of Item to be tested. | |||
* @return <code>true</code> if given id is in the container; | |||
* <code>false</code> otherwise. | |||
*/ | |||
@Override | |||
public boolean containsId(Object id) { | |||
if (!(id instanceof Integer)) { | |||
return false; | |||
} | |||
final int i = ((Integer) id).intValue(); | |||
if (i < 1) { | |||
return false; | |||
} | |||
if (i > size) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
/** | |||
* Creates new Item with the given ID into the Container. | |||
* | |||
* @param itemId | |||
* ID of the Item to be created. | |||
* | |||
* @return Created new Item, or <code>null</code> if it fails. | |||
* | |||
* @throws UnsupportedOperationException | |||
* if the addItem method is not supported. | |||
*/ | |||
@Override | |||
public Item addItem(Object itemId) throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Creates a new Item into the Container, and assign it an ID. | |||
* | |||
* @return ID of the newly created Item, or <code>null</code> if it fails. | |||
* @throws UnsupportedOperationException | |||
* if the addItem method is not supported. | |||
*/ | |||
@Override | |||
public Object addItem() throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Removes the Item identified by ItemId from the Container. | |||
* | |||
* @param itemId | |||
* ID of the Item to remove. | |||
* @return <code>true</code> if the operation succeeded; <code>false</code> | |||
* otherwise. | |||
* @throws UnsupportedOperationException | |||
* if the removeItem method is not supported. | |||
*/ | |||
@Override | |||
public boolean removeItem(Object itemId) | |||
throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Adds new Property to all Items in the Container. | |||
* | |||
* @param propertyId | |||
* ID of the Property | |||
* @param type | |||
* Data type of the new Property | |||
* @param defaultValue | |||
* The value all created Properties are initialized to. | |||
* @return <code>true</code> if the operation succeeded; <code>false</code> | |||
* otherwise. | |||
* @throws UnsupportedOperationException | |||
* if the addContainerProperty method is not supported. | |||
*/ | |||
@Override | |||
public boolean addContainerProperty(Object propertyId, Class<?> type, | |||
Object defaultValue) throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Removes a Property specified by the given Property ID from the Container. | |||
* | |||
* @param propertyId | |||
* ID of the Property to remove | |||
* @return <code>true</code> if the operation succeeded; <code>false</code> | |||
* otherwise. | |||
* @throws UnsupportedOperationException | |||
* if the removeContainerProperty method is not supported. | |||
*/ | |||
@Override | |||
public boolean removeContainerProperty(Object propertyId) | |||
throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Removes all Items from the Container. | |||
* | |||
* @return <code>true</code> if the operation succeeded; <code>false</code> | |||
* otherwise. | |||
* @throws UnsupportedOperationException | |||
* if the removeAllItems method is not supported. | |||
*/ | |||
@Override | |||
public boolean removeAllItems() throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Adds new item after the given item. | |||
* | |||
* @param previousItemId | |||
* Id of the previous item in ordered container. | |||
* @param newItemId | |||
* Id of the new item to be added. | |||
* @return Returns new item or <code>null</code> if the operation fails. | |||
* @throws UnsupportedOperationException | |||
* if the addItemAfter method is not supported. | |||
*/ | |||
@Override | |||
public Item addItemAfter(Object previousItemId, Object newItemId) | |||
throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Adds new item after the given item. | |||
* | |||
* @param previousItemId | |||
* Id of the previous item in ordered container. | |||
* @return Returns item id created new item or <code>null</code> if the | |||
* operation fails. | |||
* @throws UnsupportedOperationException | |||
* if the addItemAfter method is not supported. | |||
*/ | |||
@Override | |||
public Object addItemAfter(Object previousItemId) | |||
throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Returns id of first item in the Container. | |||
* | |||
* @return ID of the first Item in the list. | |||
*/ | |||
@Override | |||
public Object firstItemId() { | |||
if (size < 1) { | |||
return null; | |||
} | |||
return new Integer(1); | |||
} | |||
/** | |||
* Returns <code>true</code> if given id is first id at first index. | |||
* | |||
* @param id | |||
* ID of an Item in the Container. | |||
*/ | |||
@Override | |||
public boolean isFirstId(Object id) { | |||
return size > 0 && (id instanceof Integer) | |||
&& ((Integer) id).intValue() == 1; | |||
} | |||
/** | |||
* Returns <code>true</code> if given id is last id at last index. | |||
* | |||
* @param id | |||
* ID of an Item in the Container | |||
* | |||
*/ | |||
@Override | |||
public boolean isLastId(Object id) { | |||
return size > 0 && (id instanceof Integer) | |||
&& ((Integer) id).intValue() == size; | |||
} | |||
/** | |||
* Returns id of last item in the Container. | |||
* | |||
* @return ID of the last Item. | |||
*/ | |||
@Override | |||
public Object lastItemId() { | |||
if (size < 1) { | |||
return null; | |||
} | |||
return new Integer(size); | |||
} | |||
/** | |||
* Returns id of next item in container at next index. | |||
* | |||
* @param id | |||
* ID of an Item in the Container. | |||
* @return ID of the next Item or null. | |||
*/ | |||
@Override | |||
public Object nextItemId(Object id) { | |||
if (size < 1 || !(id instanceof Integer)) { | |||
return null; | |||
} | |||
final int i = ((Integer) id).intValue(); | |||
if (i >= size) { | |||
return null; | |||
} | |||
return new Integer(i + 1); | |||
} | |||
/** | |||
* Returns id of previous item in container at previous index. | |||
* | |||
* @param id | |||
* ID of an Item in the Container. | |||
* @return ID of the previous Item or null. | |||
*/ | |||
@Override | |||
public Object prevItemId(Object id) { | |||
if (size < 1 || !(id instanceof Integer)) { | |||
return null; | |||
} | |||
final int i = ((Integer) id).intValue(); | |||
if (i <= 1) { | |||
return null; | |||
} | |||
return new Integer(i - 1); | |||
} | |||
/** | |||
* The <code>Row</code> class implements methods of Item. | |||
* | |||
* @author Vaadin Ltd. | |||
* @since 4.0 | |||
*/ | |||
class Row implements Item { | |||
Object id; | |||
private Row(Object rowId) { | |||
id = rowId; | |||
} | |||
/** | |||
* Adds the item property. | |||
* | |||
* @param id | |||
* ID of the new Property. | |||
* @param property | |||
* Property to be added and associated with ID. | |||
* @return <code>true</code> if the operation succeeded; | |||
* <code>false</code> otherwise. | |||
* @throws UnsupportedOperationException | |||
* if the addItemProperty method is not supported. | |||
*/ | |||
@Override | |||
public boolean addItemProperty(Object id, Property property) | |||
throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Gets the property corresponding to the given property ID stored in | |||
* the Item. | |||
* | |||
* @param propertyId | |||
* identifier of the Property to get | |||
* @return the Property with the given ID or <code>null</code> | |||
*/ | |||
@Override | |||
public Property<?> getItemProperty(Object propertyId) { | |||
return getContainerProperty(id, propertyId); | |||
} | |||
/** | |||
* Gets the collection of property IDs stored in the Item. | |||
* | |||
* @return unmodifiable collection containing IDs of the Properties | |||
* stored the Item. | |||
*/ | |||
@Override | |||
public Collection<String> getItemPropertyIds() { | |||
return propertyIds; | |||
} | |||
/** | |||
* Removes given item property. | |||
* | |||
* @param id | |||
* ID of the Property to be removed. | |||
* @return <code>true</code> if the item property is removed; | |||
* <code>false</code> otherwise. | |||
* @throws UnsupportedOperationException | |||
* if the removeItemProperty is not supported. | |||
*/ | |||
@Override | |||
public boolean removeItemProperty(Object id) | |||
throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
} | |||
/** | |||
* Closes the statement. | |||
* | |||
* @see #close() | |||
*/ | |||
@Override | |||
public void finalize() { | |||
try { | |||
close(); | |||
} catch (final SQLException ignored) { | |||
} | |||
} | |||
/** | |||
* Adds the given item at the position of given index. | |||
* | |||
* @param index | |||
* Index to add the new item. | |||
* @param newItemId | |||
* Id of the new item to be added. | |||
* @return new item or <code>null</code> if the operation fails. | |||
* @throws UnsupportedOperationException | |||
* if the addItemAt is not supported. | |||
*/ | |||
@Override | |||
public Item addItemAt(int index, Object newItemId) | |||
throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Adds item at the position of provided index in the container. | |||
* | |||
* @param index | |||
* Index to add the new item. | |||
* @return item id created new item or <code>null</code> if the operation | |||
* fails. | |||
* | |||
* @throws UnsupportedOperationException | |||
* if the addItemAt is not supported. | |||
*/ | |||
@Override | |||
public Object addItemAt(int index) throws UnsupportedOperationException { | |||
throw new UnsupportedOperationException(); | |||
} | |||
/** | |||
* Gets the Index id in the container. | |||
* | |||
* @param index | |||
* Index Id. | |||
* @return ID in the given index. | |||
*/ | |||
@Override | |||
public Object getIdByIndex(int index) { | |||
if (size < 1 || index < 0 || index >= size) { | |||
return null; | |||
} | |||
return new Integer(index + 1); | |||
} | |||
/** | |||
* Gets the index of the Item corresponding to id in the container. | |||
* | |||
* @param id | |||
* ID of an Item in the Container | |||
* @return index of the Item, or -1 if the Container does not include the | |||
* Item | |||
*/ | |||
@Override | |||
public int indexOfId(Object id) { | |||
if (size < 1 || !(id instanceof Integer)) { | |||
return -1; | |||
} | |||
final int i = ((Integer) id).intValue(); | |||
if (i >= size || i < 1) { | |||
return -1; | |||
} | |||
return i - 1; | |||
} | |||
} |
@@ -69,7 +69,9 @@ final public class ColumnProperty implements Property { | |||
* @param value | |||
* @param type | |||
* | |||
* @deprecated | |||
* @deprecated as of 7.0. Use | |||
* {@link #ColumnProperty(String, boolean, boolean, boolean, boolean, Object, Class) | |||
* instead | |||
*/ | |||
@Deprecated | |||
public ColumnProperty(String propertyId, boolean readOnly, | |||
@@ -144,7 +146,7 @@ final public class ColumnProperty implements Property { | |||
@Override | |||
public void setValue(Object newValue) throws ReadOnlyException, | |||
ConversionException { | |||
ConversionException { | |||
if (newValue == null && !nullable) { | |||
throw new NotNullableException( | |||
"Null values are not allowed for this property."); |
@@ -121,34 +121,6 @@ public abstract class AbstractComponent extends AbstractClientConnector | |||
return getState().getDebugId(); | |||
} | |||
/** | |||
* Gets style for component. Multiple styles are joined with spaces. | |||
* | |||
* @return the component's styleValue of property style. | |||
* @deprecated Use getStyleName() instead; renamed for consistency and to | |||
* indicate that "style" should not be used to switch client | |||
* side implementation, only to style the component. | |||
*/ | |||
@Deprecated | |||
public String getStyle() { | |||
return getStyleName(); | |||
} | |||
/** | |||
* Sets and replaces all previous style names of the component. This method | |||
* will trigger a {@link RepaintRequestEvent}. | |||
* | |||
* @param style | |||
* the new style of the component. | |||
* @deprecated Use setStyleName() instead; renamed for consistency and to | |||
* indicate that "style" should not be used to switch client | |||
* side implementation, only to style the component. | |||
*/ | |||
@Deprecated | |||
public void setStyle(String style) { | |||
setStyleName(style); | |||
} | |||
/* | |||
* Gets the component's style. Don't add a JavaDoc comment here, we use the | |||
* default documentation from implemented interface. |
@@ -232,19 +232,6 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements | |||
} | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.ui.Layout.AlignmentHandler#setComponentAlignment(com | |||
* .vaadin.ui.Component, int, int) | |||
*/ | |||
@Override | |||
public void setComponentAlignment(Component childComponent, | |||
int horizontalAlignment, int verticalAlignment) { | |||
Alignment a = new Alignment(horizontalAlignment + verticalAlignment); | |||
setComponentAlignment(childComponent, a); | |||
} | |||
@Override | |||
public void setComponentAlignment(Component childComponent, | |||
Alignment alignment) { |
@@ -156,22 +156,6 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, | |||
.valueOf((String) getData("horizontalLocation")); | |||
} | |||
/** | |||
* @deprecated use {@link #getVerticalDropLocation()} instead | |||
*/ | |||
@Deprecated | |||
public VerticalDropLocation verticalDropLocation() { | |||
return getVerticalDropLocation(); | |||
} | |||
/** | |||
* @deprecated use {@link #getHorizontalDropLocation()} instead | |||
*/ | |||
@Deprecated | |||
public HorizontalDropLocation horizontalDropLocation() { | |||
return getHorizontalDropLocation(); | |||
} | |||
} | |||
public enum DragStartMode { |
@@ -805,14 +805,6 @@ public class GridLayout extends AbstractLayout implements | |||
component = newComponent; | |||
} | |||
/** | |||
* @deprecated Use {@link #getColumn1()} instead. | |||
*/ | |||
@Deprecated | |||
public int getX1() { | |||
return getColumn1(); | |||
} | |||
/** | |||
* Gets the column of the top-left corner cell. | |||
* | |||
@@ -822,14 +814,6 @@ public class GridLayout extends AbstractLayout implements | |||
return column1; | |||
} | |||
/** | |||
* @deprecated Use {@link #getColumn2()} instead. | |||
*/ | |||
@Deprecated | |||
public int getX2() { | |||
return getColumn2(); | |||
} | |||
/** | |||
* Gets the column of the bottom-right corner cell. | |||
* | |||
@@ -839,14 +823,6 @@ public class GridLayout extends AbstractLayout implements | |||
return column2; | |||
} | |||
/** | |||
* @deprecated Use {@link #getRow1()} instead. | |||
*/ | |||
@Deprecated | |||
public int getY1() { | |||
return getRow1(); | |||
} | |||
/** | |||
* Gets the row of the top-left corner cell. | |||
* | |||
@@ -856,14 +832,6 @@ public class GridLayout extends AbstractLayout implements | |||
return row1; | |||
} | |||
/** | |||
* @deprecated Use {@link #getRow2()} instead. | |||
*/ | |||
@Deprecated | |||
public int getY2() { | |||
return getRow2(); | |||
} | |||
/** | |||
* Gets the row of the bottom-right corner cell. | |||
* | |||
@@ -1149,20 +1117,6 @@ public class GridLayout extends AbstractLayout implements | |||
cursorY = 0; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.ui.Layout.AlignmentHandler#setComponentAlignment(com | |||
* .vaadin.ui.Component, int, int) | |||
*/ | |||
@Override | |||
public void setComponentAlignment(Component childComponent, | |||
int horizontalAlignment, int verticalAlignment) { | |||
componentToAlignment.put(childComponent, new Alignment( | |||
horizontalAlignment + verticalAlignment)); | |||
requestRepaint(); | |||
} | |||
@Override | |||
public void setComponentAlignment(Component childComponent, | |||
Alignment alignment) { |
@@ -18,7 +18,6 @@ package com.vaadin.ui; | |||
import java.io.Serializable; | |||
import com.vaadin.shared.ui.AlignmentInfo.Bits; | |||
import com.vaadin.shared.ui.MarginInfo; | |||
/** | |||
@@ -38,74 +37,6 @@ public interface Layout extends ComponentContainer, Serializable { | |||
*/ | |||
public interface AlignmentHandler extends Serializable { | |||
/** | |||
* Contained component should be aligned horizontally to the left. | |||
* | |||
* @deprecated Use of {@link Alignment} class and its constants | |||
*/ | |||
@Deprecated | |||
public static final int ALIGNMENT_LEFT = Bits.ALIGNMENT_LEFT; | |||
/** | |||
* Contained component should be aligned horizontally to the right. | |||
* | |||
* @deprecated Use of {@link Alignment} class and its constants | |||
*/ | |||
@Deprecated | |||
public static final int ALIGNMENT_RIGHT = Bits.ALIGNMENT_RIGHT; | |||
/** | |||
* Contained component should be aligned vertically to the top. | |||
* | |||
* @deprecated Use of {@link Alignment} class and its constants | |||
*/ | |||
@Deprecated | |||
public static final int ALIGNMENT_TOP = Bits.ALIGNMENT_TOP; | |||
/** | |||
* Contained component should be aligned vertically to the bottom. | |||
* | |||
* @deprecated Use of {@link Alignment} class and its constants | |||
*/ | |||
@Deprecated | |||
public static final int ALIGNMENT_BOTTOM = Bits.ALIGNMENT_BOTTOM; | |||
/** | |||
* Contained component should be horizontally aligned to center. | |||
* | |||
* @deprecated Use of {@link Alignment} class and its constants | |||
*/ | |||
@Deprecated | |||
public static final int ALIGNMENT_HORIZONTAL_CENTER = Bits.ALIGNMENT_HORIZONTAL_CENTER; | |||
/** | |||
* Contained component should be vertically aligned to center. | |||
* | |||
* @deprecated Use of {@link Alignment} class and its constants | |||
*/ | |||
@Deprecated | |||
public static final int ALIGNMENT_VERTICAL_CENTER = Bits.ALIGNMENT_VERTICAL_CENTER; | |||
/** | |||
* Set alignment for one contained component in this layout. Alignment | |||
* is calculated as a bit mask of the two passed values. | |||
* | |||
* @deprecated Use {@link #setComponentAlignment(Component, Alignment)} | |||
* instead | |||
* | |||
* @param childComponent | |||
* the component to align within it's layout cell. | |||
* @param horizontalAlignment | |||
* the horizontal alignment for the child component (left, | |||
* center, right). Use ALIGNMENT constants. | |||
* @param verticalAlignment | |||
* the vertical alignment for the child component (top, | |||
* center, bottom). Use ALIGNMENT constants. | |||
*/ | |||
@Deprecated | |||
public void setComponentAlignment(Component childComponent, | |||
int horizontalAlignment, int verticalAlignment); | |||
/** | |||
* Set alignment for one contained component in this layout. Use | |||
* predefined alignments from Alignment class. |
@@ -159,22 +159,6 @@ public class PopupView extends AbstractComponentContainer implements | |||
return content; | |||
} | |||
/** | |||
* @deprecated Use {@link #setPopupVisible()} instead. | |||
*/ | |||
@Deprecated | |||
public void setPopupVisibility(boolean visible) { | |||
setPopupVisible(visible); | |||
} | |||
/** | |||
* @deprecated Use {@link #isPopupVisible()} instead. | |||
*/ | |||
@Deprecated | |||
public boolean getPopupVisibility() { | |||
return isPopupVisible(); | |||
} | |||
/** | |||
* Set the visibility of the popup. Does not hide the minimal | |||
* representation. |
@@ -16,7 +16,6 @@ | |||
package com.vaadin.ui; | |||
import java.text.Format; | |||
import java.util.Map; | |||
import com.vaadin.data.Property; | |||
@@ -34,12 +33,6 @@ import com.vaadin.terminal.Vaadin6Component; | |||
public class RichTextArea extends AbstractField<String> implements | |||
Vaadin6Component { | |||
/** | |||
* Value formatter used to format the string contents. | |||
*/ | |||
@Deprecated | |||
private Format format; | |||
/** | |||
* Null representation. | |||
*/ | |||
@@ -123,7 +116,7 @@ public class RichTextArea extends AbstractField<String> implements | |||
} | |||
// Adds the content as variable | |||
String value = getFormattedValue(); | |||
String value = getValue(); | |||
if (value == null) { | |||
value = getNullRepresentation(); | |||
} | |||
@@ -167,37 +160,6 @@ public class RichTextArea extends AbstractField<String> implements | |||
requestRepaint(); | |||
} | |||
/** | |||
* Gets the formatted string value. Sets the field value by using the | |||
* assigned Format. | |||
* | |||
* @return the Formatted value. | |||
* @see #setFormat(Format) | |||
* @see Format | |||
* @deprecated | |||
*/ | |||
@Deprecated | |||
protected String getFormattedValue() { | |||
Object v = getValue(); | |||
if (v == null) { | |||
return null; | |||
} | |||
return v.toString(); | |||
} | |||
@Override | |||
public String getValue() { | |||
String v = super.getValue(); | |||
if (format == null || v == null) { | |||
return v; | |||
} | |||
try { | |||
return format.format(v); | |||
} catch (final IllegalArgumentException e) { | |||
return v; | |||
} | |||
} | |||
@Override | |||
public void changeVariables(Object source, Map<String, Object> variables) { | |||
// Sets the text | |||
@@ -207,7 +169,7 @@ public class RichTextArea extends AbstractField<String> implements | |||
// has been updated | |||
String newValue = (String) variables.get("text"); | |||
final String oldValue = getFormattedValue(); | |||
final String oldValue = getValue(); | |||
if (newValue != null | |||
&& (oldValue == null || isNullSettingAllowed()) | |||
&& newValue.equals(getNullRepresentation())) { | |||
@@ -218,9 +180,9 @@ public class RichTextArea extends AbstractField<String> implements | |||
boolean wasModified = isModified(); | |||
setValue(newValue, true); | |||
// If the modified status changes, or if we have a formatter, | |||
// If the modified status changes, | |||
// repaint is needed after all. | |||
if (format != null || wasModified != isModified()) { | |||
if (wasModified != isModified()) { | |||
requestRepaint(); | |||
} | |||
} | |||
@@ -323,31 +285,6 @@ public class RichTextArea extends AbstractField<String> implements | |||
this.nullSettingAllowed = nullSettingAllowed; | |||
} | |||
/** | |||
* Gets the value formatter of TextField. | |||
* | |||
* @return the Format used to format the value. | |||
* @deprecated replaced by {@link com.vaadin.data.util.PropertyFormatter} | |||
*/ | |||
@Deprecated | |||
public Format getFormat() { | |||
return format; | |||
} | |||
/** | |||
* Gets the value formatter of TextField. | |||
* | |||
* @param format | |||
* the Format used to format the value. Null disables the | |||
* formatting. | |||
* @deprecated replaced by {@link com.vaadin.data.util.PropertyFormatter} | |||
*/ | |||
@Deprecated | |||
public void setFormat(Format format) { | |||
this.format = format; | |||
requestRepaint(); | |||
} | |||
@Override | |||
protected boolean isEmpty() { | |||
return super.isEmpty() || getValue().length() == 0; |
@@ -697,40 +697,6 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering, | |||
return filteringMode; | |||
} | |||
/** | |||
* Note, one should use more generic setWidth(String) method instead of | |||
* this. This now days actually converts columns to width with em css unit. | |||
* | |||
* Sets the number of columns in the editor. If the number of columns is set | |||
* 0, the actual number of displayed columns is determined implicitly by the | |||
* adapter. | |||
* | |||
* @deprecated | |||
* | |||
* @param columns | |||
* the number of columns to set. | |||
*/ | |||
@Deprecated | |||
public void setColumns(int columns) { | |||
if (columns < 0) { | |||
columns = 0; | |||
} | |||
if (this.columns != columns) { | |||
this.columns = columns; | |||
setWidth(columns, Select.UNITS_EM); | |||
requestRepaint(); | |||
} | |||
} | |||
/** | |||
* @deprecated see setter function | |||
* @return | |||
*/ | |||
@Deprecated | |||
public int getColumns() { | |||
return columns; | |||
} | |||
@Override | |||
public void addListener(BlurListener listener) { | |||
addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, |
@@ -361,8 +361,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, | |||
String caption = null; | |||
Resource icon = null; | |||
if (TabSheet.class.isAssignableFrom(source.getClass())) { | |||
caption = ((TabSheet) source).getTabCaption(c); | |||
icon = ((TabSheet) source).getTabIcon(c); | |||
Tab tab = ((TabSheet) source).getTab(c); | |||
caption = tab.getCaption(); | |||
icon = tab.getIcon(); | |||
} | |||
source.removeComponent(c); | |||
addTab(c, caption, icon); | |||
@@ -477,82 +478,6 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, | |||
requestRepaint(); | |||
} | |||
/** | |||
* Gets tab caption. The tab is identified by the tab content component. | |||
* | |||
* @param c | |||
* the component in the tab | |||
* @deprecated Use {@link #getTab(Component)} and {@link Tab#getCaption()} | |||
* instead. | |||
*/ | |||
@Deprecated | |||
public String getTabCaption(Component c) { | |||
Tab info = tabs.get(c); | |||
if (info == null) { | |||
return ""; | |||
} else { | |||
return info.getCaption(); | |||
} | |||
} | |||
/** | |||
* Sets tab caption. The tab is identified by the tab content component. | |||
* | |||
* @param c | |||
* the component in the tab | |||
* @param caption | |||
* the caption to set. | |||
* @deprecated Use {@link #getTab(Component)} and | |||
* {@link Tab#setCaption(String)} instead. | |||
*/ | |||
@Deprecated | |||
public void setTabCaption(Component c, String caption) { | |||
Tab info = tabs.get(c); | |||
if (info != null) { | |||
info.setCaption(caption); | |||
requestRepaint(); | |||
} | |||
} | |||
/** | |||
* Gets the icon for a tab. The tab is identified by the tab content | |||
* component. | |||
* | |||
* @param c | |||
* the component in the tab | |||
* @deprecated Use {@link #getTab(Component)} and {@link Tab#getIcon()} | |||
* instead. | |||
*/ | |||
@Deprecated | |||
public Resource getTabIcon(Component c) { | |||
Tab info = tabs.get(c); | |||
if (info == null) { | |||
return null; | |||
} else { | |||
return info.getIcon(); | |||
} | |||
} | |||
/** | |||
* Sets icon for the given component. The tab is identified by the tab | |||
* content component. | |||
* | |||
* @param c | |||
* the component in the tab | |||
* @param icon | |||
* the icon to set | |||
* @deprecated Use {@link #getTab(Component)} and | |||
* {@link Tab#setIcon(Resource)} instead. | |||
*/ | |||
@Deprecated | |||
public void setTabIcon(Component c, Resource icon) { | |||
Tab info = tabs.get(c); | |||
if (info != null) { | |||
info.setIcon(icon); | |||
requestRepaint(); | |||
} | |||
} | |||
/** | |||
* Returns the {@link Tab} (metadata) for a component. The {@link Tab} | |||
* object can be used for setting caption,icon, etc for the tab. |
@@ -1506,31 +1506,6 @@ public class Table extends AbstractSelect implements Action.Container, | |||
setCurrentPageFirstItemIndex(newIndex, true); | |||
} | |||
/** | |||
* Getter for property pageBuffering. | |||
* | |||
* @deprecated functionality is not needed in ajax rendering model | |||
* | |||
* @return the Value of property pageBuffering. | |||
*/ | |||
@Deprecated | |||
public boolean isPageBufferingEnabled() { | |||
return true; | |||
} | |||
/** | |||
* Setter for property pageBuffering. | |||
* | |||
* @deprecated functionality is not needed in ajax rendering model | |||
* | |||
* @param pageBuffering | |||
* the New value of property pageBuffering. | |||
*/ | |||
@Deprecated | |||
public void setPageBufferingEnabled(boolean pageBuffering) { | |||
} | |||
/** | |||
* Getter for property selectable. | |||
* | |||
@@ -2229,16 +2204,6 @@ public class Table extends AbstractSelect implements Action.Container, | |||
} | |||
} | |||
/** | |||
* Refreshes the current page contents. | |||
* | |||
* @deprecated should not need to be used | |||
*/ | |||
@Deprecated | |||
public void refreshCurrentPage() { | |||
} | |||
/** | |||
* Sets the row header mode. | |||
* <p> |
@@ -855,33 +855,6 @@ public class Upload extends AbstractComponent implements Component.Focusable, | |||
return contentLength; | |||
} | |||
/** | |||
* This method is deprecated, use addListener(ProgressListener) instead. | |||
* | |||
* @deprecated Use addListener(ProgressListener) instead. | |||
* @param progressListener | |||
*/ | |||
@Deprecated | |||
public void setProgressListener(ProgressListener progressListener) { | |||
addListener(progressListener); | |||
} | |||
/** | |||
* This method is deprecated. | |||
* | |||
* @deprecated Replaced with addListener/removeListener | |||
* @return listener | |||
* | |||
*/ | |||
@Deprecated | |||
public ProgressListener getProgressListener() { | |||
if (progressListeners == null || progressListeners.isEmpty()) { | |||
return null; | |||
} else { | |||
return progressListeners.iterator().next(); | |||
} | |||
} | |||
/** | |||
* ProgressListener receives events to track progress of upload. | |||
*/ |
@@ -44,18 +44,6 @@ public class BaseTheme { | |||
*/ | |||
public static final String BUTTON_LINK = "link"; | |||
/** | |||
* Removes extra decorations from the panel. | |||
* | |||
* @deprecated Base theme does not implement this style, but it is defined | |||
* here since it has been a part of the framework before | |||
* multiple themes were available. Use the constant provided by | |||
* the theme you're using instead, e.g. | |||
* {@link Reindeer#PANEL_LIGHT} or {@link Runo#PANEL_LIGHT}. | |||
*/ | |||
@Deprecated | |||
public static final String PANEL_LIGHT = "light"; | |||
/** | |||
* Adds the connector lines between a parent node and its child nodes to | |||
* indicate the tree hierarchy better. |
@@ -48,12 +48,6 @@ public class Reindeer extends BaseTheme { | |||
*/ | |||
public static final String LABEL_SMALL = "light"; | |||
/** | |||
* @deprecated Use {@link #LABEL_SMALL} instead. | |||
*/ | |||
@Deprecated | |||
public static final String LABEL_LIGHT = "small"; | |||
/*************************************************************************** | |||
* | |||
* Button styles | |||
@@ -67,12 +61,6 @@ public class Reindeer extends BaseTheme { | |||
*/ | |||
public static final String BUTTON_DEFAULT = "primary"; | |||
/** | |||
* @deprecated Use {@link #BUTTON_DEFAULT} instead | |||
*/ | |||
@Deprecated | |||
public static final String BUTTON_PRIMARY = BUTTON_DEFAULT; | |||
/** | |||
* Small sized button, use for context specific actions for example | |||
*/ | |||
@@ -128,12 +116,6 @@ public class Reindeer extends BaseTheme { | |||
*/ | |||
public static final String TABSHEET_SMALL = "bar"; | |||
/** | |||
* @deprecated Use {@link #TABSHEET_SMALL} instead. | |||
*/ | |||
@Deprecated | |||
public static final String TABSHEET_BAR = TABSHEET_SMALL; | |||
/** | |||
* Removes borders and background color from the tab sheet. The tabs are | |||
* presented with minimal lines indicating the selected tab. |
@@ -5,10 +5,12 @@ import java.util.Iterator; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.util.MethodProperty; | |||
import com.vaadin.shared.ui.AlignmentInfo.Bits; | |||
import com.vaadin.shared.ui.MarginInfo; | |||
import com.vaadin.terminal.SystemError; | |||
import com.vaadin.terminal.ThemeResource; | |||
import com.vaadin.ui.AbstractComponent; | |||
import com.vaadin.ui.Alignment; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.CheckBox; | |||
import com.vaadin.ui.Component; | |||
@@ -320,76 +322,66 @@ public class Ticket1710 extends com.vaadin.Application.LegacyApplication { | |||
hAlign.setNullSelectionAllowed(false); | |||
vAlign.setNullSelectionAllowed(false); | |||
vAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_TOP)); | |||
vAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_TOP), "top"); | |||
vAlign.addItem(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_VERTICAL_CENTER)); | |||
vAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_VERTICAL_CENTER), | |||
vAlign.addItem(new Integer(Bits.ALIGNMENT_TOP)); | |||
vAlign.setItemCaption(new Integer(Bits.ALIGNMENT_TOP), "top"); | |||
vAlign.addItem(new Integer(Bits.ALIGNMENT_VERTICAL_CENTER)); | |||
vAlign.setItemCaption(new Integer(Bits.ALIGNMENT_VERTICAL_CENTER), | |||
"center"); | |||
vAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_BOTTOM)); | |||
vAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_BOTTOM), "bottom"); | |||
hAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT)); | |||
hAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_LEFT), "left"); | |||
hAlign.addItem(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER)); | |||
hAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER), | |||
"center"); | |||
hAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_RIGHT)); | |||
hAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_RIGHT), "right"); | |||
vAlign.addItem(new Integer(Bits.ALIGNMENT_BOTTOM)); | |||
vAlign.setItemCaption(new Integer(Bits.ALIGNMENT_BOTTOM), "bottom"); | |||
hAlign.addItem(new Integer(Bits.ALIGNMENT_LEFT)); | |||
hAlign.setItemCaption(new Integer(Bits.ALIGNMENT_LEFT), "left"); | |||
hAlign.addItem(new Integer(Bits.ALIGNMENT_HORIZONTAL_CENTER)); | |||
hAlign.setItemCaption( | |||
new Integer(Bits.ALIGNMENT_HORIZONTAL_CENTER), "center"); | |||
hAlign.addItem(new Integer(Bits.ALIGNMENT_RIGHT)); | |||
hAlign.setItemCaption(new Integer(Bits.ALIGNMENT_RIGHT), "right"); | |||
Property.ValueChangeListener alignmentChangeListener = new Property.ValueChangeListener() { | |||
@Override | |||
public void valueChange(ValueChangeEvent event) { | |||
updateAlignments(((Integer) hAlign.getValue()).intValue(), | |||
((Integer) vAlign.getValue()).intValue()); | |||
Integer h = ((Integer) hAlign.getValue()).intValue(); | |||
int v = ((Integer) vAlign.getValue()).intValue(); | |||
updateAlignments(new Alignment(h + v)); | |||
} | |||
}; | |||
hAlign.setValue(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT)); | |||
hAlign.setValue(new Integer(Bits.ALIGNMENT_LEFT)); | |||
vAlign.addListener(alignmentChangeListener); | |||
hAlign.addListener(alignmentChangeListener); | |||
vAlign.setValue(new Integer(Layout.AlignmentHandler.ALIGNMENT_TOP)); | |||
vAlign.setValue(new Integer(Bits.ALIGNMENT_TOP)); | |||
controls.addComponent(new Label("layout alignment")); | |||
final NativeSelect lAlign = new NativeSelect(); | |||
controls.addComponent(lAlign); | |||
lAlign.setNullSelectionAllowed(false); | |||
lAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT)); | |||
lAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_LEFT), "left"); | |||
lAlign.addItem(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER)); | |||
lAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER), | |||
"center"); | |||
lAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_RIGHT)); | |||
lAlign.setItemCaption(new Integer( | |||
Layout.AlignmentHandler.ALIGNMENT_RIGHT), "right"); | |||
lAlign.addItem(new Integer(Bits.ALIGNMENT_LEFT)); | |||
lAlign.setItemCaption(new Integer(Bits.ALIGNMENT_LEFT), "left"); | |||
lAlign.addItem(new Integer(Bits.ALIGNMENT_HORIZONTAL_CENTER)); | |||
lAlign.setItemCaption( | |||
new Integer(Bits.ALIGNMENT_HORIZONTAL_CENTER), "center"); | |||
lAlign.addItem(new Integer(Bits.ALIGNMENT_RIGHT)); | |||
lAlign.setItemCaption(new Integer(Bits.ALIGNMENT_RIGHT), "right"); | |||
lAlign.addListener(new Property.ValueChangeListener() { | |||
@Override | |||
public void valueChange(ValueChangeEvent event) { | |||
testPanelLayout.setComponentAlignment(testedLayout, | |||
((Integer) lAlign.getValue()).intValue(), | |||
VerticalLayout.ALIGNMENT_TOP); | |||
testPanelLayout.setComponentAlignment( | |||
testedLayout, | |||
new Alignment(((Integer) lAlign.getValue()) | |||
.intValue() + Bits.ALIGNMENT_TOP)); | |||
} | |||
}); | |||
} | |||
@SuppressWarnings("deprecation") | |||
private void updateAlignments(int h, int v) { | |||
private void updateAlignments(Alignment a) { | |||
for (Iterator<Component> i = testedLayout.getComponentIterator(); i | |||
.hasNext();) { | |||
((Layout.AlignmentHandler) testedLayout).setComponentAlignment( | |||
i.next(), h, v); | |||
i.next(), a); | |||
} | |||
} | |||