// loop each selected and copy to "saved" table\r
final Set selected = (Set) source.getValue();\r
int s = 0;\r
- \r
+\r
// The set can return the items in quite any order, but\r
// for testing purposes they always have to be in the\r
// same order.\r
List ordered = new LinkedList(selected);\r
java.util.Collections.sort(ordered);\r
- \r
+\r
// Now move the items to the other table\r
for (final Iterator it = ordered.iterator(); it.hasNext();) {\r
final Object id = it.next();\r
* Helper to add an item with specified caption and (optional) parent.
*
* @param caption
- * The item caption
+ * The item caption
* @param parent
- * The (optional) parent item id
+ * The (optional) parent item id
* @return the created item's id
*/
private Object addCaptionedItem(String caption, Object parent) {
* when <code>commit</code> is called.
*
* @throws SourceException
- * if the operation fails because of an exception is thrown
- * by the data source. The cause is included in the
- * exception.
+ * if the operation fails because of an exception is thrown by
+ * the data source. The cause is included in the exception.
*/
public void commit() throws SourceException;
* the data source.
*
* @throws SourceException
- * if the operation fails because of an exception is thrown
- * by the data source. The cause is included in the
- * exception.
+ * if the operation fails because of an exception is thrown by
+ * the data source. The cause is included in the exception.
*/
public void discard() throws SourceException;
* will be performed.
*
* @param writeThrough
- * Boolean value to indicate if the object should be in
- * write-through mode after the call.
+ * Boolean value to indicate if the object should be in
+ * write-through mode after the call.
* @throws SourceException
- * If the operation fails because of an exception is thrown
- * by the data source.
+ * If the operation fails because of an exception is thrown by
+ * the data source.
*
*/
public void setWriteThrough(boolean writeThrough) throws SourceException;
* data source.
*
* @param readThrough
- * Boolean value to indicate if the object should be in
- * read-through mode after the call.
+ * Boolean value to indicate if the object should be in
+ * read-through mode after the call.
*
* @throws SourceException
- * If the operation fails because of an exception is thrown
- * by the data source. The cause is included in the
- * exception.
+ * If the operation fails because of an exception is thrown by
+ * the data source. The cause is included in the exception.
*/
public void setReadThrough(boolean readThrough) throws SourceException;
* Creates a source exception that does not include a cause.
*
* @param source
- * the source object implementing the Buffered interface.
+ * the source object implementing the Buffered interface.
*/
public SourceException(Buffered source) {
this.source = source;
* Creates a source exception from a cause exception.
*
* @param source
- * the source object implementing the Buffered interface.
+ * the source object implementing the Buffered interface.
* @param cause
- * the original cause for this exception.
+ * the original cause for this exception.
*/
public SourceException(Buffered source, Throwable cause) {
this.source = source;
* Creates a source exception from multiple causes.
*
* @param source
- * the source object implementing the Buffered interface.
+ * the source object implementing the Buffered interface.
* @param causes
- * the original causes for this exception.
+ * the original causes for this exception.
*/
public SourceException(Buffered source, Throwable[] causes) {
this.source = source;
*
* @return The cause for the exception.
* @throws MoreThanOneCauseException
- * if there is more than one cause for the exception.
- * This is possible if the commit operation triggers
- * more than one error at the same time.
+ * if there is more than one cause for the exception. This
+ * is possible if the commit operation triggers more than
+ * one error at the same time.
*/
public final Throwable getCause() {
if (causes.length == 0) {
*
* <p>
* Note that though uniquely identified, the Items in a Container are not
- * neccessarily {@link Container.Ordered ordered}or
- * {@link Container.Indexed indexed}.
+ * neccessarily {@link Container.Ordered ordered}or {@link Container.Indexed
+ * indexed}.
* </p>
*
* <p>
* does not contain the requested Item, <code>null</code> is returned.
*
* @param itemId
- * ID of the Item to retrieve
+ * ID of the Item to retrieve
* @return the Item with the given ID or <code>null</code> if the Item is
* not found in the Container
*/
* <code>null</code> is returned.
*
* @param itemId
- * ID of the Item which contains the Property
+ * ID of the Item which contains the Property
* @param propertyId
- * ID of the Property to retrieve
+ * ID of the Property to retrieve
* @return Property with the given ID or <code>null</code>
*/
public Property getContainerProperty(Object itemId, Object propertyId);
* Gets the data type of all Properties identified by the given Property ID.
*
* @param propertyId
- * ID identifying the Properties
+ * ID identifying the Properties
* @return data type of the Properties
*/
public Class getType(Object propertyId);
* Tests if the Container contains the specified Item
*
* @param itemId
- * ID the of Item to be tested
+ * ID the of Item to be tested
* @return boolean indicating if the Container holds the specified Item
*/
public boolean containsId(Object itemId);
* Creates a new Item with the given ID into the Container. The new
* <p>
* Item is returned, and it is ready to have its Properties modified.
- * Returns <code>null</code> if the operation fails or the Container
- * already contains a Item with the given ID.
+ * Returns <code>null</code> if the operation fails or the Container already
+ * contains a Item with the given ID.
* </p>
*
* <p>
* </p>
*
* @param itemId
- * ID of the Item to be created
+ * ID of the Item to be created
* @return Created new Item, or <code>null</code> in case of a failure
*/
public Item addItem(Object itemId) throws UnsupportedOperationException;
*
* <p>
* The new ID is returned, or <code>null</code> if the operation fails.
- * After a successful call you can use the
- * {@link #getItem(Object ItemId) <code>getItem</code>}method to fetch the
- * Item.
+ * After a successful call you can use the {@link #getItem(Object ItemId)
+ * <code>getItem</code>}method to fetch the Item.
* </p>
*
* <p>
* This functionality is optional.
*
* @param itemId
- * ID of the Item to remove
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * ID of the Item to remove
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean removeItem(Object itemId)
throws UnsupportedOperationException;
* This functionality is optional.
*
* @param propertyId
- * ID of the Property
+ * ID of the Property
* @param type
- * Data type of the new Property
+ * 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> if not
+ * The value all created Properties are initialized to
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean addContainerProperty(Object propertyId, Class type,
Object defaultValue) throws UnsupportedOperationException;
* This functionality is optional.
*
* @param propertyId
- * ID of the Property to remove
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * ID of the Property to remove
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException;
* functionality is optional.
* </p>
*
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean removeAllItems() throws UnsupportedOperationException;
* the Container, <code>null</code> is returned.
*
* @param itemId
- * ID of an Item in the Container
+ * ID of an Item in the Container
* @return ID of the next Item or <code>null</code>
*/
public Object nextItemId(Object itemId);
/**
* Gets the ID of the Item preceding the Item that corresponds to
- * <code>itemId</code>. If the given Item is the first or not found
- * in the Container, <code>null</code> is returned.
+ * <code>itemId</code>. If the given Item is the first or not found in
+ * the Container, <code>null</code> is returned.
*
* @param itemId
- * ID of an Item in the Container
+ * ID of an Item in the Container
* @return ID of the previous Item or <code>null</code>
*/
public Object prevItemId(Object itemId);
* Item in the Container.
*
* @param itemId
- * ID of an Item in the Container
+ * ID of an Item in the Container
* @return <code>true</code> if the Item is first in the Container,
* <code>false</code> if not
*/
* </p>
*
* @param previousItemId
- * Id of the previous item in ordered container.
+ * Id of the previous item in ordered container.
* @return Returns item id the the created new item or null if the
* operation fails.
*/
* </p>
*
* @param previousItemId
- * Id of the previous item in ordered container.
+ * Id of the previous item in ordered container.
* @param newItemId
- * Id of the new item to be added.
+ * Id of the new item to be added.
* @return Returns new item or null if the operation fails.
*/
public Item addItemAfter(Object previousItemId, Object newItemId)
* Sorts the container items.
*
* @param propertyId
- * Array of container property IDs, which values are used
- * to sort the items in container as primary, secondary,
- * ... sorting criterion. All of the item IDs must be in
- * the collection returned by
- * <code>getSortableContainerPropertyIds</code>
+ * Array of container property IDs, which values are used to
+ * sort the items in container as primary, secondary, ...
+ * sorting criterion. All of the item IDs must be in the
+ * collection returned by
+ * <code>getSortableContainerPropertyIds</code>
* @param ascending
- * Array of sorting order flags corresponding to each
- * property ID used in sorting. If this array is shorter
- * than propertyId array, ascending order is assumed for
- * items where the order is not specified. Use
- * <code>true</code> to sort in ascending order,
- * <code>false</code> to use descending order.
+ * Array of sorting order flags corresponding to each
+ * property ID used in sorting. If this array is shorter than
+ * propertyId array, ascending order is assumed for items
+ * where the order is not specified. Use <code>true</code> to
+ * sort in ascending order, <code>false</code> to use
+ * descending order.
*/
void sort(Object[] propertyId, boolean[] ascending);
* is <code>true</code> for the returned index: 0 <= index < size().
*
* @param itemId
- * ID of an Item in the Container
+ * ID of an Item in the Container
* @return index of the Item, or -1 if the Container does not include
* the Item
*/
* Gets the ID of an Item by an index number.
*
* @param index
- * Index of the requested id in the Container
+ * Index of the requested id in the Container
* @return ID of the Item in the given index
*/
public Object getIdByIndex(int index);
* </p>
*
* @param index
- * Index to add the new item.
+ * Index to add the new item.
* @return Returns item id the the created new item or null if the
* operation fails.
*/
* </p>
*
* @param index
- * Index to add the new item.
+ * Index to add the new item.
* @param newItemId
- * Id of the new item to be added.
+ * Id of the new item to be added.
* @return Returns new item or null if the operation fails.
*/
public Item addItemAt(int index, Object newItemId)
/**
* <p>
- * Interface for <code>Container</code> classes whose Items can be
- * arranged hierarchically. This means that the Items in the container
- * belong in a tree-like structure, with the following quirks:
+ * Interface for <code>Container</code> classes whose Items can be arranged
+ * hierarchically. This means that the Items in the container belong in a
+ * tree-like structure, with the following quirks:
* </p>
*
* <ul>
* The returned collection is unmodifiable.
*
* @param itemId
- * ID of the Item whose children the caller is interested
- * in
+ * ID of the Item whose children the caller is interested in
* @return An unmodifiable {@link java.util.Collection collection}
* containing the IDs of all other Items that are children in
* the container hierarchy
* Gets the ID of the parent Item of the specified Item.
*
* @param itemId
- * ID of the Item whose parent the caller wishes to find
- * out.
+ * ID of the Item whose parent the caller wishes to find out.
* @return the ID of the parent Item. Will be <code>null</code> if the
* specified Item is a root element.
*/
* </p>
*
* @param itemId
- * ID of the item to be set as the child of the Item
- * identified with <code>newParentId</code>
+ * ID of the item to be set as the child of the Item
+ * identified with <code>newParentId</code>
* @param newParentId
- * ID of the Item that's to be the new parent of the Item
- * identified with <code>itemId</code>
+ * ID of the Item that's to be the new parent of the Item
+ * identified with <code>itemId</code>
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
*/
* Tests if the Item with given ID can have any children.
*
* @param itemId
- * ID of the Item in the container whose child capability
- * is to be tested
+ * ID of the Item in the container whose child capability is
+ * to be tested
* @return <code>true</code> if the specified Item exists in the
* Container and it can have children, <code>false</code> if
* it's not found from the container or it can't have children.
* </p>
*
* @param itemId
- * ID of the Item in the container whose child capability
- * is to be set
+ * ID of the Item in the container whose child capability is
+ * to be set
* @param areChildrenAllowed
- * boolean value specifying if the Item can have children
- * or not
+ * boolean value specifying if the Item can have children or
+ * not
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
*/
throws UnsupportedOperationException;
/**
- * Tests if the Item specified with <code>itemId</code> is a root
- * Item. The hierarchical container can have more than one root and must
- * have at least one unless it is empty. The
- * {@link #getParent(Object itemId)}method always returns
- * <code>null</code> for root Items.
+ * Tests if the Item specified with <code>itemId</code> is a root Item.
+ * The hierarchical container can have more than one root and must have
+ * at least one unless it is empty. The {@link #getParent(Object itemId)}
+ * method always returns <code>null</code> for root Items.
*
* @param itemId
- * ID of the Item whose root status is to be tested
+ * ID of the Item whose root status is to be tested
* @return <code>true</code> if the specified Item is a root,
* <code>false</code> if not
*/
* <p>
* Note that being a leaf does not imply whether or not an Item is
* allowed to have children.
- * </p>.
+ * </p>
+ * .
*
* @param itemId
- * ID of the Item whose leaf status is to be tested
+ * ID of the Item whose leaf status is to be tested
* @return <code>true</code> if the specified Item is a leaf,
* <code>false</code> if not
*/
* starts with given filterString are visible in the container.
*
* @param propertyId
- * Property for which the filter is applied to.
+ * Property for which the filter is applied to.
* @param filterString
- * String that must match contents of the property
+ * String that must match contents of the property
* @param ignoreCase
- * Determine if the casing can be ignored when comparing
- * strings.
+ * Determine if the casing can be ignored when comparing
+ * strings.
* @param onlyMatchPrefix
- * Only match prefixes; no other matches are included.
+ * Only match prefixes; no other matches are included.
*/
public void addContainerFilter(Object propertyId, String filterString,
boolean ignoreCase, boolean onlyMatchPrefix);
* Sets the Container that serves as the data source of the viewer.
*
* @param newDataSource
- * The new data source Item
+ * The new data source Item
*/
public void setContainerDataSource(Container newDataSource);
}
- /* Contents change event ******************************************* */
+ /* Contents change event */
/**
- * An <code>Event</code> object specifying the Container whose Item set
- * has changed.
+ * An <code>Event</code> object specifying the Container whose Item set has
+ * changed.
*/
public interface ItemSetChangeEvent {
* Lets the listener know a Containers Item set has changed.
*
* @param event
- * change event text
+ * change event text
*/
public void containerItemSetChange(Container.ItemSetChangeEvent event);
}
/**
* The interface for adding and removing <code>ItemSetChangeEvent</code>
* listeners. By implementing this interface a class explicitly announces
- * that it will generate a <code>ItemSetChangeEvent</code> when its
- * contents are modified.
+ * that it will generate a <code>ItemSetChangeEvent</code> when its contents
+ * are modified.
* <p>
* Note: The general Java convention is not to explicitly declare that a
* class generates events, but to directly define the
- * <code>addListener</code> and <code>removeListener</code> methods.
- * That way the caller of these methods has no real way of finding out if
- * the class really will send the events, or if it just defines the methods
- * to be able to implement an interface.
+ * <code>addListener</code> and <code>removeListener</code> methods. That
+ * way the caller of these methods has no real way of finding out if the
+ * class really will send the events, or if it just defines the methods to
+ * be able to implement an interface.
* </p>
*/
public interface ItemSetChangeNotifier {
* Adds an Item set change listener for the object.
*
* @param listener
- * listener to be added
+ * listener to be added
*/
public void addListener(Container.ItemSetChangeListener listener);
* Removes the Item set change listener from the object.
*
* @param listener
- * listener to be removed
+ * listener to be removed
*/
public void removeListener(Container.ItemSetChangeListener listener);
}
- /* Property set change event ******************************************** */
+ /* Property set change event */
/**
- * An <code>Event</code> object specifying the Container whose Property
- * set has changed.
+ * An <code>Event</code> object specifying the Container whose Property set
+ * has changed.
*/
public interface PropertySetChangeEvent {
* Notifies this listener that the Containers contents has changed.
*
* @param event
- * Change event.
+ * Change event.
*/
public void containerPropertySetChange(
Container.PropertySetChangeEvent event);
* <p>
* Note that the general Java convention is not to explicitly declare that a
* class generates events, but to directly define the
- * <code>addListener</code> and <code>removeListener</code> methods.
- * That way the caller of these methods has no real way of finding out if
- * the class really will send the events, or if it just defines the methods
- * to be able to implement an interface.
+ * <code>addListener</code> and <code>removeListener</code> methods. That
+ * way the caller of these methods has no real way of finding out if the
+ * class really will send the events, or if it just defines the methods to
+ * be able to implement an interface.
* </p>
*/
public interface PropertySetChangeNotifier {
* Registers a new Property set change listener for this Container.
*
* @param listener
- * The new Listener to be registered
+ * The new Listener to be registered
*/
public void addListener(Container.PropertySetChangeListener listener);
* Removes a previously registered Property set change listener.
*
* @param listener
- * Listener to be removed
+ * Listener to be removed
*/
public void removeListener(Container.PropertySetChangeListener listener);
}
/**
* <p>
* Provides a mechanism for handling a set of Properties, each associated to a
- * locally unique non-null identifier. The interface is split into subinterfaces to
- * enable a class to implement only the functionalities it needs.
+ * locally unique non-null identifier. The interface is split into subinterfaces
+ * to enable a class to implement only the functionalities it needs.
* </p>
*
* @author IT Mill Ltd
* returned.
*
* @param id
- * identifier of the Property to get
+ * identifier of the Property to get
* @return the Property with the given ID or <code>null</code>
*/
public Property getItemProperty(Object id);
* </p>
*
* @param id
- * ID of the new Property
+ * ID of the new Property
* @param property
- * the Property to be added and associated with the id
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the Property to be added and associated with the id
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
* @throws UnsupportedOperationException
- * if the operation is not supported.
+ * if the operation is not supported.
*/
public boolean addItemProperty(Object id, Property property)
throws UnsupportedOperationException;
* </p>
*
* @param id
- * ID of the Property to be removed
+ * ID of the Property to be removed
* @return <code>true</code> if the operation succeeded
* @throws UnsupportedOperationException
- * if the operation is not supported. <code>false</code>
- * if not
+ * if the operation is not supported. <code>false</code> if not
*/
public boolean removeItemProperty(Object id)
throws UnsupportedOperationException;
* Sets the Item that serves as the data source of the viewer.
*
* @param newDataSource
- * The new data source Item
+ * The new data source Item
*/
public void setItemDataSource(Item newDataSource);
}
- /* Property set change event ******************************************** */
+ /* Property set change event */
/**
- * An <code>Event</code> object specifying the Item whose contents has
- * been changed through the <code>Property</code> interface.
+ * An <code>Event</code> object specifying the Item whose contents has been
+ * changed through the <code>Property</code> interface.
* <p>
* Note: The values stored in the Properties may change without triggering
* this event.
* Notifies this listener that the Item's property set has changed.
*
* @param event
- * Property set change event object
+ * Property set change event object
*/
public void itemPropertySetChange(Item.PropertySetChangeEvent event);
}
* <p>
* Note : The general Java convention is not to explicitly declare that a
* class generates events, but to directly define the
- * <code>addListener</code> and <code>removeListener</code> methods.
- * That way the caller of these methods has no real way of finding out if
- * the class really will send the events, or if it just defines the methods
- * to be able to implement an interface.
+ * <code>addListener</code> and <code>removeListener</code> methods. That
+ * way the caller of these methods has no real way of finding out if the
+ * class really will send the events, or if it just defines the methods to
+ * be able to implement an interface.
* </p>
*/
public interface PropertySetChangeNotifier {
* Registers a new property set change listener for this Item.
*
* @param listener
- * The new Listener to be registered.
+ * The new Listener to be registered.
*/
public void addListener(Item.PropertySetChangeListener listener);
* Removes a previously registered property set change listener.
*
* @param listener
- * Listener to be removed.
+ * Listener to be removed.
*/
public void removeListener(Item.PropertySetChangeListener listener);
}
*
* <p>
* The <code>Property</code> also defines the events
- * <code>ReadOnlyStatusChangeEvent</code> and <code>ValueChangeEvent</code>,
- * and the associated <code>listener</code> and <code>notifier</code>
- * interfaces.
+ * <code>ReadOnlyStatusChangeEvent</code> and <code>ValueChangeEvent</code>, and
+ * the associated <code>listener</code> and <code>notifier</code> interfaces.
* </p>
*
* <p>
* </p>
*
* <p>
- * The <code>Property.editor</code> interface should be implemented if the
- * value needs to be changed through the implementing class.
+ * The <code>Property.editor</code> interface should be implemented if the value
+ * needs to be changed through the implementing class.
* </p>
*
* @author IT Mill Ltd
* throw <code>Property.ReadOnlyException</code> in this function.
* </p>
* Note : It is not required, but highly recommended to support setting the
- * value also as a <code>String</code> in addition to the native type of
- * the Property (as given by the <code>getType</code> method). If the
- * <code>String</code> conversion fails or is unsupported, the method
- * should throw <code>Property.ConversionException</code>. The string
- * conversion should at least understand the format returned by the
+ * value also as a <code>String</code> in addition to the native type of the
+ * Property (as given by the <code>getType</code> method). If the
+ * <code>String</code> conversion fails or is unsupported, the method should
+ * throw <code>Property.ConversionException</code>. The string conversion
+ * should at least understand the format returned by the
* <code>toString</code> method of the Property.
*
* @param newValue
- * New value of the Property. This should be assignable to
- * the type returned by getType, but also String type should
- * be supported
+ * New value of the Property. This should be assignable to the
+ * type returned by getType, but also String type should be
+ * supported
*
* @throws Property.ReadOnlyException
- * if the object is in read-only mode
+ * if the object is in read-only mode
* @throws Property.ConversionException
- * if newValue can't be converted into the Property's native
- * type directly or through String
+ * if newValue can't be converted into the Property's native
+ * type directly or through String
*/
public void setValue(Object newValue) throws Property.ReadOnlyException,
Property.ConversionException;
/**
* Returns the value of the Property in human readable textual format. The
- * return value should be assignable to the <code>setValue</code> method
- * if the Property is not in read-only mode.
+ * return value should be assignable to the <code>setValue</code> method if
+ * the Property is not in read-only mode.
*
* @return <code>String</code> representation of the value stored in the
* Property
/**
* Returns the type of the Property. The methods <code>getValue</code> and
- * <code>setValue</code> must be compatible with this type: one must be
- * able to safely cast the value returned from <code>getValue</code> to
- * the given type and pass any variable assignable to this type as an
- * argument to <code>setValue</code>.
+ * <code>setValue</code> must be compatible with this type: one must be able
+ * to safely cast the value returned from <code>getValue</code> to the given
+ * type and pass any variable assignable to this type as an argument to
+ * <code>setValue</code>.
*
* @return type of the Property
*/
* <code>isReadOnly</code> mode query correctly.
*
* @param newStatus
- * new read-only status of the Property
+ * new read-only status of the Property
*/
public void setReadOnly(boolean newStatus);
* detail message.
*
* @param msg
- * the detail message
+ * the detail message
*/
public ReadOnlyException(String msg) {
super(msg);
/**
* An exception that signals that the value passed to the
- * <code>setValue</code> method couldn't be converted to the native type
- * of the Property.
+ * <code>setValue</code> method couldn't be converted to the native type of
+ * the Property.
*
* @author IT Mill Ltd
* @version
}
/**
- * Constructs a new <code>ConversionException</code> with the
- * specified detail message.
+ * Constructs a new <code>ConversionException</code> with the specified
+ * detail message.
*
* @param msg
- * the detail message
+ * the detail message
*/
public ConversionException(String msg) {
super(msg);
* exception.
*
* @param cause
- * The cause of the the conversion failure
+ * The cause of the the conversion failure
*/
public ConversionException(Throwable cause) {
super(cause.toString());
* Sets the Property that serves as the data source of the viewer.
*
* @param newDataSource
- * the new data source Property
+ * the new data source Property
*/
public void setPropertyDataSource(Property newDataSource);
}
- /* Value change event ******************************************* */
+ /* Value change event */
/**
- * An <code>Event</code> object specifying the Property whose value has
- * been changed.
+ * An <code>Event</code> object specifying the Property whose value has been
+ * changed.
*
* @author IT Mill Ltd.
* @version
* Notifies this listener that the Property's value has changed.
*
* @param event
- * value change event object
+ * value change event object
*/
public void valueChange(Property.ValueChangeEvent event);
}
* <p>
* Note : The general Java convention is not to explicitly declare that a
* class generates events, but to directly define the
- * <code>addListener</code> and <code>removeListener</code> methods.
- * That way the caller of these methods has no real way of finding out if
- * the class really will send the events, or if it just defines the methods
- * to be able to implement an interface.
+ * <code>addListener</code> and <code>removeListener</code> methods. That
+ * way the caller of these methods has no real way of finding out if the
+ * class really will send the events, or if it just defines the methods to
+ * be able to implement an interface.
* </p>
*
* @author IT Mill Ltd.
* Registers a new value change listener for this Property.
*
* @param listener
- * the new Listener to be registered
+ * the new Listener to be registered
*/
public void addListener(Property.ValueChangeListener listener);
* Removes a previously registered value change listener.
*
* @param listener
- * listener to be removed
+ * listener to be removed
*/
public void removeListener(Property.ValueChangeListener listener);
}
- /* ReadOnly Status change event ***************************************** */
+ /* ReadOnly Status change event */
/**
* An <code>Event</code> object specifying the Property whose read-only
* changed.
*
* @param event
- * Read-only status change event object
+ * Read-only status change event object
*/
public void readOnlyStatusChange(
Property.ReadOnlyStatusChangeEvent event);
/**
* The interface for adding and removing
- * <code>ReadOnlyStatusChangeEvent</code> listeners. If a Property wishes
- * to allow other objects to receive <code>ReadOnlyStatusChangeEvent</code>
+ * <code>ReadOnlyStatusChangeEvent</code> listeners. If a Property wishes to
+ * allow other objects to receive <code>ReadOnlyStatusChangeEvent</code>
* generated by it, it must implement this interface.
* <p>
* Note : The general Java convention is not to explicitly declare that a
* class generates events, but to directly define the
- * <code>addListener</code> and <code>removeListener</code> methods.
- * That way the caller of these methods has no real way of finding out if
- * the class really will send the events, or if it just defines the methods
- * to be able to implement an interface.
+ * <code>addListener</code> and <code>removeListener</code> methods. That
+ * way the caller of these methods has no real way of finding out if the
+ * class really will send the events, or if it just defines the methods to
+ * be able to implement an interface.
* </p>
*
* @author IT Mill Ltd.
* Registers a new read-only status change listener for this Property.
*
* @param listener
- * the new Listener to be registered
+ * the new Listener to be registered
*/
public void addListener(Property.ReadOnlyStatusChangeListener listener);
* Removes a previously registered read-only status change listener.
*
* @param listener
- * listener to be removed
+ * listener to be removed
*/
public void removeListener(
Property.ReadOnlyStatusChangeListener listener);
* </p>
*
* @param validator
- * the new validator
+ * the new validator
*/
void addValidator(Validator validator);
/**
* <p>
* Removes a previously registered validator from the object. The specified
- * validator is removed from the object and its <code>validate</code>
- * method is no longer called in {@link #isValid()}.
+ * validator is removed from the object and its <code>validate</code> method
+ * is no longer called in {@link #isValid()}.
* </p>
*
* @param validator
- * the validator to remove
+ * the validator to remove
*/
void removeValidator(Validator validator);
* </p>
*
* @throws Validator.InvalidValueException
- * if the value is not valid
+ * if the value is not valid
*/
public void validate() throws Validator.InvalidValueException;
* @param invalidValueAllowed
*
* @throws UnsupportedOperationException
- * if the setInvalidAllowed is not supported.
+ * if the setInvalidAllowed is not supported.
*/
public void setInvalidAllowed(boolean invalidValueAllowed)
throws UnsupportedOperationException;
* <code>Validator.InvalidValueException</code>
*
* @param value
- * the value to check
+ * the value to check
* @throws Validator.InvalidValueException
- * if the value is not valid
+ * if the value is not valid
*/
public void validate(Object value) throws Validator.InvalidValueException;
* Tests if the given value is valid.
*
* @param value
- * the value to check
+ * the value to check
* @return <code>true</code> for valid value, otherwise <code>false</code>.
*/
public boolean isValid(Object value);
* specified detail message.
*
* @param message
- * The detail message of the problem.
+ * The detail message of the problem.
*/
public InvalidValueException(String message) {
this(message, new InvalidValueException[] {});
* validatables.
*
* @param message
- * The detail message of the problem.
+ * The detail message of the problem.
* @param causes
- * Array of validatables whos invalidities are possiblity
- * causing the invalidity.
+ * Array of validatables whos invalidities are possiblity
+ * causing the invalidity.
*/
public InvalidValueException(String message,
InvalidValueException[] causes) {
* Serial generated by eclipse.
*/
private static final long serialVersionUID = -4488988853486652602L;
-
+
public EmptyValueException(String message) {
super(message);
}
-
+
}
}
* <code>Container.Hierarchical</code> interface.
*
* @param toBeWrapped
- * the container that needs to be accessed hierarchically
+ * the container that needs to be accessed hierarchically
* @see #updateHierarchicalWrapper()
*/
public ContainerHierarchicalWrapper(Container toBeWrapped) {
* </p>
*
* @param itemId
- * the ID of the item to remove from the hierarchy.
+ * the ID of the item to remove from the hierarchy.
*/
private void removeFromHierarchyWrapper(Object itemId) {
* modified.
*
* @param itemId
- * the ID of the item to add to the hierarchy.
+ * the ID of the item to add to the hierarchy.
*/
private void addToHierarchyWrapper(Object itemId) {
roots.add(itemId);
* </p>
*
* @param itemId
- * the ID of the Item in the container whose child capability
- * is to be set.
+ * the ID of the Item in the container whose child capability is
+ * to be set.
* @param childrenAllowed
- * the boolean value specifying if the Item can have children
- * or not.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the boolean value specifying if the Item can have children or
+ * not.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean setChildrenAllowed(Object itemId, boolean childrenAllowed) {
/**
* <p>
* Sets the parent of an Item. The new parent item must exist and be able to
- * have children. (<code>canHaveChildren(newParentId) == true</code>).
- * It is also possible to detach a node from the hierarchy (and thus make it
- * root) by setting the parent <code>null</code>.
+ * have children. (<code>canHaveChildren(newParentId) == true</code>). It is
+ * also possible to detach a node from the hierarchy (and thus make it root)
+ * by setting the parent <code>null</code>.
* </p>
*
* @param itemId
- * the ID of the item to be set as the child of the Item
- * identified with newParentId.
+ * the ID of the item to be set as the child of the Item
+ * identified with newParentId.
* @param newParentId
- * the ID of the Item that's to be the new parent of the Item
- * identified with itemId.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the ID of the Item that's to be the new parent of the Item
+ * identified with itemId.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean setParent(Object itemId, Object newParentId) {
* Creates a new Item into the Container, assigns it an automatic ID, and
* adds it to the hierarchy.
*
- * @return the autogenerated ID of the new Item or <code>null</code> if
- * the operation failed
+ * @return the autogenerated ID of the new Item or <code>null</code> if the
+ * operation failed
* @throws UnsupportedOperationException
- * if the addItem is not supported.
+ * if the addItem is not supported.
*/
public Object addItem() throws UnsupportedOperationException {
* hierarchy.
*
* @param itemId
- * the ID of the Item to be created.
+ * the ID of the Item to be created.
* @return the added Item or <code>null</code> if the operation failed.
* @throws UnsupportedOperationException
- * if the addItem is not supported.
+ * if the addItem is not supported.
*/
public Item addItem(Object itemId) throws UnsupportedOperationException {
- // Null ids are not accepted
- if (itemId == null) throw new NullPointerException("Container item id can not be null");
+ // Null ids are not accepted
+ if (itemId == null)
+ throw new NullPointerException("Container item id can not be null");
final Item item = container.addItem(itemId);
if (!hierarchical && item != null) {
/**
* Removes all items from the underlying container and from the hierarcy.
*
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
* @throws UnsupportedOperationException
- * if the removeAllItems is not supported.
+ * if the removeAllItems is not supported.
*/
public boolean removeAllItems() throws UnsupportedOperationException {
* from the hierarcy.
*
* @param itemId
- * the ID of the Item to be removed.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the ID of the Item to be removed.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
* @throws UnsupportedOperationException
- * if the removeItem is not supported.
+ * if the removeItem is not supported.
*/
public boolean removeItem(Object itemId)
throws UnsupportedOperationException {
* Adds a new Property to all Items in the Container.
*
* @param propertyId
- * the ID of the new Property.
+ * the ID of the new Property.
* @param type
- * the Data type of the new Property.
+ * the 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> if not
+ * the value all created Properties are initialized to.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
* @throws UnsupportedOperationException
- * if the addContainerProperty is not supported.
+ * if the addContainerProperty is not supported.
*/
public boolean addContainerProperty(Object propertyId, Class type,
Object defaultValue) throws UnsupportedOperationException {
* </p>
*
* @param propertyId
- * the ID of the Property to remove.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the ID of the Property to remove.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
* @throws UnsupportedOperationException
- * if the removeContainerProperty is not supported.
+ * if the removeContainerProperty is not supported.
*/
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException {
* interface.
*
* @param toBeWrapped
- * the container whose contents need to be ordered.
+ * the container whose contents need to be ordered.
*/
public ContainerOrderedWrapper(Container toBeWrapped) {
* </p>
*
* @param id
- * the ID of the Item to be removed from the ordering.
+ * the ID of the Item to be removed from the ordering.
*/
private void removeFromOrderWrapper(Object id) {
if (id != null) {
* internal ordering. The underlying container is not modified.
*
* @param id
- * the ID of the Item to be added to the ordering.
+ * the ID of the Item to be added to the ordering.
*/
private void addToOrderWrapper(Object id) {
* id must be in the container, or must be null.
*
* @param id
- * the ID of the Item to be added to the ordering.
+ * the ID of the Item to be added to the ordering.
* @param previousItemId
- * the Id of the previous item.
+ * the Id of the previous item.
*/
private void addToOrderWrapper(Object id, Object previousItemId) {
* Registers a new Property to all Items in the Container.
*
* @param propertyId
- * the ID of the new Property.
+ * the ID of the new Property.
* @param type
- * the Data type of the new Property.
+ * the 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> if not
+ * the value all created Properties are initialized to.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean addContainerProperty(Object propertyId, Class type,
Object defaultValue) throws UnsupportedOperationException {
* Creates a new Item into the Container, assigns it an automatic ID, and
* adds it to the ordering.
*
- * @return the autogenerated ID of the new Item or <code>null</code> if
- * the operation failed
+ * @return the autogenerated ID of the new Item or <code>null</code> if the
+ * operation failed
* @throws UnsupportedOperationException
- * if the addItem is not supported.
+ * if the addItem is not supported.
*/
public Object addItem() throws UnsupportedOperationException {
* ordering.
*
* @param itemId
- * the ID of the Item to be created.
+ * the ID of the Item to be created.
* @return the added Item or <code>null</code> if the operation failed
* @throws UnsupportedOperationException
- * if the addItem is not supported.
+ * if the addItem is not supported.
*/
public Item addItem(Object itemId) throws UnsupportedOperationException {
final Item item = container.addItem(itemId);
* @return <code>true</code> if the operation succeeded, otherwise
* <code>false</code>
* @throws UnsupportedOperationException
- * if the removeAllItems is not supported.
+ * if the removeAllItems is not supported.
*/
public boolean removeAllItems() throws UnsupportedOperationException {
final boolean success = container.removeAllItems();
* from the ordering.
*
* @param itemId
- * the ID of the Item to be removed.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the ID of the Item to be removed.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
* @throws UnsupportedOperationException
- * if the removeItem is not supported.
+ * if the removeItem is not supported.
*/
public boolean removeItem(Object itemId)
throws UnsupportedOperationException {
* </p>
*
* @param propertyId
- * the ID of the Property to remove.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the ID of the Property to remove.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
* @throws UnsupportedOperationException
- * if the removeContainerProperty is not supported.
+ * if the removeContainerProperty is not supported.
*/
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException {
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.data.Container.Ordered#addItemAfter(java.lang.Object,
- * java.lang.Object)
+ * @see
+ * com.itmill.toolkit.data.Container.Ordered#addItemAfter(java.lang.Object,
+ * java.lang.Object)
*/
public Item addItemAfter(Object previousItemId, Object newItemId)
throws UnsupportedOperationException {
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.data.Container.Ordered#addItemAfter(java.lang.Object)
+ * @see
+ * com.itmill.toolkit.data.Container.Ordered#addItemAfter(java.lang.Object)
*/
public Object addItemAfter(Object previousItemId)
throws UnsupportedOperationException {
* </p>
*
* @param itemId
- * the ID of the Item in the container whose child capability
- * is to be set.
+ * the ID of the Item in the container whose child capability is
+ * to be set.
* @param childrenAllowed
- * the boolean value specifying if the Item can have children
- * or not.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the boolean value specifying if the Item can have children or
+ * not.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean setChildrenAllowed(Object itemId, boolean childrenAllowed) {
/**
* <p>
* Sets the parent of an Item. The new parent item must exist and be able to
- * have children. (<code>canHaveChildren(newParentId) == true</code>).
- * It is also possible to detach a node from the hierarchy (and thus make it
- * root) by setting the parent <code>null</code>.
+ * have children. (<code>canHaveChildren(newParentId) == true</code>). It is
+ * also possible to detach a node from the hierarchy (and thus make it root)
+ * by setting the parent <code>null</code>.
* </p>
*
* @param itemId
- * the ID of the item to be set as the child of the Item
- * identified with newParentId.
+ * the ID of the item to be set as the child of the Item
+ * identified with newParentId.
* @param newParentId
- * the ID of the Item that's to be the new parent of the Item
- * identified with itemId.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the ID of the Item that's to be the new parent of the Item
+ * identified with itemId.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean setParent(Object itemId, Object newParentId) {
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.data.util.IndexedContainer#addItem(java.lang.Object)
+ * @see
+ * com.itmill.toolkit.data.util.IndexedContainer#addItem(java.lang.Object)
*/
public Item addItem(Object itemId) {
final Item item = super.addItem(itemId);
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.data.util.IndexedContainer#removeItem(java.lang.Object)
+ * @see
+ * com.itmill.toolkit.data.util.IndexedContainer#removeItem(java.lang.Object
+ * )
*/
public boolean removeItem(Object itemId) {
final boolean success = super.removeItem(itemId);
* property.
* </p>
* <p>
- * The getter method of a <code>MethodProperty</code> instantiated with
- * this constructor will be called with no arguments, and the setter method
- * with only the new value as the sole argument.
+ * The getter method of a <code>MethodProperty</code> instantiated with this
+ * constructor will be called with no arguments, and the setter method with
+ * only the new value as the sole argument.
* </p>
*
* <p>
* </p>
*
* @param instance
- * the object that includes the property.
+ * the object that includes the property.
* @param beanPropertyName
- * the name of the property to bind to.
+ * the name of the property to bind to.
*/
public MethodProperty(Object instance, String beanPropertyName) {
* </p>
*
* @param type
- * the type of the property.
+ * the type of the property.
* @param instance
- * the object that includes the property.
+ * the object that includes the property.
* @param getMethodName
- * the name of the getter method.
+ * the name of the getter method.
* @param setMethodName
- * the name of the setter method.
+ * the name of the setter method.
*
*/
public MethodProperty(Class type, Object instance, String getMethodName,
/**
* <p>
- * Creates a new instance of <code>MethodProperty</code> with the getter
- * and setter methods. The getter method of a <code>MethodProperty</code>
+ * Creates a new instance of <code>MethodProperty</code> with the getter and
+ * setter methods. The getter method of a <code>MethodProperty</code>
* instantiated with this constructor will be called with no arguments, and
* the setter method with only the new value as the sole argument.
* </p>
* </p>
*
* @param type
- * the type of the property.
+ * the type of the property.
* @param instance
- * the object that includes the property.
+ * the object that includes the property.
* @param getMethod
- * the getter method.
+ * the getter method.
* @param setMethod
- * the setter method.
+ * the setter method.
*/
public MethodProperty(Class type, Object instance, Method getMethod,
Method setMethod) {
* <p>
* For example, if the <code>setArgs</code> contains <code>A</code>,
* <code>B</code> and <code>C</code>, and <code>setArgumentIndex =
- * 1</code>,
- * the call <code>methodProperty.setValue(X)</code> would result in the
- * setter method to be called with the parameter set of
+ * 1</code>, the call <code>methodProperty.setValue(X)</code> would result
+ * in the setter method to be called with the parameter set of
* <code>{A, X, C}</code>
* </p>
*
* @param type
- * the type of the property.
+ * the type of the property.
* @param instance
- * the object that includes the property.
+ * the object that includes the property.
* @param getMethodName
- * the name of the getter method.
+ * the name of the getter method.
* @param setMethodName
- * the name of the setter method.
+ * the name of the setter method.
* @param getArgs
- * the fixed argument list to be passed to the getter method.
+ * the fixed argument list to be passed to the getter method.
* @param setArgs
- * the fixed argument list to be passed to the setter method.
+ * the fixed argument list to be passed to the setter method.
* @param setArgumentIndex
- * the index of the argument in <code>setArgs</code> to be
- * replaced with <code>newValue</code> when
- * {@link #setValue(Object newValue)} is called.
+ * the index of the argument in <code>setArgs</code> to be
+ * replaced with <code>newValue</code> when
+ * {@link #setValue(Object newValue)} is called.
*/
public MethodProperty(Class type, Object instance, String getMethodName,
String setMethodName, Object[] getArgs, Object[] setArgs,
/**
* <p>
- * Creates a new instance of <code>MethodProperty</code> from the getter
- * and setter methods, and argument lists.
+ * Creates a new instance of <code>MethodProperty</code> from the getter and
+ * setter methods, and argument lists.
* </p>
* <p>
* This constructor behaves exactly like
- * {@link #MethodProperty(Class type, Object instance, String getMethodName,
- * String setMethodName, Object [] getArgs, Object [] setArgs, int
- * setArgumentIndex)} except that instead of names of the getter and setter
- * methods this constructor is given the actual methods themselves.
+ * {@link #MethodProperty(Class type, Object instance, String getMethodName, String setMethodName, Object [] getArgs, Object [] setArgs, int setArgumentIndex)}
+ * except that instead of names of the getter and setter methods this
+ * constructor is given the actual methods themselves.
* </p>
*
* @param type
- * the type of the property.
+ * the type of the property.
* @param instance
- * the object that includes the property.
+ * the object that includes the property.
* @param getMethod
- * the getter method.
+ * the getter method.
* @param setMethod
- * the setter method.
+ * the setter method.
* @param getArgs
- * the fixed argument list to be passed to the getter method.
+ * the fixed argument list to be passed to the getter method.
* @param setArgs
- * the fixed argument list to be passed to the setter method.
+ * the fixed argument list to be passed to the setter method.
* @param setArgumentIndex
- * the index of the argument in <code>setArgs</code> to be
- * replaced with <code>newValue</code> when
- * {@link #setValue(Object newValue)} is called.
+ * the index of the argument in <code>setArgs</code> to be
+ * replaced with <code>newValue</code> when
+ * {@link #setValue(Object newValue)} is called.
*/
public MethodProperty(Class type, Object instance, Method getMethod,
Method setMethod, Object[] getArgs, Object[] setArgs,
/**
* Returns the type of the Property. The methods <code>getValue</code> and
- * <code>setValue</code> must be compatible with this type: one must be
- * able to safely cast the value returned from <code>getValue</code> to
- * the given type and pass any variable assignable to this type as an
- * argument to <code>setValue</code>.
+ * <code>setValue</code> must be compatible with this type: one must be able
+ * to safely cast the value returned from <code>getValue</code> to the given
+ * type and pass any variable assignable to this type as an argument to
+ * <code>setValue</code>.
*
* @return type of the Property
*/
/**
* Tests if the object is in read-only mode. In read-only mode calls to
- * <code>setValue</code> will throw <code>ReadOnlyException</code> and
- * will not modify the value of the Property.
+ * <code>setValue</code> will throw <code>ReadOnlyException</code> and will
+ * not modify the value of the Property.
*
* @return <code>true</code> if the object is in read-only mode,
* <code>false</code> if it's not
* </p>
*
* @param getArgs
- * the fixed argument list to be passed to the getter method.
+ * the fixed argument list to be passed to the getter method.
* @param setArgs
- * the fixed argument list to be passed to the setter method.
+ * the fixed argument list to be passed to the setter method.
* @param setArgumentIndex
- * the index of the argument in <code>setArgs</code> to be
- * replaced with <code>newValue</code> when
- * {@link #setValue(Object newValue)} is called.
+ * the index of the argument in <code>setArgs</code> to be
+ * replaced with <code>newValue</code> when
+ * {@link #setValue(Object newValue)} is called.
*/
public void setArguments(Object[] getArgs, Object[] setArgs,
int setArgumentIndex) {
/**
* Sets the value of the property. This method supports setting from
- * <code>String</code>s if either <code>String</code> is directly
- * assignable to property type, or the type class contains a string
- * constructor.
+ * <code>String</code>s if either <code>String</code> is directly assignable
+ * to property type, or the type class contains a string constructor.
*
* @param newValue
- * the New value of the property.
+ * the New value of the property.
* @throws <code>Property.ReadOnlyException</code> if the object is in
- * read-only mode.
+ * read-only mode.
* @throws <code>Property.ConversionException</code> if
- * <code>newValue</code> can't be converted into the
- * Property's native type directly or through
- * <code>String</code>.
+ * <code>newValue</code> can't be converted into the Property's
+ * native type directly or through <code>String</code>.
* @see #invokeSetMethod(Object)
*/
public void setValue(Object newValue) throws Property.ReadOnlyException,
* Sets the Property's read-only mode to the specified status.
*
* @param newStatus
- * the new read-only status of the Property.
+ * the new read-only status of the Property.
*/
public void setReadOnly(boolean newStatus) {
final boolean prevStatus = readOnly;
* detail message.
*
* @param msg
- * the detail message.
+ * the detail message.
*/
public MethodException(String msg) {
super(msg);
}
/**
- * Constructs a new <code>MethodException</code> from another
- * exception.
+ * Constructs a new <code>MethodException</code> from another exception.
*
* @param cause
- * the cause of the exception.
+ * the cause of the exception.
*/
public MethodException(Throwable cause) {
this.cause = cause;
}
}
- /* Events *************************************************************** */
+ /* Events */
/**
* An <code>Event</code> object specifying the Property whose read-only
* Constructs a new read-only status change event for this object.
*
* @param source
- * source object of the event.
+ * source object of the event.
*/
protected ReadOnlyStatusChangeEvent(MethodProperty source) {
super(source);
* Registers a new read-only status change listener for this Property.
*
* @param listener
- * the new Listener to be registered.
+ * the new Listener to be registered.
*/
public void addListener(Property.ReadOnlyStatusChangeListener listener) {
if (readOnlyStatusChangeListeners == null) {
* Removes a previously registered read-only status change listener.
*
* @param listener
- * the listener to be removed.
+ * the listener to be removed.
*/
public void removeListener(Property.ReadOnlyStatusChangeListener listener) {
if (readOnlyStatusChangeListeners != null) {
}
/**
- * An <code>Event</code> object specifying the Property whose value has
- * been changed.
+ * An <code>Event</code> object specifying the Property whose value has been
+ * changed.
*
* @author IT Mill Ltd.
* @version
* Constructs a new value change event for this object.
*
* @param source
- * source object of the event.
+ * source object of the event.
*/
protected ValueChangeEvent(MethodProperty source) {
super(source);
* value.
*
* @param value
- * the Initial value of the Property.
+ * the Initial value of the Property.
*/
public ObjectProperty(Object value) {
this(value, value.getClass());
* Creates a new instance of ObjectProperty with the given value and type.
*
* @param value
- * the Initial value of the Property.
+ * the Initial value of the Property.
* @param type
- * the type of the value. The value must be assignable to
- * given type.
+ * the type of the value. The value must be assignable to given
+ * type.
*/
public ObjectProperty(Object value, Class type) {
* read-only mode status.
*
* @param value
- * the Initial value of the property.
+ * the Initial value of the property.
* @param type
- * the type of the value. <code>value</code> must be
- * assignable to this type.
+ * the type of the value. <code>value</code> must be assignable
+ * to this type.
* @param readOnly
- * Sets the read-only mode.
+ * Sets the read-only mode.
*/
public ObjectProperty(Object value, Class type, boolean readOnly) {
this(value, type);
/**
* Returns the type of the ObjectProperty. The methods <code>getValue</code>
- * and <code>setValue</code> must be compatible with this type: one must
- * be able to safely cast the value returned from <code>getValue</code> to
- * the given type and pass any variable assignable to this type as an
- * argument to <code>setValue</code>.
+ * and <code>setValue</code> must be compatible with this type: one must be
+ * able to safely cast the value returned from <code>getValue</code> to the
+ * given type and pass any variable assignable to this type as an argument
+ * to <code>setValue</code>.
*
* @return type of the Property
*/
/**
* Returns the value of the ObjectProperty in human readable textual format.
- * The return value should be assignable to the <code>setValue</code>
- * method if the Property is not in read-only mode.
+ * The return value should be assignable to the <code>setValue</code> method
+ * if the Property is not in read-only mode.
*
* @return <code>String</code> representation of the value stored in the
* ObjectProperty
* Sets the Property's read-only mode to the specified status.
*
* @param newStatus
- * the new read-only status of the Property.
+ * the new read-only status of the Property.
*/
public void setReadOnly(boolean newStatus) {
if (newStatus != readOnly) {
/**
* Sets the value of the property. This method supports setting from
- * <code>String</code> if either <code>String</code> is directly
- * assignable to property type, or the type class contains a string
- * constructor.
+ * <code>String</code> if either <code>String</code> is directly assignable
+ * to property type, or the type class contains a string constructor.
*
* @param newValue
- * the New value of the property.
+ * the New value of the property.
* @throws <code>Property.ReadOnlyException</code> if the object is in
- * read-only mode
- * @throws <code>Property.ConversionException</code> if the newValue
- * can't be converted into the Property's native type
- * directly or through <code>String</code>
+ * read-only mode
+ * @throws <code>Property.ConversionException</code> if the newValue can't
+ * be converted into the Property's native type directly or through
+ * <code>String</code>
*/
public void setValue(Object newValue) throws Property.ReadOnlyException,
Property.ConversionException {
fireValueChange();
}
- /* Events *************************************************************** */
+ /* Events */
/**
* An <code>Event</code> object specifying the ObjectProperty whose value
* Constructs a new value change event for this object.
*
* @param source
- * the source object of the event.
+ * the source object of the event.
*/
protected ValueChangeEvent(ObjectProperty source) {
super(source);
* Constructs a new read-only status change event for this object.
*
* @param source
- * source object of the event
+ * source object of the event
*/
protected ReadOnlyStatusChangeEvent(ObjectProperty source) {
super(source);
* Removes a previously registered value change listener.
*
* @param listener
- * the listener to be removed.
+ * the listener to be removed.
*/
public void removeListener(Property.ValueChangeListener listener) {
if (valueChangeListeners != null) {
* Registers a new value change listener for this ObjectProperty.
*
* @param listener
- * the new Listener to be registered
+ * the new Listener to be registered
*/
public void addListener(Property.ValueChangeListener listener) {
if (valueChangeListeners == null) {
* Registers a new read-only status change listener for this Property.
*
* @param listener
- * the new Listener to be registered
+ * the new Listener to be registered
*/
public void addListener(Property.ReadOnlyStatusChangeListener listener) {
if (readOnlyStatusChangeListeners == null) {
* Removes a previously registered read-only status change listener.
*
* @param listener
- * the listener to be removed.
+ * the listener to be removed.
*/
public void removeListener(Property.ReadOnlyStatusChangeListener listener) {
if (readOnlyStatusChangeListeners != null) {
public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
Cloneable {
- /* Private representation of the item *********************************** */
+ /* Private representation of the item */
/**
* Mapping from property id to property.
*/
private LinkedList propertySetChangeListeners = null;
- /* Item methods ******************************************************** */
+ /* Item methods */
/**
* Gets the Property corresponding to the given Property ID stored in the
* returned.
*
* @param id
- * the identifier of the Property to get.
+ * the identifier of the Property to get.
* @return the Property with the given ID or <code>null</code>
*/
public Property getItemProperty(Object id) {
return Collections.unmodifiableCollection(list);
}
- /* Item.Managed methods ************************************************* */
+ /* Item.Managed methods */
/**
* Removes the Property identified by ID from the Item. This functionality
* <code>false</code>.
*
* @param id
- * the ID of the Property to be removed.
+ * the ID of the Property to be removed.
* @return <code>true</code> if the operation succeeded <code>false</code>
* if not
*/
* Tries to add a new Property into the Item.
*
* @param id
- * the ID of the new Property.
+ * the ID of the new Property.
* @param property
- * the Property to be added and associated with the id.
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * the Property to be added and associated with the id.
+ * @return <code>true</code> if the operation succeeded, <code>false</code>
+ * if not
*/
public boolean addItemProperty(Object id, Property property) {
- // Null ids are not accepted
- if (id == null) throw new NullPointerException("Item property id can not be null");
+ // Null ids are not accepted
+ if (id == null)
+ throw new NullPointerException("Item property id can not be null");
// Cant add a property twice
if (map.containsKey(id)) {
}
/**
- * Gets the <code>String</code> representation of the contents of the
- * Item. The format of the string is a space separated catenation of the
+ * Gets the <code>String</code> representation of the contents of the Item.
+ * The format of the string is a space separated catenation of the
* <code>String</code> representations of the Properties contained by the
* Item.
*
return retValue;
}
- /* Notifiers ************************************************************ */
+ /* Notifiers */
/**
* An <code>event</code> object specifying an Item whose Property set has
* Registers a new property set change listener for this Item.
*
* @param listener
- * the new Listener to be registered.
+ * the new Listener to be registered.
*/
public void addListener(Item.PropertySetChangeListener listener) {
if (propertySetChangeListeners == null) {
* Removes a previously registered property set change listener.
*
* @param listener
- * the Listener to be removed.
+ * the Listener to be removed.
*/
public void removeListener(Item.PropertySetChangeListener listener) {
if (propertySetChangeListeners != null) {
* </p>
*
* @throws CloneNotSupportedException
- * if the object's class does not support the Cloneable
- * interface.
+ * if the object's class does not support the Cloneable
+ * interface.
*
* @see java.lang.Object#clone()
*/
* boolean value as this object.
*
* @param obj
- * the object to compare with.
- * @return <code>true</code> if the Boolean objects represent the same
- * value otherwise <code>false</code>.
+ * the object to compare with.
+ * @return <code>true</code> if the Boolean objects represent the same value
+ * otherwise <code>false</code>.
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
/**
* <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
+ * 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 Toolkit Table.
* This creates Items based on the queryStatement provided to the container.
* </p>
* <code>queryStatement</code>.
*
* @param queryStatement
- * Database query
+ * Database query
* @param connection
- * Connection object
+ * Connection object
* @param resultSetType
* @param resultSetConcurrency
* @throws SQLException
- * when database operation fails
+ * when database operation fails
*/
public QueryContainer(String queryStatement, Connection connection,
int resultSetType, int resultSetConcurrency) throws SQLException {
* concurrency.
*
* @param queryStatement
- * Database query
+ * Database query
* @param connection
- * Connection object
+ * Connection object
* @see QueryContainer#DEFAULT_RESULTSET_TYPE
* @see QueryContainer#DEFAULT_RESULTSET_CONCURRENCY
* @throws SQLException
- * when database operation fails
+ * when database operation fails
*/
public QueryContainer(String queryStatement, Connection connection)
throws SQLException {
* constructor.
*
* @throws SQLException
- * when parameter initialization fails.
+ * when parameter initialization fails.
* @see QueryContainer#QueryContainer(String, Connection, int, int).
*/
private void init() throws SQLException {
* items.
*
* @throws SQLException
- * when database operation fails
+ * when database operation fails
*
*/
* Releases and nullifies the <code>statement</code>.
*
* @throws SQLException
- * when database operation fails
+ * when database operation fails
*/
public void close() throws SQLException {
* Gets the Item with the given Item ID from the Container.
*
* @param id
- * ID of the Item to retrieve
+ * ID of the Item to retrieve
* @return Item Id.
*/
* <code>null</code> is returned.
*
* @param itemId
- * ID of the Item which contains the Property
+ * ID of the Item which contains the Property
* @param propertyId
- * ID of the Property to retrieve
+ * ID of the Property to retrieve
*
* @return Property with the given ID if exists; <code>null</code>
* otherwise.
* Gets the data type of all properties identified by the given type ID.
*
* @param id
- * ID identifying the Properties
+ * ID identifying the Properties
*
* @return data type of the Properties
*/
* Tests if the list contains the specified Item.
*
* @param id
- * ID the of Item to be tested.
+ * ID the of Item to be tested.
* @return <code>true</code> if given id is in the container;
* <code>false</code> otherwise.
*/
* Creates new Item with the given ID into the Container.
*
* @param itemId
- * ID of the Item to be created.
+ * 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.
+ * if the addItem method is not supported.
*/
public Item addItem(Object itemId) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
*
* @return ID of the newly created Item, or <code>null</code> if it fails.
* @throws UnsupportedOperationException
- * if the addItem method is not supported.
+ * if the addItem method is not supported.
*/
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.
+ * 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.
+ * if the removeItem method is not supported.
*/
public boolean removeItem(Object itemId)
throws UnsupportedOperationException {
* Adds new Property to all Items in the Container.
*
* @param propertyId
- * ID of the Property
+ * ID of the Property
* @param type
- * Data type of the new Property
+ * 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.
+ * 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.
+ * if the addContainerProperty method is not supported.
*/
public boolean addContainerProperty(Object propertyId, Class type,
Object defaultValue) throws 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.
+ * 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.
+ * if the removeContainerProperty method is not supported.
*/
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException {
/**
* Removes all Items from the Container.
*
- * @return <code>true</code> if the operation succeeded;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the operation succeeded; <code>false</code>
+ * otherwise.
* @throws UnsupportedOperationException
- * if the removeAllItems method is not supported.
+ * if the removeAllItems method is not supported.
*/
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.
+ * Id of the previous item in ordered container.
* @param newItemId
- * Id of the new item to be added.
+ * 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.
+ * if the addItemAfter method is not supported.
*/
public Item addItemAfter(Object previousItemId, Object newItemId)
throws UnsupportedOperationException {
* Adds new item after the given item.
*
* @param previousItemId
- * Id of the previous item in ordered container.
+ * 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.
+ * if the addItemAfter method is not supported.
*/
public Object addItemAfter(Object previousItemId)
throws UnsupportedOperationException {
* Returns <code>true</code> if given id is first id at first index.
*
* @param id
- * ID of an Item in the Container.
+ * ID of an Item in the Container.
*/
public boolean isFirstId(Object id) {
return size > 0 && (id instanceof Integer)
* Returns <code>true</code> if given id is last id at last index.
*
* @param id
- * ID of an Item in the Container
+ * ID of an Item in the Container
*
*/
public boolean isLastId(Object id) {
* Returns id of next item in container at next index.
*
* @param id
- * ID of an Item in the Container.
+ * ID of an Item in the Container.
* @return ID of the next Item or null.
*/
public Object nextItemId(Object id) {
* Returns id of previous item in container at previous index.
*
* @param id
- * ID of an Item in the Container.
+ * ID of an Item in the Container.
* @return ID of the previous Item or null.
*/
public Object prevItemId(Object id) {
* Adds the item property.
*
* @param id
- * ID of the new Property.
+ * ID of the new Property.
* @param property
- * Property to be added and associated with ID.
+ * 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.
+ * if the addItemProperty method is not supported.
*/
public boolean addItemProperty(Object id, Property property)
throws UnsupportedOperationException {
* the Item.
*
* @param propertyId
- * identifier of the Property to get
+ * identifier of the Property to get
* @return the Property with the given ID or <code>null</code>
*/
public Property getItemProperty(Object propertyId) {
* Removes given item property.
*
* @param id
- * ID of the Property to be removed.
+ * 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.
+ * if the removeItemProperty is not supported.
*/
public boolean removeItemProperty(Object id)
throws UnsupportedOperationException {
* Adds the given item at the position of given index.
*
* @param index
- * Index to add the new item.
+ * Index to add the new item.
* @param newItemId
- * Id of the new item to be added.
+ * 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.
+ * if the addItemAt is not supported.
*/
public Item addItemAt(int index, Object newItemId)
throws UnsupportedOperationException {
* Adds item at the position of provided index in the container.
*
* @param index
- * Index to add the new item.
+ * 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.
+ * if the addItemAt is not supported.
*/
public Object addItemAt(int index) throws UnsupportedOperationException {
* Gets the Index id in the container.
*
* @param index
- * Index Id.
+ * Index Id.
* @return ID in the given index.
*/
public Object getIdByIndex(int index) {
* Gets the index of the Item corresponding to id in the container.
*
* @param id
- * ID of an Item in the Container
+ * ID of an Item in the Container
* @return index of the Item, or -1 if the Container does not include the
* Item
*/
public class CompositeValidator implements Validator {
/**
- * The validators are combined with <code>AND</code> clause: validity of
- * the composite implies validity of the all validators it is composed of
- * must be valid.
+ * The validators are combined with <code>AND</code> clause: validity of the
+ * composite implies validity of the all validators it is composed of must
+ * be valid.
*/
public static final int MODE_AND = 0;
/**
- * The validators are combined with <code>OR</code> clause: validity of
- * the composite implies that some of validators it is composed of must be
+ * The validators are combined with <code>OR</code> clause: validity of the
+ * composite implies that some of validators it is composed of must be
* valid.
*/
public static final int MODE_OR = 1;
* </p>
*
* @param value
- * the value to check.
+ * the value to check.
* @throws Validator.InvalidValueException
- * if the value is not valid.
+ * if the value is not valid.
*/
public void validate(Object value) throws Validator.InvalidValueException {
switch (mode) {
* </ul>
*
* @param value
- * the value to check.
+ * the value to check.
*/
public boolean isValid(Object value) {
switch (mode) {
* </ul>
*
* @param mode
- * the mode to set.
+ * the mode to set.
*/
public void setMode(int mode) {
if (mode != MODE_AND && mode != MODE_OR) {
* is null, original error messages of the sub-validators are used instead.
*
* @param errorMessage
- * the Error Message to set.
+ * the Error Message to set.
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
* Adds validator to the interface.
*
* @param validator
- * the Validator object which performs validation checks on
- * this set of data field values.
+ * the Validator object which performs validation checks on this
+ * set of data field values.
*/
public void addValidator(Validator validator) {
if (validator == null) {
* Removes a validator from the composite.
*
* @param validator
- * the Validator object which performs validation checks on
- * this set of data field values.
+ * the Validator object which performs validation checks on this
+ * set of data field values.
*/
public void removeValidator(Validator validator) {
validators.remove(validator);
* Creates a new NullValidator.
*
* @param errorMessage
- * the error message to display on invalidation.
+ * the error message to display on invalidation.
* @param onlyNullAllowed
- * Are only nulls allowed?
+ * Are only nulls allowed?
*/
public NullValidator(String errorMessage, boolean onlyNullAllowed) {
setErrorMessage(errorMessage);
* Validates the data given in value.
*
* @param value
- * the value to validate.
+ * the value to validate.
* @throws Validator.InvalidValueException
- * if the value was invalid.
+ * if the value was invalid.
*/
public void validate(Object value) throws Validator.InvalidValueException {
if ((onlyNullAllowed && value != null)
* Tests if the given value is valid.
*
* @param value
- * the value to validate.
- * @returns <code>true</code> for valid value, otherwise
- * <code>false</code>.
+ * the value to validate.
+ * @returns <code>true</code> for valid value, otherwise <code>false</code>.
*/
public boolean isValid(Object value) {
return onlyNullAllowed ? value == null : value != null;
* Sets if nulls (and only nulls) are to be allowed.
*
* @param onlyNullAllowed
- * If true, only nulls are allowed. If false only non-nulls
- * are allowed. Do we allow nulls?
+ * If true, only nulls are allowed. If false only non-nulls are
+ * allowed. Do we allow nulls?
*/
public void setNullAllowed(boolean onlyNullAllowed) {
this.onlyNullAllowed = onlyNullAllowed;
* Sets the error message to be displayed on invalid value.
*
* @param errorMessage
- * the Error Message to set.
+ * the Error Message to set.
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
* Creates a new StringLengthValidator with a given error message.
*
* @param errorMessage
- * the message to display in case the value does not
- * validate.
+ * the message to display in case the value does not validate.
*/
public StringLengthValidator(String errorMessage) {
setErrorMessage(errorMessage);
* permissable lengths and null-string allowance.
*
* @param errorMessage
- * the message to display in case the value does not
- * validate.
+ * the message to display in case the value does not validate.
* @param minLength
- * the minimum permissable length of the string.
+ * the minimum permissable length of the string.
* @param maxLength
- * the maximum permissable length of the string.
+ * the maximum permissable length of the string.
* @param allowNull
- * Are null strings permissable?
+ * Are null strings permissable?
*/
public StringLengthValidator(String errorMessage, int minLength,
int maxLength, boolean allowNull) {
* Validates the value.
*
* @param value
- * the value to validate.
+ * the value to validate.
* @throws Validator.InvalidValueException
- * if the value was invalid.
+ * if the value was invalid.
*/
public void validate(Object value) throws Validator.InvalidValueException {
if (value == null) {
* Checks if the given value is valid.
*
* @param value
- * the value to validate.
+ * the value to validate.
* @return <code>true</code> for valid value, otherwise <code>false</code>.
*/
public boolean isValid(Object value) {
* Sets the maximum permissable length of the string.
*
* @param maxLength
- * the length to set.
+ * the length to set.
*/
public void setMaxLength(int maxLength) {
if (maxLength < -1) {
* Sets the minimum permissable length.
*
* @param minLength
- * the length to set.
+ * the length to set.
*/
public void setMinLength(int minLength) {
if (minLength < -1) {
* Sets the message to be displayer in case the value does not validate.
*
* @param errorMessage
- * the Error Message to set.
+ * the Error Message to set.
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
* </p>
*
* @param event
- * the button click event specifying which button was pressed
+ * the button click event specifying which button was pressed
*/
public void buttonClick(Button.ClickEvent event) {
* Add multiple demo component to given layout.
*
* @param layout
- * where components are added
+ * where components are added
* @param numberOfComponents
- * to add
+ * to add
*/
private void fillLayout(Layout layout, int numberOfComponents) {
for (int i = 1; i <= numberOfComponents; i++) {
* Containers. QueryContainer is used to bind SQL table rows into Toolkit UI
* components. Table has few example actions added. Also embedding XHTML through
* Label components is used. Demonstrates: how to create
- * <code>com.itmill.toolkit.data.Container</code> and set it as datasource to
- * UI components <code>com.itmill.toolkit.ui.Component.Tree</code>, how to
- * receive ExpandEvent and implement
+ * <code>com.itmill.toolkit.data.Container</code> and set it as datasource to UI
+ * components <code>com.itmill.toolkit.ui.Component.Tree</code>, how to receive
+ * ExpandEvent and implement
* <code>com.itmill.toolkit.ui.Tree.ExpandListener</code>, how to use
* <code>com.itmill.toolkit.event.Action</code>.
*
/**
* Browsable file explorer using Toolkit Tree component. Demonstrates: how to
* add items hierarchially into
- * <code>com.itmill.toolkit.ui.Component.Tree</code>, how to receive
- * ExpandEvent and implement
- * <code>com.itmill.toolkit.ui.Tree.ExpandListener</code>.
+ * <code>com.itmill.toolkit.ui.Component.Tree</code>, how to receive ExpandEvent
+ * and implement <code>com.itmill.toolkit.ui.Tree.ExpandListener</code>.
*
* @since 4.0.0
*
* parent and children properties are updated.
*
* @param file
- * path which contents are added to tree
+ * path which contents are added to tree
* @param parent
- * for added nodes, if null then new nodes are added to root
- * node
+ * for added nodes, if null then new nodes are added to root node
*/
private void populateNode(String file, Object parent) {
final File subdir = new File(file);
* the demo has not been shown already, re-uses old window otherwise.
*
* @param demoName
- * the name of the demo to be shown
+ * the name of the demo to be shown
*/
private void show(String demoName) {
Window w = (Window) windows.get(demoName);
package com.itmill.toolkit.demo.featurebrowser;
import com.itmill.toolkit.ui.Accordion;
-import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.CustomComponent;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.OrderedLayout;
import com.itmill.toolkit.ui.TextField;
/**
- * Accordion is a derivative of TabSheet, a vertical tabbed layout
- * that places the tab contents between the vertical tabs.
+ * Accordion is a derivative of TabSheet, a vertical tabbed layout that places
+ * the tab contents between the vertical tabs.
*/
public class AccordionExample extends CustomComponent {
public AccordionExample() {
setCompositionRoot(accordion);
// Add a few tabs to the accordion.
- for (int i=0; i<5; i++) {
+ for (int i = 0; i < 5; i++) {
// Create a root component for a accordion tab
OrderedLayout layout = new OrderedLayout();
accordion.addComponent(layout);
-
+
// The accordion tab label is taken from the caption of the root
// component. Notice that layouts can have a caption too.
- layout.setCaption("Tab "+(i+1));
+ layout.setCaption("Tab " + (i + 1));
// Add some components in each accordion tab
- Label label = new Label("These are the contents of Tab "+(i+1)+".");
+ Label label = new Label("These are the contents of Tab " + (i + 1)
+ + ".");
layout.addComponent(label);
-
+
TextField textfield = new TextField("Some text field");
layout.addComponent(textfield);
}
tree.addListener(this);
tree.setImmediate(true);
tree.expandItemsRecursively(rootId);
- for (Iterator i=container.getItemIds().iterator(); i.hasNext();) {
- Object id = i.next();
- if (container.getChildren(id)==null) tree.setChildrenAllowed(id, false);
+ for (Iterator i = container.getItemIds().iterator(); i.hasNext();) {
+ Object id = i.next();
+ if (container.getChildren(id) == null)
+ tree.setChildrenAllowed(id, false);
}
-
+
split.addComponent(tree);
final SplitPanel split2 = new SplitPanel();
public void valueChange(ValueChangeEvent event) {
if (event.getProperty() == tree) {
final Object id = tree.getValue();
- if (id == null) return;
+ if (id == null)
+ return;
final Item item = tree.getItem(id);
//
String newSection;
import java.util.Vector;
-import org.apache.commons.digester.SetRootRule;
-
import com.itmill.toolkit.data.Container;
import com.itmill.toolkit.data.Item;
import com.itmill.toolkit.data.Property;
import com.itmill.toolkit.data.Validator;
-import com.itmill.toolkit.data.Item.PropertySetChangeEvent;
-import com.itmill.toolkit.data.Item.PropertySetChangeListener;
import com.itmill.toolkit.data.util.BeanItem;
-import com.itmill.toolkit.data.util.ObjectProperty;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Component;
import com.itmill.toolkit.ui.CustomComponent;
import com.itmill.toolkit.ui.Field;
import com.itmill.toolkit.ui.FieldFactory;
import com.itmill.toolkit.ui.Form;
-import com.itmill.toolkit.ui.FormLayout;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.OrderedLayout;
-import com.itmill.toolkit.ui.Panel;
import com.itmill.toolkit.ui.Select;
-import com.itmill.toolkit.ui.Table;
import com.itmill.toolkit.ui.TextField;
import com.itmill.toolkit.ui.Button.ClickEvent;
public class FormExample extends CustomComponent {
/** Contact information data model. */
public class Contact {
- String name = "";
- String address = "";
- int postalCode = 0;
+ String name = "";
+ String address = "";
+ int postalCode = 0;
String city;
}
if (pid.equals("name"))
return new TextField("Name");
-
+
if (pid.equals("address"))
return new TextField("Street Address");
-
+
if (pid.equals("postalCode")) {
TextField field = new TextField("Postal Code");
field.setColumns(5);
return ((String) value).matches("[0-9]{5}");
}
- public void validate(Object value) throws InvalidValueException {
+ public void validate(Object value)
+ throws InvalidValueException {
if (!isValid(value)) {
throw new InvalidValueException(
"Postal code must be a number 10000-99999.");
field.addValidator(postalCodeValidator);
return field;
}
-
+
if (pid.equals("city")) {
Select select = new Select("City");
final String cities[] = new String[] { "Amsterdam", "Berlin",
**/
public class ContactDisplay extends CustomComponent {
ContactBean contact;
- Label name;
- Label address;
- Label postalCode;
- Label city;
+ Label name;
+ Label address;
+ Label postalCode;
+ Label city;
- public ContactDisplay (ContactBean contact) {
+ public ContactDisplay(ContactBean contact) {
this.contact = contact;
-
+
// Use a Form merely as a layout component. The CSS will add
// a border to the form.
Form layout = new Form();
setCompositionRoot(layout);
layout.setCaption("Data Model State");
- layout.setDescription("Below is the state of the actual stored data. "+
- "It is updated only when the form is committed successfully. "+
- "Discarding the form input reverts the form to this state.");
+ layout
+ .setDescription("Below is the state of the actual stored data. "
+ + "It is updated only when the form is committed successfully. "
+ + "Discarding the form input reverts the form to this state.");
layout.setWidth("400px");
// Manually create read-only components for each of the fields.
postalCode.setCaption("Postal Code:");
city = new Label(contact.getCity());
city.setCaption("City:");
-
+
layout.getLayout().addComponent(name);
layout.getLayout().addComponent(address);
layout.getLayout().addComponent(postalCode);
public FormExample() {
// The root layout of the custom component.
- OrderedLayout root = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ OrderedLayout root = new OrderedLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
root.addStyleName("formroot");
setCompositionRoot(root);
-
+
// Create a form. It will use FormLayout as its layout by default.
final Form form = new Form();
root.addComponent(form);
form.setCaption("Contact Information");
// Set description that will appear on top of the form.
- form.setDescription("Please enter valid name and address. Fields marked with * are required. "+
- "If you try to commit with invalid values, a form error message is displayed. " +
- "(Address is required but failing to give it a value does not display an error.)");
+ form
+ .setDescription("Please enter valid name and address. Fields marked with * are required. "
+ + "If you try to commit with invalid values, a form error message is displayed. "
+ + "(Address is required but failing to give it a value does not display an error.)");
// Use custom field factory to create the fields in the form.
form.setFieldFactory(new MyFieldFactory());
// necessary for the validation of the fields to occur immediately when
// the input focus changes and not just on commit.
form.setImmediate(true);
-
+
// Set buffering so that commit() must be called for the form
// before input is written to the data. (Form input is not written
// immediately through to the underlying object.)
form.setWriteThrough(false);
-
+
// If the state of the bound data source changes, the changes are shown
- // immediately in the form, so there is no buffering. (This is the default.)
+ // immediately in the form, so there is no buffering. (This is the
+ // default.)
form.setReadThrough(true);
// Have a read-only component to display the actual current state
// of the bean (POJO).
final ContactDisplay display = new ContactDisplay(bean);
root.addComponent(display);
-
+
// Add Commit and Discard controls to the form.
- ExpandLayout footer = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ ExpandLayout footer = new ExpandLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
// The Commit button calls form.commit().
Button commit = new Button("Commit", new Button.ClickListener() {
Button discard = new Button("Discard", form, "discard");
footer.addComponent(commit);
footer.setComponentAlignment(commit, ExpandLayout.ALIGNMENT_RIGHT,
- ExpandLayout.ALIGNMENT_TOP);
+ ExpandLayout.ALIGNMENT_TOP);
footer.setHeight("25px"); // Has to be set explicitly for ExpandLayout.
footer.addComponent(discard);
form.setFooter(footer);
import com.itmill.toolkit.ui.Button.ClickListener;
/**
- * This example demonstrates the use of generated columns in a table.
- * Generated columns can be used for formatting values or calculating
- * them from other columns (or properties of the items).
+ * This example demonstrates the use of generated columns in a table. Generated
+ * columns can be used for formatting values or calculating them from other
+ * columns (or properties of the items).
*
- * For the data model, we use POJOs bound to a custom Container
- * with BeanItem items.
+ * For the data model, we use POJOs bound to a custom Container with BeanItem
+ * items.
*
* @author magi
*/
public FillUp() {
}
- public FillUp(int day, int month, int year, double quantity, double total) {
- date = new GregorianCalendar(year, month-1, day).getTime();
+ public FillUp(int day, int month, int year, double quantity,
+ double total) {
+ date = new GregorianCalendar(year, month - 1, day).getTime();
this.quantity = quantity;
this.total = total;
}
double difference_ms = date.getTime() - other.date.getTime();
double days = difference_ms / 1000 / 3600 / 24;
if (days < 0.5)
- days = 1.0; // Avoid division by zero if two fill-ups on the same day.
+ days = 1.0; // Avoid division by zero if two fill-ups on the
+ // same day.
return quantity / days;
}
* Most of the interface methods are implemented with just dummy
* implementations, as they are not needed in this example.
*/
- public class MySimpleIndexedContainer implements Container,Indexed {
+ public class MySimpleIndexedContainer implements Container, Indexed {
Vector items;
Object itemtemplate;
-
+
public MySimpleIndexedContainer(Object itemtemplate) {
this.itemtemplate = itemtemplate;
items = new Vector(); // Yeah this is just a test
int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < items.size()) {
Item item = (Item) items.get(pos);
-
+
// The BeanItem provides the property objects for the items.
return item.getItemProperty(propertyId);
}
public Item getItem(Object itemId) {
if (itemId instanceof Integer) {
- int pos = ((Integer)itemId).intValue();
+ int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < items.size())
return (Item) items.get(pos);
}
}
public boolean isLastId(Object itemId) {
- return ((Integer) itemId).intValue() == (items.size()-1);
+ return ((Integer) itemId).intValue() == (items.size() - 1);
}
public Object lastItemId() {
- return new Integer(items.size()-1);
+ return new Integer(items.size() - 1);
}
public Object nextItemId(Object itemId) {
int pos = indexOfId(itemId);
- if (pos >= items.size()-1)
+ if (pos >= items.size() - 1)
return null;
- return getIdByIndex(pos+1);
+ return getIdByIndex(pos + 1);
}
public Object prevItemId(Object itemId) {
int pos = indexOfId(itemId);
if (pos <= 0)
return null;
- return getIdByIndex(pos-1);
+ return getIdByIndex(pos - 1);
}
}
* Generates the cell containing the Date value. The column is
* irrelevant in this use case.
*/
- public Component generateCell(Table source, Object itemId, Object columnId) {
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
Property prop = source.getItem(itemId).getItemProperty(columnId);
if (prop.getType().equals(Date.class)) {
Label label = new Label(String.format("%tF",
/** Formats the value in a column containing Double objects. */
class ValueColumnGenerator implements Table.ColumnGenerator {
String format; /* Format string for the Double values. */
-
+
/** Creates double value column formatter with the given format string. */
public ValueColumnGenerator(String format) {
this.format = format;
}
-
+
/**
* Generates the cell containing the Double value. The column is
* irrelevant in this use case.
*/
- public Component generateCell(Table source, Object itemId, Object columnId) {
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
Property prop = source.getItem(itemId).getItemProperty(columnId);
if (prop.getType().equals(Double.class)) {
Label label = new Label(String.format(format,
new Object[] { (Double) prop.getValue() }));
-
- // Set styles for the column: one indicating that it's a value and a more
- // specific one with the column name in it. This assumes that the column
+
+ // Set styles for the column: one indicating that it's a value
+ // and a more
+ // specific one with the column name in it. This assumes that
+ // the column
// name is proper for CSS.
label.addStyleName("column-type-value");
label.addStyleName("column-" + (String) columnId);
/** Table column generator for calculating price column. */
class PriceColumnGenerator implements Table.ColumnGenerator {
- public Component generateCell(Table source, Object itemId, Object columnId) {
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
// Retrieve the item.
BeanItem item = (BeanItem) source.getItem(itemId);
/**
* Generates a cell containing value calculated from the item.
*/
- public Component generateCell(Table source, Object itemId, Object columnId) {
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
Indexed indexedSource = (Indexed) source.getContainerDataSource();
// Can not calculate consumption for the first item.
Object prevItemId = indexedSource.prevItemId(itemId);
// Retrieve the POJOs.
- FillUp fillup = (FillUp) ((BeanItem) indexedSource.getItem(itemId)).getBean();
- FillUp prev = (FillUp) ((BeanItem) source.getItem(prevItemId)).getBean();
+ FillUp fillup = (FillUp) ((BeanItem) indexedSource.getItem(itemId))
+ .getBean();
+ FillUp prev = (FillUp) ((BeanItem) source.getItem(prevItemId))
+ .getBean();
// Do the business logic
return generateCell(fillup, prev);
public Field createField(Class type, Component uiContext) {
// Let the BaseFieldFactory create the fields
Field field = super.createField(type, uiContext);
-
+
// ...and just set them as immediate
- ((AbstractField)field).setImmediate(true);
-
+ ((AbstractField) field).setImmediate(true);
+
return field;
}
}
// Define table columns. These include also the column for the generated
// column, because we want to set the column label to something
// different than the property ID.
- table.addContainerProperty("date", Date.class, null, "Date", null, null);
- table.addContainerProperty("quantity", Double.class, null, "Quantity (l)", null, null);
- table.addContainerProperty("price", Double.class, null, "Price (€/l)", null, null);
- table.addContainerProperty("total", Double.class, null, "Total (€)", null, null);
- table.addContainerProperty("consumption", Double.class, null, "Consumption (l/day)", null, null);
- table.addContainerProperty("dailycost", Double.class, null, "Daily Cost (€/day)", null, null);
+ table
+ .addContainerProperty("date", Date.class, null, "Date", null,
+ null);
+ table.addContainerProperty("quantity", Double.class, null,
+ "Quantity (l)", null, null);
+ table.addContainerProperty("price", Double.class, null, "Price (€/l)",
+ null, null);
+ table.addContainerProperty("total", Double.class, null, "Total (€)",
+ null, null);
+ table.addContainerProperty("consumption", Double.class, null,
+ "Consumption (l/day)", null, null);
+ table.addContainerProperty("dailycost", Double.class, null,
+ "Daily Cost (€/day)", null, null);
// Define the generated columns and their generators.
- table.addGeneratedColumn("date", new DateColumnGenerator());
- table.addGeneratedColumn("quantity", new ValueColumnGenerator("%.2f l"));
- table.addGeneratedColumn("price", new PriceColumnGenerator());
- table.addGeneratedColumn("total", new ValueColumnGenerator("%.2f €"));
- table.addGeneratedColumn("consumption", new ConsumptionColumnGenerator());
- table.addGeneratedColumn("dailycost", new DailyCostColumnGenerator());
+ table.addGeneratedColumn("date", new DateColumnGenerator());
+ table
+ .addGeneratedColumn("quantity", new ValueColumnGenerator(
+ "%.2f l"));
+ table.addGeneratedColumn("price", new PriceColumnGenerator());
+ table.addGeneratedColumn("total", new ValueColumnGenerator("%.2f €"));
+ table.addGeneratedColumn("consumption",
+ new ConsumptionColumnGenerator());
+ table.addGeneratedColumn("dailycost", new DailyCostColumnGenerator());
// Create a data source and bind it to the table.
- MySimpleIndexedContainer data = new MySimpleIndexedContainer(new FillUp());
+ MySimpleIndexedContainer data = new MySimpleIndexedContainer(
+ new FillUp());
table.setContainerDataSource(data);
// Generated columns are automatically placed after property columns, so
// we have to set the order of the columns explicitly.
- table.setVisibleColumns(new Object[] { "date", "quantity", "price", "total", "consumption", "dailycost" });
+ table.setVisibleColumns(new Object[] { "date", "quantity", "price",
+ "total", "consumption", "dailycost" });
// Add some data.
- data.addItem(new BeanItem(new FillUp(19, 2, 2005, 44.96, 51.21)));
- data.addItem(new BeanItem(new FillUp(30, 3, 2005, 44.91, 53.67)));
- data.addItem(new BeanItem(new FillUp(20, 4, 2005, 42.96, 49.06)));
- data.addItem(new BeanItem(new FillUp(23, 5, 2005, 47.37, 55.28)));
- data.addItem(new BeanItem(new FillUp(6, 6, 2005, 35.34, 41.52)));
- data.addItem(new BeanItem(new FillUp(30, 6, 2005, 16.07, 20.00)));
- data.addItem(new BeanItem(new FillUp(2, 7, 2005, 36.40, 36.19)));
- data.addItem(new BeanItem(new FillUp(6, 7, 2005, 39.17, 50.90)));
- data.addItem(new BeanItem(new FillUp(27, 7, 2005, 43.43, 53.03)));
- data.addItem(new BeanItem(new FillUp(17, 8, 2005, 20, 29.18)));
- data.addItem(new BeanItem(new FillUp(30, 8, 2005, 46.06, 59.09)));
- data.addItem(new BeanItem(new FillUp(22, 9, 2005, 46.11, 60.36)));
+ data.addItem(new BeanItem(new FillUp(19, 2, 2005, 44.96, 51.21)));
+ data.addItem(new BeanItem(new FillUp(30, 3, 2005, 44.91, 53.67)));
+ data.addItem(new BeanItem(new FillUp(20, 4, 2005, 42.96, 49.06)));
+ data.addItem(new BeanItem(new FillUp(23, 5, 2005, 47.37, 55.28)));
+ data.addItem(new BeanItem(new FillUp(6, 6, 2005, 35.34, 41.52)));
+ data.addItem(new BeanItem(new FillUp(30, 6, 2005, 16.07, 20.00)));
+ data.addItem(new BeanItem(new FillUp(2, 7, 2005, 36.40, 36.19)));
+ data.addItem(new BeanItem(new FillUp(6, 7, 2005, 39.17, 50.90)));
+ data.addItem(new BeanItem(new FillUp(27, 7, 2005, 43.43, 53.03)));
+ data.addItem(new BeanItem(new FillUp(17, 8, 2005, 20, 29.18)));
+ data.addItem(new BeanItem(new FillUp(30, 8, 2005, 46.06, 59.09)));
+ data.addItem(new BeanItem(new FillUp(22, 9, 2005, 46.11, 60.36)));
data.addItem(new BeanItem(new FillUp(14, 10, 2005, 41.51, 50.19)));
data.addItem(new BeanItem(new FillUp(12, 11, 2005, 35.24, 40.00)));
data.addItem(new BeanItem(new FillUp(28, 11, 2005, 45.26, 53.27)));
// Have a check box that allows the user to make the quantity
// and total columns editable.
- final CheckBox editable = new CheckBox("Edit the input values - calculated columns are regenerated");
+ final CheckBox editable = new CheckBox(
+ "Edit the input values - calculated columns are regenerated");
editable.setImmediate(true);
editable.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
table.setEditable(editable.booleanValue());
-
+
// The columns may not be generated when we want to have them
// editable.
if (editable.booleanValue()) {
table.removeGeneratedColumn("quantity");
table.removeGeneratedColumn("total");
} else {
- // In non-editable mode we want to show the formatted values.
- table.addGeneratedColumn("quantity", new ValueColumnGenerator("%.2f l"));
- table.addGeneratedColumn("total", new ValueColumnGenerator("%.2f €"));
+ // In non-editable mode we want to show the formatted
+ // values.
+ table.addGeneratedColumn("quantity",
+ new ValueColumnGenerator("%.2f l"));
+ table.addGeneratedColumn("total", new ValueColumnGenerator(
+ "%.2f €"));
}
// The visible columns are affected by removal and addition of
// generated columns so we have to redefine them.
- table.setVisibleColumns(
- new Object[] { "date","quantity","price","total","consumption", "dailycost" });
+ table.setVisibleColumns(new Object[] { "date", "quantity",
+ "price", "total", "consumption", "dailycost" });
}
});
-
+
// Use a custom field factory to set the edit fields as immediate.
// This is used when the table is in editable mode.
table.setFieldFactory(new ImmediateFieldFactory());
-
- // Setting the table itself as immediate has no relevance in this example,
+
+ // Setting the table itself as immediate has no relevance in this
+ // example,
// because it is relevant only if the table is selectable and we want to
// get the selection changes immediately.
table.setImmediate(true);
table.setHeight("100%");
ExpandLayout layout = new ExpandLayout();
- layout.addComponent(new Label("Table with column generators that format and calculate cell values."));
+ layout
+ .addComponent(new Label(
+ "Table with column generators that format and calculate cell values."));
layout.addComponent(table);
layout.addComponent(editable);
- layout.addComponent(new Label("Columns displayed in blue are calculated from Quantity and Total. "+
- "Others are simply formatted."));
+ layout.addComponent(new Label(
+ "Columns displayed in blue are calculated from Quantity and Total. "
+ + "Others are simply formatted."));
layout.expand(table);
layout.setSizeFull();
setCompositionRoot(layout);
root.setSizeFull();\r
setCompositionRoot(root);\r
setSizeFull();\r
- \r
+\r
// main layout\r
final OrderedLayout main = new OrderedLayout();\r
root.addComponent(main);\r
* Helper to add an item with specified caption and (optional) parent.
*
* @param caption
- * The item caption
+ * The item caption
* @param parent
- * The (optional) parent item id
+ * The (optional) parent item id
* @return the created item's id
*/
private Object addCaptionedItem(String caption, Object parent) {
e.printStackTrace();
}
/*
- * // Calendar will use the first date property as start if you do not //
- * explicitly specify the property id. Our start -property will be the //
- * first one, so it's intentionally left out. // Start is the only
- * mandatory property, but you'll probably want to // specify title as
- * well.
+ * // Calendar will use the first date property as start if you do not
+ * // explicitly specify the property id. Our start -property will be
+ * the // first one, so it's intentionally left out. // Start is the
+ * only mandatory property, but you'll probably want to // specify title
+ * as well.
* from.setItemEndPropertyId(SampleCalendarDatabase.PROPERTY_ID_END);
- * from.setItemTitlePropertyId(SampleCalendarDatabase.PROPERTY_ID_TITLE);
- * from.setItemNotimePropertyId(SampleCalendarDatabase.PROPERTY_ID_NOTIME);
+ * from
+ * .setItemTitlePropertyId(SampleCalendarDatabase.PROPERTY_ID_TITLE);
+ * from
+ * .setItemNotimePropertyId(SampleCalendarDatabase.PROPERTY_ID_NOTIME);
*
* to.setItemEndPropertyId(SampleCalendarDatabase.PROPERTY_ID_END);
* to.setItemTitlePropertyId(SampleCalendarDatabase.PROPERTY_ID_TITLE);
- * to.setItemNotimePropertyId(SampleCalendarDatabase.PROPERTY_ID_NOTIME);
+ * to
+ * .setItemNotimePropertyId(SampleCalendarDatabase.PROPERTY_ID_NOTIME);
*/
}
* RESOLUTION_HOUR are supported.\r
* \r
* @param resolution\r
- * the resolution to set.\r
+ * the resolution to set.\r
* @see com.itmill.toolkit.ui.DateField#setResolution(int)\r
*/\r
public void setResolution(int resolution) {\r
* Paints the content of this component.\r
* \r
* @param target\r
- * the Paint Event.\r
+ * the Paint Event.\r
* @throws PaintException\r
- * if the paint operation failed.\r
+ * if the paint operation failed.\r
*/\r
public void paintContent(PaintTarget target) throws PaintException {\r
super.paintContent(target);\r
* Constructs a new action with the given caption.
*
* @param caption
- * the caption for the new action.
+ * the caption for the new action.
*/
public Action(String caption) {
this.caption = caption;
* Constructs a new action with the given caption string and icon.
*
* @param caption
- * the caption for the new action.
+ * the caption for the new action.
* @param icon
- * the icon for the new action.
+ * the icon for the new action.
*/
public Action(String caption, Resource icon) {
this.caption = caption;
* Gets the list of actions applicable to this handler.
*
* @param target
- * the target handler to list actions for. For item
- * containers this is the item id.
+ * the target handler to list actions for. For item
+ * containers this is the item id.
* @param sender
- * the party that would be sending the actions. Most of
- * this is the action container.
+ * the party that would be sending the actions. Most of this
+ * is the action container.
* @return the list of Action
*/
public Action[] getActions(Object target, Object sender);
* discard the action if it's not suitable.
*
* @param action
- * the action to be handled.
+ * the action to be handled.
* @param sender
- * the sender of the action. This is most often the
- * action container.
+ * the sender of the action. This is most often the action
+ * container.
* @param target
- * the target of the action. For item containers this is
- * the item id.
+ * the target of the action. For item containers this is the
+ * item id.
*/
public void handleAction(Action action, Object sender, Object target);
}
* Registers a new action handler for this container
*
* @param actionHandler
- * the new handler to be added.
+ * the new handler to be added.
*/
public void addActionHandler(Action.Handler actionHandler);
* this container.
*
* @param actionHandler
- * the handler to be removed.
+ * the handler to be removed.
*/
public void removeActionHandler(Action.Handler actionHandler);
}
* Sets the caption.
*
* @param caption
- * the caption to set.
+ * the caption to set.
*/
public void setCaption(String caption) {
this.caption = caption;
* Sets the icon.
*
* @param icon
- * the icon to set.
+ * the icon to set.
*/
public void setIcon(Resource icon) {
this.icon = icon;
*
* @since 5.3
*
- * TODO extract generic super class/interfaces if we implement some other click
- * events.
+ * TODO extract generic super class/interfaces if we implement some other
+ * click events.
*/
public class ItemClickEvent extends Event {
public static final int BUTTON_LEFT = MouseEventDetails.BUTTON_LEFT;
* This feature is EXPERIMENTAL
*
* @param listener
- * ItemClickListener to be registered
+ * ItemClickListener to be registered
*/
public void addListener(ItemClickListener listener);
} catch (final java.lang.IllegalAccessException e) {
// This should never happen
throw new java.lang.RuntimeException(
- "Internal error - please report",e);
+ "Internal error - please report", e);
} catch (final java.lang.reflect.InvocationTargetException e) {
// This should never happen
throw new MethodException("Invocation of method " + method
*
* <p>
* For more information on the inheritable event mechanism see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package
+ * documentation}.
* </p>
*
* @author IT Mill Ltd.
*
* <p>
* For more information on the inheritable event mechanism see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package
+ * documentation}.
* </p>
*
* @param eventType
- * the type of the listened event. Events of this type or its
- * subclasses activate the listener.
+ * the type of the listened event. Events of this type or its
+ * subclasses activate the listener.
* @param object
- * the object instance who owns the activation method.
+ * the object instance who owns the activation method.
* @param method
- * the activation method.
+ * the activation method.
* @throws java.lang.IllegalArgumentException
- * unless <code>method</code> has exactly one match in
- * <code>object</code>
+ * unless <code>method</code> has exactly one match in
+ * <code>object</code>
*/
public void addListener(Class eventType, Object object, Method method);
* </p>
*
* <p>
- * This version of <code>addListener</code> gets the name of the
- * activation method as a parameter. The actual method is reflected from
+ * This version of <code>addListener</code> gets the name of the activation
+ * method as a parameter. The actual method is reflected from
* <code>object</code>, and unless exactly one match is found,
* <code>java.lang.IllegalArgumentException</code> is thrown.
* </p>
*
* <p>
* For more information on the inheritable event mechanism see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package
+ * documentation}.
* </p>
*
* @param eventType
- * the type of the listened event. Events of this type or its
- * subclasses activate the listener.
+ * the type of the listened event. Events of this type or its
+ * subclasses activate the listener.
* @param object
- * the object instance who owns the activation method.
+ * the object instance who owns the activation method.
* @param methodName
- * the name of the activation method.
+ * the name of the activation method.
* @throws java.lang.IllegalArgumentException
- * unless <code>method</code> has exactly one match in
- * <code>object</code>
+ * unless <code>method</code> has exactly one match in
+ * <code>object</code>
*/
public void addListener(Class eventType, Object object, String methodName);
/**
* Removes all registered listeners matching the given parameters. Since
* this method receives the event type and the listener object as
- * parameters, it will unregister all <code>object</code>'s methods that
- * are registered to listen to events of type <code>eventType</code>
- * generated by this component.
+ * parameters, it will unregister all <code>object</code>'s methods that are
+ * registered to listen to events of type <code>eventType</code> generated
+ * by this component.
*
* <p>
* For more information on the inheritable event mechanism see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package
+ * documentation}.
* </p>
*
* @param eventType
- * the exact event type the <code>object</code> listens to.
+ * the exact event type the <code>object</code> listens to.
* @param target
- * the target object that has registered to listen to events
- * of type <code>eventType</code> with one or more methods.
+ * the target object that has registered to listen to events of
+ * type <code>eventType</code> with one or more methods.
*/
public void removeListener(Class eventType, Object target);
*
* <p>
* For more information on the inheritable event mechanism see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package
+ * documentation}.
* </p>
*
* @param eventType
- * the exact event type the <code>object</code> listens to.
+ * the exact event type the <code>object</code> listens to.
* @param target
- * the target object that has registered to listen to events
- * of type eventType with one or more methods.
+ * the target object that has registered to listen to events of
+ * type eventType with one or more methods.
* @param method
- * the method owned by the target that's registered to listen
- * to events of type eventType.
+ * the method owned by the target that's registered to listen to
+ * events of type eventType.
*/
public void removeListener(Class eventType, Object target, Method method);
*
* <p>
* For more information on the inheritable event mechanism see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package
+ * documentation}.
* </p>
*
* @param eventType
- * the exact event type the <code>object</code> listens to.
+ * the exact event type the <code>object</code> listens to.
* @param target
- * the target object that has registered to listen to events
- * of type <code>eventType</code> with one or more methods.
+ * the target object that has registered to listen to events of
+ * type <code>eventType</code> with one or more methods.
* @param methodName
- * the name of the method owned by <code>target</code>
- * that's registered to listen to events of type
- * <code>eventType</code>.
+ * the name of the method owned by <code>target</code> that's
+ * registered to listen to events of type <code>eventType</code>.
*/
public void removeListener(Class eventType, Object target, String methodName);
}
* Open a control dialog for embedded server.
*
* @param applicationUrl
- * Application URL
+ * Application URL
*/
private static void openServerControlDialog(final String applicationUrl) {
* Adds transaction listener to this context.
*
* @param listener
- * the listener to be added.
+ * the listener to be added.
* @see TransactionListener
*/
public void addTransactionListener(TransactionListener listener);
* Removes transaction listener from this context.
*
* @param listener
- * the listener to be removed.
+ * the listener to be removed.
* @see TransactionListener
*/
public void removeTransactionListener(TransactionListener listener);
* Invoked at the beginning of every transaction.
*
* @param application
- * the Application object.
+ * the Application object.
* @param transactionData
- * the Data identifying the transaction.
+ * the Data identifying the transaction.
*/
public void transactionStart(Application application,
Object transactionData);
* Invoked at the end of every transaction.
*
* @param applcation
- * the Application object.
+ * the Application object.
* @param transactionData
- * the Data identifying the transaction.
+ * the Data identifying the transaction.
*/
public void transactionEnd(Application application,
Object transactionData);
* only on the file name extension.
*
* @param fileName
- * the name of the file whose mime-type is requested.
+ * the name of the file whose mime-type is requested.
* @return mime-type <code>String</code> for the given filename
*/
public static String getMIMEType(String fileName) {
* not found the default icon is returned.
*
* @param fileName
- * the name of the file whose icon is requested.
+ * the name of the file whose icon is requested.
* @return the icon corresponding to the given file
*/
public static Resource getIcon(String fileName) {
* icon is returned.
*
* @param file
- * the file whose icon is requested.
+ * the file whose icon is requested.
* @return the icon corresponding to the given file
*/
public static Resource getIcon(File file) {
* resolved by the filename extension only.
*
* @param file
- * the file whose mime-type is requested.
+ * the file whose mime-type is requested.
* @return the files mime-type <code>String</code>
*/
public static String getMIMEType(File file) {
* extension is already in the internal mapping it is overwritten.
*
* @param extension
- * the filename extension to be associated with
- * <code>MIMEType</code>.
+ * the filename extension to be associated with
+ * <code>MIMEType</code>.
* @param MIMEType
- * the new mime-type for <code>extension</code>.
+ * the new mime-type for <code>extension</code>.
*/
public static void addExtension(String extension, String MIMEType) {
extToMIMEMap.put(extension, MIMEType);
* corresponding icon, it is replaced with the new icon.
*
* @param MIMEType
- * the mime-type whose icon is to be changed.
+ * the mime-type whose icon is to be changed.
* @param icon
- * the new icon to be associated with <code>MIMEType</code>.
+ * the new icon to be associated with <code>MIMEType</code>.
*/
public static void addIcon(String MIMEType, Resource icon) {
MIMEToIconMap.put(MIMEType, icon);
* to the location of the application class.
*
* @param resourceName
- * the Unique identifier of the resource within the
- * application.
+ * the Unique identifier of the resource within the application.
* @param application
- * the application this resource will be added to.
+ * the application this resource will be added to.
*/
public ClassResource(String resourceName, Application application) {
associatedClass = application.getClass();
* Creates a new application resource instance.
*
* @param associatedClass
- * the class of the which the resource is associated.
+ * the class of the which the resource is associated.
* @param resourceName
- * the Unique identifier of the resource within the
- * application.
+ * the Unique identifier of the resource within the application.
* @param application
- * the application this resource will be added to.
+ * the application this resource will be added to.
*/
public ClassResource(Class associatedClass, String resourceName,
Application application) {
* Sets the size of the download buffer used for this resource.
*
* @param bufferSize
- * the size of the buffer in bytes.
+ * the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
* </p>
*
* @param cacheTime
- * the cache time in milliseconds.
+ * the cache time in milliseconds.
*
*/
public void setCacheTime(long cacheTime) {
* Constructor for CompositeErrorMessage.
*
* @param errorMessages
- * the Array of error messages that are listed togeter. Nulls
- * are ignored, but at least one message is required.
+ * the Array of error messages that are listed togeter. Nulls are
+ * ignored, but at least one message is required.
*/
public CompositeErrorMessage(ErrorMessage[] errorMessages) {
errors = new ArrayList(errorMessages.length);
* Constructor for CompositeErrorMessage.
*
* @param errorMessages
- * the Collection of error messages that are listed togeter.
- * At least one message is required.
+ * the Collection of error messages that are listed togeter. At
+ * least one message is required.
*/
public CompositeErrorMessage(Collection errorMessages) {
errors = new ArrayList(errorMessages.size());
* field.
*
* @param error
- * the error message to be added. Duplicate errors are
- * ignored.
+ * the error message to be added. Duplicate errors are ignored.
*/
private void addErrorMessage(ErrorMessage error) {
if (error != null && !errors.contains(error)) {
public Iterator iterator() {
return errors.iterator();
}
-
+
/**
* @see com.itmill.toolkit.terminal.Paintable#paint(com.itmill.toolkit.terminal.PaintTarget)
*/
* Sets the stream.
*
* @param stream
- * The stream to set
+ * The stream to set
*/
public void setStream(InputStream stream) {
this.stream = stream;
* Sets stream content type.
*
* @param contentType
- * the contentType to set
+ * the contentType to set
*/
public void setContentType(String contentType) {
this.contentType = contentType;
* Sets the file name.
*
* @param fileName
- * the file name to set.
+ * the file name to set.
*/
public void setFileName(String fileName) {
this.fileName = fileName;
* If the parameters by this name exists, the old value is replaced.
*
* @param name
- * the Name of the parameter to set.
+ * the Name of the parameter to set.
* @param value
- * the Value of the parameter to set.
+ * the Value of the parameter to set.
*/
public void setParameter(String name, String value) {
if (params == null) {
* headers.
*
* @param name
- * the Name of the parameter to set.
+ * the Name of the parameter to set.
* @return Value of the parameter or null if the parameter does not exist.
*/
public String getParameter(String name) {
* value disbales the caching of this stream.
*
* @param cacheTime
- * the cache time in milliseconds.
+ * the cache time in milliseconds.
*/
public void setCacheTime(long cacheTime) {
this.cacheTime = cacheTime;
* Sets the size of the download buffer.
*
* @param bufferSize
- * the size of the buffer in bytes.
+ * the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
* method should be implemented as empty.
*
* @param listener
- * the listener to be added.
+ * the listener to be added.
* @see com.itmill.toolkit.terminal.Paintable#addListener(Paintable.RepaintRequestListener)
*/
public void addListener(RepaintRequestListener listener);
* method should be implemented as empty.
*
* @param listener
- * the listener to be removed.
+ * the listener to be removed.
* @see com.itmill.toolkit.terminal.Paintable#removeListener(Paintable.RepaintRequestListener)
*/
public void removeListener(RepaintRequestListener listener);
* Creates a new download component for downloading directly from given URL.
*
* @param sourceURL
- * the source URL.
+ * the source URL.
*/
public ExternalResource(URL sourceURL) {
if (sourceURL == null) {
* Creates a new download component for downloading directly from given URL.
*
* @param sourceURL
- * the source URL.
+ * the source URL.
*/
public ExternalResource(String sourceURL) {
if (sourceURL == null) {
import com.itmill.toolkit.service.FileTypeResolver;
/**
- * <code>FileResources</code> are files or directories on local filesystem.
- * The files and directories are served through URI:s to the client terminal and
+ * <code>FileResources</code> are files or directories on local filesystem. The
+ * files and directories are served through URI:s to the client terminal and
* thus must be registered to an URI context before they can be used. The
* resource is automatically registered to the application when it is created.
*
* Sets the source file.
*
* @param sourceFile
- * the source file to set.
+ * the source file to set.
*/
public void setSourceFile(File sourceFile) {
this.sourceFile = sourceFile;
* value disbales the caching of this stream.
*
* @param cacheTime
- * the cache time in milliseconds.
+ * the cache time in milliseconds.
*/
public void setCacheTime(long cacheTime) {
this.cacheTime = cacheTime;
* Sets the size of the download buffer used for this resource.
*
* @param bufferSize
- * the size of the buffer in bytes.
+ * the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
import java.util.Hashtable;
/**
- * <code>KeyMapper</code> is the simple two-way map for generating textual
- * keys for objects and retrieving the objects later with the key.
+ * <code>KeyMapper</code> is the simple two-way map for generating textual keys
+ * for objects and retrieving the objects later with the key.
*
* @author IT Mill Ltd.
* @version
* Gets key for an object.
*
* @param o
- * the object.
+ * the object.
*/
public String key(Object o) {
* Retrieves object with the key.
*
* @param key
- * the name with the desired value.
+ * the name with the desired value.
* @return the object with the key.
*/
public Object get(String key) {
* Removes object from the mapper.
*
* @param removeobj
- * the object to be removed.
+ * the object to be removed.
*/
public void remove(Object removeobj) {
final String key = (String) objectKeyMap.get(removeobj);
private static final long serialVersionUID = 3762535607221891897L;
/**
- * Constructs an instance of <code>PaintExeception</code> with the
- * specified detail message.
+ * Constructs an instance of <code>PaintExeception</code> with the specified
+ * detail message.
*
* @param msg
- * the detail message.
+ * the detail message.
*/
public PaintException(String msg) {
super(msg);
}
/**
- * Constructs an instance of <code>PaintExeception</code> from
- * IOException.
+ * Constructs an instance of <code>PaintExeception</code> from IOException.
*
* @param exception
- * the original exception.
+ * the original exception.
*/
public PaintException(IOException exception) {
super(exception.getMessage());
* surrounded by XML start and end-tags.
*
* @param sectionTagName
- * the name of the tag.
+ * the name of the tag.
* @param sectionData
- * the scetion data.
+ * the scetion data.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addSection(String sectionTagName, String sectionData)
throws PaintException;
* </p>
*
* @param paintable
- * the paintable to start.
+ * the paintable to start.
* @param tag
- * the name of the start tag.
- * @return <code>true</code> if paintable found in cache,
- * <code>false</code> otherwise.
+ * the name of the start tag.
+ * @return <code>true</code> if paintable found in cache, <code>false</code>
+ * otherwise.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
* @see #startTag(String)
* @since 3.1
*/
* in future.
*
* @param paintable
- * the Paintable to reference
+ * the Paintable to reference
* @param referenceName
* @throws PaintException
*
* </pre>
*
* @param tagName
- * the name of the start tag.
+ * the name of the start tag.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void startTag(String tagName) throws PaintException;
* PaintException is raised.
*
* @param tagName
- * the name of the end tag.
+ * the name of the end tag.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void endTag(String tagName) throws PaintException;
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, boolean value) throws PaintException;
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, int value) throws PaintException;
* any content is written.
*
* @param name
- * the Attribute name
+ * the Attribute name
* @param value
- * the Attribute value
+ * the Attribute value
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, Resource value) throws PaintException;
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, long value) throws PaintException;
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, float value) throws PaintException;
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, double value) throws PaintException;
* content is written.
*
* @param name
- * the Boolean attribute name.
+ * the Boolean attribute name.
* @param value
- * the Boolean attribute value.
+ * the Boolean attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, String value) throws PaintException;
* Adds a string type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String value)
throws PaintException;
* Adds a int type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, int value)
throws PaintException;
* Adds a long type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, long value)
throws PaintException;
* Adds a float type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, float value)
throws PaintException;
* Adds a double type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, double value)
throws PaintException;
* Adds a boolean type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, boolean value)
throws PaintException;
* Adds a string array type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String[] value)
throws PaintException;
* Adds a upload stream type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addUploadStreamVariable(VariableOwner owner, String name)
throws PaintException;
* </p>
*
* @param sectionTagName
- * the tag name.
+ * the tag name.
* @param sectionData
- * the section data to be printed.
+ * the section data to be printed.
* @param namespace
- * the namespace.
+ * the namespace.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addXMLSection(String sectionTagName, String sectionData,
String namespace) throws PaintException;
* UIDL.dtd
*
* @param uidl
- * the UIDL to be added.
+ * the UIDL to be added.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addUIDL(java.lang.String uidl) throws PaintException;
* Adds text node. All the contents of the text are XML-escaped.
*
* @param text
- * the Text to add
+ * the Text to add
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
void addText(String text) throws PaintException;
* Adds CDATA node to target UIDL-tree.
*
* @param text
- * the Character data to add
+ * the Character data to add
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
* @since 3.1
*/
void addCharacterData(String text) throws PaintException;
* </p>
*
* @param target
- * the target UIDL stream where the component should paint
- * itself to.
+ * the target UIDL stream where the component should paint itself
+ * to.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void paint(PaintTarget target) throws PaintException;
* instance is on programmers responsibility.
*
* @param id
- * A short (< 20 chars) alphanumeric id
+ * A short (< 20 chars) alphanumeric id
*/
public void setDebugId(String id);
* Constructs a new event.
*
* @param source
- * the paintable needing repaint.
+ * the paintable needing repaint.
*/
public RepaintRequestEvent(Paintable source) {
super(source);
/**
* Gets the paintable needing repainting.
*
- * @return Paintable for which the <code>paint</code> method will
- * return dissimilar UIDL from the previous call of the method.
+ * @return Paintable for which the <code>paint</code> method will return
+ * dissimilar UIDL from the previous call of the method.
*/
public Paintable getPaintable() {
return (Paintable) getSource();
/**
* Listens repaint requests. The <code>repaintRequested</code> method is
* called when the paintable needs to be repainted. This is typically done
- * when the <code>paint</code> method would return dissimilar UIDL from
- * the previous call of the method.
+ * when the <code>paint</code> method would return dissimilar UIDL from the
+ * previous call of the method.
*/
public interface RepaintRequestListener {
* Receives repaint request events.
*
* @param event
- * the repaint request event specifying the paintable
- * source.
+ * the repaint request event specifying the paintable source.
*/
public void repaintRequested(RepaintRequestEvent event);
}
* right after adding itself as listener.
*
* @param listener
- * the listener to be added.
+ * the listener to be added.
*/
public void addListener(RepaintRequestListener listener);
* Removes repaint request listener.
*
* @param listener
- * the listener to be removed.
+ * the listener to be removed.
*/
public void removeListener(RepaintRequestListener listener);
* <p>
* Handles the given parameters. The parameters are given as inmodifieable
* name to value map. All parameters names are of type:
- * {@link java.lang.String}. All the parameter values are arrays of
- * strings.
+ * {@link java.lang.String}. All the parameter values are arrays of strings.
* </p>
*
* @param parameters
- * the Inmodifiable name to value[] mapping.
+ * the Inmodifiable name to value[] mapping.
*
*/
public void handleParameters(Map parameters);
* </p>
*
* @param pixelsScrolled
- * the xOffset.
+ * the xOffset.
*/
public void setScrollLeft(int pixelsScrolled);
* </p>
*
* @param pixelsScrolled
- * the yOffset.
+ * the yOffset.
*/
public void setScrollTop(int pixelsScrolled);
* </p>
*
* @param isScrollingEnabled
- * true if the scrolling is allowed.
+ * true if the scrolling is allowed.
*/
public void setScrollable(boolean isScrollingEnabled);
* (terminal is free to set the size).
*
* @param width
- * the width of the object in units specified by widthUnits
- * property.
+ * the width of the object in units specified by widthUnits
+ * property.
*/
public void setWidth(int width);
* (terminal is free to set the size).
*
* @param height
- * the height of the object in units specified by heightUnits
- * property.
+ * the height of the object in units specified by heightUnits
+ * property.
*/
public void setHeight(int height);
* Sets the width property units.
*
* @param units
- * the units used in width property.
+ * the units used in width property.
*/
public void setWidthUnits(int units);
* Sets the height property units.
*
* @param units
- * the units used in height property.
+ * the units used in height property.
*/
public void setHeightUnits(int units);
* spesification</a> for more details.
*
* @param height
- * in CSS style string representation
+ * in CSS style string representation
*/
public void setHeight(String height);
* spesification</a> for more details.
*
* @param width
- * in CSS style string representation
+ * in CSS style string representation
*/
public void setWidth(String width);
import com.itmill.toolkit.service.FileTypeResolver;
/**
- * <code>StreamResource</code> is a resource provided to the client directly
- * by the application. The strean resource is fetched from URI that is most
- * often in the context of the application or window. The resource is
- * automatically registered to window in creation.
+ * <code>StreamResource</code> is a resource provided to the client directly by
+ * the application. The strean resource is fetched from URI that is most often
+ * in the context of the application or window. The resource is automatically
+ * registered to window in creation.
*
* @author IT Mill Ltd.
* @version
* Creates a new stream resource for downloading from stream.
*
* @param streamSource
- * the source Stream.
+ * the source Stream.
* @param filename
- * the name of the file.
+ * the name of the file.
* @param application
- * the Application object.
+ * the Application object.
*/
public StreamResource(StreamSource streamSource, String filename,
Application application) {
* Sets the mime type of the resource.
*
* @param MIMEType
- * the MIME type to be set.
+ * the MIME type to be set.
*/
public void setMIMEType(String MIMEType) {
this.MIMEType = MIMEType;
}
/**
- * Returns the source for this <code>StreamResource</code>. StreamSource
- * is queried when the resource is about to be streamed to the client.
+ * Returns the source for this <code>StreamResource</code>. StreamSource is
+ * queried when the resource is about to be streamed to the client.
*
* @return Source of the StreamResource.
*/
* streamed to the client.
*
* @param streamSource
- * the source to set.
+ * the source to set.
*/
public void setStreamSource(StreamSource streamSource) {
this.streamSource = streamSource;
* Sets the filename.
*
* @param filename
- * the filename to set.
+ * the filename to set.
*/
public void setFilename(String filename) {
this.filename = filename;
* Sets the size of the download buffer used for this resource.
*
* @param bufferSize
- * the size of the buffer in bytes.
+ * the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
* </p>
*
* @param cacheTime
- * the cache time in milliseconds.
+ * the cache time in milliseconds.
*
*/
public void setCacheTime(long cacheTime) {
/**
* <code>SystemError</code> is a runtime exception caused by error in system.
* The system error can be shown to the user as it implements
- * <code>ErrorMessage</code> interface, but contains technical information
- * such as stack trace and exception.
+ * <code>ErrorMessage</code> interface, but contains technical information such
+ * as stack trace and exception.
*
* @author IT Mill Ltd.
* @version
* Constructor for SystemError with error message specified.
*
* @param message
- * the Textual error description.
+ * the Textual error description.
*/
public SystemError(String message) {
super(message);
* Constructor for SystemError with causing exception and error message.
*
* @param message
- * the Textual error description.
+ * the Textual error description.
* @param cause
- * the throwable causing the system error.
+ * the throwable causing the system error.
*/
public SystemError(String message, Throwable cause) {
super(message);
* Constructor for SystemError with cause.
*
* @param cause
- * the throwable causing the system error.
+ * the throwable causing the system error.
*/
public SystemError(Throwable cause) {
this.cause = cause;
* Invoked when terminal error occurs.
*
* @param event
- * the fired event.
+ * the fired event.
*/
public void terminalError(Terminal.ErrorEvent event);
}
* Creates a resource.
*
* @param resourceId
- * the Id of the resource.
+ * the Id of the resource.
*/
public ThemeResource(String resourceId) {
if (resourceId == null) {
* Tests if the given object equals this Resource.
*
* @param obj
- * the object to be tested for equality.
+ * the object to be tested for equality.
* @return <code>true</code> if the given object equals this Icon,
* <code>false</code> if not.
* @see java.lang.Object#equals(Object)
* stream is necessary, null should be returned instead.
*
* @param context
- * the URl.
+ * the URl.
* @param relativeUri
- * the relative uri.
+ * the relative uri.
* @return the download stream object.
*/
public DownloadStream handleURI(URL context, String relativeUri);
* Creates a textual error message of level ERROR.
*
* @param textErrorMessage
- * the text of the error message.
+ * the text of the error message.
*/
public UserError(String textErrorMessage) {
msg = textErrorMessage;
* Creates a error message with level and content mode.
*
* @param message
- * the error message.
+ * the error message.
* @param contentMode
- * the content Mode.
+ * the content Mode.
* @param errorLevel
- * the level of error.
+ * the level of error.
*/
public UserError(String message, int contentMode, int errorLevel) {
* changed.
*
* @param source
- * the Source of the variable change. This is the origin of
- * the event. For example in Web Adapter this is the request.
+ * the Source of the variable change. This is the origin of the
+ * event. For example in Web Adapter this is the request.
* @param variables
- * the Mapping from variable names to new variable values.
+ * the Mapping from variable names to new variable values.
*/
public void changeVariables(Object source, Map variables);
* </p>
*
* <p>
- * <strong>Note:</strong> <code>VariableOwner</code> does not include a
- * set- method for the immediateness property. This is because not all
+ * <strong>Note:</strong> <code>VariableOwner</code> does not include a set-
+ * method for the immediateness property. This is because not all
* VariableOwners wish to offer the functionality. Such VariableOwners are
* never in the immediate mode, thus they always return <code>false</code>
* in {@link #isImmediate()}.
}
if (html.length() != 0) {
- INotification n = new INotification(1000 * 60 * 45); // 45min
+ INotification n = new INotification(1000 * 60 * 45); //45min
n.addEventListener(new NotificationRedirect(url));
n.show(html, INotification.CENTERED_TOP, "system");
} else {
* Returns Paintable element by its id
*
* @param id
- * Paintable ID
+ * Paintable ID
*/
public Paintable getPaintable(String id) {
return (Paintable) idToPaintable.get(id);
* when needed.
*
* @param component
- * Widget to be updated, expected to implement an instance of
- * Paintable
+ * Widget to be updated, expected to implement an instance of
+ * Paintable
* @param uidl
- * UIDL to be painted
+ * UIDL to be painted
* @param manageCaption
- * True if you want to delegate caption, icon, description
- * and error message management to parent.
+ * True if you want to delegate caption, icon, description and
+ * error message management to parent.
*
* @return Returns true iff no further painting is needed by caller
*/
* parent.
*
* @param uidl
- * UIDL to create Paintable from.
+ * UIDL to create Paintable from.
* @return Either existing or new Paintable corresponding to UIDL.
*/
public Paintable getPaintable(UIDL uidl) {
* to browser due URI's in UIDL may contain custom protocols like theme://.
*
* @param toolkitUri
- * toolkit URI from uidl
+ * toolkit URI from uidl
* @return translated URI ready for browser
*/
public String translateToolkitUri(String toolkitUri) {
* Adds PNG-fix conditionally (only for IE6) to the specified IMG -element.
*
* @param el
- * the IMG element to fix
+ * the IMG element to fix
*/
public void addPngFix(Element el) {
BrowserInfo b = BrowserInfo.get();
/**
* Returns a specific property value from this CSS rule.
+ *
* @param propertyName
* @return
*/
* is responsible is for unregistering it.
*
* @param oldComponent
- * Child to be replaced
+ * Child to be replaced
* @param newComponent
- * Child that replaces the oldComponent
+ * Child that replaces the oldComponent
*/
void replaceChildComponent(Widget oldComponent, Widget newComponent);
* Is a given component child of this layout.
*
* @param component
- * Component to test.
+ * Component to test.
* @return true iff component is a child of this layout.
*/
boolean hasChildComponent(Widget component);
* </p>
*
* @param component
- * Child component for which service is requested.
+ * Child component for which service is requested.
* @param uidl
- * UIDL of the child component.
+ * UIDL of the child component.
*/
void updateCaption(Paintable component, UIDL uidl);
public static final String MARGIN_RIGHT = "margin-right";
public static final String MARGIN_BOTTOM = "margin-bottom";
public static final String MARGIN_LEFT = "margin-left";
-
+
public static final String VERTICAL_SPACING = "vspacing";
public static final String HORIZONTAL_SPACING = "hspacing";
* Adds transparent PNG fix to image element; only use for IE6.
*
* @param el
- * IMG element
+ * IMG element
* @param blankImageUrl
- * URL to transparent one-pixel gif
+ * URL to transparent one-pixel gif
*/
public native static void addPngFix(Element el, String blankImageUrl)
/*-{
*
* @param element
* @param deep
- * clone child tree also
+ * clone child tree also
* @return
*/
public static native Element cloneNode(Element element, boolean deep)
* component must be a {@link Widget} that implements {@link Paintable}.
*
* @param uidl
- * UIDL to be painted with returned component.
+ * UIDL to be painted with returned component.
* @return New uninitialized and unregistered component that can paint given
* UIDL.
*/
* Test if the given component implementation conforms to UIDL.
*
* @param currentWidget
- * Current implementation of the component
+ * Current implementation of the component
* @param uidl
- * UIDL to test against
+ * UIDL to test against
* @return true iff createWidget would return a new component of the same
* class than currentWidget
*/
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
import com.itmill.toolkit.terminal.gwt.client.BrowserInfo;
-import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener;
+import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
import com.itmill.toolkit.terminal.gwt.client.Util;
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
import com.itmill.toolkit.terminal.gwt.client.BrowserInfo;
-import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.ITooltip;
+import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
public class IButton extends Button implements Paintable {
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
-import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.ITooltip;
+import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
public class ICheckBox extends com.google.gwt.user.client.ui.CheckBox implements
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
-import com.itmill.toolkit.terminal.gwt.client.ICaption;
-import com.itmill.toolkit.terminal.gwt.client.ICaptionWrapper;
import com.itmill.toolkit.terminal.gwt.client.Container;
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener;
+import com.itmill.toolkit.terminal.gwt.client.ICaption;
+import com.itmill.toolkit.terminal.gwt.client.ICaptionWrapper;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
import com.itmill.toolkit.terminal.gwt.client.Util;
* If location already contains a widget it will be removed.
*
* @param widget
- * Widget to be set into location.
+ * Widget to be set into location.
* @param location
- * location name where widget will be added
+ * location name where widget will be added
*
* @throws IllegalArgumentException
- * if no such location is found in the layout.
+ * if no such location is found in the layout.
*/
public void setWidget(Widget widget, String location) {
* all _UID_ tags with an unique id-string.
*
* @param html
- * Original HTML-template received from server
+ * Original HTML-template received from server
* @return html that is used to create the HTMLPanel.
*/
private String extractBodyAndScriptsFromTemplate(String html) {
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;\r
import com.itmill.toolkit.terminal.gwt.client.ClientExceptionHandler;\r
import com.itmill.toolkit.terminal.gwt.client.DateTimeService;\r
+import com.itmill.toolkit.terminal.gwt.client.ITooltip;\r
import com.itmill.toolkit.terminal.gwt.client.LocaleNotLoadedException;\r
import com.itmill.toolkit.terminal.gwt.client.Paintable;\r
-import com.itmill.toolkit.terminal.gwt.client.ITooltip;\r
import com.itmill.toolkit.terminal.gwt.client.UIDL;\r
\r
public class IDateField extends FlowPanel implements Paintable, Field {\r
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
import com.itmill.toolkit.terminal.gwt.client.BrowserInfo;
-import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.Container;
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener;
+import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.StyleConstants;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
final Iterator it = iterator();
while (it.hasNext()) {
final Widget w = (Widget) it.next();
-
+
if (w instanceof Paintable && w != expandedWidget) {
final WidgetWrapper wr = getWidgetWrapperFor(w);
if (orientationMode == ORIENTATION_VERTICAL) {
import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
import com.itmill.toolkit.terminal.gwt.client.Focusable;
-import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.ITooltip;
+import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
import com.itmill.toolkit.terminal.gwt.client.Util;
/*
* (non-Javadoc)
*
- * @see com.google.gwt.user.client.ui.PopupPanel$PositionCallback#setPosition(int,
- * int)
+ * @see
+ * com.google.gwt.user.client.ui.PopupPanel$PositionCallback#setPosition
+ * (int, int)
*/
public void setPosition(int offsetWidth, int offsetHeight) {
/**
*
* @param component
- * optional owner of caption. If not set, getOwner will
- * return null
+ * optional owner of caption. If not set, getOwner will
+ * return null
* @param client
*/
public Caption(Paintable component, ApplicationConnection client) {
import com.google.gwt.user.client.ui.HasVerticalAlignment.VerticalAlignmentConstant;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
import com.itmill.toolkit.terminal.gwt.client.BrowserInfo;
-import com.itmill.toolkit.terminal.gwt.client.ICaptionWrapper;
import com.itmill.toolkit.terminal.gwt.client.Container;
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener;
+import com.itmill.toolkit.terminal.gwt.client.ICaptionWrapper;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.StyleConstants;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
-import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.ITooltip;
+import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
public class IListSelect extends IOptionGroupBase {
* <p>
* There are two modes - vertical and horizontal.
* <ul>
- * <li>Vertical mode uses structure: div-root ( div-wrap ( child ) div-wrap (
- * child ))).</li>
+ * <li>Vertical mode uses structure: div-root ( div-wrap ( child ) div-wrap
+ * ( child ))).</li>
* <li>Horizontal mode uses structure: table ( tbody ( tr-childcontainer (
* td-wrap ( child ) td-wrap ( child) )) )</li>
* </ul>
* without letting root element to affect the calculation.
*
* @param offset
- * offsetWidth or offsetHeight
+ * offsetWidth or offsetHeight
*/
private int rootOffsetMeasure(String offset) {
// TODO This method must be optimized!
}
public static native void nativeBlur(Element e) /*-{
- if(e.focus) {
- e.blur();
- }
- }-*/;
+ if(e.focus) {
+ e.blur();
+ }
+ }-*/;
private class CustomPopup extends IToolkitOverlay implements Container {
/**
* @param uidl
- * which contains row data
+ * which contains row data
* @param firstRow
- * first row in data set
+ * first row in data set
* @param reqRows
- * amount of rows in data set
+ * amount of rows in data set
*/
private void updateBody(UIDL uidl, int firstRow, int reqRows) {
if (uidl == null || reqRows < 1) {
* divide extra space relatively to each column which has not width set.
*
* Overflow pixels are added to last column.
- *
*/
Iterator headCells = tHead.iterator();
* Note that this returns HeaderCell even if it is currently collapsed.
*
* @param cid
- * Column key of accessed HeaderCell
+ * Column key of accessed HeaderCell
* @return HeaderCell
*/
public HeaderCell getHeaderCell(String cid) {
* handler fires showContextMenu function.
*
* @param el
- * element where to attach contenxt menu event
+ * element where to attach contenxt menu event
*/
private native void attachContextMenuEvent(Element el)
/*-{
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.terminal.gwt.client.ui.IActionOwner#getActions()
+ * @see
+ * com.itmill.toolkit.terminal.gwt.client.ui.IActionOwner#getActions
+ * ()
*/
public Action[] getActions() {
if (actionKeys == null) {
* Helper function to build html snippet for column or row headers
*
* @param uidl
- * possibly with values caption and icon
+ * possibly with values caption and icon
* @return html snippet containing possibly an icon + caption text
*/
private String buildCaptionHtmlSnippet(UIDL uidl) {
*
* With IE7 one will sometimes get scrollbars with overflow auto
* even though there is nothing to scroll (content fits into area).
- *
*/
DOM.setStyleAttribute(firstContainer, "overflow", "hidden");
DOM.setStyleAttribute(secondContainer, "overflow", "hidden");
* can be initial row data, scroll up, scroll down...
*
* @param uidl
- * which contains row data
+ * which contains row data
*/
private void updateBody(UIDL uidl) {
final Iterator it = uidl.getChildIterator();
* Shows context menu for this row.
*
* @param event
- * Event which triggered context menu. Correct place for
- * context menu can be determined with it.
+ * Event which triggered context menu. Correct place for
+ * context menu can be determined with it.
*/
public void showContextMenu(Event event) {
System.out.println("TODO: Show context menu");
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
-import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener;
+import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
import com.itmill.toolkit.terminal.gwt.client.Util;
* Adds the specified widget to the deck.\r
* \r
* @param w\r
- * the widget to be added\r
+ * the widget to be added\r
*/\r
public void add(Widget w) {\r
Element el = createContainerElement();\r
* Inserts a widget before the specified index.\r
* \r
* @param w\r
- * the widget to be inserted\r
+ * the widget to be inserted\r
* @param beforeIndex\r
- * the index before which it will be inserted\r
+ * the index before which it will be inserted\r
* @throws IndexOutOfBoundsException\r
- * if <code>beforeIndex</code> is out of range\r
+ * if <code>beforeIndex</code> is out of range\r
*/\r
public void insert(Widget w, int beforeIndex) {\r
Element el = createContainerElement();\r
* visible widget to be hidden.\r
* \r
* @param index\r
- * the index of the widget to be shown\r
+ * the index of the widget to be shown\r
*/\r
public void showWidget(int index) {\r
checkIndexBoundsForAccess(index);\r
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener;
-import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.ITooltip;
+import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
import com.itmill.toolkit.terminal.gwt.client.Util;
/**
*
* @param pid
- * Paintable id
+ * Paintable id
* @param c
- * reference to application connections
+ * reference to application connections
*/
public ShortcutActionHandler(String pid, ApplicationConnection c) {
paintableId = pid;
* Updates list of actions this handler listens to.
*
* @param c
- * UIDL snippet containing actions
+ * UIDL snippet containing actions
*/
public void updateActionMap(UIDL c) {
actions.clear();
* An image indicating an open branch.\r
* \r
* @return a prototype of this image\r
- * @gwt.resource com/itmill/toolkit/terminal/gwt/public/default/tree/img/expanded.png\r
+ * @gwt.resource \r
+ * com/itmill/toolkit/terminal/gwt/public/default/tree/img/expanded\r
+ * .png\r
*/\r
AbstractImagePrototype treeOpen();\r
\r
* An image indicating a closed branch.\r
* \r
* @return a prototype of this image\r
- * @gwt.resource com/itmill/toolkit/terminal/gwt/public/default/tree/img/collapsed.png\r
+ * @gwt.resource \r
+ * com/itmill/toolkit/terminal/gwt/public/default/tree/img/collapsed\r
+ * .png\r
*/\r
AbstractImagePrototype treeClosed();\r
\r
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.BrowserInfo;
-import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener;
+import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.Util;
import com.itmill.toolkit.terminal.gwt.client.ui.AlignmentInfo;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
-import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.Container;
+import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
import com.itmill.toolkit.terminal.gwt.client.ui.MarginInfo;
* spacings.
*
* @param baseElement
- * measurements will be done withing this element
+ * measurements will be done withing this element
* @param baseStyleName
- * base style name
+ * base style name
* @return
*/
public static MarginPixels detectMargins(Element baseElement,
+ (style != null ? style : "") + "></div>\n");
if (!fragment) {
- page.write("<noscript>" + getNoScriptMessage() + "</noscript>");
+ page.write("<noscript>" + getNoScriptMessage() + "</noscript>");
page.write("</body>\n</html>\n");
}
page.close();
}
/**
- * Returns a message printed for browsers without scripting support or if browsers scripting support is disabled.
+ * Returns a message printed for browsers without scripting support or if
+ * browsers scripting support is disabled.
*/
protected String getNoScriptMessage() {
- return "You have to enable javascript in your browser to use an application built with IT Mill Toolkit.";
- }
+ return "You have to enable javascript in your browser to use an application built with IT Mill Toolkit.";
+ }
- private boolean isGecko17(HttpServletRequest request) {
+ private boolean isGecko17(HttpServletRequest request) {
final WebBrowser browser = WebApplicationContext.getApplicationContext(
request.getSession()).getBrowser();
if (browser != null && browser.getBrowserApplication() != null) {
* Creates a new instance of UploadStreamImpl.
*
* @param name
- * the name of the stream.
+ * the name of the stream.
* @param stream
- * the input stream.
+ * the input stream.
* @param contentName
- * the name of the content.
+ * the name of the content.
* @param contentType
- * the type of the content.
+ * the type of the content.
*/
public HttpUploadStream(String name, InputStream stream,
String contentName, String contentType) {
* @param variableMap
* @param manager
* @param outWriter
- * A character-output stream.
+ * A character-output stream.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public JsonPaintTarget(CommunicationManager manager, PrintWriter outWriter,
boolean cachingRequired) throws PaintException {
* <pre>
* Todo:
* Checking of input values
- *
+ *
* </pre>
*
* @param tagName
- * the name of the start tag.
+ * the name of the start tag.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*
*/
public void startTag(String tagName, boolean isChildNode)
* PaintException is raised.
*
* @param tag
- * the name of the end tag.
+ * the name of the end tag.
* @throws Paintexception
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void endTag(String tagName) throws PaintException {
// In case of null data output nothing:
* Substitutes the XML sensitive characters with predefined XML entities.
*
* @param xml
- * the String to be substituted.
+ * the String to be substituted.
* @return A new string instance where all occurrences of XML sensitive
* characters are substituted with entities.
*/
* Substitutes the XML sensitive characters with predefined XML entities.
*
* @param xml
- * the String to be substituted.
+ * the String to be substituted.
* @return A new StringBuffer instance where all occurrences of XML
* sensitive characters are substituted with entities.
*
* Substitutes a XML sensitive character with predefined XML entity.
*
* @param c
- * the Character to be replaced with an entity.
+ * the Character to be replaced with an entity.
* @return String of the entity or null if character is not to be replaced
* with an entity.
*/
*
* @param str
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*
*/
public void addText(String str) throws PaintException {
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, boolean value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + (value ? "true" : "false"));
* any content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, Resource value) throws PaintException {
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, int value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + String.valueOf(value));
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, long value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + String.valueOf(value));
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, float value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + String.valueOf(value));
* content is written.
*
* @param name
- * the Attribute name.
+ * the Attribute name.
* @param value
- * the Attribute value.
+ * the Attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, double value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + String.valueOf(value));
* content is written.
*
* @param name
- * the String attribute name.
+ * the String attribute name.
* @param value
- * the String attribute value.
+ * the String attribute value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addAttribute(String name, String value) throws PaintException {
// In case of null data output nothing:
* Adds a string type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String value)
throws PaintException {
* Adds a int type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, int value)
throws PaintException {
* Adds a long type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, long value)
throws PaintException {
* Adds a float type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, float value)
throws PaintException {
* Adds a double type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, double value)
throws PaintException {
* Adds a boolean type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, boolean value)
throws PaintException {
* Adds a string array type variable.
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
* @param value
- * the Variable initial value.
+ * the Variable initial value.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String[] value)
throws PaintException {
* TODO not converted for JSON
*
* @param owner
- * the Listener for variable changes.
+ * the Listener for variable changes.
* @param name
- * the Variable name.
+ * the Variable name.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addUploadStreamVariable(VariableOwner owner, String name)
throws PaintException {
* Prints full text section. The section data is escaped
*
* @param sectionTagName
- * the name of the tag.
+ * the name of the tag.
* @param sectionData
- * the section data to be printed.
+ * the section data to be printed.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addSection(String sectionTagName, String sectionData)
throws PaintException {
* Adds XML directly to UIDL.
*
* @param xml
- * the Xml to be added.
+ * the Xml to be added.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void addUIDL(String xml) throws PaintException {
* Adds XML section with namespace.
*
* @param sectionTagName
- * the name of the tag.
+ * the name of the tag.
* @param sectionData
- * the section data.
+ * the section data.
* @param namespace
- * the namespace to be added.
+ * the namespace to be added.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*
* @see com.itmill.toolkit.terminal.PaintTarget#addXMLSection(String,
* String, String)
/**
* Closes the paint target. Paint target must be closed before the
- * <code>getUIDL</code> can be called. Subsequent attempts to write to
- * paint target. If the target was already closed, call to this function is
+ * <code>getUIDL</code> can be called. Subsequent attempts to write to paint
+ * target. If the target was already closed, call to this function is
* ignored. will generate an exception.
*
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void close() throws PaintException {
if (tag != null) {
/**
*
* @param s
- * json string, object or array
+ * json string, object or array
*/
public void addData(String s) {
children.add(s);
import com.itmill.toolkit.Application;
import com.itmill.toolkit.service.ApplicationContext;
-import com.itmill.toolkit.terminal.gwt.client.ClientExceptionHandler;
/**
* Web application context for the IT Mill Toolkit applications.
"com.itmill.toolkit.demo", "com.itmill.toolkit.demo.colorpicker",
"com.itmill.toolkit.demo.reservation",
"com.itmill.toolkit.demo.features",
- "com.itmill.toolkit.tests.tickets"};
+ "com.itmill.toolkit.tests.tickets" };
HierarchicalContainer testables = new HierarchicalContainer();
+ "All components are in immmediate mode. See source how to tweak this test."));
main.addComponent(eventListenerFeedback);
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
window = new Window("Components inside Window (TEST: Window)");
getMainWindow().addWindow(window);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
target
.addComponent(new Label(
target.addComponent(ol);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
target
.addComponent(new Label(
target.addComponent(ol2);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
target.addComponent(new Label(
"<hr /><h1>Components inside TabSheet</h3>",
// test(expandLayout);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (true) {
target.addComponent(new Label(
"<hr /><h1>Components inside Accordion</h3>",
// test(expandLayout);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
target.addComponent(new Label(
"<hr /><h1>Components inside GridLayout</h3>",
// test(gridLayout);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
target
.addComponent(new Label(
target.addComponent(el);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
target.addComponent(new Label(
"<hr /><h1>Components inside Panel</h3>",
target.addComponent(panel);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
target
.addComponent(new Label(
target.addComponent(sp1l);
}
- // //////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ // ////
if (false) {
target
.addComponent(new Label(
vert.addComponent(b2);
vert.addComponent(t1);
vert.addComponent(d1);
- //vert.getSize().setWidth(500);
+ // vert.getSize().setWidth(500);
vert.setComponentAlignment(b1, OrderedLayout.ALIGNMENT_RIGHT,
OrderedLayout.ALIGNMENT_TOP);
vert.setComponentAlignment(b2, OrderedLayout.ALIGNMENT_LEFT,
hori.addComponent(b4);
hori.addComponent(t2);
hori.addComponent(d2);
- //hori.getSize().setHeight(200);
+ // hori.getSize().setHeight(200);
hori.setComponentAlignment(b3, OrderedLayout.ALIGNMENT_LEFT,
OrderedLayout.ALIGNMENT_BOTTOM);
hori.setComponentAlignment(b4, OrderedLayout.ALIGNMENT_LEFT,
StreamResource strres;
OrderedLayout ol;
int getwincount = 0;
-
+
public void init() {
setTheme("tests-book");
-
+
setMainWindow(main);
// Demo the use of parameter and URI handlers
main.addParameterHandler(new MyParameterHandler());
main.addURIHandler(new MyURIHandler());
-
+
MyDynamicResource myresource = new MyDynamicResource();
main.addParameterHandler(myresource);
main.addURIHandler(myresource);
main.addURIHandler(new BookTestURIHandler());
}
-
+
class MyParameterHandler implements ParameterHandler {
public void handleParameters(Map parameters) {
// Print out the parameters to standard output
for (Iterator it = parameters.keySet().iterator(); it.hasNext();) {
- String key = (String) it.next();
+ String key = (String) it.next();
String value = ((String[]) parameters.get(key))[0];
- System.out.println("Key: "+key+", value: "+value);
+ System.out.println("Key: " + key + ", value: " + value);
}
}
}
+
class MyURIHandler implements URIHandler {
public DownloadStream handleURI(URL context, String relativeUri) {
- System.out.println("Context: "+context.toString()+", relative: "+relativeUri);
+ System.out.println("Context: " + context.toString()
+ + ", relative: " + relativeUri);
return null; // Let the Application provide the response
}
}
final Window child = (Window) cwi.next();
main.removeWindow(child);
}
-
+
// The index is listed inside a grid layout
main.setLayout(new OrderedLayout());
- GridLayout grid = new GridLayout(4,4);
+ GridLayout grid = new GridLayout(4, 4);
grid.addStyleName("index");
main.addComponent(grid);
"labelcontent", "tree", "embedded", "textfield",
"textfieldvalidation", "datefield", "button",
"select/select", "select/native", "select/optiongroup",
- "select/twincol", "filterselect", "validator", "table", "table/select", "table/component", "table/paging", "table/editable",
- "upload", "link", "gridlayout", "orderedlayout",
- "formlayout", "form", "form/simple", "form/layout", "panel", "expandlayout", "expandlayout/root", "tabsheet",
- "alignment", "alignment/grid", "window", "window/opener",
+ "select/twincol", "filterselect", "validator", "table",
+ "table/select", "table/component", "table/paging",
+ "table/editable", "upload", "link", "gridlayout",
+ "orderedlayout", "formlayout", "form", "form/simple",
+ "form/layout", "panel", "expandlayout",
+ "expandlayout/root", "tabsheet", "alignment",
+ "alignment/grid", "window", "window/opener",
"window/multiple", "classresource", "usererror",
"progress/window", "progress/thread", "progress",
"customlayout", "spacing", "margin", "clientinfo",
"fillinform/templates", "notification", "print",
- "richtextfield", "querycontainer", "menubar"};
+ "richtextfield", "querycontainer", "menubar" };
for (int i = 0; i < examples.length; i++) {
- grid.addComponent(new Label("<a href='" + context.toString() +
- examples[i] + "'>" + examples[i] + "</a>",
- Label.CONTENT_XHTML));
+ grid.addComponent(new Label("<a href='"
+ + context.toString() + examples[i] + "'>"
+ + examples[i] + "</a>", Label.CONTENT_XHTML));
}
return null;
}
} else if (example.equals("menubar")) {
example_MenuBar(main, param);
} else {
- ; // main.addComponent(new Label("Unknown test '"+example+"'."));
+ ; // main.addComponent(new
+ // Label("Unknown test '"+example+"'."));
}
return null;
}
}
-
+
/*
* public Window getWindow(String name) { Window superwin =
* super.getWindow(name); if (superwin != null) return superwin;
new Object[] { "Venus" },
new Object[] { "Earth", "The Moon" },
new Object[] { "Mars", "Phobos", "Deimos" },
- new Object[] { "Jupiter", "Io", "Europa", "Ganymedes", "Callisto" },
- new Object[] { "Saturn", "Titan", "Tethys", "Dione", "Rhea", "Iapetus" },
- new Object[] { "Uranus", "Miranda", "Ariel", "Umbriel", "Titania", "Oberon" },
- new Object[] { "Neptune", "Triton", "Proteus", "Nereid", "Larissa" } };
+ new Object[] { "Jupiter", "Io", "Europa", "Ganymedes",
+ "Callisto" },
+ new Object[] { "Saturn", "Titan", "Tethys", "Dione", "Rhea",
+ "Iapetus" },
+ new Object[] { "Uranus", "Miranda", "Ariel", "Umbriel",
+ "Titania", "Oberon" },
+ new Object[] { "Neptune", "Triton", "Proteus", "Nereid",
+ "Larissa" } };
final Tree tree = new Tree();
tree.expandItemsRecursively(planet);
}
}
-
- // Horizontal layout with the tree on the left and a details panel on the right.
- final ExpandLayout horlayout = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+
+ // Horizontal layout with the tree on the left and a details panel on
+ // the right.
+ final ExpandLayout horlayout = new ExpandLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
horlayout.addStyleName("treeexample");
horlayout.setSizeFull();
-
+
final Panel treepanel = new Panel("The Planets and Major Moons");
treepanel.addComponent(tree);
horlayout.addComponent(treepanel);
-
+
final Panel detailspanel = new Panel("Details");
horlayout.addComponent(detailspanel);
horlayout.expand(detailspanel);
-
+
final OrderedLayout detailslayout = new OrderedLayout();
detailspanel.setLayout(detailslayout);
-
- // Allow null selection - this is the default actually.
- tree.setNullSelectionAllowed(true);
-
- // When a tree item (planet or moon) is clicked, open the item in Details view.
- tree.setImmediate(true);
- tree.addListener(new ValueChangeListener() {
- String lastselected = null;
-
- public void valueChange(ValueChangeEvent event) {
- String planet = (String) tree.getValue();
-
- // Reselect a selected item if it is unselected by clicking it.
- if (planet == null) {
- planet = lastselected;
- tree.setValue(planet);
- }
- lastselected = planet;
-
+
+ // Allow null selection - this is the default actually.
+ tree.setNullSelectionAllowed(true);
+
+ // When a tree item (planet or moon) is clicked, open the item in
+ // Details view.
+ tree.setImmediate(true);
+ tree.addListener(new ValueChangeListener() {
+ String lastselected = null;
+
+ public void valueChange(ValueChangeEvent event) {
+ String planet = (String) tree.getValue();
+
+ // Reselect a selected item if it is unselected by clicking it.
+ if (planet == null) {
+ planet = lastselected;
+ tree.setValue(planet);
+ }
+ lastselected = planet;
+
detailspanel.setCaption("Details on " + planet);
detailslayout.removeAllComponents();
-
+
// Put some stuff in the Details view.
detailslayout.addComponent(new Label("Where is the cat?"));
- detailslayout.addComponent(new Label("The cat is in " + planet + "."));
-
+ detailslayout.addComponent(new Label("The cat is in " + planet
+ + "."));
+
}
});
}
void example_DateField(Window main, String param) {
- OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
-
+ OrderedLayout layout = new OrderedLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
+
/* Create a DateField with the calendar style. */
final DateField popupdate = new PopupDateField("Popup calendar field");
popupdate.setValue(new java.util.Date());
/* Create a DateField with the calendar style. */
- final DateField inlinedate = new InlineDateField("Inline calendar field");
-
+ final DateField inlinedate = new InlineDateField(
+ "Inline calendar field");
+
/* Set locale of the DateField to American English. */
inlinedate.setLocale(new Locale("en", "US"));
form.setCaption("My Form");
form.setRequired(true);
main.addComponent(form);
-
+
TextField text = new TextField("This is a required text field");
text.setRequired(true);
text.setImmediate(true);
return "pagingtable";
}
}
-
+
void example_Table(Window main, String param) {
if (param != null) {
if (param.equals("select")) {
} else if (param.equals("paging")) {
PagingTable table = new PagingTable();
table.addContainerProperty("Column 1", String.class, null);
- for (int i=0; i<100; i++)
- table.addItem(new Object[]{"Item "+i}, new Integer(i));
+ for (int i = 0; i < 100; i++)
+ table.addItem(new Object[] { "Item " + i }, new Integer(i));
main.addComponent(table);
}
- }else
+ } else
main.addComponent(new TableExample1());
}
void example_GridLayout(Window main, String param) {
if (param.equals("embedded")) {
- final GridLayout grid = new GridLayout(3,3);
- for (int i=0; i<3*3; i++) {
- ClassResource img = new ClassResource("smiley.jpg", main.getApplication());
+ final GridLayout grid = new GridLayout(3, 3);
+ for (int i = 0; i < 3 * 3; i++) {
+ ClassResource img = new ClassResource("smiley.jpg", main
+ .getApplication());
Embedded embedded = new Embedded("", img);
grid.addComponent(embedded);
}
layout.setHeight(400, Sizeable.UNITS_PIXELS);
/* Define cells and their layouts to create. */
-
- Object cells[][] = {
- {new Button("Top Left"), new Integer(OrderedLayout.ALIGNMENT_LEFT), new Integer(OrderedLayout.ALIGNMENT_TOP)},
- {new Label ("Top Center"), new Integer(OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER), new Integer(OrderedLayout.ALIGNMENT_TOP)},
- {new Label ("Top Right"), new Integer(OrderedLayout.ALIGNMENT_RIGHT), new Integer(OrderedLayout.ALIGNMENT_TOP)},
- {new Button("Center Left"), new Integer(OrderedLayout.ALIGNMENT_LEFT), new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER)},
- {new Button("Center Center"), new Integer(OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER), new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER)},
- {new Button("Center Right"), new Integer(OrderedLayout.ALIGNMENT_RIGHT), new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER)},
- {new Button("Bottom Left"), new Integer(OrderedLayout.ALIGNMENT_LEFT), new Integer(OrderedLayout.ALIGNMENT_BOTTOM)},
- {new Button("Bottom Center"), new Integer(OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER), new Integer(OrderedLayout.ALIGNMENT_BOTTOM)},
- {new Button("Bottom Right"), new Integer(OrderedLayout.ALIGNMENT_RIGHT), new Integer(OrderedLayout.ALIGNMENT_BOTTOM)}};
-
- for (int i=0; i<9; i++) {
- ExpandLayout celllayout = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
- celllayout.addComponent((Component) cells[i][0]);
- celllayout.setComponentAlignment((Component)cells[i][0], ((Integer)cells[i][1]).intValue(), ((Integer)cells[i][2]).intValue());
- layout.addComponent(celllayout);
- //layout.setComponentAlignment((Component)cells[i][0], ((Integer)cells[i][1]).intValue(), ((Integer)cells[i][2]).intValue());
- }
+
+ Object cells[][] = {
+ { new Button("Top Left"),
+ new Integer(OrderedLayout.ALIGNMENT_LEFT),
+ new Integer(OrderedLayout.ALIGNMENT_TOP) },
+ {
+ new Label("Top Center"),
+ new Integer(
+ OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER),
+ new Integer(OrderedLayout.ALIGNMENT_TOP) },
+ { new Label("Top Right"),
+ new Integer(OrderedLayout.ALIGNMENT_RIGHT),
+ new Integer(OrderedLayout.ALIGNMENT_TOP) },
+ {
+ new Button("Center Left"),
+ new Integer(OrderedLayout.ALIGNMENT_LEFT),
+ new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER) },
+ {
+ new Button("Center Center"),
+ new Integer(
+ OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER),
+ new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER) },
+ {
+ new Button("Center Right"),
+ new Integer(OrderedLayout.ALIGNMENT_RIGHT),
+ new Integer(OrderedLayout.ALIGNMENT_VERTICAL_CENTER) },
+ { new Button("Bottom Left"),
+ new Integer(OrderedLayout.ALIGNMENT_LEFT),
+ new Integer(OrderedLayout.ALIGNMENT_BOTTOM) },
+ {
+ new Button("Bottom Center"),
+ new Integer(
+ OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER),
+ new Integer(OrderedLayout.ALIGNMENT_BOTTOM) },
+ { new Button("Bottom Right"),
+ new Integer(OrderedLayout.ALIGNMENT_RIGHT),
+ new Integer(OrderedLayout.ALIGNMENT_BOTTOM) } };
+
+ for (int i = 0; i < 9; i++) {
+ ExpandLayout celllayout = new ExpandLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
+ celllayout.addComponent((Component) cells[i][0]);
+ celllayout.setComponentAlignment((Component) cells[i][0],
+ ((Integer) cells[i][1]).intValue(),
+ ((Integer) cells[i][2]).intValue());
+ layout.addComponent(celllayout);
+ // layout.setComponentAlignment((Component)cells[i][0],
+ // ((Integer)cells[i][1]).intValue(),
+ // ((Integer)cells[i][2]).intValue());
+ }
} else {
final Panel panel = new Panel("A Panel with a Layout");
main.addComponent(panel);
} else if (param != null && param.equals("layout")) {
Form form = new Form();
form.setCaption("Form Caption");
- form.setDescription("This is a description of the Form that is " +
- "displayed in the upper part of the form. You normally enter some " +
- "descriptive text about the form and its use here.");
-
- // Add a field directly to the layout. This field will not be bound to
- // the data source Item of the form.
+ form
+ .setDescription("This is a description of the Form that is "
+ + "displayed in the upper part of the form. You normally enter some "
+ + "descriptive text about the form and its use here.");
+
+ // Add a field directly to the layout. This field will not be bound
+ // to
+ // the data source Item of the form.
form.getLayout().addComponent(new TextField("A Field"));
-
+
// Add a field and bind it to an named item property.
form.addField("another", new TextField("Another Field"));
-
- form.setComponentError(new UserError("This is the error indicator of the Form."));
+
+ form.setComponentError(new UserError(
+ "This is the error indicator of the Form."));
// Set the footer layout and add some text.
form.setFooter(new OrderedLayout());
- form.getFooter().addComponent(new Label("This is the footer area of the Form. "+
- "You can use any layout here. This is nice for buttons."));
-
- // Add an Ok (commit), Reset (discard), and Cancel buttons for the form.
- ExpandLayout okbar = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ form
+ .getFooter()
+ .addComponent(
+ new Label(
+ "This is the footer area of the Form. "
+ + "You can use any layout here. This is nice for buttons."));
+
+ // Add an Ok (commit), Reset (discard), and Cancel buttons for the
+ // form.
+ ExpandLayout okbar = new ExpandLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
okbar.setHeight("25px");
Button okbutton = new Button("OK", form, "commit");
okbar.addComponent(okbutton);
- okbar.setComponentAlignment(okbutton, ExpandLayout.ALIGNMENT_RIGHT, ExpandLayout.ALIGNMENT_TOP);
+ okbar.setComponentAlignment(okbutton, ExpandLayout.ALIGNMENT_RIGHT,
+ ExpandLayout.ALIGNMENT_TOP);
okbar.addComponent(new Button("Reset", form, "discard"));
okbar.addComponent(new Button("Cancel"));
form.getFooter().addComponent(okbar);
-
+
main.addComponent(form);
- } else
+ } else
main.addComponent(new FormExample());
}
void example_ExpandLayout(Window main, String param) {
if (param != null && param.equals("centered")) {
Label widget = new Label("Here is text");
-
- ExpandLayout layout = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+
+ ExpandLayout layout = new ExpandLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
layout.addComponent(widget);
layout.expand(widget);
- layout.setComponentAlignment(widget, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+ layout.setComponentAlignment(widget,
+ OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
+ OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
layout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
layout.setHeight(100, Sizeable.UNITS_PERCENTAGE);
-
+
main.setLayout(layout);
-
+
return;
} else if (param != null && param.equals("window")) {
Window window = new Window("Progress");
window.setHeight(100, Sizeable.UNITS_PIXELS);
window.setWidth(200, Sizeable.UNITS_PIXELS);
main.addWindow(window);
-
+
ProgressIndicator progress = new ProgressIndicator(new Float(0.4));
progress.addStyleName("fullwidth");
progress.setPollingInterval(1000000);
progress.setIndeterminate(false);
-
- ExpandLayout layout = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+
+ ExpandLayout layout = new ExpandLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
layout.setHeight(100, Sizeable.UNITS_PERCENTAGE);
- layout.setComponentAlignment(progress, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+ layout.setComponentAlignment(progress,
+ OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
+ OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
window.setLayout(layout);
window.addComponent(progress);
-
+
return;
} else if (param != null && param.equals("root")) {
final Window mainwin = main;
-
+
// Layout to switch to
final OrderedLayout expand2 = new OrderedLayout();
expand2.addComponent(new Label("I am layout too."));
-
+
// Original layout
final OrderedLayout expand1 = new OrderedLayout();
Button switchButton = new Button("Switch to other layout");
});
expand1.addComponent(switchButton);
main.setLayout(expand1);
-
+
return;
} else if (param != null && param.equals("size")) {
ExpandLayout layout = new ExpandLayout();
Button button = new Button("This is a button in middle of nowhere");
layout.addComponent(button);
- layout.setComponentAlignment(button, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
-
+ layout.setComponentAlignment(button,
+ OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
+ OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+
return;
}
/*
* FIXME Java 5 -> 1.4 for (int i=0; i<5; i++)
* table.addContainerProperty("col "+(i+1), Integer.class, 0); for
- * (int j=0; j<20; j++) table.addItem(new
- * Object[]{1*j,2*j,3*j,4*j,5*j}, j);
+ * (int j=0; j<20; j++) table.addItem(new Object[]{1j,2j,3j,4j,5j},
+ * j);
*/
layout.addComponent(table);
// ("images/Mercury_small.png", this)));
} else if (param.equals("expanding")) {
// Create the layout
- ExpandLayout expanding = new ExpandLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
+ ExpandLayout expanding = new ExpandLayout(
+ OrderedLayout.ORIENTATION_VERTICAL);
+
// It is important to set the expanding layout as the root layout
// of the containing window, in this case the main window, and not
// use addComponent(), which would place the layout inside the
// default root layout.
main.setLayout(expanding);
-
+
// Create a tab sheet that fills the expanding layout
final TabSheet tabsheet = new TabSheet();
- tabsheet.addTab(new Label("Contents of the first tab"), "First Tab", null);
- tabsheet.addTab(new Label("Contents of the second tab"), "Second Tab", null);
- tabsheet.addTab(new Label("Contents of the third tab"), "Third tab", null);
-
+ tabsheet.addTab(new Label("Contents of the first tab"),
+ "First Tab", null);
+ tabsheet.addTab(new Label("Contents of the second tab"),
+ "Second Tab", null);
+ tabsheet.addTab(new Label("Contents of the third tab"),
+ "Third tab", null);
+
// Set the tabsheet to scale to full size inside its container
tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
tabsheet.setHeight(100, Sizeable.UNITS_PERCENTAGE);
expanding.expand(tabsheet);
} else if (param.equals("ordered")) {
// Create the layout
- OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
+ OrderedLayout layout = new OrderedLayout(
+ OrderedLayout.ORIENTATION_VERTICAL);
+
// It is important to set the expanding layout as the root layout
// of the containing window, in this case the main window, and not
// use addComponent(), which would place the layout inside the
// default root layout.
main.setLayout(layout);
-
+
// Create a tab sheet that fills the expanding layout
final TabSheet tabsheet = new TabSheet();
- tabsheet.addTab(new Label("Contents of the first tab"), "First Tab", null);
- tabsheet.addTab(new Label("Contents of the second tab"), "Second Tab", null);
- tabsheet.addTab(new Label("Contents of the third tab"), "Third tab", null);
-
+ tabsheet.addTab(new Label("Contents of the first tab"),
+ "First Tab", null);
+ tabsheet.addTab(new Label("Contents of the second tab"),
+ "Second Tab", null);
+ tabsheet.addTab(new Label("Contents of the third tab"),
+ "Third tab", null);
+
// Set the tabsheet to scale to full size inside its container
tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
- //tabsheet().setHeight(100, Sizeable.UNITS_PERCENTAGE);
+ // tabsheet().setHeight(100, Sizeable.UNITS_PERCENTAGE);
// Add the tab sheet to the layout as usual
layout.addComponent(tabsheet);
main.addComponent(new Embedded("This is Embedded", new ClassResource(
"smiley.jpg", main.getApplication())));
}
-
+
void example_ProgressIndicator(final Window main, String param) {
if (param != null) {
if (param.equals("thread")) {
// Create the indicator
- final ProgressIndicator indicator = new ProgressIndicator(new Float(0.0));
+ final ProgressIndicator indicator = new ProgressIndicator(
+ new Float(0.0));
main.addComponent(indicator);
-
+
// Set polling frequency to 0.5 seconds.
indicator.setPollingInterval(1000);
-
- //indicator.addStyleName("invisible");
+
+ // indicator.addStyleName("invisible");
final Label text = new Label("-- Not running --");
main.addComponent(text);
-
+
// Add a button to start the progress
final Button button = new Button("Click to start");
main.addComponent(button);
-
+
// Another thread to do some work
class WorkThread extends Thread {
- public void run () {
+ public void run() {
double current = 0.0;
while (true) {
// Do some "heavy work"
try {
sleep(50); // Sleep for 50 milliseconds
- } catch (InterruptedException e) {}
-
+ } catch (InterruptedException e) {
+ }
+
// Grow the progress value until it reaches 1.0.
current += 0.01;
- if (current>1.0)
+ if (current > 1.0)
indicator.setValue(new Float(1.0));
- else
+ else
indicator.setValue(new Float(current));
-
+
// After the progress is full for a while, stop.
if (current > 1.2) {
// Restore the state to initial.
}
}
}
-
+
// Clicking the button creates and runs a work thread
button.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
final WorkThread thread = new WorkThread();
thread.start();
-
+
// The button hides until the work is done.
button.setVisible(false);
}
});
} else if (param.equals("window")) {
- // Create a table in the main window to hold items added in the second window
+ // Create a table in the main window to hold items added in the
+ // second window
final Table table = new Table();
table.setPageLength(5);
table.setWidth(100, Sizeable.UNITS_PERCENTAGE);
main.getApplication().addWindow(adderWindow);
// Create selection component to add items to the table
- final NativeSelect select = new NativeSelect("Select item to add");
+ final NativeSelect select = new NativeSelect(
+ "Select item to add");
select.setImmediate(true);
adderWindow.addComponent(select);
-
+
// Add some items to the selection
- String items[] = new String[]{"-- Select --", "Mercury", "Venus",
- "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"};
- for (int i=0; i<items.length; i++)
+ String items[] = new String[] { "-- Select --", "Mercury",
+ "Venus", "Earth", "Mars", "Jupiter", "Saturn",
+ "Uranus", "Neptune" };
+ for (int i = 0; i < items.length; i++)
select.addItem(items[i]);
select.setNullSelectionItemId(items[0]);
-
+
// When an item is selected in the second window, add
// table in the main window
select.addListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- // If the selected value is something else but null selection item.
+ // If the selected value is something else but null
+ // selection item.
if (select.getValue() != null) {
- // Add the selected item to the table in the main window
- table.addItem(new Object[]{select.getValue()}, new Integer(table.size()));
+ // Add the selected item to the table in the main
+ // window
+ table.addItem(new Object[] { select.getValue() },
+ new Integer(table.size()));
}
}
});
// Link to open the selection window
Link link = new Link("Click to open second window",
- new ExternalResource(adderWindow.getURL()),
- "_new", 50, 200, Link.TARGET_BORDER_DEFAULT);
+ new ExternalResource(adderWindow.getURL()), "_new", 50,
+ 200, Link.TARGET_BORDER_DEFAULT);
main.addComponent(link);
// Enable polling to update the main window
poller.addStyleName("invisible");
main.addComponent(poller);
} else if (param.equals("centered")) {
-/* GridLayout grid = new GridLayout(3,3);
- main.setLayout(grid);
- grid().setWidth(100, Sizeable.UNITS_PERCENTAGE);
-
- ExpandLayout layout2 = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
- layout2().setWidth(50, Sizeable.UNITS_PERCENTAGE);
-
- ProgressIndicator poller = new ProgressIndicator(new Float(0.4));
- poller.setPollingInterval(1000000);
- poller.setIndeterminate(false);
- layout2.addComponent(poller);
-
- grid.addComponent(layout2, 1, 1);
- */
-
- //ExpandLayout layout2 = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
-
- /*ProgressIndicator poller = new ProgressIndicator(new Float(0.4));
- poller.setPollingInterval(1000000);
- poller.setIndeterminate(false);*/
- /*layout2.addComponent(poller);
- layout2().setWidth(50, Sizeable.UNITS_PERCENTAGE);*/
-
- //layout.setComponentAlignment(poller, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
- /*GridLayout grid = new GridLayout(1,1);
- grid.addComponent(layout2, 0, 0);
- grid().setWidth(100, Sizeable.UNITS_PERCENTAGE);*/
-
- /*GridLayout layout = new GridLayout(1,1); //OrderedLayout.ORIENTATION_HORIZONTAL);
- layout.addComponent(poller);
- //layout.expand(poller);
- layout.setComponentAlignment(poller, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
- layout().setWidth(100, Sizeable.UNITS_PERCENTAGE);
- layout().setHeight(100, Sizeable.UNITS_PERCENTAGE);*/
-
+ /*
+ * GridLayout grid = new GridLayout(3,3); main.setLayout(grid);
+ * grid().setWidth(100, Sizeable.UNITS_PERCENTAGE);
+ *
+ * ExpandLayout layout2 = new
+ * ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ * layout2().setWidth(50, Sizeable.UNITS_PERCENTAGE);
+ *
+ * ProgressIndicator poller = new ProgressIndicator(new
+ * Float(0.4)); poller.setPollingInterval(1000000);
+ * poller.setIndeterminate(false); layout2.addComponent(poller);
+ *
+ * grid.addComponent(layout2, 1, 1);
+ */
+
+ // ExpandLayout layout2 = new
+ // ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ /*
+ * ProgressIndicator poller = new ProgressIndicator(new
+ * Float(0.4)); poller.setPollingInterval(1000000);
+ * poller.setIndeterminate(false);
+ */
+ /*
+ * layout2.addComponent(poller); layout2().setWidth(50,
+ * Sizeable.UNITS_PERCENTAGE);
+ */
+
+ // layout.setComponentAlignment(poller,
+ // OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
+ // OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+ /*
+ * GridLayout grid = new GridLayout(1,1);
+ * grid.addComponent(layout2, 0, 0); grid().setWidth(100,
+ * Sizeable.UNITS_PERCENTAGE);
+ */
+
+ /*
+ * GridLayout layout = new GridLayout(1,1);
+ * //OrderedLayout.ORIENTATION_HORIZONTAL);
+ * layout.addComponent(poller); //layout.expand(poller);
+ * layout.setComponentAlignment(poller,
+ * OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
+ * OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+ * layout().setWidth(100, Sizeable.UNITS_PERCENTAGE);
+ * layout().setHeight(100, Sizeable.UNITS_PERCENTAGE);
+ */
+
}
} else {
ProgressIndicator poller = new ProgressIndicator(new Float(0.0));
main.addComponent(poller);
}
}
-
+
void example_CustomLayout(final Window main, String param) {
Window sub = new Window("Login");
sub.setModal(true);
main.addWindow(sub);
-
+
// Create the custom layout and set it as the root layout of
// the containing window.
final CustomLayout custom = new CustomLayout("layoutname");
sub.setLayout(custom);
-
+
// Create components and bind them to the location tags
// in the custom layout.
TextField username = new TextField();
custom.addComponent(username, "username");
-
+
TextField password = new TextField();
custom.addComponent(password, "password");
-
+
final Button ok = new Button("Login");
custom.addComponent(ok, "okbutton");
-
+
final Button deny = new Button("No can do!");
-
+
Button.ClickListener listener = new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
// Switch between ok and deny
System.out.println("Changing to ok button.");
custom.addComponent(ok, "okbutton");
}
- }
- };
-
+ }
+ };
+
ok.addListener(listener);
deny.addListener(listener);
}
OrderedLayout containinglayout = new OrderedLayout();
main.setLayout(containinglayout);
- GridLayout grid = new GridLayout(4,3);
+ GridLayout grid = new GridLayout(4, 3);
grid.addStyleName("spacingexample");
containinglayout.addComponent(grid);
grid.addComponent(new Label(""), 0, 0);
grid.addComponent(new Label(""), 1, 0);
-
- grid.addComponent(new Label("No spacing:"),0,1);
- OrderedLayout layout1 = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
- grid.addComponent(layout1,1,1);
+
+ grid.addComponent(new Label("No spacing:"), 0, 1);
+ OrderedLayout layout1 = new OrderedLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
+ grid.addComponent(layout1, 1, 1);
layout1.addStyleName("spacingexample");
layout1.addComponent(new Button("Component 1"));
layout1.addComponent(new Button("Component 2"));
layout1.addComponent(new Button("Component 3"));
-
+
grid.addComponent(new Label("Horizontal spacing:"), 0, 2);
- OrderedLayout layout2 = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
- grid.addComponent(layout2,1,2);
+ OrderedLayout layout2 = new OrderedLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
+ grid.addComponent(layout2, 1, 2);
layout2.addStyleName("spacingexample");
layout2.setSpacing(true);
layout2.addComponent(new Button("Component 1"));
layout2.addComponent(new Button("Component 2"));
layout2.addComponent(new Button("Component 3"));
- grid.addComponent(new Label("No spacing:"),2,0);
- OrderedLayout layout3 = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
- grid.addComponent(layout3,2,1,2,2);
+ grid.addComponent(new Label("No spacing:"), 2, 0);
+ OrderedLayout layout3 = new OrderedLayout(
+ OrderedLayout.ORIENTATION_VERTICAL);
+ grid.addComponent(layout3, 2, 1, 2, 2);
layout3.addStyleName("spacingexample");
layout3.addComponent(new Button("Component 1"));
layout3.addComponent(new Button("Component 2"));
layout3.addComponent(new Button("Component 3"));
- grid.addComponent(new Label("Vertical spacing:"),3,0);
- OrderedLayout layout4 = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
- grid.addComponent(layout4,3,1,3,2);
+ grid.addComponent(new Label("Vertical spacing:"), 3, 0);
+ OrderedLayout layout4 = new OrderedLayout(
+ OrderedLayout.ORIENTATION_VERTICAL);
+ grid.addComponent(layout4, 3, 1, 3, 2);
layout4.addStyleName("spacingexample");
layout4.setSpacing(true);
layout4.addComponent(new Button("Component 1"));
layout4.addComponent(new Button("Component 2"));
layout4.addComponent(new Button("Component 3"));
-}
+ }
void example_Margin(final Window main, String param) {
- OrderedLayout hor = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ OrderedLayout hor = new OrderedLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
main.setLayout(hor);
-
+
OrderedLayout containinglayout = new OrderedLayout();
hor.addComponent(containinglayout);
// Create a layout
OrderedLayout layout2 = new OrderedLayout();
- containinglayout.addComponent(new Label("Layout with a special margin element:"));
+ containinglayout.addComponent(new Label(
+ "Layout with a special margin element:"));
containinglayout.addComponent(layout2);
-
+
// Set style name for the layout to allow styling it
layout2.addStyleName("marginexample2");
-
+
// Have margin on all sides around the layout
layout2.setMargin(true);
-
+
// Put something inside the layout
layout2.addComponent(new Button("Component 1"));
layout2.addComponent(new Button("Component 2"));
void example_ClientInfo(final Window main, String param) {
// Get the client identification string
WebApplicationContext context2 = (WebApplicationContext) getContext();
- String browserApplication = context2.getBrowser().getBrowserApplication();
-
+ String browserApplication = context2.getBrowser()
+ .getBrowserApplication();
+
// Add a browser-dependent style name for the main window
if (browserApplication.indexOf("Firefox/2") != -1)
main.addStyleName("firefox2");
-
+
// Display the client identification string
main.addComponent(new Label(browserApplication));
}
void example_FillInForm(final Window main, String param) {
- if (param.equals("templates")) {
- // Create a custom layout from the fill-in-form.html template.
- CustomLayout fillinlayout = new CustomLayout("fill-in-form");
-
- // The style will set the display to be "inline".
- fillinlayout.addStyleName("fillinlayout");
-
- // Create the fields that occur in the text.
- TextField field1 = new TextField();
- TextField field2 = new TextField();
- fillinlayout.addComponent(field1, "q1");
- fillinlayout.addComponent(field2, "q2");
-
- main.addComponent(fillinlayout);
- } else {
- String fillintext = "The <q1> is mightier than <q2>.";
- int pos = 0;
- while (pos < fillintext.length()) {
- int nexttag = fillintext.indexOf("<", pos);
- if (nexttag == -1) {
-
- }
- }
- }
+ if (param.equals("templates")) {
+ // Create a custom layout from the fill-in-form.html template.
+ CustomLayout fillinlayout = new CustomLayout("fill-in-form");
+
+ // The style will set the display to be "inline".
+ fillinlayout.addStyleName("fillinlayout");
+
+ // Create the fields that occur in the text.
+ TextField field1 = new TextField();
+ TextField field2 = new TextField();
+ fillinlayout.addComponent(field1, "q1");
+ fillinlayout.addComponent(field2, "q2");
+
+ main.addComponent(fillinlayout);
+ } else {
+ String fillintext = "The <q1> is mightier than <q2>.";
+ int pos = 0;
+ while (pos < fillintext.length()) {
+ int nexttag = fillintext.indexOf("<", pos);
+ if (nexttag == -1) {
+
+ }
+ }
+ }
}
void example_Notification(final Window main, String param) {
final Window sub1 = new Window("");
main.addWindow(sub1);
-
+
sub1.showNotification("The default notification");
-
- //Notification notif = new Notification("Title");
+
+ // Notification notif = new Notification("Title");
}
void example_Print(final Window main, String param) {
- if (param != null && param.equals("simple")) {
- main.addComponent(new Label("<input type='button' onClick='print()' value='Click to Print'/>", Label.CONTENT_XHTML));
+ if (param != null && param.equals("simple")) {
+ main
+ .addComponent(new Label(
+ "<input type='button' onClick='print()' value='Click to Print'/>",
+ Label.CONTENT_XHTML));
return;
}
public void buttonClick(ClickEvent event) {
// Create a window that contains stuff you want to print.
Window printWindow = new Window("Window to Print");
-
+
// Have some content to print.
- printWindow.addComponent(new Label("Here's some dynamic content."));
-
+ printWindow.addComponent(new Label(
+ "Here's some dynamic content."));
+
// To execute the print() JavaScript, we need to run it
// from a custom layout.
CustomLayout scriptLayout = new CustomLayout("printpage");
- printWindow.addComponent (scriptLayout);
-
+ printWindow.addComponent(scriptLayout);
+
// Add the printing window as an application-level window.
main.getApplication().addWindow(printWindow);
-
+
// Open the printing window as a new browser window
main.open(new ExternalResource(printWindow.getURL()), "_new");
- }
+ }
});
- //main.addComponent(new Label("<p>Print this!</p>\n<script type='text/javascript'>print();</script>", Label.CONTENT_XHTML));
+ // main.addComponent(new Label(
+ // "<p>Print this!</p>\n<script type='text/javascript'>print();</script>"
+ // , Label.CONTENT_XHTML));
}
void example_RichTextField(final Window main, String param) {
// Create the rich text area
final RichTextArea rtarea = new RichTextArea();
-
+
// Set initial content as HTML
rtarea.setValue("<h1>Hello</h1>\n<p>This contains some text.</p>");
-
+
// Show the text edited in the rich text area as HTML.
final Button show = new Button("Show HTML");
final Label html = new Label((String) rtarea.getValue());
try {
// Create a database connection
Class.forName("org.hsqldb.jdbcDriver");
- final Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:qcexample", "sa", "");
-
+ final Connection connection = DriverManager.getConnection(
+ "jdbc:hsqldb:mem:qcexample", "sa", "");
+
// Create an example table and put some data in it.
Statement st = connection.createStatement();
- st.executeQuery("CREATE TABLE Prisoners (id INTEGER, name VARCHAR)");
+ st
+ .executeQuery("CREATE TABLE Prisoners (id INTEGER, name VARCHAR)");
st.close();
- for (int i=0; i<100; i++) {
+ for (int i = 0; i < 100; i++) {
st = connection.createStatement();
- st.executeQuery("INSERT INTO Prisoners (id, name) VALUES ("+i+",'I am number "+(i+1)+"')");
+ st.executeQuery("INSERT INTO Prisoners (id, name) VALUES (" + i
+ + ",'I am number " + (i + 1) + "')");
st.close();
}
-
+
// Query the database
- final QueryContainer qc = new QueryContainer("SELECT id,name FROM Prisoners", connection);
-
+ final QueryContainer qc = new QueryContainer(
+ "SELECT id,name FROM Prisoners", connection);
+
// Create a component for selecting a query result item.
Select select = new Select("Select an item");
-
- // The items shown in the selection component are obtained from the query.
+
+ // The items shown in the selection component are obtained from the
+ // query.
select.setContainerDataSource(qc);
-
- // The item captions are obtained from a field in the query result.
+
+ // The item captions are obtained from a field in the query result.
select.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
-
- // Set the name of the field from which the item captions are obtained.
+
+ // Set the name of the field from which the item captions are
+ // obtained.
select.setItemCaptionPropertyId("name");
-
+
// When selection changes, display the selected item.
select.setImmediate(true);
final Label selection = new Label("Currently selected: -");
public void valueChange(ValueChangeEvent event) {
// Get the item id of the currently selected item
Integer itemId = (Integer) event.getProperty().getValue();
-
- // Use the item ID to get the actual row from the query result.
+
+ // Use the item ID to get the actual row from the query
+ // result.
Item qrItem = qc.getItem(itemId);
-
+
// Display the item ID
- selection.setValue("Currently selected: result row "+itemId.intValue() +
- " (id="+qrItem.getItemProperty("id")+", " +
- "name="+qrItem.getItemProperty("name")+")");
+ selection.setValue("Currently selected: result row "
+ + itemId.intValue() + " (id="
+ + qrItem.getItemProperty("id") + ", " + "name="
+ + qrItem.getItemProperty("name") + ")");
}
});
-
+
main.addComponent(select);
main.addComponent(selection);
} catch (SQLException e) {
// Create a menu bar
final MenuBar menubar = new MenuBar();
main.addComponent(menubar);
-
+
// A feedback component
final Label selection = new Label("");
main.addComponent(selection);
-
+
// Define a common menu command for all the menu items.
MenuBar.Command mycommand = new MenuBar.Command() {
public void menuSelected(MenuItem selectedItem) {
- selection.setValue("Ordered a " + selectedItem.getText() + " from menu.");
- }
+ selection.setValue("Ordered a " + selectedItem.getText()
+ + " from menu.");
+ }
};
-
+
// Put some items in the menu hierarchically
MenuBar.MenuItem beverages = menubar.addItem("Beverages", null, null);
MenuBar.MenuItem hot_beverages = beverages.addItem("Hot", null, null);
hot_beverages.addItem("Coffee", null, mycommand);
MenuBar.MenuItem cold_beverages = beverages.addItem("Cold", null, null);
cold_beverages.addItem("Milk", null, mycommand);
-
+
// Another top-level item
MenuBar.MenuItem snacks = menubar.addItem("Snacks", null, null);
snacks.addItem("Weisswurst", null, mycommand);
snacks.addItem("Salami", null, mycommand);
-
+
// Yet another top-level item
MenuBar.MenuItem services = menubar.addItem("Services", null, null);
services.addItem("Car Service", null, mycommand);
- }
+ }
}
package com.itmill.toolkit.tests.book;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import com.itmill.toolkit.Application;
-import com.itmill.toolkit.ui.*;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.ProgressIndicator;
+import com.itmill.toolkit.ui.Table;
+import com.itmill.toolkit.ui.TextField;
+import com.itmill.toolkit.ui.Window;
import com.itmill.toolkit.ui.Button.ClickEvent;
-public class ChatApplication extends Application implements Button.ClickListener {
- /* ChatApplication instances of different users.
- * Warning: a hack, not safe, because sessions can expire. */
+public class ChatApplication extends Application implements
+ Button.ClickListener {
+ /*
+ * ChatApplication instances of different users. Warning: a hack, not safe,
+ * because sessions can expire.
+ */
static List users = new ArrayList();
-
+
/* Messages as a shared list. */
- static List messages = new ArrayList();
- int localSize = 0;
+ static List messages = new ArrayList();
+ int localSize = 0;
/* User interface. */
- Table messageTable = new Table();
- TextField username = new TextField("Username:");
- TextField message = new TextField("Message:");
+ Table messageTable = new Table();
+ TextField username = new TextField("Username:");
+ TextField message = new TextField("Message:");
public void init() {
- final Window main = new Window ("Chat");
+ final Window main = new Window("Chat");
setMainWindow(main);
setTheme("tests-magi");
users.add(this);
messageTable.addContainerProperty("Sender", String.class, "");
messageTable.addContainerProperty("Message", String.class, "");
updateTable();
-
+
main.addComponent(message);
-
+
Button send = new Button("Send");
send.addListener(this);
main.addComponent(send);
}
public void buttonClick(ClickEvent event) {
- synchronized(users) {
+ synchronized (users) {
// Create the new message in the shared list.
- messages.add(new String[]{new String((String) username.getValue()),
- new String((String) message.getValue())});
+ messages.add(new String[] {
+ new String((String) username.getValue()),
+ new String((String) message.getValue()) });
// Update the message tables for all users.
- for (Iterator i = users.iterator();i.hasNext();)
- ((ChatApplication)i.next()).updateTable();
+ for (Iterator i = users.iterator(); i.hasNext();)
+ ((ChatApplication) i.next()).updateTable();
}
}
// Add new messages to the table
while (localSize < messages.size())
- messageTable.addItem((Object[])messages.get(localSize++),
- new Integer(localSize-1));
+ messageTable.addItem((Object[]) messages.get(localSize++),
+ new Integer(localSize - 1));
}
}
import com.itmill.toolkit.event.Action;
import com.itmill.toolkit.event.ShortcutAction;
import com.itmill.toolkit.event.Action.Handler;
-import com.itmill.toolkit.ui.AbstractField;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.CustomComponent;
import com.itmill.toolkit.ui.FormLayout;
TextField password = new TextField("Password");
OrderedLayout buttons = new FormLayout();
- // Create buttons and define their listener methods. Here we use parameterless
+ // Create buttons and define their listener methods. Here we use
+ // parameterless
// methods so that we can use same methods for both click events and
// keyboard actions.
Button ok = new Button("OK", this, "okHandler");
// Have the unmodified Enter key cause an event
Action action_ok = new ShortcutAction("Default key",
- ShortcutAction.KeyCode.ENTER,
- null);
+ ShortcutAction.KeyCode.ENTER, null);
// Have the C key modified with Alt cause an event
Action action_cancel = new ShortcutAction("Alt+C",
- ShortcutAction.KeyCode.C,
- new int[] { ShortcutAction.ModifierKey.ALT });
+ ShortcutAction.KeyCode.C,
+ new int[] { ShortcutAction.ModifierKey.ALT });
Window window = null;
*/
public Action[] getActions(Object target, Object sender) {
System.out.println("getActions()");
- return new Action[] {action_ok, action_cancel};
+ return new Action[] { action_ok, action_cancel };
}
/**
public void okHandler() {
// Do something: report the click
- formlayout.addComponent(new Label("OK clicked. "+
- "User="+username.getValue()+
- ", password="+password.getValue()));
+ formlayout.addComponent(new Label("OK clicked. " + "User="
+ + username.getValue() + ", password=" + password.getValue()));
//
}
public void cancelHandler() {
// Do something: report the click
- formlayout.addComponent(new Label("Cancel clicked. User="+username.getValue()+", password="+password.getValue()));
+ formlayout.addComponent(new Label("Cancel clicked. User="
+ + username.getValue() + ", password=" + password.getValue()));
}
}
public class FormExample extends CustomComponent {
/** Contact information data model. */
public class Contact {
- String name = "";
- String address = "";
- int postalCode = 20540;
+ String name = "";
+ String address = "";
+ int postalCode = 20540;
String city;
}
if (pid.equals("name"))
return new TextField("Name");
-
+
if (pid.equals("address"))
return new TextField("Street Address");
-
+
if (pid.equals("postalCode")) {
TextField field = new TextField("Postal Code");
field.setColumns(5);
return ((String) value).matches("[0-9]{5}");
}
- public void validate(Object value) throws InvalidValueException {
+ public void validate(Object value)
+ throws InvalidValueException {
if (!isValid(value)) {
throw new InvalidValueException(
"Postal code must be a number 10000-99999.");
field.addValidator(postalCodeValidator);
return field;
}
-
+
if (pid.equals("city")) {
Select select = new Select("City");
final String cities[] = new String[] { "Amsterdam", "Berlin",
// Set form caption and description texts.
form.setCaption("Contact Information");
- form.setDescription("Please enter valid name and address. Fields marked with * are required.");
+ form
+ .setDescription("Please enter valid name and address. Fields marked with * are required.");
// Use custom field factory to create the fields in the form.
form.setFieldFactory(new MyFieldFactory());
// necessary for the validation of the fields to occur immediately when
// the input focus changes and not just on commit.
form.setImmediate(true);
-
+
// Set buffering so that commit() must be called for the form
// before input is written to the data. (Input is not written
// immediately through).
form.setReadThrough(false);
// Add Commit and Discard controls to the form.
- ExpandLayout footer = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ ExpandLayout footer = new ExpandLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
// The Commit button calls form.commit().
Button commit = new Button("Commit", form, "commit");
Button discard = new Button("Discard", form, "discard");
footer.addComponent(commit);
footer.setComponentAlignment(commit, ExpandLayout.ALIGNMENT_RIGHT,
- ExpandLayout.ALIGNMENT_TOP);
+ ExpandLayout.ALIGNMENT_TOP);
footer.setHeight("25px");
footer.addComponent(discard);
form.setFooter(footer);
public class PersonBean {
String name = "";
String city = "";
-
+
public void setName(String name) {
this.name = name;
}
// Set form caption and description texts
form.setCaption("Contact Information");
- form.setDescription("Please specify name of the person and the city where the person lives in.");
+ form
+ .setDescription("Please specify name of the person and the city where the person lives in.");
// Use the custom field factory to create the fields in the form.
form.setFieldFactory(new MyFieldFactory());
order.add("name");
order.add("city");
form.setVisibleItemProperties(order);
-
+
form.getField("name").setRequired(true);
form.getField("name").setRequiredError("You must enter a name.");
form.getField("city").setRequired(true);
package com.itmill.toolkit.tests.book;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Graphics;
import java.awt.image.BufferedImage;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.net.URL;
import java.util.Map;
+
import javax.imageio.ImageIO;
-import com.itmill.toolkit.terminal.*;
+
+import com.itmill.toolkit.terminal.DownloadStream;
+import com.itmill.toolkit.terminal.ParameterHandler;
+import com.itmill.toolkit.terminal.URIHandler;
/**
* Demonstrates handling URI parameters and the URI itself to create a dynamic
public void handleParameters(Map parameters) {
// Get and store the passed HTTP parameter.
if (parameters.containsKey("text"))
- textToDisplay = ((String[])parameters.get("text"))[0];
+ textToDisplay = ((String[]) parameters.get("text"))[0];
}
/**
// URI handlers or the Application to handle the response.
if (!relativeUri.startsWith("myresource"))
return null;
-
+
// Create an image and draw some background on it.
- BufferedImage image = new BufferedImage (200, 200, BufferedImage.TYPE_INT_RGB);
+ BufferedImage image = new BufferedImage(200, 200,
+ BufferedImage.TYPE_INT_RGB);
Graphics drawable = image.getGraphics();
drawable.setColor(Color.lightGray);
- drawable.fillRect(0,0,200,200);
+ drawable.fillRect(0, 0, 200, 200);
drawable.setColor(Color.yellow);
- drawable.fillOval(25,25,150,150);
+ drawable.fillOval(25, 25, 150, 150);
drawable.setColor(Color.blue);
- drawable.drawRect(0,0,199,199);
-
+ drawable.drawRect(0, 0, 199, 199);
+
// Use the parameter to create dynamic content.
drawable.setColor(Color.black);
- drawable.drawString("Text: "+textToDisplay, 75, 100);
+ drawable.drawString("Text: " + textToDisplay, 75, 100);
try {
// Write the image to a buffer.
ImageIO.write(image, "png", imagebuffer);
// Return a stream from the buffer.
- ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer.toByteArray());
- return new DownloadStream (istream,null,null);
+ ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer
+ .toByteArray());
+ return new DownloadStream(istream, null, null);
} catch (IOException e) {
return null;
}
import java.io.OutputStream;
import com.itmill.toolkit.terminal.FileResource;
-import com.itmill.toolkit.ui.*;
+import com.itmill.toolkit.ui.CustomComponent;
+import com.itmill.toolkit.ui.Embedded;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Upload;
-public class MyUploader extends CustomComponent
-implements Upload.SucceededListener, Upload.FailedListener, Upload.Receiver {
- Panel root; // Root element for contained components.
- Panel imagePanel; // Panel that contains the uploaded image.
- File file; // File to write to.
+public class MyUploader extends CustomComponent implements
+ Upload.SucceededListener, Upload.FailedListener, Upload.Receiver {
+ Panel root; // Root element for contained components.
+ Panel imagePanel; // Panel that contains the uploaded image.
+ File file; // File to write to.
MyUploader() {
root = new Panel("My Upload Component");
upload.addListener((Upload.FailedListener) this);
root.addComponent(upload);
- root.addComponent(new Label("Click 'Browse' to select a file and then click 'Upload'."));
+ root.addComponent(new Label(
+ "Click 'Browse' to select a file and then click 'Upload'."));
// Create a panel for displaying the uploaded file (image).
imagePanel = new Panel("Uploaded image");
// Log the upload on screen.
root.addComponent(new Label("File " + event.getFilename()
+ " of type '" + event.getMIMEType() + "' uploaded."));
-
+
// Display the uploaded file in the image panel.
- final FileResource imageResource = new FileResource(file, getApplication());
+ final FileResource imageResource = new FileResource(file,
+ getApplication());
imagePanel.removeAllComponents();
imagePanel.addComponent(new Embedded("", imageResource));
}
package com.itmill.toolkit.tests.book;
-import java.text.MessageFormat;
-
import com.itmill.toolkit.data.Property;
import com.itmill.toolkit.data.Validator;
import com.itmill.toolkit.data.Property.ValueChangeEvent;
public class SSNField extends CustomComponent implements
Property.ValueChangeListener {
OrderedLayout layout = new FormLayout();
- // new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); //;new FormLayout();
+ // new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); //;new
+ // FormLayout();
TextField myfield;
Label myerror;
public void validate(Object value) throws InvalidValueException {
final String ssn = (String) value;
if (ssn.length() == 0)
- return;
+ return;
if (ssn.length() != 11)
throw new InvalidValueException("Invalid SSN length");
/* Create and set the validator object for the field. */
myfield.addValidator(new SSNValidator());
- /* ValueChageEvent will be generated immediately when the component
- loses focus. */
+ /*
+ * ValueChageEvent will be generated immediately when the component
+ * loses focus.
+ */
myfield.setImmediate(true);
/* Listen for ValueChangeEvent events. */
public TableCellStyle() {
Table table = new Table("Table with Cell Styles");
table.addStyleName("checkerboard");
-
+
// Add some columns in the table. In this example, the property IDs
// of the container are integers so we can determine the column number
// easily.
- table.addContainerProperty("0", String.class, null, "", null, null); // Row header
- for (int i=0; i<8; i++)
- table.addContainerProperty(""+(i+1), String.class, null,
- String.valueOf((char) (65+i)), null, null);
-
+ table.addContainerProperty("0", String.class, null, "", null, null); // Row
+ // header
+ for (int i = 0; i < 8; i++)
+ table.addContainerProperty("" + (i + 1), String.class, null, String
+ .valueOf((char) (65 + i)), null, null);
+
// Add some items in the table.
- table.addItem(new Object[]{"1", "R", "N", "B", "Q", "K", "B", "N", "R"}, new Integer(0));
- table.addItem(new Object[]{"2", "P", "P", "P", "P", "P", "P", "P", "P"}, new Integer(1));
- for (int i=2; i<6; i++)
- table.addItem(new Object[]{String.valueOf(i+1), "", "", "", "", "", "", "", ""}, new Integer(i));
- table.addItem(new Object[]{"7", "P", "P", "P", "P", "P", "P", "P", "P"}, new Integer(6));
- table.addItem(new Object[]{"8", "R", "N", "B", "Q", "K", "B", "N", "R"}, new Integer(7));
+ table.addItem(new Object[] { "1", "R", "N", "B", "Q", "K", "B", "N",
+ "R" }, new Integer(0));
+ table.addItem(new Object[] { "2", "P", "P", "P", "P", "P", "P", "P",
+ "P" }, new Integer(1));
+ for (int i = 2; i < 6; i++)
+ table.addItem(new Object[] { String.valueOf(i + 1), "", "", "", "",
+ "", "", "", "" }, new Integer(i));
+ table.addItem(new Object[] { "7", "P", "P", "P", "P", "P", "P", "P",
+ "P" }, new Integer(6));
+ table.addItem(new Object[] { "8", "R", "N", "B", "Q", "K", "B", "N",
+ "R" }, new Integer(7));
table.setPageLength(8);
-
+
// Set cell style generator
table.setCellStyleGenerator(new Table.CellStyleGenerator() {
public String getStyle(Object itemId, Object propertyId) {
- int row = ((Integer)itemId).intValue();
- int col = Integer.parseInt((String)propertyId);
-
+ int row = ((Integer) itemId).intValue();
+ int col = Integer.parseInt((String) propertyId);
+
// The first column.
if (col == 0)
return "rowheader";
-
+
// Other cells.
- if ((row+col)%2 == 1)
+ if ((row + col) % 2 == 1)
return "black";
else
return "white";
}
});
-
+
setCompositionRoot(table);
}
}
import com.itmill.toolkit.data.Property;
import com.itmill.toolkit.data.Property.ValueChangeEvent;
-import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.CheckBox;
import com.itmill.toolkit.ui.CustomComponent;
-import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.OrderedLayout;
-import com.itmill.toolkit.ui.RichTextArea;
import com.itmill.toolkit.ui.Table;
-import com.itmill.toolkit.ui.TextField;
-import com.itmill.toolkit.ui.Button.ClickEvent;
public class TableEditable extends CustomComponent {
/* A layout needed for the example. */
OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
+
TableEditable() {
setCompositionRoot(layout);
// Create a table. It is by default not editable.
final Table table = new Table();
-
+
// Define the names and data types of columns.
- table.addContainerProperty("Date", Date.class, null);
- table.addContainerProperty("Work", Boolean.class, null);
- table.addContainerProperty("Comments", String.class, null);
-
+ table.addContainerProperty("Date", Date.class, null);
+ table.addContainerProperty("Work", Boolean.class, null);
+ table.addContainerProperty("Comments", String.class, null);
+
// Add a few items in the table.
- for (int i=0; i<100; i++) {
- Calendar calendar = new GregorianCalendar(2008,0,1);
+ for (int i = 0; i < 100; i++) {
+ Calendar calendar = new GregorianCalendar(2008, 0, 1);
calendar.add(Calendar.DAY_OF_YEAR, i);
-
+
// Create the table row.
- table.addItem(new Object[] {calendar.getTime(),
- new Boolean(false),
- ""},
- new Integer(i)); // Item identifier
+ table.addItem(new Object[] { calendar.getTime(),
+ new Boolean(false), "" }, new Integer(i)); // Item
+ // identifier
}
-
+
table.setPageLength(8);
layout.addComponent(table);
-
+
final CheckBox switchEditable = new CheckBox("Editable");
switchEditable.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- table.setEditable(((Boolean)event.getProperty().getValue()).booleanValue());
+ table.setEditable(((Boolean) event.getProperty().getValue())
+ .booleanValue());
}
});
switchEditable.setImmediate(true);
import com.itmill.toolkit.ui.Table;
/**
- * Shows how to bind a bean to a table and make it editable.
+ * Shows how to bind a bean to a table and make it editable.
*/
public class TableEditableBean extends CustomComponent {
/**
* Let's have a simple example bean.
*/
- public class MyBean {
- boolean selected;
- String text;
-
- public MyBean() {
- this.selected = false;
- this.text = "";
- }
-
- public boolean isSelected() {
- System.out.println("isSelected() called: " + selected);
+ public class MyBean {
+ boolean selected;
+ String text;
+
+ public MyBean() {
+ this.selected = false;
+ this.text = "";
+ }
+
+ public boolean isSelected() {
+ System.out.println("isSelected() called: " + selected);
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
- System.out.println("setSelected1("+selected+") called.");
+ System.out.println("setSelected1(" + selected + ") called.");
}
public String getText() {
public void setText(String text) {
this.text = text;
- System.out.println("setText("+text+") called.");
+ System.out.println("setText(" + text + ") called.");
}
- };
+ };
/**
* Custom field factory that sets the fields as immediate for debugging
* purposes. This is not normally necessary, unless you want to have some
* interaction that requires it.
*/
- public class MyFieldFactory extends BaseFieldFactory {
- public Field createField(Class type, Component uiContext) {
- // Let the BaseFieldFactory create the fields
- Field field = super.createField(type, uiContext);
-
- // ...and just set them as immediate
- ((AbstractField)field).setImmediate(true);
-
+ public class MyFieldFactory extends BaseFieldFactory {
+ public Field createField(Class type, Component uiContext) {
+ // Let the BaseFieldFactory create the fields
+ Field field = super.createField(type, uiContext);
+
+ // ...and just set them as immediate
+ ((AbstractField) field).setImmediate(true);
+
return field;
- }
- }
+ }
+ }
/**
* This is a custom container that allows adding BeanItems inside it. The
* Most of the interface methods are implemented with just dummy
* implementations, as they are not needed in this example.
*/
- public class MyContainer implements Container {
+ public class MyContainer implements Container {
Item[] items;
- int current = 0;
-
- public MyContainer() {
- items = new Item[100]; // Yeah this is just a test
- }
+ int current = 0;
+
+ public MyContainer() {
+ items = new Item[100]; // Yeah this is just a test
+ }
public boolean addContainerProperty(Object propertyId, Class type,
Object defaultValue) throws UnsupportedOperationException {
}
/**
- * This addItem method is specific for this container and allows adding
- * BeanItem objects. The BeanItems must be bound to MyBean objects.
+ * This addItem method is specific for this container and allows adding
+ * BeanItem objects. The BeanItems must be bound to MyBean objects.
*/
public void addItem(BeanItem item) throws UnsupportedOperationException {
items[current++] = item;
public boolean containsId(Object itemId) {
if (itemId instanceof Integer) {
- int pos = ((Integer)itemId).intValue();
+ int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < 100)
return items[pos] != null;
}
*/
public Property getContainerProperty(Object itemId, Object propertyId) {
if (itemId instanceof Integer) {
- int pos = ((Integer)itemId).intValue();
+ int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < 100) {
Item item = items[pos];
-
+
// The BeanItem provides the property objects for the items.
return item.getItemProperty(propertyId);
}
public Collection getContainerPropertyIds() {
// This container can contain only BeanItems bound to MyBeans.
Item item = new BeanItem(new MyBean());
-
+
// The BeanItem knows how to get the property names from the bean.
return item.getItemPropertyIds();
}
public Item getItem(Object itemId) {
if (itemId instanceof Integer) {
- int pos = ((Integer)itemId).intValue();
+ int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < 100)
return items[pos];
}
public Collection getItemIds() {
Vector ids = new Vector();
- for (int i=0; i<100; i++)
+ for (int i = 0; i < 100; i++)
ids.add(Integer.valueOf(i));
return ids;
}
public int size() {
return current;
}
-
- }
+
+ }
TableEditableBean() {
/* A layout needed for the example. */
- OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+ OrderedLayout layout = new OrderedLayout(
+ OrderedLayout.ORIENTATION_VERTICAL);
setCompositionRoot(layout);
// Create a table. It is by default not editable.
final Table table = new Table();
layout.addComponent(table);
table.setPageLength(8);
-
+
// Use the custom container as the data source
MyContainer myContainer = new MyContainer();
table.setContainerDataSource(myContainer);
-
+
// Add a few items in the table.
- for (int i=0; i<5; i++) {
+ for (int i = 0; i < 5; i++) {
// Create the bean
- MyBean item = new MyBean();
- item.setText("MyBean " + i);
-
- // Have an Item that is bound to the bean
- BeanItem bitem = new BeanItem(item);
-
- // Add the item directly to the container using the custom addItem()
+ MyBean item = new MyBean();
+ item.setText("MyBean " + i);
+
+ // Have an Item that is bound to the bean
+ BeanItem bitem = new BeanItem(item);
+
+ // Add the item directly to the container using the custom addItem()
// method. We could otherwise add it to the Table as well, but
// the Container interface of Table does not allow adding items
- // as such, just item IDs.
- myContainer.addItem(bitem);
+ // as such, just item IDs.
+ myContainer.addItem(bitem);
}
-
+
// Use custom field factory that sets the checkboxes in immediate mode.
// This is just for debugging purposes and is not normally necessary.
table.setFieldFactory(new MyFieldFactory());
- // Have a check box to switch the table between normal and editable mode.
+ // Have a check box to switch the table between normal and editable
+ // mode.
final CheckBox switchEditable = new CheckBox("Editable");
switchEditable.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- table.setEditable(((Boolean)event.getProperty().getValue()).booleanValue());
+ table.setEditable(((Boolean) event.getProperty().getValue())
+ .booleanValue());
}
});
switchEditable.setImmediate(true);
layout.addComponent(table);
/* Define the names, data types, and default values of columns. */
- table.addContainerProperty("First Name", String.class, "(no first name)");
- table.addContainerProperty("Last Name", String.class, "(no last name)");
- table.addContainerProperty("Year", Integer.class, null);
+ table.addContainerProperty("First Name", String.class,
+ "(no first name)");
+ table.addContainerProperty("Last Name", String.class, "(no last name)");
+ table.addContainerProperty("Year", Integer.class, null);
/* We use these entries to generate random items in a table. */
- final String[] firstnames = new String[] { "Donald", "Patty", "Sally", "Douglas" };
- final String[] lastnames = new String[] { "Smith", "Jones", "Adams", "Knuth" };
+ final String[] firstnames = new String[] { "Donald", "Patty", "Sally",
+ "Douglas" };
+ final String[] lastnames = new String[] { "Smith", "Jones", "Adams",
+ "Knuth" };
/* Add some items in the table and assign them an Item ID (IID). */
for (int i = 0; i < 1000; i++) {
/* Add a randomly generated item in the Table. */
- table.addItem(new Object[] {
- firstnames[(int) (Math.random() * (firstnames.length - 0.01))],
- lastnames[(int) (Math.random() * (lastnames.length - 0.01))],
- new Integer((int) (1900 + Math.random() * 100)) },
- new Integer(i));
+ table
+ .addItem(
+ new Object[] {
+ firstnames[(int) (Math.random() * (firstnames.length - 0.01))],
+ lastnames[(int) (Math.random() * (lastnames.length - 0.01))],
+ new Integer(
+ (int) (1900 + Math.random() * 100)) },
+ new Integer(i));
}
/* Set the number of items visible in the table. */
/* Allow selecting items from the table. */
table.setSelectable(true);
-
- /* When an item is selected, the selection is sent immediately to server. */
+
+ /*
+ * When an item is selected, the selection is sent immediately to
+ * server.
+ */
table.setImmediate(true);
-
+
/* Handle selection change. */
table.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
current.setValue("Selected: " + table.getValue().toString());
}
});
-
+
layout.addComponent(current);
}
}
/* Create the table with a caption. */
Table table = new Table("This is my Table");
-
- /* Define the names and data types of columns.
- * The "default value" parameter is meaningless here. */
- table.addContainerProperty("First Name", String.class, null);
- table.addContainerProperty("Last Name", String.class, null);
- table.addContainerProperty("Year", Integer.class, null);
+
+ /*
+ * Define the names and data types of columns. The "default value"
+ * parameter is meaningless here.
+ */
+ table.addContainerProperty("First Name", String.class, null);
+ table.addContainerProperty("Last Name", String.class, null);
+ table.addContainerProperty("Year", Integer.class, null);
/* Add a few items in the table. */
- table.addItem(new Object[] {"Nicolaus","Copernicus",new Integer(1473)}, new Integer(1));
- table.addItem(new Object[] {"Tycho", "Brahe", new Integer(1546)}, new Integer(2));
- table.addItem(new Object[] {"Giordano","Bruno", new Integer(1548)}, new Integer(3));
- table.addItem(new Object[] {"Galileo", "Galilei", new Integer(1564)}, new Integer(4));
- table.addItem(new Object[] {"Johannes","Kepler", new Integer(1571)}, new Integer(5));
- table.addItem(new Object[] {"Isaac", "Newton", new Integer(1643)}, new Integer(6));
-
+ table.addItem(new Object[] { "Nicolaus", "Copernicus",
+ new Integer(1473) }, new Integer(1));
+ table.addItem(new Object[] { "Tycho", "Brahe", new Integer(1546) },
+ new Integer(2));
+ table.addItem(new Object[] { "Giordano", "Bruno", new Integer(1548) },
+ new Integer(3));
+ table.addItem(new Object[] { "Galileo", "Galilei", new Integer(1564) },
+ new Integer(4));
+ table.addItem(new Object[] { "Johannes", "Kepler", new Integer(1571) },
+ new Integer(5));
+ table.addItem(new Object[] { "Isaac", "Newton", new Integer(1643) },
+ new Integer(6));
+
/* Set number of visible rows. */
table.setPageLength(5);
public class TableExample2 extends CustomComponent {
/* A layout needed for the example. */
OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
+
TableExample2() {
setCompositionRoot(layout);
/* Create the table with a caption. */
final Table table = new Table();
-
- /* Define the names and data types of columns.
- * The "default value" parameter is meaningless here. */
- table.addContainerProperty("First Name", String.class, null);
- table.addContainerProperty("Last Name", String.class, null);
- table.addContainerProperty("Year", Integer.class, null);
+
+ /*
+ * Define the names and data types of columns. The "default value"
+ * parameter is meaningless here.
+ */
+ table.addContainerProperty("First Name", String.class, null);
+ table.addContainerProperty("Last Name", String.class, null);
+ table.addContainerProperty("Year", Integer.class, null);
/* Add a few items in the table. */
- table.addItem(new Object[] {"Nicolaus","Copernicus",new Integer(1473)}, new Integer(1));
- table.addItem(new Object[] {"Tycho", "Brahe", new Integer(1546)}, new Integer(2));
- table.addItem(new Object[] {"Giordano","Bruno", new Integer(1548)}, new Integer(3));
- table.addItem(new Object[] {"Galileo", "Galilei", new Integer(1564)}, new Integer(4));
- table.addItem(new Object[] {"Johannes","Kepler", new Integer(1571)}, new Integer(5));
- table.addItem(new Object[] {"Isaac", "Newton", new Integer(1643)}, new Integer(6));
-
+ table.addItem(new Object[] { "Nicolaus", "Copernicus",
+ new Integer(1473) }, new Integer(1));
+ table.addItem(new Object[] { "Tycho", "Brahe", new Integer(1546) },
+ new Integer(2));
+ table.addItem(new Object[] { "Giordano", "Bruno", new Integer(1548) },
+ new Integer(3));
+ table.addItem(new Object[] { "Galileo", "Galilei", new Integer(1564) },
+ new Integer(4));
+ table.addItem(new Object[] { "Johannes", "Kepler", new Integer(1571) },
+ new Integer(5));
+ table.addItem(new Object[] { "Isaac", "Newton", new Integer(1643) },
+ new Integer(6));
+
/* Set number of visible rows. */
table.setPageLength(5);
/* Allow selecting items from the table. */
table.setSelectable(true);
-
- /* When an item is selected, the selection is sent immediately to server. */
+
+ /*
+ * When an item is selected, the selection is sent immediately to
+ * server.
+ */
table.setImmediate(true);
/* Feedback from selection. */
package com.itmill.toolkit.tests.book;
-import com.itmill.toolkit.data.Property;
-import com.itmill.toolkit.data.Property.ValueChangeEvent;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.CheckBox;
import com.itmill.toolkit.ui.CustomComponent;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.OrderedLayout;
-import com.itmill.toolkit.ui.RichTextArea;
import com.itmill.toolkit.ui.Table;
import com.itmill.toolkit.ui.TextField;
import com.itmill.toolkit.ui.Button.ClickEvent;
public class TableExample3 extends CustomComponent {
/* A layout needed for the example. */
OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
-
+
TableExample3() {
setCompositionRoot(layout);
- // Create a table and add a style to allow setting the row height in theme.
+ // Create a table and add a style to allow setting the row height in
+ // theme.
final Table table = new Table();
table.addStyleName("components-inside");
-
- /* Define the names and data types of columns.
- * The "default value" parameter is meaningless here. */
- table.addContainerProperty("Sum", Label.class, null);
- table.addContainerProperty("Is Transferred", CheckBox.class, null);
- table.addContainerProperty("Comments", TextField.class, null);
- table.addContainerProperty("Details", Button.class, null);
-
+
+ /*
+ * Define the names and data types of columns. The "default value"
+ * parameter is meaningless here.
+ */
+ table.addContainerProperty("Sum", Label.class, null);
+ table.addContainerProperty("Is Transferred", CheckBox.class, null);
+ table.addContainerProperty("Comments", TextField.class, null);
+ table.addContainerProperty("Details", Button.class, null);
+
/* Add a few items in the table. */
- for (int i=0; i<100; i++) {
+ for (int i = 0; i < 100; i++) {
// Create the fields for the current table row
- Label sumField = new Label(String.format("Sum is <b>$%04.2f</b><br/><i>(VAT incl.)</i>",
- new Object[] {new Double(Math.random()*1000)}),
- Label.CONTENT_XHTML);
+ Label sumField = new Label(String.format(
+ "Sum is <b>$%04.2f</b><br/><i>(VAT incl.)</i>",
+ new Object[] { new Double(Math.random() * 1000) }),
+ Label.CONTENT_XHTML);
CheckBox transferredField = new CheckBox("is transferred");
-
+
// Multiline text field. This required modifying the height of the
// table row.
TextField commentsField = new TextField();
commentsField.setRows(3);
-
+
// The Table item identifier for the row.
Integer itemId = new Integer(i);
-
+
// Create a button and handle its click. A Button does not know
// the item it is contained in, so we have to store the item
// ID as user-defined data.
detailsField.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
// Get the item identifier from the user-defined data.
- Integer itemId = (Integer)event.getButton().getData();
- getWindow().showNotification("Link "+itemId.intValue()+" clicked.");
- }
+ Integer itemId = (Integer) event.getButton().getData();
+ getWindow().showNotification(
+ "Link " + itemId.intValue() + " clicked.");
+ }
});
detailsField.addStyleName("link");
-
+
// Create the table row.
- table.addItem(new Object[] {sumField, transferredField,
- commentsField, detailsField},
- itemId);
+ table.addItem(new Object[] { sumField, transferredField,
+ commentsField, detailsField }, itemId);
}
// Show just three rows because they are so high.
// Initially show the 50th item in the top of the table.
table.setCurrentPageFirstItemIndex(50);
- //table.setCurrentPageFirstItemId(initial);
-
+ // table.setCurrentPageFirstItemId(initial);
+
layout.addComponent(table);
}
}
* This is a virtual container that generates the items on the fly when
* requested.
*/
- public class HugeContainer implements Container,Indexed {
+ public class HugeContainer implements Container, Indexed {
int numberofitems;
-
+
public HugeContainer(int numberofitems) {
this.numberofitems = numberofitems;
}
if (itemId instanceof Integer) {
int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < numberofitems) {
- return new ObjectProperty("This is the item "+pos+" in the huge table");
+ return new ObjectProperty("This is the item " + pos
+ + " in the huge table");
}
}
return null;
public Item getItem(Object itemId) {
if (itemId instanceof Integer) {
- int pos = ((Integer)itemId).intValue();
+ int pos = ((Integer) itemId).intValue();
if (pos >= 0 && pos < numberofitems) {
Item item = new PropertysetItem();
- item.addItemProperty("id", new ObjectProperty("This is the item "+pos+" in the huge table"));
+ item.addItemProperty("id", new ObjectProperty(
+ "This is the item " + pos + " in the huge table"));
return item;
}
}
}
public boolean isLastId(Object itemId) {
- return ((Integer) itemId).intValue() == (numberofitems-1);
+ return ((Integer) itemId).intValue() == (numberofitems - 1);
}
public Object lastItemId() {
- return new Integer(numberofitems-1);
+ return new Integer(numberofitems - 1);
}
public Object nextItemId(Object itemId) {
int pos = indexOfId(itemId);
- if (pos >= numberofitems-1)
+ if (pos >= numberofitems - 1)
return null;
- return getIdByIndex(pos+1);
+ return getIdByIndex(pos + 1);
}
public Object prevItemId(Object itemId) {
int pos = indexOfId(itemId);
if (pos <= 0)
return null;
- return getIdByIndex(pos-1);
+ return getIdByIndex(pos - 1);
}
}
Table table = new Table("HUGE table, REALLY HUGE");
table.setContainerDataSource(new HugeContainer(500000));
table.setPageLength(20);
-
+
setCompositionRoot(table);
}
}
import com.itmill.toolkit.ui.Window.CloseEvent;
/** Component contains a button that allows opening a window. */
-public class WindowOpener extends CustomComponent
- implements Window.CloseListener {
- Window mainwindow; // Reference to main window
- Window mywindow; // The window to be opened
- Button openbutton; // Button for opening the window
+public class WindowOpener extends CustomComponent implements
+ Window.CloseListener {
+ Window mainwindow; // Reference to main window
+ Window mywindow; // The window to be opened
+ Button openbutton; // Button for opening the window
Button closebutton; // A button in the window
- Label explanation; // A descriptive text
+ Label explanation; // A descriptive text
public WindowOpener(String label, Window main) {
mainwindow = main;
/* The component consists of a button that opens the window. */
final OrderedLayout layout = new OrderedLayout();
-
+
openbutton = new Button("Open Window", this, "openButtonClick");
explanation = new Label("Explanation");
layout.addComponent(openbutton);
layout.addComponent(explanation);
-
+
setCompositionRoot(layout);
}
import com.itmill.toolkit.ui.Button.ClickEvent;
public class WindowTestApplication extends Application {
- Window anotherpage = null;
- HashMap windows = new HashMap();
+ Window anotherpage = null;
+ HashMap windows = new HashMap();
public void init() {
final Window main = new Window("Window Test Application");
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
// Open the window.
- main.open(new ExternalResource(mywindow.getURL()), "_new");
+ main.open(new ExternalResource(mywindow.getURL()),
+ "_new");
}
}));
/* Add a link to the second window. */
Link link = new Link("Click to open second window",
- new ExternalResource(mywindow.getURL()));
+ new ExternalResource(mywindow.getURL()));
link.setTargetName("_new");
main.addComponent(link);
// Add the link manually inside a Label.
- main.addComponent(new Label("Second window: <a href='" + mywindow.getURL()
- + "' target='_new'>click to open</a>",
- Label.CONTENT_XHTML));
- main.addComponent(new Label("The second window can be accessed through URL: "
- + mywindow.getURL()));
+ main.addComponent(new Label("Second window: <a href='"
+ + mywindow.getURL() + "' target='_new'>click to open</a>",
+ Label.CONTENT_XHTML));
+ main.addComponent(new Label(
+ "The second window can be accessed through URL: "
+ + mywindow.getURL()));
// Add links to windows that do not yet exist, but are created
// dynamically when the URL is called.
main.addComponent(new Label("URLs to open item windows:"));
final String[] items = new String[] { "mercury", "venus", "earth",
"mars", "jupiter", "saturn", "uranus", "neptune" };
-
+
for (int inx = 0; inx < items.length; inx++) {
String item = items[inx];
- // We do not create window objects here, but just links to the windows
+ // We do not create window objects here, but just links to the
+ // windows
String windowUrl = getURL() + "planet-" + item;
- main.addComponent(new Label("A window about '" + item + "': <a href='" +
- windowUrl + "' target='_new'>" + windowUrl +
- "</a>", Label.CONTENT_XHTML));
+ main.addComponent(new Label("A window about '" + item
+ + "': <a href='" + windowUrl + "' target='_new'>"
+ + windowUrl + "</a>", Label.CONTENT_XHTML));
}
}
if (!windows.containsKey(planetName)) {
// Create the window object on the fly.
Window newWindow = new Window("Yet Another Page");
- newWindow.addComponent(new Label("This window contains details about " +
- planetName + "."));
+ newWindow.addComponent(new Label(
+ "This window contains details about " + planetName
+ + "."));
windows.put(planetName, newWindow);
// We must add the window to the application, it is not done
}\r
});\r
\r
-// gl.addComponent(new Label("0-0"), 0, 0);\r
-// gl.addComponent(new Label("0-1"), 1, 0);\r
- gl.addComponent(new Label("1-0"), 1, 0);\r
- gl.addComponent(new Label("1-1"), 1, 1);\r
- gl.addComponent(new Label("0,0-1,0"), 0, 0, 1, 0);\r
- gl.addComponent(new Label("2,0-3,0"), 2, 0, 3, 0);\r
- Label l = new\r
- Label("Large cell 0,1-2,2<br/>yadayada<br/>lorem ipsum");\r
- l.setContentMode(Label.CONTENT_XHTML);\r
- gl.addComponent(l, 0, 1, 2, 2);\r
- gl.addComponent(new Label("3-1"), 3, 1);\r
- gl.addComponent(new Label("3,2-3,3"), 3, 2, 3, 3);\r
+ // gl.addComponent(new Label("0-0"), 0, 0);\r
+ // gl.addComponent(new Label("0-1"), 1, 0);\r
+ gl.addComponent(new Label("1-0"), 1, 0);\r
+ gl.addComponent(new Label("1-1"), 1, 1);\r
+ gl.addComponent(new Label("0,0-1,0"), 0, 0, 1, 0);\r
+ gl.addComponent(new Label("2,0-3,0"), 2, 0, 3, 0);\r
+ Label l = new Label("Large cell 0,1-2,2<br/>yadayada<br/>lorem ipsum");\r
+ l.setContentMode(Label.CONTENT_XHTML);\r
+ gl.addComponent(l, 0, 1, 2, 2);\r
+ gl.addComponent(new Label("3-1"), 3, 1);\r
+ gl.addComponent(new Label("3,2-3,3"), 3, 2, 3, 3);\r
gl.addComponent(tf, 0, 3);\r
gl.addComponent(insert, 1, 3);\r
- gl.addComponent(delete, 2, 3);\r
+ gl.addComponent(delete, 2, 3);\r
\r
gl.setStyleName("border");\r
w.addComponent(gl);\r
int pos = Integer.parseInt(tf.getValue().toString());\r
gl.insertRow(pos);\r
try {\r
- TextField t = new TextField("",\r
- "Newly added row");\r
+ TextField t = new TextField("", "Newly added row");\r
t.setWidth("100%");\r
gl.addComponent(t, 0, pos, 3, pos);\r
} catch (Exception e) {\r
* Helper to add an item with specified caption and (optional) parent.\r
* \r
* @param caption\r
- * The item caption\r
+ * The item caption\r
* @param parent\r
- * The (optional) parent item id\r
+ * The (optional) parent item id\r
* @return the created item's id\r
*/\r
private Object addCaptionedItem(String caption, Object parent) {\r
panel.addComponent(pe);
// Second test component
- PopupView pe2 = new PopupView("fooLabel", new Label(
- "Foooooooooo..."));
+ PopupView pe2 = new PopupView("fooLabel", new Label("Foooooooooo..."));
pe2.setDescription("Click to view");
panel.addComponent(pe2);
import com.itmill.toolkit.ui.Panel;
public class Ticket1506 extends CustomComponent {
-
+
Panel p;
-
+
public Ticket1506() {
p = new Ticket1506_Panel();
setCompositionRoot(p);
package com.itmill.toolkit.tests.tickets;\r
\r
-import com.itmill.toolkit.data.util.ObjectProperty;\r
import com.itmill.toolkit.data.Container;\r
+import com.itmill.toolkit.data.util.ObjectProperty;\r
+import com.itmill.toolkit.ui.Button;\r
import com.itmill.toolkit.ui.Component;\r
import com.itmill.toolkit.ui.Panel;\r
import com.itmill.toolkit.ui.Select;\r
-import com.itmill.toolkit.ui.Button;\r
\r
/**\r
* @author Efecte R&D\r
\r
public Ticket1506_Panel() {\r
ObjectProperty property1 = new ObjectProperty(null, String.class);\r
- addComponent(initSelect(new Ticket1506_TestContainer(), "Test select", property1));\r
+ addComponent(initSelect(new Ticket1506_TestContainer(), "Test select",\r
+ property1));\r
addComponent(initButton(property1));\r
- addComponent(initSelect(new Ticket1506_TestContainer2(), "Test select 2", new ObjectProperty(null, String.class)));\r
+ addComponent(initSelect(new Ticket1506_TestContainer2(),\r
+ "Test select 2", new ObjectProperty(null, String.class)));\r
}\r
\r
private Component initButton(final ObjectProperty property) {\r
return button;\r
}\r
\r
- private Component initSelect(Container containerDataSource, String caption, ObjectProperty property) {\r
+ private Component initSelect(Container containerDataSource, String caption,\r
+ ObjectProperty property) {\r
Select select = new Select(caption);\r
select.setFilteringMode(Select.FILTERINGMODE_CONTAINS);\r
select.setImmediate(true);\r
package com.itmill.toolkit.tests.tickets;\r
\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
import com.itmill.toolkit.data.Container;\r
import com.itmill.toolkit.data.Item;\r
import com.itmill.toolkit.data.Property;\r
-import com.itmill.toolkit.data.util.PropertysetItem;\r
import com.itmill.toolkit.data.util.ObjectProperty;\r
-\r
-import java.util.*;\r
+import com.itmill.toolkit.data.util.PropertysetItem;\r
\r
/**\r
* @author Efecte R&D\r
\r
private void loadItems() {\r
final PropertysetItem item1 = new PropertysetItem();\r
- item1.addItemProperty(PROPERTY_1_ID, new ObjectProperty("value 1", String.class));\r
- item1.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name 1", String.class));\r
+ item1.addItemProperty(PROPERTY_1_ID, new ObjectProperty("value 1",\r
+ String.class));\r
+ item1.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name 1",\r
+ String.class));\r
this.items.put(ITEM_1_ID, item1);\r
\r
final PropertysetItem item2 = new PropertysetItem();\r
- item2.addItemProperty(PROPERTY_1_ID, new ObjectProperty("value 2", String.class));\r
- item2.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name 2", String.class));\r
+ item2.addItemProperty(PROPERTY_1_ID, new ObjectProperty("value 2",\r
+ String.class));\r
+ item2.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name 2",\r
+ String.class));\r
this.items.put(ITEM_2_ID, item2);\r
}\r
\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean removeItem(Object itemId) throws UnsupportedOperationException {\r
+ public boolean removeItem(Object itemId)\r
+ throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean addContainerProperty(Object propertyId, Class type, Object defaultValue) throws UnsupportedOperationException {\r
+ public boolean addContainerProperty(Object propertyId, Class type,\r
+ Object defaultValue) throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException {\r
+ public boolean removeContainerProperty(Object propertyId)\r
+ throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
package com.itmill.toolkit.tests.tickets;\r
\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
import com.itmill.toolkit.data.Container;\r
import com.itmill.toolkit.data.Item;\r
import com.itmill.toolkit.data.Property;\r
-import com.itmill.toolkit.data.util.PropertysetItem;\r
import com.itmill.toolkit.data.util.ObjectProperty;\r
-\r
-import java.util.*;\r
+import com.itmill.toolkit.data.util.PropertysetItem;\r
\r
/**\r
* @author Efecte R&D\r
private void loadItems() {\r
for (int i = 1; i < 15; i++) {\r
final PropertysetItem item = new PropertysetItem();\r
- item.addItemProperty(PROPERTY_1_ID, new ObjectProperty("value " + i, String.class));\r
- item.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name " + i, String.class));\r
+ item.addItemProperty(PROPERTY_1_ID, new ObjectProperty(\r
+ "value " + i, String.class));\r
+ item.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name " + i,\r
+ String.class));\r
this.items.put(String.valueOf(i), item);\r
}\r
}\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean removeItem(Object itemId) throws UnsupportedOperationException {\r
+ public boolean removeItem(Object itemId)\r
+ throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean addContainerProperty(Object propertyId, Class type, Object defaultValue) throws UnsupportedOperationException {\r
+ public boolean addContainerProperty(Object propertyId, Class type,\r
+ Object defaultValue) throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException {\r
+ public boolean removeContainerProperty(Object propertyId)\r
+ throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
}
});
- final MenuItem last = (MenuItem) menuBar.getItems().get(menuBar.getSize() - 1);
+ final MenuItem last = (MenuItem) menuBar.getItems().get(
+ menuBar.getSize() - 1);
last.setText("Remove me!");
// A command for removing the selected menuitem
public class Ticket1659 extends Application {
- public void init() {
- final Window mainWin = new Window();
- setMainWindow(mainWin);
- mainWin.addComponent(new Button("Change URI using Application.getURL()", new Button.ClickListener() {
+ public void init() {
+ final Window mainWin = new Window();
+ setMainWindow(mainWin);
+ mainWin.addComponent(new Button(
+ "Change URI using Application.getURL()",
+ new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- mainWin.open(new ExternalResource(getURL() + "#"+System.currentTimeMillis()));
- }}));
- mainWin.addComponent(new Button("Change URI uring Window.getURL()", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ mainWin.open(new ExternalResource(getURL() + "#"
+ + System.currentTimeMillis()));
+ }
+ }));
+ mainWin.addComponent(new Button("Change URI uring Window.getURL()",
+ new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- mainWin.open(new ExternalResource(mainWin.getURL() + "#"+System.currentTimeMillis()));
- }}));
- }
+ public void buttonClick(ClickEvent event) {
+ mainWin.open(new ExternalResource(mainWin.getURL()
+ + "#" + System.currentTimeMillis()));
+ }
+ }));
+ }
}
+ i\r
+ " 5067w09adsfasdjfahlsdfjhalfjhaldjfhalsjdfhlajdhflajhdfljahdslfjahldsjfhaljdfhaljfdhlajsdhflajshdflkajhsdlfkjahsldfkjahsldfhalskjfdhlksjfdh857idifhaljsdfhlajsdhflajhdflajhdfljahldfjhaljdfhalsjdfhalkjdhflkajhdfljahsdlfjahlsdjfhaldjfhaljfdhlajdhflajshdfljahsdlfjhalsjdfhalskjhfdlhusfglksuhdflgjshflgjhslfghslfjghsljfglsjhfglsjhfgljshfgljshflgjhslfghsljfgsljdfglsdjhfglsjhflgkjshfldjgh"));\r
}\r
- //main.getLayout().setSizeFull();\r
+ // main.getLayout().setSizeFull();\r
\r
p.setHeight("300px");\r
p.setWidth("250px");\r
- //p.setWidth("50%");\r
+ // p.setWidth("50%");\r
\r
p.setScrollTop(100);\r
p.setScrollLeft(100);\r
/*\r
* \r
* OrderedLayout\r
- * \r
*/\r
\r
Panel p2 = new Panel();\r
/*\r
* \r
* GridLayout\r
- * \r
*/\r
\r
Panel p3 = new Panel();\r
* (non-Javadoc)
*
* @see com.itmill.toolkit.ui.Layout#setMargin(boolean, boolean, boolean,
- * boolean)
+ * boolean)
*/
public void setMargin(boolean topEnabled, boolean rightEnabled,
boolean bottomEnabled, boolean leftEnabled) {
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.ui.AbstractComponent#paintContent(com.itmill.toolkit.terminal.PaintTarget)
+ * @see
+ * com.itmill.toolkit.ui.AbstractComponent#paintContent(com.itmill.toolkit
+ * .terminal.PaintTarget)
*/
public void paintContent(PaintTarget target) throws PaintException {
Container.ItemSetChangeListener {
/**
- * Item caption mode: Item's ID's <code>String</code> representation is
- * used as caption.
+ * Item caption mode: Item's ID's <code>String</code> representation is used
+ * as caption.
*/
public static final int ITEM_CAPTION_MODE_ID = 0;
/**
* entered value. The value is matched to the item caption.
* <code>FILTERINGMODE_OFF</code> (0) turns the filtering off.
* <code>FILTERINGMODE_STARTSWITH</code> (1) matches from the start of the
- * caption. <code>FILTERINGMODE_CONTAINS</code> (1) matches anywhere in
- * the caption.
+ * caption. <code>FILTERINGMODE_CONTAINS</code> (1) matches anywhere in the
+ * caption.
*/
public interface Filtering {
public static final int FILTERINGMODE_OFF = 0;
* Sets the option filtering mode.
*
* @param filteringMode
- * the filtering mode to use
+ * the filtering mode to use
*/
public void setFilteringMode(int filteringMode);
* Creates a new select that is connected to a data-source.
*
* @param caption
- * the Caption of the component.
+ * the Caption of the component.
* @param dataSource
- * the Container datasource to be selected from by this
- * select.
+ * the Container datasource to be selected from by this select.
*/
public AbstractSelect(String caption, Container dataSource) {
setCaption(caption);
* Creates a new select that is filled from a collection of option values.
*
* @param caption
- * the Caption of this field.
+ * the Caption of this field.
* @param options
- * the Collection containing the options.
+ * the Collection containing the options.
*/
public AbstractSelect(String caption, Collection options) {
* Paints the content of this component.
*
* @param target
- * the Paint Event.
+ * the Paint Event.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
/**
* Returns the type of the property. <code>getValue</code> and
- * <code>setValue</code> methods must be compatible with this type: one
- * can safely cast <code>getValue</code> to given type and pass any
- * variable assignable to this type as a parameter to <code>setValue</code>.
+ * <code>setValue</code> methods must be compatible with this type: one can
+ * safely cast <code>getValue</code> to given type and pass any variable
+ * assignable to this type as a parameter to <code>setValue</code>.
*
* @return the Type of the property.
*/
* </p>
*
* @param newValue
- * the New selected item or collection of selected items.
+ * the New selected item or collection of selected items.
* @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object)
*/
public void setValue(Object newValue) throws Property.ReadOnlyException,
* </p>
*
* @param newValue
- * the New selected item or collection of selected items.
+ * the New selected item or collection of selected items.
* @param repaintIsNotNeeded
- * True if caller is sure that repaint is not needed.
+ * True if caller is sure that repaint is not needed.
* @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object,
* java.lang.Boolean)
*/
* contain the requested item, null is returned.
*
* @param itemId
- * the item id.
+ * the item id.
* @return the item from the container.
*/
public Item getItem(Object itemId) {
* Gets the property type.
*
* @param propertyId
- * the Id identifying the property.
+ * the Id identifying the property.
* @see com.itmill.toolkit.data.Container#getType(java.lang.Object)
*/
public Class getType(Object propertyId) {
* Tests, if the collection contains an item with given id.
*
* @param itemId
- * the Id the of item to be tested.
+ * the Id the of item to be tested.
*/
public boolean containsId(Object itemId) {
if (itemId != null) {
* returns null.
*
* @param itemId
- * the Identification of the item to be created.
+ * the Identification of the item to be created.
* @return the Created item with the given id, or null in case of failure.
* @see com.itmill.toolkit.data.Container#addItem(java.lang.Object)
*/
* Sets the container as data-source for viewing.
*
* @param newDataSource
- * the new data source.
+ * the new data source.
*/
public void setContainerDataSource(Container newDataSource) {
if (newDataSource == null) {
* selected items, only one of the selected items is kept as selected.
*
* @param multiSelect
- * the New value of property multiSelect.
+ * the New value of property multiSelect.
*/
public void setMultiSelect(boolean multiSelect) {
if (multiSelect && getNullSelectionItemId() != null) {
* Enables or disables possibility to add new options by the user.
*
* @param allowNewOptions
- * the New value of property allowNewOptions.
+ * the New value of property allowNewOptions.
*/
public void setNewItemsAllowed(boolean allowNewOptions) {
* item and index captions.
*
* @param itemId
- * the id of the item to be recaptioned.
+ * the id of the item to be recaptioned.
* @param caption
- * the New caption.
+ * the New caption.
*/
public void setItemCaption(Object itemId, String caption) {
if (itemId != null) {
* details.
*
* @param itemId
- * the id of the item to be queried.
+ * the id of the item to be queried.
* @return the caption for specified item.
*/
public String getItemCaption(Object itemId) {
* Sets the icon for an item.
*
* @param itemId
- * the id of the item to be assigned an icon.
+ * the id of the item to be assigned an icon.
* @param icon
- * the New icon.
+ * the New icon.
*/
public void setItemIcon(Object itemId, Resource icon) {
if (itemId != null) {
* Gets the item icon.
*
* @param itemId
- * the id of the item to be assigned an icon.
+ * the id of the item to be assigned an icon.
* @return the Icon for the item or null, if not specified.
*/
public Resource getItemIcon(Object itemId) {
* <code>toString</code> is used as item caption.</li>
* <li><code>ITEM_CAPTION_MODE_ITEM</code> : Item-objects
* <code>toString</code> is used as item caption.</li>
- * <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is
- * used as item caption. The index mode can only be used with the containers
+ * <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is used
+ * as item caption. The index mode can only be used with the containers
* implementing <code>Container.Indexed</code> interface.</li>
- * <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must
- * be explicitly specified.</li>
- * <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are
- * read from property, that must be specified with
+ * <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must be
+ * explicitly specified.</li>
+ * <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are read
+ * from property, that must be specified with
* <code>setItemCaptionPropertyId</code>.</li>
* </ul>
* The <code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> is the default
* </p>
*
* @param mode
- * the One of the modes listed above.
+ * the One of the modes listed above.
*/
public void setItemCaptionMode(int mode) {
if (ITEM_CAPTION_MODE_ID <= mode && mode <= ITEM_CAPTION_MODE_PROPERTY) {
* <code>toString</code> is used as item caption.</li>
* <li><code>ITEM_CAPTION_MODE_ITEM</code> : Item-objects
* <code>toString</code> is used as item caption.</li>
- * <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is
- * used as item caption. The index mode can only be used with the containers
+ * <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is used
+ * as item caption. The index mode can only be used with the containers
* implementing <code>Container.Indexed</code> interface.</li>
- * <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must
- * be explicitly specified.</li>
- * <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are
- * read from property, that must be specified with
+ * <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must be
+ * explicitly specified.</li>
+ * <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are read
+ * from property, that must be specified with
* <code>setItemCaptionPropertyId</code>.</li>
* </ul>
* The <code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> is the default
* <p>
* Setting the id to a existing property implicitly sets the item caption
* mode to <code>ITEM_CAPTION_MODE_PROPERTY</code>. If the object is in
- * <code>ITEM_CAPTION_MODE_PROPERTY</code> mode, setting caption property
- * id null resets the item caption mode to
+ * <code>ITEM_CAPTION_MODE_PROPERTY</code> mode, setting caption property id
+ * null resets the item caption mode to
* <code>ITEM_CAPTION_EXPLICIT_DEFAULTS_ID</code>.
* </p>
*
* <p>
* Setting the property id to null disables this feature. The id is null by
* default
- * </p> .
+ * </p>
+ * .
*
* @param propertyId
- * the id of the property.
+ * the id of the property.
*
*/
public void setItemCaptionPropertyId(Object propertyId) {
* </p>
*
* <p>
- * Note : The icons set with <code>setItemIcon</code> function override
- * the icons from the property.
+ * Note : The icons set with <code>setItemIcon</code> function override the
+ * icons from the property.
* </p>
*
* <p>
* Setting the property id to null disables this feature. The id is null by
* default
- * </p> .
+ * </p>
+ * .
*
* @param propertyId
- * the Id of the property that specifies icons for items.
+ * the Id of the property that specifies icons for items.
*/
public void setItemIconPropertyId(Object propertyId) {
if ((propertyId != null)
* </p>
*
* <p>
- * Note : The icons set with <code>setItemIcon</code> function override
- * the icons from the property.
+ * Note : The icons set with <code>setItemIcon</code> function override the
+ * icons from the property.
* </p>
*
* <p>
* Setting the property id to null disables this feature. The id is null by
* default
- * </p> .
+ * </p>
+ * .
*
* @return the Id of the property containing the item icons.
*/
* </p>
*
* @param itemId
- * the Id the of the item to be tested.
+ * the Id the of the item to be tested.
* @see #getNullSelectionItemId()
* @see #setNullSelectionItemId(Object)
*
* </p>
*
* @param itemId
- * the tem to be selected.
+ * the tem to be selected.
* @see #getNullSelectionItemId()
* @see #setNullSelectionItemId(Object)
*
* Unselects an item.
*
* @param itemId
- * the Item to be unselected.
+ * the Item to be unselected.
* @see #getNullSelectionItemId()
* @see #setNullSelectionItemId(Object)
*
/**
* Allow of disallow empty selection. If the select is in single-select
* mode, you can make an item represent the empty selection by calling
- * <code>setNullSelectionItemId()</code>. This way you can for instance
- * set an icon and caption for the null selection item.
+ * <code>setNullSelectionItemId()</code>. This way you can for instance set
+ * an icon and caption for the null selection item.
*
* @param nullSelectionAllowed
- * whether or not to allow empty selection
+ * whether or not to allow empty selection
* @see #setNullSelectionItemId(Object)
* @see #isNullSelectionAllowed()
*/
* </p>
*
* @param nullSelectionItemId
- * the nullSelectionItemId to set.
+ * the nullSelectionItemId to set.
* @see #getNullSelectionItemId()
* @see #isSelected(Object)
* @see #select(Object)
package com.itmill.toolkit.ui;
public class Accordion extends TabSheet {
-
+
public String getTag() {
return "accordion";
}
*
*
* @param type
- * the type of data presented in field.
+ * the type of data presented in field.
* @param uiContext
- * the context where the Field is presented.
+ * the context where the Field is presented.
*
* @see com.itmill.toolkit.ui.FieldFactory#createField(Class, Component)
*/
* Creates a new switch button with a caption and a set initial state.
*
* @param caption
- * the caption of the switch button
+ * the caption of the switch button
* @param initialState
- * the initial state of the switch button
+ * the initial state of the switch button
*/
public CheckBox(String caption, boolean initialState) {
setCaption(caption);
* Creates a new switch button with a caption and a click listener.
*
* @param caption
- * the caption of the switch button
+ * the caption of the switch button
* @param listener
- * the click listener
+ * the click listener
*/
public CheckBox(String caption, ClickListener listener) {
setCaption(caption);
* Button.ClickEvent type.
*
* @param caption
- * the Button caption.
+ * the Button caption.
* @param target
- * the Object having the method for listening button clicks.
+ * the Object having the method for listening button clicks.
* @param methodName
- * the name of the method in target object, that receives
- * button click events.
+ * the name of the method in target object, that receives button
+ * click events.
*/
public CheckBox(String caption, Object target, String methodName) {
setCaption(caption);
* Creates a new switch button that is connected to a boolean property.
*
* @param state
- * the Initial state of the switch-button.
+ * the Initial state of the switch-button.
* @param dataSource
*/
public CheckBox(String caption, Property dataSource) {
* default.
*
* @param caption
- * the Button caption.
+ * the Button caption.
*/
public CheckBox(String caption) {
/**
* Sets and replaces all previous style names of the component. This method
* will trigger a
- * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
+ * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent
+ * RepaintRequestEvent}.
*
* @param style
- * the new style of the component.
+ * the new style of the component.
*/
public void setStyleName(String style);
* classes as given on server side.
*
* This method will trigger a
- * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
+ * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent
+ * RepaintRequestEvent}.
*
* @param style
- * the new style to be added to the component
+ * the new style to be added to the component
*/
public void addStyleName(String style);
* Removes given style name from component.
*
* @param style
- * the style to be removed
+ * the style to be removed
*/
public void removeStyleName(String style);
* Components should be enabled by default.
* </p>
*
- * @return <code>true</code> if the component is enabled,
- * <code>false</code> if not.
+ * @return <code>true</code> if the component is enabled, <code>false</code>
+ * if not.
* @see VariableOwner#isEnabled()
*/
public boolean isEnabled();
/**
* Enables or disables the component. Being enabled means that the component
* can be edited. This method will trigger a
- * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
+ * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent
+ * RepaintRequestEvent}.
*
* @param enabled
- * the boolean value specifying if the component should be
- * enabled after the call or not
+ * the boolean value specifying if the component should be
+ * enabled after the call or not
*/
public void setEnabled(boolean enabled);
* component is shown in the UI or not.
*
* @param visible
- * the Boolean value specifying if the component should be
- * visible after the call or not.
+ * the Boolean value specifying if the component should be
+ * visible after the call or not.
*/
public void setVisible(boolean visible);
* <p>
* This method calls automatically {@link #attach()} if the parent is
* attached to a window (or is itself a window}, and {@link #detach()} if
- * <code>parent</code> is set <code>null</code>, but the component was
- * in the application.
+ * <code>parent</code> is set <code>null</code>, but the component was in
+ * the application.
* </p>
*
* <p>
* components to container, which call this method implicitly.
*
* @param parent
- * the new parent component.
+ * the new parent component.
*/
public void setParent(Component parent);
/**
* Sets the component's to read-only mode to the specified state. This
* method will trigger a
- * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
+ * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent
+ * RepaintRequestEvent}.
*
* @param readOnly
- * the boolean value specifying if the component should be in
- * read-only mode after the call or not.
+ * the boolean value specifying if the component should be in
+ * read-only mode after the call or not.
*/
public void setReadOnly(boolean readOnly);
public String getCaption();
/**
- * Sets the component's caption <code>String</code>. Caption is the
- * visible name of the component. This method will trigger a
- * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
+ * Sets the component's caption <code>String</code>. Caption is the visible
+ * name of the component. This method will trigger a
+ * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent
+ * RepaintRequestEvent}.
*
* @param caption
- * the new caption <code>String</code> for the component.
+ * the new caption <code>String</code> for the component.
*/
public void setCaption(String caption);
/**
* Sets the component's icon. This method will trigger a
- * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
+ * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent
+ * RepaintRequestEvent}.
*
* @param icon
- * the icon to be shown with the component's caption.
+ * the icon to be shown with the component's caption.
*/
public void setIcon(Resource icon);
* Notifies the component that it is connected to an application. This
* method is always called before the component is first time painted and is
* suitable to be extended. The <code>getApplication</code> and
- * <code>getWindow</code> methods might return <code>null</code> before
- * this method is called.
+ * <code>getWindow</code> methods might return <code>null</code> before this
+ * method is called.
* </p>
*
* <p>
* themselves.
*
* @param alreadyNotified
- * the collection of repaint request listeners that have been
- * already notified by the child. This component should not
- * renotify the listed listeners again. The container given
- * as parameter must be modifiable as the component might
- * modify it and pass it forwards. Null parameter is
- * interpreted as empty collection.
+ * the collection of repaint request listeners that have been
+ * already notified by the child. This component should not
+ * renotify the listed listeners again. The container given as
+ * parameter must be modifiable as the component might modify it
+ * and pass it forwards. Null parameter is interpreted as empty
+ * collection.
*/
public void childRequestedRepaint(Collection alreadyNotified);
- /* Component event framework *************************************** */
+ /* Component event framework */
/**
* Superclass of all component originated <code>Event</code>s.
* Constructs a new event with a specified source component.
*
* @param source
- * the source component of the event.
+ * the source component of the event.
*/
public Event(Component source) {
super(source);
* Notifies the listener of a component event.
*
* @param event
- * the event that has occured.
+ * the event that has occured.
*/
public void componentEvent(Component.Event event);
}
* Registers a new component event listener for this component.
*
* @param listener
- * the new Listener to be registered.
+ * the new Listener to be registered.
*/
public void addListener(Component.Listener listener);
* component.
*
* @param listener
- * the listener to be removed.
+ * the listener to be removed.
*/
public void removeListener(Component.Listener listener);
* Constructs a new event with a specified source component.
*
* @param message
- * the error message.
+ * the error message.
* @param component
- * the source component.
+ * the source component.
*/
public ErrorEvent(ErrorMessage message, Component component) {
super(component);
* Notifies the listener of a component error.
*
* @param event
- * the event that has occured.
+ * the event that has occured.
*/
public void componentError(Component.ErrorEvent event);
}
* specify the natural tab order of fields.
*
* @param tabIndex
- * the tab order of this component. Indexes usually start
- * from 1. Negative value means that field is not wanted
- * to tabbing sequence.
+ * the tab order of this component. Indexes usually start
+ * from 1. Negative value means that field is not wanted to
+ * tabbing sequence.
*/
public void setTabIndex(int tabIndex);
* Adds the component into this container.
*
* @param c
- * the component to be added.
+ * the component to be added.
*/
public void addComponent(Component c);
* Removes the component from this container.
*
* @param c
- * the component to be added.
+ * the component to be added.
*/
public void removeComponent(Component c);
* </p>
*
* @param oldComponent
- * the old component that will be replaced.
+ * the old component that will be replaced.
* @param newComponent
- * the new component to be replaced.
+ * the new component to be replaced.
*/
public void replaceComponent(Component oldComponent, Component newComponent);
* components are removed from <code>source</code>.
*
* @param source
- * the container which contains the components that are to be
- * moved to this container.
+ * the container which contains the components that are to be
+ * moved to this container.
*/
public void moveComponentsFrom(ComponentContainer source);
* Listens the component attach events.
*
* @param listener
- * the listener to add.
+ * the listener to add.
*/
public void addListener(ComponentAttachListener listener);
* Stops the listening component attach events.
*
* @param listener
- * the listener to removed.
+ * the listener to removed.
*/
public void removeListener(ComponentAttachListener listener);
* A new component is attached to container.
*
* @param event
- * the component attach event.
+ * the component attach event.
*/
public void componentAttachedToContainer(ComponentAttachEvent event);
}
* A component has been detached from container.
*
* @param event
- * the component detach event.
+ * the component detach event.
*/
public void componentDetachedFromContainer(ComponentDetachEvent event);
}
* Creates a new attach event.
*
* @param container
- * the component container the component has been
- * detached to.
+ * the component container the component has been detached
+ * to.
* @param attachedComponent
- * the component that has been attached.
+ * the component that has been attached.
*/
public ComponentAttachEvent(ComponentContainer container,
Component attachedComponent) {
* Gets the component container.
*
* @param the
- * component container.
+ * component container.
*/
public ComponentContainer getContainer() {
return (ComponentContainer) getSource();
* Gets the attached component.
*
* @param the
- * attach component.
+ * attach component.
*/
public Component getAttachedComponent() {
return component;
* Creates a new detach event.
*
* @param container
- * the component container the component has been
- * detached from.
+ * the component container the component has been detached
+ * from.
* @param detachedComponent
- * the component that has been detached.
+ * the component that has been detached.
*/
public ComponentDetachEvent(ComponentContainer container,
Component detachedComponent) {
* Gets the component container.
*
* @param the
- * component container.
+ * component container.
*/
public ComponentContainer getContainer() {
return (ComponentContainer) getSource();
* </p>
*
* @param compositionRoot
- * the root of the composition component tree.
+ * the root of the composition component tree.
*/
public CustomComponent(Component compositionRoot) {
setCompositionRoot(compositionRoot);
* </p>
*
* @param compositionRoot
- * the root of the composition component tree.
+ * the root of the composition component tree.
*/
protected final void setCompositionRoot(Component compositionRoot) {
if (compositionRoot != root) {
* the UIDL as component tag attribute.
*
* @param componentType
- * the componentType to set.
+ * the componentType to set.
*/
public void setComponentType(String componentType) {
this.componentType = componentType;
* compatible with <code>java.util.Date</code>.
* </p>
* <p>
- * Since <code>DateField</code> extends <code>AbstractField</code> it
- * implements the {@link com.itmill.toolkit.data.Buffered}interface. A
+ * Since <code>DateField</code> extends <code>AbstractField</code> it implements
+ * the {@link com.itmill.toolkit.data.Buffered}interface. A
* <code>DateField</code> is in write-through mode by default, so
* {@link com.itmill.toolkit.ui.AbstractField#setWriteThrough(boolean)}must be
* called to enable buffering.
*/
public class DateField extends AbstractField {
- /* Private members ************************************************* */
+ /* Private members */
/**
* Resolution identifier: milliseconds.
*/
private Calendar calendar;
- /* Constructors **************************************************** */
+ /* Constructors */
/**
* Constructs an empty <code>DateField</code> with no caption.
* Constructs an empty <code>DateField</code> with caption.
*
* @param caption
- * the caption of the datefield.
+ * the caption of the datefield.
*/
public DateField(String caption) {
setCaption(caption);
* <code>Property</code> and has the given caption <code>String</code>.
*
* @param caption
- * the caption <code>String</code> for the editor.
+ * the caption <code>String</code> for the editor.
* @param dataSource
- * the Property to be edited with this editor.
+ * the Property to be edited with this editor.
*/
public DateField(String caption, Property dataSource) {
this(dataSource);
* <code>Property</code> and has no caption.
*
* @param dataSource
- * the Property to be edited with this editor.
+ * the Property to be edited with this editor.
*/
public DateField(Property dataSource) throws IllegalArgumentException {
if (!Date.class.isAssignableFrom(dataSource.getType())) {
* is called to bind it.
*
* @param caption
- * the caption <code>String</code> for the editor.
+ * the caption <code>String</code> for the editor.
* @param value
- * the Date value.
+ * the Date value.
*/
public DateField(String caption, Date value) {
setValue(value);
setCaption(caption);
}
- /* Component basic features ********************************************* */
+ /* Component basic features */
/*
* Paints this component. Don't add a JavaDoc comment here, we use the
* interface.
*/
public void changeVariables(Object source, Map variables) {
- super.changeVariables(source, variables);
+ super.changeVariables(source, variables);
if (!isReadOnly()
&& (variables.containsKey("year")
}
}
- /* Property features **************************************************** */
+ /* Property features */
/*
* Gets the edited property's type. Don't add a JavaDoc comment here, we use
* Sets the resolution of the DateField.
*
* @param resolution
- * the resolution to set.
+ * the resolution to set.
*/
public void setResolution(int resolution) {
this.resolution = resolution;
*
* @param caption
* @param source
- * the Source of the embedded object.
+ * the Source of the embedded object.
*/
public Embedded(String caption, Resource source) {
setCaption(caption);
* parameter.
*
* @param name
- * the name of the parameter.
+ * the name of the parameter.
* @param value
- * the value of the parameter.
+ * the value of the parameter.
*/
public void setParameter(String name, String value) {
parameters.put(name, value);
* Removes an object parameter from the list.
*
* @param name
- * the name of the parameter to remove.
+ * the name of the parameter to remove.
*/
public void removeParameter(String name) {
parameters.remove(name);
* paths.
*
* @param codebase
- * the codebase to set.
+ * the codebase to set.
*/
public void setCodebase(String codebase) {
if (codebase != this.codebase
* Sets the codetype, the MIME-Type of the code.
*
* @param codetype
- * the codetype to set.
+ * the codetype to set.
*/
public void setCodetype(String codetype) {
if (codetype != this.codetype
* Sets the mimeType, the MIME-Type of the object.
*
* @param mimeType
- * the mimeType to set.
+ * the mimeType to set.
*/
public void setMimeType(String mimeType) {
if (mimeType != this.mimeType
* Sets the standby, the text to display while loading the object.
*
* @param standby
- * the standby to set.
+ * the standby to set.
*/
public void setStandby(String standby) {
if (standby != this.standby
* Sets the classId attribute.
*
* @param classId
- * the classId to set.
+ * the classId to set.
*/
public void setClassId(String classId) {
if (classId != this.classId
* The type is guessed from resource.
*
* @param source
- * the source to set.
+ * the source to set.
*/
public void setSource(Resource source) {
if (source != null && !source.equals(this.source)) {
* </p>
*
* @param type
- * the type to set.
+ * the type to set.
*/
public void setType(int type) {
if (type != TYPE_OBJECT && type != TYPE_IMAGE && type != TYPE_BROWSER) {
* Sets the archive attribute.
*
* @param archive
- * the archive string to set.
+ * the archive string to set.
*/
public void setArchive(String archive) {
if (archive != this.archive
/**
* @param c
- * Component which container will be maximized
+ * Component which container will be maximized
*/
public void expand(Component c) {
expanded = c;
* Sets the field required. Required fields must filled by the user.
*
* @param required
- * Is the field required.
+ * Is the field required.
* @since 3.1
*/
public void setRequired(boolean required);
* @since 5.2.6
*/
public String getRequiredError();
-
+
/**
* An <code>Event</code> object specifying the Field whose value has been
* changed.
* Constructs a new event object with the specified source field object.
*
* @param source
- * the field that caused the event.
+ * the field that caused the event.
*/
public ValueChangeEvent(Field source) {
super(source);
* Creates a field based on type of data.
*
* @param type
- * the type of data presented in field.
+ * the type of data presented in field.
* @param uiContext
- * the component where the field is presented.
+ * the component where the field is presented.
* @return Field the field suitable for editing the specified data.
*
*/
* Creates a field based on the property datasource.
*
* @param property
- * the property datasource.
+ * the property datasource.
* @param uiContext
- * the component where the field is presented.
+ * the component where the field is presented.
* @return Field the field suitable for editing the specified data.
*/
Field createField(Property property, Component uiContext);
* Creates a field based on the item and property id.
*
* @param item
- * the item where the property belongs to.
+ * the item where the property belongs to.
* @param propertyId
- * the Id of the property.
+ * the Id of the property.
* @param uiContext
- * the component where the field is presented.
+ * the component where the field is presented.
* @return Field the field suitable for editing the specified data.
*/
Field createField(Item item, Object propertyId, Component uiContext);
* Creates a field based on the container item id and property id.
*
* @param container
- * the Container where the property belongs to.
+ * the Container where the property belongs to.
* @param itemId
- * the item Id.
+ * the item Id.
* @param propertyId
- * the Id of the property.
+ * the Id of the property.
* @param uiContext
- * the component where the field is presented.
+ * the component where the field is presented.
* @return Field the field suitable for editing the specified data.
*/
Field createField(Container container, Object itemId, Object propertyId,
* is calculated as a bit mask of the two passed values.
*
* @param childComponent
- * the component to align within it's layout cell.
+ * the component to align within it's layout cell.
* @param horizontalAlignment
- * the horizontal alignment for the child component
- * (left, center, right). Use ALIGNMENT constants.
+ * 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.
+ * the vertical alignment for the child component (top,
+ * center, bottom). Use ALIGNMENT constants.
*/
public void setComponentAlignment(Component childComponent,
int horizontalAlignment, int verticalAlignment);
*
*
* @param caption
- * the Link text.
+ * the Link text.
* @param targetName
- * the name of the target window where the link opens to.
- * Empty name of null implies that the target is opened to
- * the window containing the link.
+ * the name of the target window where the link opens to. Empty
+ * name of null implies that the target is opened to the window
+ * containing the link.
* @param width
- * the Width of the target window.
+ * the Width of the target window.
* @param height
- * the Height of the target window.
+ * the Height of the target window.
* @param border
- * the Border style of the target window.
+ * the Border style of the target window.
*
*/
public Link(String caption, Resource resource, String targetName,
* Paints the content of this component.
*
* @param target
- * the Paint Event.
+ * the Paint Event.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
* Sets the border of the target window.
*
* @param targetBorder
- * the targetBorder to set.
+ * the targetBorder to set.
*/
public void setTargetBorder(int targetBorder) {
if (targetBorder == TARGET_BORDER_DEFAULT
* Sets the target window height.
*
* @param targetHeight
- * the targetHeight to set.
+ * the targetHeight to set.
*/
public void setTargetHeight(int targetHeight) {
this.targetHeight = targetHeight;
* Sets the target window name.
*
* @param targetName
- * the targetName to set.
+ * the targetName to set.
*/
public void setTargetName(String targetName) {
this.targetName = targetName;
* Sets the target window width.
*
* @param targetWidth
- * the targetWidth to set.
+ * the targetWidth to set.
*/
public void setTargetWidth(int targetWidth) {
this.targetWidth = targetWidth;
* Sets the resource this link opens.
*
* @param resource
- * the resource to set.
+ * the resource to set.
*/
public void setResource(Resource resource) {
this.resource = resource;
* adapter.
*
* @param columns
- * the number of columns to set.
+ * the number of columns to set.
*/
public void setColumns(int columns) {
if (columns < 0) {
* adapter.
*
* @param rows
- * the number of rows to set.
+ * the number of rows to set.
*/
public void setRows(int rows) {
if (rows < 0) {
* adapter.
*
* @param columns
- * the number of columns to set.
+ * the number of columns to set.
*/
public void setColumns(int columns) {
if (columns < 0) {
public class OrderedLayout extends AbstractLayout implements
Layout.AlignmentHandler, Layout.SpacingHandler {
- /* Predefined orientations ***************************************** */
+ /* Predefined orientations */
/**
* Components are to be laid out vertically.
*/
protected LinkedList components = new LinkedList();
- /* Child component alignments ************************************** */
+ /* Child component alignments */
/**
* Mapping from components to alignments (horizontal + vertical).
* parameters.
*
* @param orientation
- * the Orientation of the layout.
+ * the Orientation of the layout.
*/
public OrderedLayout(int orientation) {
this.orientation = orientation;
* or under the previous component.
*
* @param c
- * the component to be added.
+ * the component to be added.
*/
public void addComponent(Component c) {
super.addComponent(c);
* or on top of the other components.
*
* @param c
- * the component to be added.
+ * the component to be added.
*/
public void addComponentAsFirst(Component c) {
super.addComponent(c);
* Adds a component into indexed position in this container.
*
* @param c
- * the component to be added.
+ * the component to be added.
* @param index
- * the Index of the component position. The components
- * currently in and after the position are shifted forwards.
+ * the Index of the component position. The components currently
+ * in and after the position are shifted forwards.
*/
public void addComponent(Component c, int index) {
super.addComponent(c);
* Removes the component from this container.
*
* @param c
- * the component to be removed.
+ * the component to be removed.
*/
public void removeComponent(Component c) {
super.removeComponent(c);
* Paints the content of this component.
*
* @param target
- * the Paint Event.
+ * the Paint Event.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
* Set the orientation of the container.
*
* @param orientation
- * the New value of property orientation.
+ * the New value of property orientation.
*/
public void setOrientation(int orientation) {
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.ui.Layout.AlignmentHandler#setComponentAlignment(com.itmill.toolkit.ui.Component,
- * int, int)
+ * @see
+ * com.itmill.toolkit.ui.Layout.AlignmentHandler#setComponentAlignment(com
+ * .itmill.toolkit.ui.Component, int, int)
*/
public void setComponentAlignment(Component childComponent,
int horizontalAlignment, int verticalAlignment) {
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.ui.Layout.AlignmentHandler#getComponentAlignment(com.itmill.toolkit.ui.Component)
+ * @see
+ * com.itmill.toolkit.ui.Layout.AlignmentHandler#getComponentAlignment(com
+ * .itmill.toolkit.ui.Component)
*/
public int getComponentAlignment(Component childComponent) {
final Integer bitMask = (Integer) componentToAlignment
* Creates a new empty panel with given layout. Layout must be non-null.
*
* @param layout
- * the layout used in the panel.
+ * the layout used in the panel.
*/
public Panel(Layout layout) {
setLayout(layout);
* Creates a new empty panel with caption. Default layout is used.
*
* @param caption
- * the caption used in the panel.
+ * the caption used in the panel.
*/
public Panel(String caption) {
this(caption, null);
* Creates a new empty panel with caption.
*
* @param caption
- * the caption of the panel.
+ * the caption of the panel.
* @param layout
- * the layout used in the panel.
+ * the layout used in the panel.
*/
public Panel(String caption, Layout layout) {
this(layout);
* (changed in 5.2.2). Use function in Layout interface manually.
*
* @param newLayout
- * the New layout of the panel.
+ * the New layout of the panel.
*/
public void setLayout(Layout newLayout) {
* Paints the content of this component.
*
* @param target
- * the Paint Event.
+ * the Paint Event.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
layout.paint(target);
* Adds the component into this container.
*
* @param c
- * the component to be added.
+ * the component to be added.
* @see com.itmill.toolkit.ui.AbstractComponentContainer#addComponent(com.itmill.toolkit.ui.Component)
*/
public void addComponent(Component c) {
* Removes the component from this container.
*
* @param c
- * The component to be added.
+ * The component to be added.
* @see com.itmill.toolkit.ui.AbstractComponentContainer#removeComponent(com.itmill.toolkit.ui.Component)
*/
public void removeComponent(Component c) {
* ProgressIndicator.
*
* @param readOnly
- * True to enable read-only mode, False to disable it.
+ * True to enable read-only mode, False to disable it.
*/
public void setReadOnly(boolean readOnly) {
if (dataSource == null) {
* Paints the content of this component.
*
* @param target
- * the Paint Event.
+ * the Paint Event.
* @throws PaintException
- * if the Paint Operation fails.
+ * if the Paint Operation fails.
*/
public void paintContent(PaintTarget target) throws PaintException {
target.addAttribute("indeterminate", indeterminate);
* is the Float between 0 and 1.
*
* @param newValue
- * the New value of the ProgressIndicator.
+ * the New value of the ProgressIndicator.
* @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object)
*/
public void setValue(Object newValue) {
* Sets the property as data-source for viewing.
*
* @param newDataSource
- * the new data source.
+ * the new data source.
* @see com.itmill.toolkit.ui.AbstractField#setPropertyDataSource(com.itmill.toolkit.data.Property)
*/
public void setPropertyDataSource(Property newDataSource) {
* Sets wheter or not the ProgressIndicator is indeterminate.
*
* @param newValue
- * true to set to indeterminate mode.
+ * true to set to indeterminate mode.
*/
public void setIndeterminate(boolean newValue) {
indeterminate = newValue;
* Sets the interval that component checks for progress.
*
* @param newValue
- * the interval in milliseconds.
+ * the interval in milliseconds.
*/
public void setPollingInterval(int newValue) {
pollingInterval = newValue;
*/
private boolean optionRequest;
- /* Constructors ********************************************************* */
+ /* Constructors */
- /* Component methods **************************************************** */
+ /* Component methods */
public Select() {
super();
* Paints the content of this component.
*
* @param target
- * the Paint Event.
+ * the Paint Event.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
if (isMultiSelect()) {
*
* @param options
* @param needNullSelectOption
- * flag to indicate if nullselect option needs to be taken
- * into consideration
+ * flag to indicate if nullselect option needs to be taken into
+ * consideration
*/
private List sanitetizeList(List options, boolean needNullSelectOption) {
* @deprecated
*
* @param columns
- * the number of columns to set.
+ * the number of columns to set.
*/
public void setColumns(int columns) {
if (columns < 0) {
*/
public class SplitPanel extends AbstractLayout {
- /* Predefined orientations ***************************************** */
+ /* Predefined orientations */
/**
* Components are to be layed out vertically.
* parameters.
*
* @param orientation
- * the Orientation of the layout.
+ * the Orientation of the layout.
*/
public SplitPanel(int orientation) {
this();
* or under the previous component.
*
* @param c
- * the component to be added.
+ * the component to be added.
*/
public void addComponent(Component c) {
if (firstComponent == null) {
* Removes the component from this container.
*
* @param c
- * the component to be removed.
+ * the component to be removed.
*/
public void removeComponent(Component c) {
super.removeComponent(c);
* Paints the content of this component.
*
* @param target
- * the Paint Event.
+ * the Paint Event.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
* Set the orientation of the container.
*
* @param orientation
- * the New value of property orientation.
+ * the New value of property orientation.
*/
public void setOrientation(int orientation) {
* Moves the position of the splitter.
*
* @param pos
- * the new size of the first region in persentage
+ * the new size of the first region in persentage
*/
public void setSplitPosition(int pos) {
setSplitPosition(pos, UNITS_PERCENTAGE);
* Moves the position of the splitter with given position and unit.
*
* @param pos
- * size of the first region
+ * size of the first region
* @param unit
- * the unit (from {@link Size}) in which the size is given.
+ * the unit (from {@link Size}) in which the size is given.
*/
public void setSplitPosition(int pos, int unit) {
this.pos = pos;
* handle.
*
* @param locked
- * Set <code>true</code> if locked, <code>false</code>
- * otherwise.
+ * Set <code>true</code> if locked, <code>false</code> otherwise.
*/
public void setLocked(boolean locked) {
this.locked = locked;
* </p>
*
* @param visibleColumns
- * the Array of shown property id:s.
+ * the Array of shown property id:s.
*/
public void setVisibleColumns(Object[] visibleColumns) {
* </p>
*
* @param columnHeaders
- * the Array of column headers that match the
- * <code>getVisibleColumns</code> method.
+ * the Array of column headers that match the
+ * <code>getVisibleColumns</code> method.
*/
public void setColumnHeaders(String[] columnHeaders) {
* </p>
*
* @param columnIcons
- * the Array of icons that match the
- * <code>getVisibleColumns</code>.
+ * the Array of icons that match the
+ * <code>getVisibleColumns</code>.
*/
public void setColumnIcons(Resource[] columnIcons) {
*
* <p>
* The items in the array must match the properties identified by
- * <code>getVisibleColumns()</code>. The possible values for the
- * alignments include:
+ * <code>getVisibleColumns()</code>. The possible values for the alignments
+ * include:
* <ul>
* <li><code>ALIGN_LEFT</code>: Left alignment</li>
* <li><code>ALIGN_CENTER</code>: Centered</li>
*
* <p>
* The items in the array must match the properties identified by
- * <code>getVisibleColumns()</code>. The possible values for the
- * alignments include:
+ * <code>getVisibleColumns()</code>. The possible values for the alignments
+ * include:
* <ul>
* <li><code>ALIGN_LEFT</code>: Left alignment</li>
* <li><code>ALIGN_CENTER</code>: Centered</li>
* </p>
*
* @param columnAlignments
- * the Column alignments array.
+ * the Column alignments array.
*/
public void setColumnAlignments(String[] columnAlignments) {
* will make decision of width.
*
* @param columnId
- * colunmns property id
+ * colunmns property id
* @param width
- * width to be reserved for colunmns content
+ * width to be reserved for colunmns content
* @since 4.0.3
*/
public void setColumnWidth(Object columnId, int width) {
* </p>
*
* @param pageLength
- * the Length of one page.
+ * the Length of one page.
*/
public void setPageLength(int pageLength) {
if (pageLength >= 0 && this.pageLength != pageLength) {
* Setter for property currentPageFirstItemId.
*
* @param currentPageFirstItemId
- * the New value of property currentPageFirstItemId.
+ * the New value of property currentPageFirstItemId.
*/
public void setCurrentPageFirstItemId(Object currentPageFirstItemId) {
* Gets the icon Resource for the specified column.
*
* @param propertyId
- * the propertyId indentifying the column.
+ * the propertyId indentifying the column.
* @return the icon for the specified column; null if the column has no icon
* set, or if the column is not visible.
*/
* </p>
*
* @param propertyId
- * the propertyId identifying the column.
+ * the propertyId identifying the column.
* @param icon
- * the icon Resource to set.
+ * the icon Resource to set.
*/
public void setColumnIcon(Object propertyId, Resource icon) {
* Gets the header for the specified column.
*
* @param propertyId
- * the propertyId indentifying the column.
+ * the propertyId indentifying the column.
* @return the header for the specifed column if it has one.
*/
public String getColumnHeader(Object propertyId) {
* Sets the column header for the specified column;
*
* @param propertyId
- * the propertyId indentifying the column.
+ * the propertyId indentifying the column.
* @param header
- * the header to set.
+ * the header to set.
*/
public void setColumnHeader(Object propertyId, String header) {
* Gets the specified column's alignment.
*
* @param propertyId
- * the propertyID identifying the column.
+ * the propertyID identifying the column.
* @return the specified column's alignment if it as one; null otherwise.
*/
public String getColumnAlignment(Object propertyId) {
* </p>
*
* @param propertyId
- * the propertyID identifying the column.
+ * the propertyID identifying the column.
* @param alignment
- * the desired alignment.
+ * the desired alignment.
*/
public void setColumnAlignment(Object propertyId, String alignment) {
* Checks if the specified column is collapsed.
*
* @param propertyId
- * the propertyID identifying the column.
+ * the propertyID identifying the column.
* @return true if the column is collapsed; false otherwise;
*/
public boolean isColumnCollapsed(Object propertyId) {
*
*
* @param propertyId
- * the propertyID identifying the column.
+ * the propertyID identifying the column.
* @param collapsed
- * the desired collapsedness.
+ * the desired collapsedness.
* @throws IllegalAccessException
*/
public void setColumnCollapsed(Object propertyId, boolean collapsed)
* Sets whether column collapsing is allowed or not.
*
* @param collapsingAllowed
- * specifies whether column collapsing is allowed.
+ * specifies whether column collapsing is allowed.
*/
public void setColumnCollapsingAllowed(boolean collapsingAllowed) {
columnCollapsingAllowed = collapsingAllowed;
* Sets whether column reordering is allowed or not.
*
* @param reorderingAllowed
- * specifies whether column reordering is allowed.
+ * specifies whether column reordering is allowed.
*/
public void setColumnReorderingAllowed(boolean reorderingAllowed) {
columnReorderingAllowed = reorderingAllowed;
* Setter for property currentPageFirstItem.
*
* @param newIndex
- * the New value of property currentPageFirstItem.
+ * the New value of property currentPageFirstItem.
*/
public void setCurrentPageFirstItemIndex(int newIndex) {
setCurrentPageFirstItemIndex(newIndex, true);
* @deprecated functionality is not needed in ajax rendering model
*
* @param pageBuffering
- * the New value of property pageBuffering.
+ * the New value of property pageBuffering.
*/
public void setPageBufferingEnabled(boolean pageBuffering) {
* </p>
*
* @param selectable
- * the New value of property selectable.
+ * the New value of property selectable.
*/
public void setSelectable(boolean selectable) {
if (this.selectable != selectable) {
* Setter for property columnHeaderMode.
*
* @param columnHeaderMode
- * the New value of property columnHeaderMode.
+ * the New value of property columnHeaderMode.
*/
public void setColumnHeaderMode(int columnHeaderMode) {
if (columnHeaderMode >= COLUMN_HEADER_MODE_HIDDEN
* <code>toString()</code> is used as row caption.
* <li><code>ROW_HEADER_MODE_PROPERTY</code>: Property set with
* <code>setItemCaptionPropertyId()</code> is used as row header.
- * <li><code>ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID</code>: Items
- * Id-objects <code>toString()</code> is used as row header. If caption is
- * explicitly specified, it overrides the id-caption.
+ * <li><code>ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID</code>: Items Id-objects
+ * <code>toString()</code> is used as row header. If caption is explicitly
+ * specified, it overrides the id-caption.
* <li><code>ROW_HEADER_MODE_EXPLICIT</code>: The row headers must be
* explicitly specified.</li>
- * <li><code>ROW_HEADER_MODE_INDEX</code>: The index of the item is used
- * as row caption. The index mode can only be used with the containers
+ * <li><code>ROW_HEADER_MODE_INDEX</code>: The index of the item is used as
+ * row caption. The index mode can only be used with the containers
* implementing <code>Container.Indexed</code> interface.</li>
* </ul>
* The default value is <code>ROW_HEADER_MODE_HIDDEN</code>
* </p>
*
* @param mode
- * the One of the modes listed above.
+ * the One of the modes listed above.
*/
public void setRowHeaderMode(int mode) {
if (ROW_HEADER_MODE_HIDDEN == mode) {
* columns) with given values.
*
* @param cells
- * the Object array that is used for filling the visible
- * cells new row. The types must be settable to visible
- * column property types.
+ * the Object array that is used for filling the visible cells
+ * new row. The types must be settable to visible column property
+ * types.
* @param itemId
- * the Id the new row. If null, a new id is automatically
- * assigned. If given, the table cant already have a item
- * with given id.
+ * the Id the new row. If null, a new id is automatically
+ * assigned. If given, the table cant already have a item with
+ * given id.
* @return Returns item id for the new row. Returns null if operation fails.
*/
public Object addItem(Object[] cells, Object itemId)
* Go to mode where content content refreshing has effect.
*
* @param refreshContent
- * true if content refresh needs to be done
+ * true if content refresh needs to be done
*/
protected void enableContentRefreshing(boolean refreshContent) {
isContentRefreshesEnabled = true;
/*
* (non-Javadoc)
*
- * @see com.itmill.toolkit.ui.AbstractSelect#paintContent(com.itmill.toolkit.
- * terminal.PaintTarget)
+ * @see
+ * com.itmill.toolkit.ui.AbstractSelect#paintContent(com.itmill.toolkit.
+ * terminal.PaintTarget)
*/
public void paintContent(PaintTarget target) throws PaintException {
* the value representation.
*
* @param rowId
- * the Id of the row (same as item Id).
+ * the Id of the row (same as item Id).
* @param colId
- * the Id of the column.
+ * the Id of the column.
* @param property
- * the Property to be presented.
+ * the Property to be presented.
* @return Object Either formatted value or Component for field.
* @see #setFieldFactory(FieldFactory)
*/
* and return a empty string for null properties.
*
* @param rowId
- * the Id of the row (same as item Id).
+ * the Id of the row (same as item Id).
* @param colId
- * the Id of the column.
+ * the Id of the column.
* @param property
- * the Property to be formatted.
+ * the Property to be formatted.
* @return the String representation of property and its value.
* @since 3.1
*/
* Adds a new property to the table and show it as a visible column.
*
* @param propertyId
- * the Id of the proprty.
+ * the Id of the proprty.
* @param type
- * the class of the property.
+ * the class of the property.
* @param defaultValue
- * the default value given for all existing items.
+ * the default value given for all existing items.
* @see com.itmill.toolkit.data.Container#addContainerProperty(Object,
* Class, Object)
*/
* Adds a new property to the table and show it as a visible column.
*
* @param propertyId
- * the Id of the proprty
+ * the Id of the proprty
* @param type
- * the class of the property
+ * the class of the property
* @param defaultValue
- * the default value given for all existing items
+ * the default value given for all existing items
* @param columnHeader
- * the Explicit header of the column. If explicit header is
- * not needed, this should be set null.
+ * the Explicit header of the column. If explicit header is not
+ * needed, this should be set null.
* @param columnIcon
- * the Icon of the column. If icon is not needed, this should
- * be set null.
+ * the Icon of the column. If icon is not needed, this should be
+ * set null.
* @param columnAlignment
- * the Alignment of the column. Null implies align left.
+ * the Alignment of the column. Null implies align left.
* @throws UnsupportedOperationException
- * if the operation is not supported.
+ * if the operation is not supported.
* @see com.itmill.toolkit.data.Container#addContainerProperty(Object,
* Class, Object)
*/
* </p>
*
* @param id
- * the id of the column to be added
+ * the id of the column to be added
* @param generatedColumn
- * the {@link ColumnGenerator} to use for this column
+ * the {@link ColumnGenerator} to use for this column
*/
public void addGeneratedColumn(Object id, ColumnGenerator generatedColumn) {
if (generatedColumn == null) {
* Removes a generated column previously added with addGeneratedColumn.
*
* @param id
- * id of the generated column to remove
+ * id of the generated column to remove
* @return true if the column could be removed (existed in the Table)
*/
public boolean removeGeneratedColumn(Object id) {
* Adding new items is not supported.
*
* @throws UnsupportedOperationException
- * if set to true.
+ * if set to true.
* @see com.itmill.toolkit.ui.Select#setNewItemsAllowed(boolean)
*/
public void setNewItemsAllowed(boolean allowNewOptions)
* Focusing to this component is not supported.
*
* @throws UnsupportedOperationException
- * if invoked.
+ * if invoked.
* @see com.itmill.toolkit.ui.AbstractField#focus()
*/
public void focus() throws UnsupportedOperationException {
* BaseFieldFactory is used.
*
* @param fieldFactory
- * the field factory to set.
+ * the field factory to set.
* @see #isEditable
* @see BaseFieldFactory
*
* property to true.
*
* @param editable
- * true if table should be editable by user.
+ * true if table should be editable by user.
* @see Field
* @see FieldFactory
*
* Sorts the table.
*
* @throws UnsupportedOperationException
- * if the container data source does not implement
- * Container.Sortable
+ * if the container data source does not implement
+ * Container.Sortable
* @see com.itmill.toolkit.data.Container.Sortable#sort(java.lang.Object[],
* boolean[])
*
* Sorts the table by currently selected sorting column.
*
* @throws UnsupportedOperationException
- * if the container data source does not implement
- * Container.Sortable
+ * if the container data source does not implement
+ * Container.Sortable
*/
public void sort() {
if (getSortContainerPropertyId() == null) {
* Sets the currently sorted column property id.
*
* @param propertyId
- * the Container property id of the currently sorted column.
+ * the Container property id of the currently sorted column.
*/
public void setSortContainerPropertyId(Object propertyId) {
setSortContainerPropertyId(propertyId, true);
/**
* Is the table currently sorted in ascending order.
*
- * @return <code>true</code> if ascending, <code>false</code> if
- * descending.
+ * @return <code>true</code> if ascending, <code>false</code> if descending.
*/
public boolean isSortAscending() {
return sortAscending;
* Sets the table in ascending order.
*
* @param ascending
- * <code>true</code> if ascending, <code>false</code> if
- * descending.
+ * <code>true</code> if ascending, <code>false</code> if
+ * descending.
*/
public void setSortAscending(boolean ascending) {
setSortAscending(ascending, true);
* columns are given even in the case where datasource would support this.
*
* @param sortDisabled
- * True iff sorting is disabled.
+ * True iff sorting is disabled.
*/
public void setSortDisabled(boolean sortDisabled) {
if (this.sortDisabled != sortDisabled) {
* generated.
*
* @param source
- * the source Table
+ * the source Table
* @param itemId
- * the itemId (aka rowId) for the of the cell to be
- * generated
+ * the itemId (aka rowId) for the of the cell to be generated
* @param columnId
- * the id for the generated column (as specified in
- * addGeneratedColumn)
+ * the id for the generated column (as specified in
+ * addGeneratedColumn)
* @return
*/
public abstract Component generateCell(Table source, Object itemId,
* Set cell style generator for Table.
*
* @param cellStyleGenerator
- * New cell style generator or null to remove generator.
+ * New cell style generator or null to remove generator.
*/
public void setCellStyleGenerator(CellStyleGenerator cellStyleGenerator) {
this.cellStyleGenerator = cellStyleGenerator;
* Called by Table when a cell (and row) is painted.
*
* @param itemId
- * The itemId of the painted cell
+ * The itemId of the painted cell
* @param propertyId
- * The propertyId of the cell, null when getting row
- * style
+ * The propertyId of the cell, null when getting row style
* @return The style name to add to this cell or row. (the CSS class
* name will be i-table-cell-content-[style name], or
* i-table-row-[style name] for rows)
String key = (String) variables.get("clickedKey");
Object id = itemIdMapper.get(key);
- MouseEventDetails details = MouseEventDetails.deSerialize((String) variables
- .get("clickEvent"));
+ MouseEventDetails details = MouseEventDetails
+ .deSerialize((String) variables.get("clickEvent"));
fireEvent(new ItemClickEvent(this, getItem(id), id, null, details));
}
* adapter.
*
* @param columns
- * the number of columns to set.
+ * the number of columns to set.
*/
public void setColumns(int columns) {
if (columns < 0) {
* adapter.
*
* @param rows
- * the number of rows to set.
+ * the number of rows to set.
*/
public void setRows(int rows) {
if (rows < 0) {