aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Laakso <jani.laakso@itmill.com>2007-04-12 14:41:25 +0000
committerJani Laakso <jani.laakso@itmill.com>2007-04-12 14:41:25 +0000
commit544a4770365be51e26b1b8418f2f4226db5bcb15 (patch)
treec5ef61d190d461a3aa789ef8444159f7bd1bd7b3
parentfde5869b30ae8da8ec5d884d3438815e1a63aca1 (diff)
downloadvaadin-framework-544a4770365be51e26b1b8418f2f4226db5bcb15.tar.gz
vaadin-framework-544a4770365be51e26b1b8418f2f4226db5bcb15.zip
Pulled changesets from branches/4.0.0-SRIT into trunk, done by
mohamed.atique@renaissance-it.com. All changes are related to javadocs only. Merge was done beetween revisions 924:1192. svn changeset:1212/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/Application.java279
-rw-r--r--src/com/itmill/toolkit/data/Buffered.java90
-rw-r--r--src/com/itmill/toolkit/data/BufferedValidatable.java20
-rw-r--r--src/com/itmill/toolkit/data/Container.java65
-rw-r--r--src/com/itmill/toolkit/data/Item.java89
-rw-r--r--src/com/itmill/toolkit/data/Property.java161
-rw-r--r--src/com/itmill/toolkit/data/Validatable.java56
-rw-r--r--src/com/itmill/toolkit/data/Validator.java33
-rw-r--r--src/com/itmill/toolkit/data/util/BeanItem.java47
-rw-r--r--src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java132
-rw-r--r--src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java155
-rw-r--r--src/com/itmill/toolkit/data/util/FilesystemContainer.java217
-rw-r--r--src/com/itmill/toolkit/data/util/HierarchicalContainer.java81
-rw-r--r--src/com/itmill/toolkit/data/util/IndexedContainer.java256
-rw-r--r--src/com/itmill/toolkit/data/util/MethodProperty.java308
-rw-r--r--src/com/itmill/toolkit/data/util/ObjectProperty.java125
-rw-r--r--src/com/itmill/toolkit/data/util/PropertysetItem.java66
-rw-r--r--src/com/itmill/toolkit/data/util/QueryContainer.java217
-rw-r--r--src/com/itmill/toolkit/data/validator/CompositeValidator.java85
-rw-r--r--src/com/itmill/toolkit/data/validator/NullValidator.java40
-rw-r--r--src/com/itmill/toolkit/data/validator/StringLengthValidator.java77
-rw-r--r--src/com/itmill/toolkit/event/Action.java76
-rw-r--r--src/com/itmill/toolkit/event/EventRouter.java16
-rw-r--r--src/com/itmill/toolkit/event/ListenerMethod.java233
-rw-r--r--src/com/itmill/toolkit/event/MethodEventSource.java122
-rw-r--r--src/com/itmill/toolkit/service/ApplicationContext.java40
-rw-r--r--src/com/itmill/toolkit/service/FileTypeResolver.java74
-rw-r--r--src/com/itmill/toolkit/service/License.java89
-rw-r--r--src/com/itmill/toolkit/terminal/ApplicationResource.java47
-rw-r--r--src/com/itmill/toolkit/terminal/ClassResource.java82
-rw-r--r--src/com/itmill/toolkit/terminal/CompositeErrorMessage.java50
-rw-r--r--src/com/itmill/toolkit/terminal/DownloadStream.java100
-rw-r--r--src/com/itmill/toolkit/terminal/ErrorMessage.java41
-rw-r--r--src/com/itmill/toolkit/terminal/ExternalResource.java28
-rw-r--r--src/com/itmill/toolkit/terminal/FileResource.java67
-rw-r--r--src/com/itmill/toolkit/terminal/KeyMapper.java38
-rw-r--r--src/com/itmill/toolkit/terminal/PaintException.java11
-rw-r--r--src/com/itmill/toolkit/terminal/PaintTarget.java191
-rw-r--r--src/com/itmill/toolkit/terminal/Paintable.java68
-rw-r--r--src/com/itmill/toolkit/terminal/ParameterHandler.java29
-rw-r--r--src/com/itmill/toolkit/terminal/Resource.java10
-rw-r--r--src/com/itmill/toolkit/terminal/Scrollable.java35
-rw-r--r--src/com/itmill/toolkit/terminal/Sizeable.java110
-rw-r--r--src/com/itmill/toolkit/terminal/StreamResource.java89
-rw-r--r--src/com/itmill/toolkit/terminal/SystemError.java46
-rw-r--r--src/com/itmill/toolkit/terminal/Terminal.java35
-rw-r--r--src/com/itmill/toolkit/terminal/ThemeResource.java33
-rw-r--r--src/com/itmill/toolkit/terminal/URIHandler.java27
-rw-r--r--src/com/itmill/toolkit/terminal/UploadStream.java27
-rw-r--r--src/com/itmill/toolkit/terminal/UserError.java35
-rw-r--r--src/com/itmill/toolkit/terminal/VariableOwner.java70
-rw-r--r--src/com/itmill/toolkit/terminal/web/AjaxApplicationManager.java182
-rw-r--r--src/com/itmill/toolkit/terminal/web/AjaxHttpUploadStream.java49
-rw-r--r--src/com/itmill/toolkit/terminal/web/AjaxPaintTarget.java198
-rw-r--r--src/com/itmill/toolkit/terminal/web/AjaxVariableMap.java155
-rw-r--r--src/com/itmill/toolkit/terminal/web/ApplicationServlet.java453
-rw-r--r--src/com/itmill/toolkit/terminal/web/CollectionThemeSource.java29
-rw-r--r--src/com/itmill/toolkit/terminal/web/DebugWindow.java99
-rw-r--r--src/com/itmill/toolkit/terminal/web/DirectoryThemeSource.java40
-rw-r--r--src/com/itmill/toolkit/terminal/web/HttpUploadStream.java49
-rw-r--r--src/com/itmill/toolkit/terminal/web/HttpVariableMap.java156
-rw-r--r--src/com/itmill/toolkit/terminal/web/JarThemeSource.java67
-rw-r--r--src/com/itmill/toolkit/terminal/web/Log.java48
-rw-r--r--src/com/itmill/toolkit/terminal/web/MultipartRequest.java603
-rw-r--r--src/com/itmill/toolkit/terminal/web/ServletMultipartRequest.java38
-rw-r--r--src/com/itmill/toolkit/terminal/web/ServletThemeSource.java87
-rw-r--r--src/com/itmill/toolkit/terminal/web/Theme.java313
-rw-r--r--src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java127
-rw-r--r--src/com/itmill/toolkit/terminal/web/ThemeSource.java103
-rw-r--r--src/com/itmill/toolkit/terminal/web/UIDLTransformer.java154
-rw-r--r--src/com/itmill/toolkit/terminal/web/UIDLTransformerException.java18
-rw-r--r--src/com/itmill/toolkit/terminal/web/UIDLTransformerFactory.java119
-rw-r--r--src/com/itmill/toolkit/terminal/web/UIDLTransformerType.java46
-rw-r--r--src/com/itmill/toolkit/terminal/web/WebApplicationContext.java87
-rw-r--r--src/com/itmill/toolkit/terminal/web/WebBrowser.java295
-rw-r--r--src/com/itmill/toolkit/terminal/web/WebBrowserProbe.java39
-rw-r--r--src/com/itmill/toolkit/terminal/web/WebPaintTarget.java239
-rw-r--r--src/com/itmill/toolkit/terminal/web/XSLReader.java84
-rw-r--r--src/com/itmill/toolkit/ui/AbstractComponent.java272
-rw-r--r--src/com/itmill/toolkit/ui/AbstractComponentContainer.java38
-rw-r--r--src/com/itmill/toolkit/ui/AbstractField.java219
-rw-r--r--src/com/itmill/toolkit/ui/BaseFieldFactory.java29
-rw-r--r--src/com/itmill/toolkit/ui/Button.java136
-rw-r--r--src/com/itmill/toolkit/ui/Component.java195
-rw-r--r--src/com/itmill/toolkit/ui/ComponentContainer.java112
-rw-r--r--src/com/itmill/toolkit/ui/CustomComponent.java219
-rw-r--r--src/com/itmill/toolkit/ui/CustomLayout.java83
-rw-r--r--src/com/itmill/toolkit/ui/DateField.java97
-rw-r--r--src/com/itmill/toolkit/ui/Embedded.java174
-rw-r--r--src/com/itmill/toolkit/ui/Field.java38
-rw-r--r--src/com/itmill/toolkit/ui/FieldFactory.java48
-rw-r--r--src/com/itmill/toolkit/ui/Form.java260
-rw-r--r--src/com/itmill/toolkit/ui/FrameWindow.java303
-rw-r--r--src/com/itmill/toolkit/ui/GridLayout.java328
-rw-r--r--src/com/itmill/toolkit/ui/Label.java169
-rw-r--r--src/com/itmill/toolkit/ui/Layout.java3
-rw-r--r--src/com/itmill/toolkit/ui/Link.java114
-rw-r--r--src/com/itmill/toolkit/ui/OrderedLayout.java85
-rw-r--r--src/com/itmill/toolkit/ui/Panel.java149
-rw-r--r--src/com/itmill/toolkit/ui/ProgressIndicator.java106
-rw-r--r--src/com/itmill/toolkit/ui/Select.java376
-rw-r--r--src/com/itmill/toolkit/ui/TabSheet.java168
-rw-r--r--src/com/itmill/toolkit/ui/Table.java526
-rw-r--r--src/com/itmill/toolkit/ui/TextField.java171
-rw-r--r--src/com/itmill/toolkit/ui/Tree.java236
-rw-r--r--src/com/itmill/toolkit/ui/Upload.java219
-rw-r--r--src/com/itmill/toolkit/ui/Window.java267
107 files changed, 8629 insertions, 4906 deletions
diff --git a/src/com/itmill/toolkit/Application.java b/src/com/itmill/toolkit/Application.java
index bff944bdc9..bb6d7dc1d5 100644
--- a/src/com/itmill/toolkit/Application.java
+++ b/src/com/itmill/toolkit/Application.java
@@ -63,7 +63,7 @@ import java.net.URL;
* As mentioned, all IT Mill Toolkit applications must inherit this class.
* However, this is almost all of what one needs to do to create a fully
* functional application. The only thing a class inheriting the
- * <code>Application</code> needs to do is implement the <code>init()</code>
+ * <code>Application</code> needs to do is implement the <code>init</code> method
* where it creates the windows it needs to perform its function. Note that all
* applications must have at least one window: the main window. The first
* unnamed window constructed by an application automatically becomes the main
@@ -164,9 +164,10 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
private Focusable pendingFocus;
/**
- * Gets a window by name. Returns <code>null</code> if the application is
- * not running or it does not contain a window corresponding to
- * <code>name</code>.
+ * <p>
+ * Gets a window by name. Returns <code>null</code> if the application is not
+ * running or it does not contain a window corresponding to the name.
+ * </p>
*
* @param name
* The name of the window.
@@ -183,7 +184,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
return window;
}
-
+
/**
* Adds a new window to the application.
*
@@ -196,7 +197,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
* the new <code>Window</code> to add
* @throws IllegalArgumentException
* if a window with the same name as the new window already
- * exists in the application
+ * exists in the application.
* @throws NullPointerException
* if the given <code>Window</code> or its name is
* <code>null</code>
@@ -257,10 +258,10 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Removes the specified window from the application.
+ * Removes the specified window from the application.
*
* @param window
- * The window to be removed
+ * The window to be removed.
*/
public void removeWindow(Window window) {
if (window != null && windows.contains(window)) {
@@ -297,11 +298,15 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Sets the user of the application instance. An application instance may
- * have a user associated to it. This can be set in login procedure or
- * application initialization. A component performing the user login
- * procedure can assign the user property of the application and make the
- * user object available to other components of the application.
+ * <p>
+ * Sets the user of the application instance. An application instance may have
+ * a user associated to it. This can be set in login procedure or application initialization.
+ * </p>
+ * <p>
+ * A component performing the user login procedure can assign the user property
+ * of the application and make the user object available to other components
+ * of the application.
+ * </p>
*
* @param user
* the new user.
@@ -332,24 +337,24 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Ends the Application. In effect this will cause the application stop
- * returning any windows when asked.
+ * Ends the Application. In effect this will cause the application
+ * stop returning any windows when asked.
*/
public void close() {
applicationIsRunning = false;
}
/**
- * Starts the application on the given URL. After this call the application
- * corresponds to the given URL and it will return windows when asked for
- * them.
+ * Starts the application on the given URL.After this call the
+ * application corresponds to the given URL and it will return
+ * windows when asked for them.
*
* @param applicationUrl
- * The URL the application should respond to
+ * The URL the application should respond to.
* @param applicationProperties
* Application properties as specified by the adapter.
* @param context
- * The context application will be running in
+ * The context application will be running in.
*
*/
public void start(URL applicationUrl, Properties applicationProperties,
@@ -362,10 +367,10 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Tests if the application is running or if it has it been finished.
+ * Tests if the application is running or if it has been finished.
*
* @return <code>true</code> if the application is running,
- * <code>false</code> if not
+ * <code>false</code> if not.
*/
public boolean isRunning() {
return applicationIsRunning;
@@ -381,18 +386,19 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Main initializer of the application. This method is called by the
+ * <p>
+ * Main initializer of the application. The <code>init</code> method is called by the
* framework when the application is started, and it should perform whatever
* initialization operations the application needs, such as creating windows
* and adding components to them.
+ * </p>
*/
public abstract void init();
/**
- * Gets the application's theme. The application's theme is the default
- * theme used by all the windows in it that do not explicitly specify a
- * theme. If the application theme is not explicitly set, the
- * <code>null</code> is returned.
+ * Gets the application's theme. The application's theme is the default theme
+ * used by all the windows in it that do not explicitly specify a theme.
+ * If the application theme is not explicitly set, the <code>null</code> is returned.
*
* @return the name of the application's theme
*/
@@ -401,9 +407,11 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Sets the application's theme. Note that this theme can be overridden by
- * the windows. <code>null</code> implies the default terminal theme.
- *
+ * Sets the application's theme.
+ * <p>
+ * Note that this theme can be overridden by the windows. <code>null</code>
+ * implies the default terminal theme.
+ * </p>
* @param theme
* The new theme for this application
*/
@@ -431,19 +439,20 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Returns the mainWindow of the application.
+ * Gets the mainWindow of the application.
*
- * @return Window
+ * @return the main window
*/
public Window getMainWindow() {
return mainWindow;
}
/**
- * Sets the mainWindow. If the main window is not explicitly set, the main
- * window defaults to first created window. Setting window as a main window
- * of this application also adds the window to this application.
- *
+ * <p>
+ * Sets the mainWindow. If the main window is not explicitly set, the main window
+ * defaults to first created window. Setting window as a main window of this
+ * application also adds the window to this application.
+ * </p>
* @param mainWindow
* The mainWindow to set
*/
@@ -466,7 +475,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
/**
* Searches for the property with the specified name in this application.
- * The method returns null if the property is not found.
+ * This method returns <code>null</code> if the property is not found.
*
* @param name
* The name of the property.
@@ -477,8 +486,10 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Add new resource to the application. The resource can be accessed by the
- * user of the application.
+ * Adds new resource to the application. The resource can be accessed
+ * by the user of the application.
+ * @param resource
+ * the resource to add.
*/
public void addResource(ApplicationResource resource) {
@@ -494,7 +505,11 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
keyResourceMap.put(key, resource);
}
- /** Remove resource from the application. */
+ /**
+ * Removes the resource from the application.
+ * @param resource
+ * the resource to remove.
+ */
public void removeResource(ApplicationResource resource) {
Object key = resourceKeyMap.get(resource);
if (key != null) {
@@ -503,7 +518,11 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
}
- /** Get relative uri of the resource */
+ /**
+ * Gets the relative uri of the resource.
+ * @param resource
+ * the resource to get relative location.
+ */
public String getRelativeLocation(ApplicationResource resource) {
// Get the key
@@ -576,19 +595,27 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
return null;
}
- /** Get thed default locale for this application */
+ /**
+ * Gets the default locale for this application.
+ * @return the locale of this application.
+ */
public Locale getLocale() {
if (this.locale != null)
return this.locale;
return Locale.getDefault();
}
- /** Set the default locale for this application */
+ /**
+ * Sets the default locale for this application.
+ * @param locale Locale object
+ *
+ */
public void setLocale(Locale locale) {
this.locale = locale;
}
/**
+ * <p>An event that characterizes a change in the current selection.</p>
* Application user change event sent when the setUser is called to change
* the current user of the application.
*
@@ -609,7 +636,12 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
/** Previous user of the application */
private Object prevUser;
- /** Contructor for user change event */
+ /**
+ * Contructor for user change event.
+ * @param source
+ * @param newUser new User
+ * @param prevUser previous User
+ */
public UserChangeEvent(Application source, Object newUser,
Object prevUser) {
super(source);
@@ -617,24 +649,34 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
this.prevUser = prevUser;
}
- /** Get the new user of the application */
+ /**
+ * Gets the new user of the application.
+ * @return new User.
+ */
public Object getNewUser() {
return newUser;
}
- /** Get the previous user of the application */
+ /**
+ * Gets the previous user of the application.
+ * @return previous Toolkit user, if user has not changed
+ * ever on application it returns <code>null</code>
+ */
public Object getPreviousUser() {
return prevUser;
}
- /** Get the application where the user change occurred */
+ /**
+ * Gets the application where the user change occurred.
+ * @return Application
+ */
public Application getApplication() {
return (Application) getSource();
}
}
/**
- * Public interface for listening application user changes
+ * The <code>UserChangeListener</code> interface for listening application user changes.
*
* @version
* @VERSION@
@@ -642,18 +684,30 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
*/
public interface UserChangeListener extends EventListener {
- /** Invoked when the application user has changed */
+ /**
+ * The <code>applicationUserChanged</code> method Invoked when the application user has changed.
+ * @param event
+ * change event.
+ */
public void applicationUserChanged(Application.UserChangeEvent event);
}
- /** Add user change listener */
+ /**
+ * Adds user change listener.
+ * @param listener
+ * user change listener to add.
+ */
public void addListener(UserChangeListener listener) {
if (userChangeListeners == null)
userChangeListeners = new LinkedList();
userChangeListeners.add(listener);
}
- /** Remove user change listener */
+ /**
+ * Removes user change listener.
+ * @param listener
+ * user change listener to remove.
+ */
public void removeListener(UserChangeListener listener) {
if (userChangeListeners == null)
return;
@@ -683,18 +737,25 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
this.window = window;
}
- /** Get the detached window */
+ /**
+ * Gets the detached window.
+ * @return detached window
+ */
public Window getWindow() {
return window;
}
- /** Get the application from which the window was detached */
+ /**
+ * Gets the application from which the window was detached.
+ * @return Application
+ */
public Application getApplication() {
return (Application) getSource();
}
}
/** Window attach event */
+
public class WindowAttachEvent extends EventObject {
/**
@@ -705,7 +766,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
private Window window;
/**
- * Create event.
+ * Creates event.
*
* @param window
* Attached window.
@@ -715,12 +776,18 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
this.window = window;
}
- /** Get the attached window */
+ /**
+ * Gets the attached window.
+ * @return attached window.
+ */
public Window getWindow() {
return window;
}
- /** Get the application to which the window was attached */
+ /**
+ * Gets the application to which the window was attached.
+ * @return Application.
+ */
public Application getApplication() {
return (Application) getSource();
}
@@ -729,32 +796,52 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
/** Window attach listener interface */
public interface WindowAttachListener {
- /** Window attached */
+ /**
+ * Window attached
+ * @param event
+ * change event.
+ */
public void windowAttached(WindowAttachEvent event);
}
/** Window detach listener interface */
public interface WindowDetachListener {
- /** Window attached */
+ /**
+ * Window detached.
+ * @param event
+ * change event.
+ */
public void windowDetached(WindowDetachEvent event);
}
- /** Add window attach listener */
+ /**
+ * Adds window attach listener.
+ * @param listener
+ * window attach listener to add.
+ */
public void addListener(WindowAttachListener listener) {
if (windowAttachListeners == null)
windowAttachListeners = new LinkedList();
windowAttachListeners.add(listener);
}
- /** Add window detach listener */
+ /**
+ * Adds window detach listener.
+ * @param listener
+ * window detach listener to add.
+ */
public void addListener(WindowDetachListener listener) {
if (windowDetachListeners == null)
windowDetachListeners = new LinkedList();
windowDetachListeners.add(listener);
}
- /** Remove window attach listener */
+ /**
+ * Removes window attach listener.
+ * @param listener
+ * window attach listener to remove.
+ */
public void removeListener(WindowAttachListener listener) {
if (windowAttachListeners != null) {
windowAttachListeners.remove(listener);
@@ -763,7 +850,11 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
}
- /** Remove window detach listener */
+ /**
+ * Removes window detach listener.
+ * @param listener
+ * window detach listener to remove.
+ */
public void removeListener(WindowDetachListener listener) {
if (windowDetachListeners != null) {
windowDetachListeners.remove(listener);
@@ -773,11 +864,13 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Returns the URL user is redirected to on application close. If the URL is
- * null, the application is closed normally as defined by the application
- * running environment: Desctop application just closes the application
- * window and web-application redirects the browser to application main URL.
- *
+ * Returns the URL user is redirected to on application close.If the URL
+ * is <code>null</code>, the application is closed normally as defined by
+ * the application running environment.
+ * <p>
+ * Desctop application just closes the application window and web-application redirects
+ * the browser to application main URL.
+ * </p>
* @return URL
*/
public String getLogoutURL() {
@@ -785,10 +878,10 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Sets the URL user is redirected to on application close. If the URL is
- * null, the application is closed normally as defined by the application
- * running environment: Desctop application just closes the application
- * window and web-application redirects the browser to application main URL.
+ * Sets the URL user is redirected to on application close. If the URL is <code>null</code>,
+ * the application is closed normally as defined by the application running environment:
+ * Desctop application just closes the application window and web-application redirects
+ * the browser to application main URL.
*
* @param logoutURL
* The logoutURL to set
@@ -797,12 +890,18 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
this.logoutURL = logoutURL;
}
- /** This method is invoked by the terminal on any exception that occurs in application
- * and is thrown by the setVariable() to the terminal. The default implementation sets
- * the exceptions as ComponentErrors to the component that initiated the exception.
+ /**
+ * <p>
+ * Invoked by the terminal on any exception that occurs in application and is thrown by
+ * the <code>setVariable</code> to the terminal. The default implementation sets
+ * the exceptions as <code>ComponentErrors</code> to the component that initiated the exception.
+ * </p>
+ * <p>
* You can safely override this method in your application in order to direct the errors
* to some other destination (for example log).
- *
+ * </p>
+ * @param event
+ * change event.
* @see com.itmill.toolkit.terminal.Terminal.ErrorListener#terminalError(com.itmill.toolkit.terminal.Terminal.ErrorEvent)
*/
public void terminalError(Terminal.ErrorEvent event) {
@@ -829,23 +928,24 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Get application context.
- *
+ * Gets application context.
+ * <p>
* The application context is the environment where the application is
* running in.
+ * </p>
+ * @return context
*/
public ApplicationContext getContext() {
return context;
}
/**
- * Get the license this application is running on.
- *
- * The license is initialized by the ApplicationServlet before application
- * is started. The the license-file can not be found in
- * WEB-INF/itmill-toolkit-license.xml, you can set its source in application
- * init().
- *
+ * Gets the license this application is running on.
+ * <p>
+ * The license is initialized by the <code>ApplicationServlet</code> class before application
+ * is started. The license-file can not be found in <code>WEB-INF/itmill-toolkit-license.xml</code>,
+ * you can set its source in application <code>init</code> method.
+ * </p>
* @return License this application is currently using
*/
public License getToolkitLicense() {
@@ -853,11 +953,12 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
}
/**
- * Set the license this application is currently using.
- *
- * The license is initialized by the ApplicationServlet before application
- * is started. Changing the license after application init has no effect.
- *
+ * Sets the license this application is currently using.
+ * <p>
+ * The license is initialized by the <code>ApplicationServlet</code> before application
+ * is started. Changing the license after application <code>init</code> method has no effect.
+ * </p>
+ *
* @param license
* New license for this application.
*/
diff --git a/src/com/itmill/toolkit/data/Buffered.java b/src/com/itmill/toolkit/data/Buffered.java
index 0e14fdd8c6..fcba99d313 100644
--- a/src/com/itmill/toolkit/data/Buffered.java
+++ b/src/com/itmill/toolkit/data/Buffered.java
@@ -33,22 +33,29 @@ import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.SystemError;
-/** <p>Defines the interface to commit and discard changes to an object,
- * supporting read-through and write-through modes.</p>
+/**
+ * <p>Defines the interface to commit and discard changes to an object,
+ * supporting read-through and write-through modes.
+ * </p>
*
* <p><i>Read-through mode</i> means that the value read from the buffered
* object is constantly up to date with the data source.
* <i>Write-through</i> mode means that all changes to the object are
- * immediately updated to the data source.</p>
+ * immediately updated to the data source.
+ * </p>
*
* <p>Since these modes are independent, their combinations may result in
- * some behaviour that may sound surprising. For example, if a
- * <code>Buffered</code> object is in read-through mode but not in
- * write-through mode, the result is an object whose value is updated
+ * some behaviour that may sound surprising.
+ * </p>
+ *
+ * <p>
+ * For example, if a <code>Buffered</code> object is in read-through mode
+ * but not in write-through mode, the result is an object whose value is updated
* directly from the data source only if it's not locally modified. If the
* value is locally modified, retrieving the value from the object would
* result in a value that is different than the one stored in the data
- * source, even though the object is in read-through mode.</p>
+ * source, even though the object is in read-through mode.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -56,7 +63,8 @@ import com.itmill.toolkit.terminal.SystemError;
*/
public interface Buffered {
- /** Updates all changes since the previous commit to the data source.
+ /**
+ * Updates all changes since the previous commit to the data source.
* The value stored in the object will always be updated into the data
* source when <code>commit</code> is called.
*
@@ -66,7 +74,8 @@ public interface Buffered {
*/
public void commit() throws SourceException;
- /** Discards all changes since last commit. The object updates its value
+ /**
+ * Discards all changes since last commit. The object updates its value
* from the data source.
*
* @throws SourceException if the operation fails because of an
@@ -75,7 +84,8 @@ public interface Buffered {
*/
public void discard() throws SourceException;
- /** Tests if the object is in write-through mode. If the object is in
+ /**
+ * Tests if the object is in write-through mode. If the object is in
* write-through mode, all modifications to it will result in
* <code>commit</code> being called after the modification.
*
@@ -84,42 +94,51 @@ public interface Buffered {
*/
public boolean isWriteThrough();
- /** Sets the object's write-through mode to the specified status. When
- * switching the write-through mode on, the <code>commit()</code>
+ /**
+ * Sets the object's write-through mode to the specified status. When
+ * switching the write-through mode on, the <code>commit</code>
* operation will be performed.
*
* @param writeThrough 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.
+ *
*/
public void setWriteThrough(boolean writeThrough) throws SourceException;
- /** Tests if the object is in read-through mode. If the object is in
+ /**
+ * Tests if the object is in read-through mode. If the object is in
* read-through mode, retrieving its value will result in the value
- * being first updated from the data source to the object. The only
- * exception to this rule is that when the object is not in
+ * being first updated from the data source to the object.
+ * <p>
+ * The only exception to this rule is that when the object is not in
* write-through mode and it's buffer contains a modified value, the
* value retrieved from the object will be the locally modified value
* in the buffer which may differ from the value in the data source.
- *
+ * </p>
* @return <code>true</code> if the object is in read-through mode,
* <code>false</code> if it's not.
*/
public boolean isReadThrough();
- /** Sets the object's read-through mode to the specified status. When
+ /**
+ * Sets the object's read-through mode to the specified status. When
* switching read-through mode on, the object's value is updated from
* the data source.
*
* @param readThrough 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
+ * @throws SourceException 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;
- /** Tests if the value stored in the object has been modified since it
+ /**
+ * Tests if the value stored in the object has been modified since it
* was last updated from the data source.
*
* @return <code>true</code> if the value in the object has been
@@ -128,8 +147,10 @@ public interface Buffered {
*/
public boolean isModified();
- /** An exception that signals that one or more exceptions occurred
- * while a buffered object tried to access its data source.
+ /**
+ * An exception that signals that one or more exceptions occurred
+ * while a buffered object tried to access its data source
+ * or if there is a problem in processing a data source.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -150,7 +171,8 @@ public interface Buffered {
private Throwable[] causes = {
};
- /** Creates a source exception that does not include a cause.
+ /**
+ * Creates a source exception that does not include a cause.
*
* @param source the source object implementing the Buffered interface.
*/
@@ -158,7 +180,8 @@ public interface Buffered {
this.source = source;
}
- /** Creates a source exception from a cause exception.
+ /**
+ * Creates a source exception from a cause exception.
*
* @param source the source object implementing the Buffered
* interface.
@@ -169,7 +192,8 @@ public interface Buffered {
causes = new Throwable[] { cause };
}
- /** Creates a source exception from multiplse causes.
+ /**
+ * Creates a source exception from multiple causes.
*
* @param source the source object implementing the Buffered
* interface.
@@ -180,7 +204,8 @@ public interface Buffered {
this.causes = causes;
}
- /** Get the cause of the exception.
+ /**
+ * Gets the cause of the exception.
*
* @return The cause for the exception.
* @throws MoreThanOneCauseException if there is more than one cause
@@ -193,7 +218,8 @@ public interface Buffered {
return causes[0];
}
- /** Get all the causes for this exception.
+ /**
+ * Gets all the causes for this exception.
*
* @return throwables that caused this exception
*/
@@ -201,7 +227,8 @@ public interface Buffered {
return causes;
}
- /** Get the source of the exception.
+ /**
+ * Gets the source of the exception.
*
* @return the Buffered object which generated this exception.
*/
@@ -209,12 +236,15 @@ public interface Buffered {
return source;
}
- /** Get the error level of this buffered source exception. The
+ /**
+ * Gets the error level of this buffered source exception. The
* level of the exception is maximum error level of all the contained
- * causes. The causes that do not specify error level default to
+ * causes.
+ * <p>
+ * The causes that do not specify error level default to
* <code>ERROR</code> level. Also source exception without any causes
* are of level <code>ERROR</code>.
- *
+ * </p>
* @see com.itmill.toolkit.terminal.ErrorMessage#getErrorLevel()
*/
public int getErrorLevel() {
diff --git a/src/com/itmill/toolkit/data/BufferedValidatable.java b/src/com/itmill/toolkit/data/BufferedValidatable.java
index f5cc18f0de..de3a6edac5 100644
--- a/src/com/itmill/toolkit/data/BufferedValidatable.java
+++ b/src/com/itmill/toolkit/data/BufferedValidatable.java
@@ -29,9 +29,11 @@
package com.itmill.toolkit.data;
-/** <p>This interface defines the combination of Validatable and Buffered interfaces.
- * The combination of the interfaces defines if the invalid data is committed to
- * datasource.</p>
+/** <p>
+ * This interface defines the combination of <code>Validatable</code> and
+ * <code>Buffered</code> interfaces. The combination of the interfaces defines
+ * if the invalid data is committed to datasource.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -39,11 +41,15 @@ package com.itmill.toolkit.data;
*/
public interface BufferedValidatable extends Buffered, Validatable {
- /** Is the invalid data committed to datasource.
- * The default is false. */
+ /**
+ * Tests if the invalid data is committed to datasource.
+ * The default is <code>false</code>.
+ */
public boolean isInvalidCommitted();
- /** Set if the invalid data should be committed to datasource.
- * The default is false. */
+ /**
+ * Sets if the invalid data should be committed to datasource.
+ * The default is <code>false</code>.
+ */
public void setInvalidCommitted(boolean isCommitted);
}
diff --git a/src/com/itmill/toolkit/data/Container.java b/src/com/itmill/toolkit/data/Container.java
index 048a5da590..6dd819719b 100644
--- a/src/com/itmill/toolkit/data/Container.java
+++ b/src/com/itmill/toolkit/data/Container.java
@@ -296,7 +296,7 @@ public interface Container {
public boolean isLastId(Object itemId);
/**
- * Add new item after the given item.
+ * Adds new item after the given item.
* <p>
* Adding an item after null item adds the item as first item of the
* ordered container.
@@ -311,7 +311,7 @@ public interface Container {
throws UnsupportedOperationException;
/**
- * Add new item after the given item.
+ * Adds new item after the given item.
* <p>
* Adding an item after null item adds the item as first item of the
* ordered container.
@@ -334,13 +334,13 @@ public interface Container {
/**
* Sort method.
*
- * Sort the container items.
+ * 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>
+ * 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,
@@ -352,7 +352,7 @@ public interface Container {
void sort(Object[] propertyId, boolean[] ascending);
/**
- * Get the container property IDs, which can be used to sort the item.
+ * Gets the container property IDs, which can be used to sort the item.
*
* @return The sortable field ids.
*/
@@ -364,8 +364,8 @@ public interface Container {
public interface Indexed extends Ordered {
/**
- * Gets the index of the Item corresponding to <code>itemId</code>.
- * The following is true for the returned index: 0 <= index < size().
+ * Gets the index of the Item corresponding to the itemId.
+ * The following is <code>true</code> for the returned index: 0 <= index < size().
*
* @param itemId
* ID of an Item in the Container
@@ -375,8 +375,7 @@ public interface Container {
public int indexOfId(Object itemId);
/**
- * Get the ID of an Item by an index number. The following is true for
- * the index: 0 <= index < size().
+ * Gets the ID of an Item by an index number.
*
* @param index
* Index of the requested id in the Container
@@ -385,7 +384,7 @@ public interface Container {
public Object getIdByIndex(int index);
/**
- * Add new item at given index.
+ * Adds new item at given index.
* <p>
* The indexes of the item currently in the given position and all the
* following items are incremented.
@@ -399,7 +398,7 @@ public interface Container {
public Object addItemAt(int index) throws UnsupportedOperationException;
/**
- * Add new item at given index.
+ * Adds new item at given index.
* <p>
* The indexes of the item currently in the given position and all the
* following items are incremented.
@@ -493,8 +492,7 @@ public interface Container {
* Container also implements the <code>Managed</code> interface, the
* items created with <code>newItem</code> can have children by
* default.
- * </p>
- *
+ *
* @param itemId
* ID of the Item in the container whose child capability is
* to be tested
@@ -509,8 +507,10 @@ public interface Container {
* Sets the given Item's capability to have children. If the Item
* identified with <code>itemId</code> already has children and
* <code>areChildrenAllowed</code> is false this method fails and
- * <code>false</code> is returned; the children must be first
- * explicitly removed with
+ * <code>false</code> is returned.
+ * </p>
+ * <p>
+ * The children must be first explicitly removed with
* {@link #setParent(Object itemId, Object newParentId)}or
* {@link com.itmill.toolkit.data.Container#removeItem(Object itemId)}.
* </p>
@@ -575,7 +575,7 @@ public interface Container {
public interface Viewer {
/**
- * Set the Container that serves as the data source of the viewer.
+ * Sets the Container that serves as the data source of the viewer.
*
* @param newDataSource
* The new data source Item
@@ -583,7 +583,7 @@ public interface Container {
public void setContainerDataSource(Container newDataSource);
/**
- * Get the Container serving as the data source of the viewer.
+ * Gets the Container serving as the data source of the viewer.
*
* @return data source Container
*/
@@ -592,11 +592,15 @@ public interface Container {
}
/**
+ * <p>
* Interface implemented by the editor classes supporting editing the
* Container. Implementing this interface means that the Container serving
- * as the data source of the editor can be modified through it. Note that
- * not implementing the <code>Container.Editor</code> interface does not
+ * as the data source of the editor can be modified through it.
+ * </p>
+ * <p>
+ * Note that not implementing the <code>Container.Editor</code> interface does not
* restrict the class from editing the Container contents internally.
+ * </p>
*/
public interface Editor extends Container.Viewer {
@@ -607,7 +611,7 @@ public interface Container {
/**
* An <code>Event</code> object specifying the Container whose Item set
* has changed. Note that these events are triggered only through succesful
- * calls to the <code>newItem()</code> and <code>removeAllItems</code>
+ * calls to the <code>newItem</code> and <code>removeAllItems</code>
* methods in the Container.Managed interface.
*/
public interface ItemSetChangeEvent {
@@ -637,18 +641,19 @@ public interface Container {
* listeners. By implementing this interface a class explicitly announces
* that it will generate a <code>ItemSetChangeEvent</code> when its
* contents are modified.
- *
- * Note that the general Java convention is not to explicitly declare that a
+ * <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.
+ * </p>
*/
public interface ItemSetChangeNotifier {
/**
- * Adds a Item set change listener for the object.
+ * Adds an Item set change listener for the object.
*
* @param listener
* listener to be added
@@ -656,7 +661,7 @@ public interface Container {
public void addListener(Container.ItemSetChangeListener listener);
/**
- * Removes a Item set change listener from the object.
+ * Removes the Item set change listener from the object.
*
* @param listener
* listener to be removed
@@ -668,9 +673,12 @@ public interface Container {
/**
* An <code>Event</code> object specifying the Container whose Property
- * set has changed. Note that these events are triggered only through
- * succesful calls to the <code>addProperty</code> and
+ * set has changed.
+ *<p>
+ * Note: These events are triggered only through succesful calls to
+ * the <code>addProperty</code> and
* <code>removeProperty</code> methods in the Container.Managed interface.
+ * </p>
*/
public interface PropertySetChangeEvent {
@@ -699,17 +707,20 @@ public interface Container {
}
/**
+ * <p>
* The interface for adding and removing <code>PropertySetChangeEvent</code>
* listeners. By implementing this interface a class explicitly announces
* that it will generate a <code>PropertySetChangeEvent</code> when its
* contents are modified.
- *
+ * </p>
+ * <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.
+ * </p>
*/
public interface PropertySetChangeNotifier {
diff --git a/src/com/itmill/toolkit/data/Item.java b/src/com/itmill/toolkit/data/Item.java
index 04f4488525..d59e94edf4 100644
--- a/src/com/itmill/toolkit/data/Item.java
+++ b/src/com/itmill/toolkit/data/Item.java
@@ -30,9 +30,12 @@ package com.itmill.toolkit.data;
import java.util.Collection;
-/** <p>Provides a mechanism for handling a set of Properties, each associated
+/**
+ * <p>
+ * Provides a mechanism for handling a set of Properties, each associated
* to a locally unique identifier. The interface is split into subinterfaces
- * to enable a class to implement only the functionalities it needs.</p>
+ * to enable a class to implement only the functionalities it needs.
+ * </p>
*
* @author IT Mill Ltd
* @version @VERSION@
@@ -40,7 +43,8 @@ import java.util.Collection;
*/
public interface Item {
- /** Gets the Property corresponding to the given Property ID stored in
+ /**
+ * Gets the Property corresponding to the given Property ID stored in
* the Item. If the Item does not contain the Property,
* <code>null</code> is returned.
*
@@ -49,62 +53,72 @@ public interface Item {
*/
public Property getItemProperty(Object id);
- /** Gets the collection of IDs of all Properties stored in the Item.
+ /**
+ * Gets the collection of IDs of all Properties stored in the Item.
*
* @return unmodifiable collection containing IDs of the Properties
* stored the Item
*/
public Collection getItemPropertyIds();
- /** Tries to add a new Property into the Item.
+ /**
+ * Tries to add a new Property into the Item.
*
* <p>This functionality is optional.</p>
*
* @param id ID of the new Property
- * @param property the Property to be added and associated with
- * <code>id</code>
- * @throws UnsupportedOperationException if the operation is not supported.
+ * @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
+ * @throws UnsupportedOperationException if the operation is not supported.
*/
public boolean addItemProperty(Object id, Property property)
throws UnsupportedOperationException;
- /** Removes the Property identified by ID from the Item.
-
- * <p>This functionality is optional.</p>
+ /**
+ * Removes the Property identified by ID from the Item.
+ *
+ * <p>
+ * This functionality is optional.
+ * </p>
*
* @param id ID of the Property to be removed
- * @throws UnsupportedOperationException if the operation is not supported.
* @return <code>true</code> if the operation succeeded
+ * @throws UnsupportedOperationException if the operation is not supported.
* <code>false</code> if not
*/
public boolean removeItemProperty(Object id)
throws UnsupportedOperationException;
- /** Interface implemented by viewer classes capable of using an Item as
+ /**
+ * Interface implemented by viewer classes capable of using an Item as
* a data source.
*/
public interface Viewer {
- /** Sets the Item that serves as the data source of the viewer.
+ /**
+ * Sets the Item that serves as the data source of the viewer.
*
* @param newDataSource The new data source Item
*/
public void setItemDataSource(Item newDataSource);
- /** Gets the Item serving as the data source of the viewer.
+ /**
+ * Gets the Item serving as the data source of the viewer.
*
* @return data source Item
*/
public Item getItemDataSource();
}
- /** Interface implemented by the editor classes capable of editing the
+ /**
+ * Interface implemented by the <code>Editor</code> classes capable of editing the
* Item. Implementing this interface means that the Item serving as the
- * data source of the editor can be modified through it. Note that
- * not implementing the <code>Item.Editor</code> interface does not
+ * data source of the editor can be modified through it.
+ * <p>
+ * Note : Not implementing the <code>Item.Editor</code> interface does not
* restrict the class from editing the contents of an internally.
+ * </p>
*/
public interface Editor extends Item.Viewer {
@@ -112,54 +126,63 @@ public interface Item {
/* Property set change event ******************************************** */
- /** An <code>Event</code> object specifying the Item whose contents
- * has been changed through the Property.Managed interface. Note that
- * the values stored in the Properties may change without triggering
+ /**
+ * 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.
+ * </p>
*/
public interface PropertySetChangeEvent {
- /** Retrieves the Item whose contents has been modified.
+ /**
+ * Retrieves the Item whose contents has been modified.
*
* @return source Item of the event
*/
public Item getItem();
}
- /** The listener interface for receiving
+ /**
+ * The listener interface for receiving
* <code>PropertySetChangeEvent</code> objects.
*/
public interface PropertySetChangeListener {
- /** Notifies this listener that the Item's property set has changed.
+ /**
+ * Notifies this listener that the Item's property set has changed.
*
* @param event Property set change event object
*/
public void itemPropertySetChange(Item.PropertySetChangeEvent event);
}
- /** The interface for adding and removing
- * <code>PropertySetChangeEvent</code> listeners. By implementing this
- * interface a class explicitly announces that it will generate a
- * <code>PropertySetChangeEvent</code> when its Property set is
- * modified.
- *
- * Note that the general Java convention is not to explicitly declare
+ /**
+ * The interface for adding and removing <code>PropertySetChangeEvent</code>
+ * listeners. By implementing this interface a class explicitly announces that
+ * it will generate a <code>PropertySetChangeEvent</code> when its Property
+ * set is 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.
+ * </p>
*/
public interface PropertySetChangeNotifier {
- /** Registers a new property set change listener for this Item.
+ /**
+ * Registers a new property set change listener for this Item.
*
* @param listener The new Listener to be registered.
*/
public void addListener(Item.PropertySetChangeListener listener);
- /** Removes a previously registered property set change listener.
+ /**
+ * Removes a previously registered property set change listener.
*
* @param listener Listener to be removed.
*/
diff --git a/src/com/itmill/toolkit/data/Property.java b/src/com/itmill/toolkit/data/Property.java
index 8f5e40a1f3..2f2f27638d 100644
--- a/src/com/itmill/toolkit/data/Property.java
+++ b/src/com/itmill/toolkit/data/Property.java
@@ -28,60 +28,71 @@
package com.itmill.toolkit.data;
-/** Property is a simple data object that contains one typed value. This
+/**
+ * <p>
+ * The <code>Property</code> is a simple data object that contains one typed value. This
* interface contains methods to inspect and modify the stored value and its
* type, and the object's read-only state.
+ * </p>
*
- * Property also defines the events ReadOnlyStatusChangeEvent and
- * ValueChangeEvent, and the associated listener and notifier interfaces.
- *
- * The Property.Viewer interface should be used to attach the Property to
+ * <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.
+ * </p>
+ *
+ *<p>
+ * The <code>Property.Viewer</code> interface should be used to attach the Property to
* an external data source. This way the value in the data source can be
- * inspected using the Property interface.
+ * inspected using the <code>Property</code> interface.
+ * </p>
*
- * The Property.editor interface should be implemented if the value needs to
+ * <p>
+ * 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
* @version @VERSION@
* @since 3.0
*/
public interface Property {
- /** Gets the value stored in the Property.
+ /**
+ * Gets the value stored in the Property.
*
* @return the value stored in the Property
*/
public Object getValue();
- /** Sets the value of the Property.
- *
+ /**
+ * Sets the value of the Property.
+ * <p>
* Implementing this functionality is optional. If the functionality
* is missing, one should declare the Property to be in read-only mode
- * and throw Property.ReadOnlyException in this function.
- *
- * It is not required, but highly recommended to support setting
+ * and 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
+ * 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.
+ * the <code>toString</code> method of the Property.
*
* @param newValue New value of the Property. This should be assignable
- * to the type returned by <code>getType</code>, but also String type
+ * to the type returned by getType, but also String type
* should be supported
*
* @throws Property.ReadOnlyException if the object is in read-only
* mode
- * @throws Property.ConversionException if <code>newValue</code> can't
+ * @throws Property.ConversionException 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.
+ /**
+ * 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.
*
@@ -90,7 +101,8 @@ public interface Property {
*/
public String toString();
- /** Returns the type of the Property. The methods <code>getValue</code>
+ /**
+ * 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
@@ -100,9 +112,10 @@ public interface Property {
*/
public Class getType();
- /** Tests if the Property is in read-only mode. In read-only mode calls
+ /**
+ * Tests if the Property is in read-only mode. In read-only mode calls
* to the method <code>setValue</code> will throw
- * <code>ReadOnlyException</code>s and will not modify the value of the
+ * <code>ReadOnlyException</code> and will not modify the value of the
* Property.
*
* @return <code>true</code> if the Property is in read-only mode,
@@ -110,16 +123,18 @@ public interface Property {
*/
public boolean isReadOnly();
- /** Sets the Property's read-only mode to the specified status.
+ /**
+ * Sets the Property's read-only mode to the specified status.
*
* This functionality is optional, but all properties must implement
- * the <code>isReadOnly()</code> mode query correctly.
+ * the <code>isReadOnly</code> mode query correctly.
*
* @param newStatus new read-only status of the Property
*/
public void setReadOnly(boolean newStatus);
- /** <code>Exception</code> object that signals that a requested
+ /**
+ * <code>Exception</code> object that signals that a requested
* Property modification failed because it's in read-only mode.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -132,13 +147,15 @@ public interface Property {
*/
private static final long serialVersionUID = 3257571702287119410L;
- /** Constructs a new <code>ReadOnlyException</code> without a detail
+ /**
+ * Constructs a new <code>ReadOnlyException</code> without a detail
* message.
*/
public ReadOnlyException() {
}
- /** Constructs a new <code>ReadOnlyException</code> with the
+ /**
+ * Constructs a new <code>ReadOnlyException</code> with the
* specified detail message.
*
* @param msg the detail message
@@ -148,8 +165,9 @@ public interface Property {
}
}
- /** An exception that signals that the value passed to the
- * <code>setValue()</code> method couldn't be converted to the native
+ /**
+ * 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.
* @author IT Mill Ltd
* @version @VERSION@
@@ -162,13 +180,15 @@ public interface Property {
*/
private static final long serialVersionUID = 3257571706666366008L;
- /** Constructs a new <code>ConversionException</code> without a
+ /**
+ * Constructs a new <code>ConversionException</code> without a
* detail message.
*/
public ConversionException() {
}
- /** Constructs a new <code>ConversionException</code> with the
+ /**
+ * Constructs a new <code>ConversionException</code> with the
* specified detail message.
*
* @param msg the detail message
@@ -177,7 +197,8 @@ public interface Property {
super(msg);
}
- /** Constructs a new <code>ConversionException</code> from another
+ /**
+ * Constructs a new <code>ConversionException</code> from another
* exception.
*
* @param cause The cause of the the conversion failure
@@ -187,7 +208,8 @@ public interface Property {
}
}
- /** Interface implemented by the viewer classes capable of using a
+ /**
+ * Interface implemented by the viewer classes capable of using a
* Property as a data source.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -195,25 +217,31 @@ public interface Property {
*/
public interface Viewer {
- /** Set the Property that serves as the data source of the viewer.
+ /**
+ * Sets the Property that serves as the data source of the viewer.
*
* @param newDataSource the new data source Property
*/
public void setPropertyDataSource(Property newDataSource);
- /** Get the Property serving as the data source of the viewer.
+ /**
+ * Gets the Property serving as the data source of the viewer.
*
* @return the Property serving as the viewers data source
*/
public Property getPropertyDataSource();
}
- /** Interface implemented by the editor classes capable of editing the
- * Property. Implementing this interface means that the Property serving
+ /**
+ * Interface implemented by the editor classes capable of editing the
+ * Property.
+ * <p>
+ * Implementing this interface means that the Property serving
* as the data source of the editor can be modified through the editor.
* It does not restrict the editor from editing the Property internally,
* though if the Property is in a read-only mode, attempts to modify it
* will result in the <code>ReadOnlyException</code> being thrown.
+ * </p>
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -224,7 +252,8 @@ public interface Property {
/* Value change event ******************************************* */
- /** An <code>Event</code> object specifying the Property whose value
+ /**
+ * An <code>Event</code> object specifying the Property whose value
* has been changed.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -232,51 +261,58 @@ public interface Property {
*/
public interface ValueChangeEvent {
- /** Retrieves the Property that has been modified.
+ /**
+ * Retrieves the Property that has been modified.
*
* @return source Property of the event
*/
public Property getProperty();
}
- /** The listener interface for receiving ValueChangeEvent objects.
+ /**
+ * The <code>listener</code> interface for receiving <code>ValueChangeEvent</code> objects.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
**/
public interface ValueChangeListener {
- /** Notifies this listener that the Property's value has changed.
+ /**
+ * Notifies this listener that the Property's value has changed.
*
* @param event value change event object
*/
public void valueChange(Property.ValueChangeEvent event);
}
- /** The interface for adding and removing <code>ValueChangeEvent</code>
+ /**
+ * The interface for adding and removing <code>ValueChangeEvent</code>
* listeners. If a Property wishes to allow other objects to receive
- * <code>ValueChangeEvent</code>s generated by it, it must implement
+ * <code>ValueChangeEvent</code> generated by it, it must implement
* this interface.
- *
- * Note that the general Java convention is not to explicitly declare
+ * <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.
+ * </p>
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface ValueChangeNotifier {
- /** Registers a new value change listener for this Property.
+ /**
+ * Registers a new value change listener for this Property.
*
* @param listener the new Listener to be registered
*/
public void addListener(Property.ValueChangeListener listener);
- /** Removes a previously registered value change listener.
+ /**
+ * Removes a previously registered value change listener.
*
* @param listener listener to be removed
*/
@@ -285,7 +321,8 @@ public interface Property {
/* ReadOnly Status change event ***************************************** */
- /** An <code>Event</code> object specifying the Property whose read-only
+ /**
+ * An <code>Event</code> object specifying the Property whose read-only
* status has been changed.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -293,14 +330,16 @@ public interface Property {
*/
public interface ReadOnlyStatusChangeEvent {
- /** Property whose read-only state has changed.
+ /**
+ * Property whose read-only state has changed.
*
* @return source Property of the event.
*/
public Property getProperty();
}
- /** The listener interface for receiving ReadOnlyStatusChangeEvent
+ /**
+ * The listener interface for receiving <code>ReadOnlyStatusChangeEvent</code>
* objects.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -308,7 +347,8 @@ public interface Property {
* */
public interface ReadOnlyStatusChangeListener {
- /** Notifies this listener that a Property's read-only status has
+ /**
+ * Notifies this listener that a Property's read-only status has
* changed.
*
* @param event Read-only status change event object
@@ -317,32 +357,35 @@ public interface Property {
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>s generated by it, it must
+ /**
+ * The interface for adding and removing <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.
- *
- * Note that the general Java convention is not to explicitly declare
+ * <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.
+ * </p>
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface ReadOnlyStatusChangeNotifier {
- /** Registers a new read-only status change listener for this
+ /**
+ * Registers a new read-only status change listener for this
* Property.
*
* @param listener the new Listener to be registered
*/
public void addListener(Property.ReadOnlyStatusChangeListener listener);
- /** Remove a previously registered read-only status change listener.
+ /**
+ * Removes a previously registered read-only status change listener.
*
* @param listener listener to be removed
*/
diff --git a/src/com/itmill/toolkit/data/Validatable.java b/src/com/itmill/toolkit/data/Validatable.java
index 67501c4a0a..b60ee46b54 100644
--- a/src/com/itmill/toolkit/data/Validatable.java
+++ b/src/com/itmill/toolkit/data/Validatable.java
@@ -30,9 +30,12 @@ package com.itmill.toolkit.data;
import java.util.Collection;
-/** <p>Interface for validatable objects. Defines methods to verify if the
+/**
+ * <p>
+ * Interface for validatable objects. Defines methods to verify if the
* object's value is valid or not, and to add, remove and list registered
- * validators of the object.</p>
+ * validators of the object.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -41,57 +44,86 @@ import java.util.Collection;
*/
public interface Validatable {
- /** Adds a new validator for this object. The validator's
+ /**
+ * <p>
+ * Adds a new validator for this object. The validator's
* {@link Validator#validate(Object)} method is activated every time the
* object's value needs to be verified, that is, when the
* {@link #isValid()} method is called. This usually happens when the
* object's value changes.
+ * </p>
*
* @param validator the new validator
*/
void addValidator(Validator validator);
- /** 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()}.
+ /**
+ * <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()}.
+ * </p>
*
* @param validator the validator to remove
*/
void removeValidator(Validator validator);
- /** List all validators currently registered for the object. If no
+ /**
+ * <p>
+ * Lists all validators currently registered for the object. If no
* validators are registered, returns <code>null</code>.
+ * </p>
*
* @return collection of validators or <code>null</code>
*/
public Collection getValidators();
- /** Tests the current value of the object against all registered
+ /**
+ * <p>
+ * Tests the current value of the object against all registered
* validators. The registered validators are iterated and for each the
* {@link Validator#validate(Object)} method is called. If any validator
* throws the {@link Validator.InvalidValueException} this method
* returns <code>false</code>.
+ * </p>
*
* @return <code>true</code> if the registered validators concur that
* the value is valid, <code>false</code> otherwise
*/
public boolean isValid();
- /** Checks the validity of the validatable. If the validatable is valid
+ /**
+ * <p>
+ * Checks the validity of the validatable. If the validatable is valid
* this method should do nothing, and if it's not valid, it should throw
* <code>Validator.InvalidValueException</code>
+ * </p>
*
* @throws Validator.InvalidValueException if the value is not valid
*/
public void validate()
throws Validator.InvalidValueException;
- /** Does the validabtable object accept invalid values. The default is true. */
+ /**
+ * <p>
+ * Checks the validabtable object accept invalid values.The default value
+ * is <code>true</code>.
+ * </p>
+ *
+ */
public boolean isInvalidAllowed();
- /** Should the validabtable object accept invalid values. Supporting
+ /**
+ * <p>
+ * Should the validabtable object accept invalid values. Supporting
* this configuration possibility is optional. By default invalid values are
- * alloved.
+ * allowed.
+ * </p>
+ *
+ * @param invalidValueAllowed
+ *
+ * @throws UnsupportedOperationException
+ * if the setInvalidAllowed is not supported.
*/
public void setInvalidAllowed(boolean invalidValueAllowed)
throws UnsupportedOperationException;
diff --git a/src/com/itmill/toolkit/data/Validator.java b/src/com/itmill/toolkit/data/Validator.java
index 4894adce42..9ae86006a7 100644
--- a/src/com/itmill/toolkit/data/Validator.java
+++ b/src/com/itmill/toolkit/data/Validator.java
@@ -32,7 +32,8 @@ import com.itmill.toolkit.terminal.ErrorMessage;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
-/** Object validator interface. Implementors of this class can be added to
+/**
+ * Object validator interface. Implementors of this class can be added to
* any {@link com.itmill.toolkit.data.Validatable} object to verify
* its value. The <code>Validatable#isValid(Object)</code> iterates all
* registered <code>Validator</code>s, calling their {@link #validate(Object)}
@@ -46,7 +47,8 @@ import com.itmill.toolkit.terminal.PaintTarget;
*/
public interface Validator {
- /** Checks the given value against this validator. If the value is valid
+ /**
+ * Checks the given value against this validator. If the value is valid
* this method should do nothing, and if it's not valid, it should throw
* <code>Validator.InvalidValueException</code>
*
@@ -55,12 +57,15 @@ public interface Validator {
*/
public void validate(Object value) throws Validator.InvalidValueException;
- /** Test if the the given value is valid.
+ /**
+ * Tests if the given value is valid.
* @param value the value to check
+ * @return <code>true</code> for valid value, otherwise <code>false</code>.
*/
public boolean isValid(Object value);
- /** Adds the proposing functionality to a {@link Validator}. A
+ /**
+ * Adds the proposing functionality to a {@link Validator}. A
* <code>Suggestive</code> validator can propose a valid value for the
* object it is attached to validate. This way the {@link Validatable}
* object may avoid situations where it contains a value that could
@@ -71,8 +76,9 @@ public interface Validator {
*/
public interface Suggestive extends Validator {
- /** Suggest another value that can be used instead of
- * <code>proposedValue</code> if it is invalid. If it is valid
+ /**
+ * Suggests another value that can be used instead of the
+ * proposedValue if it is invalid. If it is valid
* in the opinion of this validator, however, it is returned as is.
*
* @param proposedValue Originally proposed value that could be
@@ -82,7 +88,8 @@ public interface Validator {
public Object suggestValidValue(Object proposedValue);
}
- /** Invalid value exception can be thrown by {@link Validator} when a
+ /**
+ * Invalid value exception can be thrown by {@link Validator} when a
* given value is not valid.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -99,7 +106,8 @@ public interface Validator {
/** Array of validation errors that are causing the problem. */
private InvalidValueException[] causes = null;
- /** Constructs a new <code>InvalidValueException</code> with the
+ /**
+ * Constructs a new <code>InvalidValueException</code> with the
* specified detail message.
*
* @param message The detail message of the problem.
@@ -109,10 +117,11 @@ public interface Validator {
});
}
- /** Constructs a new <code>InvalidValueException</code> with a set
- * of causing validation exceptions. The
- * error message contains first the given message and then a list
- * of validation errors in the given validatables.
+ /**
+ * Constructs a new <code>InvalidValueException</code> with a set
+ * of causing validation exceptions. The error message contains
+ * first the given message and then a list of validation errors
+ * in the given validatables.
*
* @param message The detail message of the problem.
* @param causes Array of validatables whos invalidities are possiblity causing the invalidity.
diff --git a/src/com/itmill/toolkit/data/util/BeanItem.java b/src/com/itmill/toolkit/data/util/BeanItem.java
index eb7ca89add..4ab7026c10 100644
--- a/src/com/itmill/toolkit/data/util/BeanItem.java
+++ b/src/com/itmill/toolkit/data/util/BeanItem.java
@@ -37,7 +37,8 @@ import java.util.Iterator;
import com.itmill.toolkit.data.Property;
-/** A wrapper class for adding the Item interface to any Java Bean.
+/**
+ * A wrapper class for adding the Item interface to any Java Bean.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -45,18 +46,26 @@ import com.itmill.toolkit.data.Property;
*/
public class BeanItem extends PropertysetItem {
- /** The bean wich this Item is based on. */
+ /**
+ * The bean which this Item is based on.
+ */
private Object bean;
- /** <p>Creates a new instance of BeanItem and adds all properties of a
+ /**
+ * <p>
+ * Creates a new instance of <code>BeanItem</code> and adds all properties of a
* Java Bean to it. The properties are identified by their respective
- * bean names.</p>
+ * bean names.
+ * </p>
+ *
+ * <p>
+ * Note : This version only supports introspectable bean
+ * properties and their getter and setter methods. Stand-alone <code>is</code> and
+ * <code>are</code> methods are not supported.
+ * </p>
*
- * <p>Note that this version only supports introspectable bean
- * properties and their getter and setter methods. Stand-alone "is" and
- * "are" methods are not supported.</p>
+ * @param bean the Java Bean to copy properties from.
*
- * @param bean the Java Bean to copy properties from
*/
public BeanItem(Object bean) {
@@ -83,15 +92,22 @@ public class BeanItem extends PropertysetItem {
}
}
- /** <p>Creates a new instance of BeanItem and adds all listed properties of a
+ /**
+ * <p>
+ * Creates a new instance of <code>BeanItem</code> and adds all listed properties of a
* Java Bean to it - in specified order. The properties are identified by their
- * respective bean names.</p>
+ * respective bean names.
+ * </p>
*
- * <p>Note that this version only supports introspectable bean
- * properties and their getter and setter methods. Stand-alone "is" and
- * "are" methods are not supported.</p>
+ * <p>
+ * Note : This version only supports introspectable bean properties and their getter
+ * and setter methods. Stand-alone <code>is</code> and <code>are</code> methods
+ * are not supported.
+ * </p>
*
- * @param bean the Java Bean to copy properties from
+ * @param bean the Java Bean to copy properties from.
+ * @param propertyIds
+ * id of the property.
*/
public BeanItem(Object bean, Collection propertyIds) {
@@ -129,7 +145,8 @@ public class BeanItem extends PropertysetItem {
}
- /** Get the underlying JavaBean object.
+ /**
+ * Gets the underlying JavaBean object.
* @return the bean object.
*/
public Object getBean() {
diff --git a/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java b/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
index 24adf5672c..b275fb7a22 100644
--- a/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
+++ b/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
@@ -39,13 +39,18 @@ import com.itmill.toolkit.data.Container;
import com.itmill.toolkit.data.Item;
import com.itmill.toolkit.data.Property;
-/** <p>A wrapper class for adding external hierarchy to containers not
+/**
+ * <p>
+ * A wrapper class for adding external hierarchy to containers not
* implementing the {@link com.itmill.toolkit.data.Container.Hierarchical}
- * interface.</p>
+ * interface.
+ * </p>
*
- * <p>If the wrapped container is changed directly (that is, not through
+ * <p>
+ * If the wrapped container is changed directly (that is, not through
* the wrapper), the hierarchy information must be updated with the
- * {@link #updateHierarchicalWrapper()} method.</p>
+ * {@link #updateHierarchicalWrapper()} method.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -75,12 +80,14 @@ public class ContainerHierarchicalWrapper
/** Is the wrapped container hierarchical by itself ? */
private boolean hierarchical;
- /** Constructs a new hierarchical wrapper for an existing Container.
+ /**
+ * Constructs a new hierarchical wrapper for an existing Container.
* Works even if the to-be-wrapped container already implements the
- * Container.Hierarchical interface.
+ * <code>Container.Hierarchical</code> interface.
*
* @param toBeWrapped the container that needs to be accessed
* hierarchically
+ * @see #updateHierarchicalWrapper()
*/
public ContainerHierarchicalWrapper(Container toBeWrapped) {
@@ -102,7 +109,8 @@ public class ContainerHierarchicalWrapper
updateHierarchicalWrapper();
}
- /** Updates the wrapper's internal hierarchy data to include all Items
+ /**
+ * Updates the wrapper's internal hierarchy data to include all Items
* in the underlying container. If the contents of the wrapped container
* change without the wrapper's knowledge, this method needs to be
* called to update the hierarchy information of the Items.
@@ -151,11 +159,14 @@ public class ContainerHierarchicalWrapper
}
}
- /** Removes the specified Item from the wrapper's internal hierarchy
- * structure. Note that the Item is not removed from the underlying
+ /**
+ * Removes the specified Item from the wrapper's internal hierarchy
+ * structure.
+ * <p>
+ * Note : The Item is not removed from the underlying
* Container.
- *
- * @param itemId ID of the item to remove from the hierarchy
+ * </p>
+ * @param itemId the ID of the item to remove from the hierarchy.
*/
private void removeFromHierarchyWrapper(Object itemId) {
@@ -172,11 +183,12 @@ public class ContainerHierarchicalWrapper
noChildrenAllowed.remove(itemId);
}
- /** Adds the specified Item specified to the internal hierarchy
+ /**
+ * Adds the specified Item specified to the internal hierarchy
* structure. The new item is added as a root Item. The underlying
* container is not modified.
*
- * @param itemId ID of the item to add to the hierarchy
+ * @param itemId the ID of the item to add to the hierarchy.
*/
private void addToHierarchyWrapper(Object itemId) {
roots.add(itemId);
@@ -195,7 +207,7 @@ public class ContainerHierarchicalWrapper
return !noChildrenAllowed.contains(itemId);
}
- /* Get the IDs of the children of the specified Item.
+ /* Gets the IDs of the children of the specified Item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -211,7 +223,7 @@ public class ContainerHierarchicalWrapper
return Collections.unmodifiableCollection(c);
}
- /* Get the ID of the parent of the specified Item.
+ /* Gets the ID of the parent of the specified Item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -250,7 +262,7 @@ public class ContainerHierarchicalWrapper
return parent.get(itemId) == null;
}
- /* Get the IDs of the root elements in the container.
+ /* Gets the IDs of the root elements in the container.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -263,17 +275,20 @@ public class ContainerHierarchicalWrapper
return Collections.unmodifiableCollection(roots);
}
- /** <p>Sets the given Item's capability to have children. If the Item
- * identified with <code>itemId</code> already has children and
- * <code>areChildrenAllowed</code> is false this method fails and
+ /**
+ * <p>
+ * Sets the given Item's capability to have children. If the Item
+ * identified with the itemId already has children and the
+ * areChildrenAllowed is false this method fails and
* <code>false</code> is returned; the children must be first explicitly
* removed with {@link #setParent(Object itemId, Object newParentId)} or
- * {@link com.itmill.toolkit.data.Container#removeItem(Object itemId)}.</p>
+ * {@link com.itmill.toolkit.data.Container#removeItem(Object itemId)}.
+ * </p>
*
- * @param itemId ID of the Item in the container whose child
- * capability is to be set
- * @param childrenAllowed boolean value specifying if the Item
- * can have children or not
+ * @param itemId 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
*/
@@ -298,16 +313,19 @@ public class ContainerHierarchicalWrapper
return true;
}
- /** <p>Sets the parent of an Item. The new parent item must exist and be
+ /**
+ * <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>.</p>
+ * by setting the parent <code>null</code>.
+ * </p>
*
- * @param itemId 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>
+ * @param itemId 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
*/
@@ -388,11 +406,14 @@ public class ContainerHierarchicalWrapper
return true;
}
- /** Creates a new Item into the Container, assigns it an
+ /**
+ * 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
+ * @throws UnsupportedOperationException
+ * if the addItem is not supported.
*/
public Object addItem() throws UnsupportedOperationException {
@@ -402,10 +423,14 @@ public class ContainerHierarchicalWrapper
return id;
}
- /** Adds a new Item by its ID to the underlying container and to the
+ /**
+ * Adds a new Item by its ID to the underlying container and to the
* hierarchy.
- *
- * @return the added Item or <code>null</code> if the operation failed
+ * @param itemId
+ * 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.
*/
public Item addItem(Object itemId) throws UnsupportedOperationException {
@@ -415,11 +440,14 @@ public class ContainerHierarchicalWrapper
return item;
}
- /** Removes all items from the underlying container and from the
+ /**
+ * Removes all items from the underlying container and from the
* hierarcy.
*
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
+ * @throws UnsupportedOperationException
+ * if the removeAllItems is not supported.
*/
public boolean removeAllItems() throws UnsupportedOperationException {
@@ -434,11 +462,15 @@ public class ContainerHierarchicalWrapper
return success;
}
- /** Removes an Item specified by <code>itemId</code> from the underlying
+ /**
+ * Removes an Item specified by the itemId from the underlying
* container and 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
+ * @throws UnsupportedOperationException
+ * if the removeItem is not supported.
*/
public boolean removeItem(Object itemId)
throws UnsupportedOperationException {
@@ -451,14 +483,17 @@ public class ContainerHierarchicalWrapper
return success;
}
- /** Adds a new Property to all Items in the Container.
+ /**
+ * Adds a new Property to all Items in the Container.
*
- * @param propertyId ID of the new Property
- * @param type Data type of the new Property
- * @param defaultValue The value all created Properties are
- * initialized to
+ * @param propertyId the ID of the new Property.
+ * @param type 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
+ * @throws UnsupportedOperationException
+ * if the addContainerProperty is not supported.
*/
public boolean addContainerProperty(
Object propertyId,
@@ -469,13 +504,18 @@ public class ContainerHierarchicalWrapper
return container.addContainerProperty(propertyId, type, defaultValue);
}
- /** Removes the specified Property from the underlying container and
- * from the hierarchy. Note that the Property will be removed from all
+ /**
+ * Removes the specified Property from the underlying container and
+ * from the hierarchy.
+ * <p>
+ * Note : The Property will be removed from all
* Items in the Container.
- *
- * @param propertyId ID of the Property to remove
+ *</p>
+ * @param propertyId 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.
*/
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException {
diff --git a/src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java b/src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java
index 51e5bc4e20..da54d2b2c8 100644
--- a/src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java
+++ b/src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java
@@ -37,13 +37,18 @@ import com.itmill.toolkit.data.Container;
import com.itmill.toolkit.data.Item;
import com.itmill.toolkit.data.Property;
-/** <p>A wrapper class for adding external ordering to containers not
+/**
+ * <p>
+ * A wrapper class for adding external ordering to containers not
* implementing the {@link com.itmill.toolkit.data.Container.Ordered}
- * interface.</p>
+ * interface.
+ * </p>
*
- * <p>If the wrapped container is changed directly (that is, not through
+ * <p>
+ * If the wrapped container is changed directly (that is, not through
* the wrapper), the ordering must be updated with the
- * {@link #updateOrderWrapper()} method.</p>
+ * {@link #updateOrderWrapper()} method.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -55,55 +60,67 @@ public class ContainerOrderedWrapper
Container.ItemSetChangeNotifier,
Container.PropertySetChangeNotifier {
- /** The wrapped container */
+ /**
+ * The wrapped container
+ */
private Container container;
- /** Ordering information, ie. the mapping from Item ID to the next
+ /**
+ * Ordering information, ie. the mapping from Item ID to the next
* item ID
*/
private Hashtable next;
- /** Reverse ordering information for convenience and performance
+ /**
+ * Reverse ordering information for convenience and performance
* reasons.
*/
private Hashtable prev;
- /** ID of the first Item in the container. */
+ /**
+ * ID of the first Item in the container.
+ */
private Object first;
- /** ID of the last Item in the container. */
+ /**
+ * ID of the last Item in the container.
+ */
private Object last;
- /** Is the wrapped container ordered by itself, ie. does it implement
+ /**
+ * Is the wrapped container ordered by itself, ie. does it implement
* the Container.Ordered interface by itself? If it does, this class
* will use the methods of the underlying container directly.
*/
private boolean ordered = false;
- /** Constructs a new ordered wrapper for an existing Container. Works
+ /**
+ * Constructs a new ordered wrapper for an existing Container. Works
* even if the to-be-wrapped container already implements the
* Container.Ordered interface.
*
- * @param toBeWrapped the container whose contents need to be ordered
+ * @param toBeWrapped the container whose contents need to be ordered.
*/
public ContainerOrderedWrapper(Container toBeWrapped) {
container = toBeWrapped;
ordered = container instanceof Container.Ordered;
- // Check arguments
+ // Checks arguments
if (container == null)
throw new NullPointerException("Null can not be wrapped");
- // Create initial order if needed
+ // Creates initial order if needed
updateOrderWrapper();
}
- /** Removes the specified Item from the wrapper's internal hierarchy
- * structure. Note that the Item is not removed from the underlying
- * Container.
- *
- * @param id ID of the Item to be removed from the ordering
+ /**
+ * Removes the specified Item from the wrapper's internal hierarchy
+ * structure.
+ * <p>
+ * Note : The Item is not removed from the underlying Container.
+ * </p>
+ * @param id the ID of the Item to be removed from the ordering.
*/
private void removeFromOrderWrapper(Object id) {
if (id != null) {
@@ -122,14 +139,15 @@ public class ContainerOrderedWrapper
}
}
- /** Adds the specified Item to the last position in the wrapper's
+ /**
+ * Registers the specified Item to the last position in the wrapper's
* internal ordering. The underlying container is not modified.
*
- * @param id ID of the Item to be added to the ordering
+ * @param id the ID of the Item to be added to the ordering.
*/
private void addToOrderWrapper(Object id) {
- // Add the if to tail
+ // Adds the if to tail
if (last != null) {
next.put(last, id);
prev.put(id, last);
@@ -139,11 +157,13 @@ public class ContainerOrderedWrapper
}
}
- /** Adds the specified Item after the specified itemId in the wrapper's
+ /**
+ * Registers the specified Item after the specified itemId in the wrapper's
* internal ordering. The underlying container is not modified.
* Given item id must be in the container, or must be null.
*
- * @param id ID of the Item to be added to the ordering
+ * @param id the ID of the Item to be added to the ordering.
+ * @param previousItemId the Id of the previous item.
*/
private void addToOrderWrapper(Object id, Object previousItemId) {
@@ -163,10 +183,14 @@ public class ContainerOrderedWrapper
}
}
- /** Updates the wrapper's internal ordering information to include all
- * Items in the underlying container. If the contents of the wrapped
- * container change without the wrapper's knowledge, this method needs
- * to be called to update the ordering information of the Items.
+ /**
+ * Updates the wrapper's internal ordering information to include all
+ * Items in the underlying container.
+ * <p>
+ * Note : If the contents of the wrapped container change without the
+ * wrapper's knowledge, this method needs to be called to update
+ * the ordering information of the Items.
+ * </p>
*/
public void updateOrderWrapper() {
@@ -174,7 +198,7 @@ public class ContainerOrderedWrapper
Collection ids = container.getItemIds();
- // Recreate ordering if some parts of it are missing
+ // Recreates ordering if some parts of it are missing
if (next == null
|| first == null
|| last == null
@@ -193,7 +217,7 @@ public class ContainerOrderedWrapper
removeFromOrderWrapper(id);
}
- // Add missing items
+ // Adds missing items
for (Iterator i = ids.iterator(); i.hasNext();) {
Object id = i.next();
if (!next.containsKey(id))
@@ -212,7 +236,7 @@ public class ContainerOrderedWrapper
return first;
}
- /* Test if the given item is the first item in the container
+ /* Tests if the given item is the first item in the container
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -222,7 +246,7 @@ public class ContainerOrderedWrapper
return first != null && first.equals(itemId);
}
- /* Test if the given item is the last item in the container
+ /* Tests if the given item is the last item in the container
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -242,7 +266,7 @@ public class ContainerOrderedWrapper
return last;
}
- /* Get the item that is next from the specified item.
+ /* Gets the item that is next from the specified item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -252,7 +276,7 @@ public class ContainerOrderedWrapper
return next.get(itemId);
}
- /* Get the item that is previous from the specified item.
+ /* Gets the item that is previous from the specified item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -262,12 +286,13 @@ public class ContainerOrderedWrapper
return prev.get(itemId);
}
- /** Adds a new Property to all Items in the Container.
+ /**
+ * Registers a new Property to all Items in the Container.
*
- * @param propertyId ID of the new Property
- * @param type Data type of the new Property
- * @param defaultValue The value all created Properties are
- * initialized to
+ * @param propertyId the ID of the new Property.
+ * @param type 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
*/
@@ -280,11 +305,14 @@ public class ContainerOrderedWrapper
return container.addContainerProperty(propertyId, type, defaultValue);
}
- /** Creates a new Item into the Container, assigns it an
+ /**
+ * 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
+ * @throws UnsupportedOperationException
+ * if the addItem is not supported.
*/
public Object addItem() throws UnsupportedOperationException {
@@ -294,10 +322,14 @@ public class ContainerOrderedWrapper
return id;
}
- /** Adds a new Item by its ID to the underlying container and to the
+ /**
+ * Registers a new Item by its ID to the underlying container and to the
* ordering.
- *
+ * @param itemId
+ * 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.
*/
public Item addItem(Object itemId) throws UnsupportedOperationException {
Item item = container.addItem(itemId);
@@ -306,11 +338,14 @@ public class ContainerOrderedWrapper
return item;
}
- /** Removes all items from the underlying container and from the
+ /**
+ * Removes all items from the underlying container and from the
* ordering.
*
- * @return <code>true</code> if the operation succeeded,
- * <code>false</code> if not
+ * @return <code>true</code> if the operation succeeded, otherwise
+ * <code>false</code>
+ * @throws UnsupportedOperationException
+ * if the removeAllItems is not supported.
*/
public boolean removeAllItems() throws UnsupportedOperationException {
boolean success = container.removeAllItems();
@@ -322,11 +357,15 @@ public class ContainerOrderedWrapper
return success;
}
- /** Removes an Item specified by <code>itemId</code> from the underlying
+ /**
+ * Removes an Item specified by the itemId from the underlying
* container and 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
+ * @throws UnsupportedOperationException
+ * if the removeItem is not supported.
*/
public boolean removeItem(Object itemId)
throws UnsupportedOperationException {
@@ -337,13 +376,17 @@ public class ContainerOrderedWrapper
return success;
}
- /** Removes the specified Property from the underlying container and
- * from the ordering. Note that the Property will be removed from all
- * Items in the Container.
- *
- * @param propertyId ID of the Property to remove
+ /**
+ * Removes the specified Property from the underlying container and
+ * from the ordering.
+ * <p>
+ * Note : The Property will be removed from all the Items in the Container.
+ * </p>
+ * @param propertyId 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.
*/
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException {
@@ -456,10 +499,10 @@ public class ContainerOrderedWrapper
if (previousItemId != null && !containsId(previousItemId))
return null;
- // Add the item to container
+ // Adds the item to container
Item item = container.addItem(newItemId);
- // Put the new item to its correct place
+ // Puts the new item to its correct place
if (item != null)
addToOrderWrapper(newItemId, previousItemId);
@@ -476,10 +519,10 @@ public class ContainerOrderedWrapper
if (previousItemId != null && !containsId(previousItemId))
return null;
- // Add the item to container
+ // Adds the item to container
Object id = container.addItem();
- // Put the new item to its correct place
+ // Puts the new item to its correct place
if (id != null)
addToOrderWrapper(id, previousItemId);
diff --git a/src/com/itmill/toolkit/data/util/FilesystemContainer.java b/src/com/itmill/toolkit/data/util/FilesystemContainer.java
index 41eee1fe84..7658d2f1d7 100644
--- a/src/com/itmill/toolkit/data/util/FilesystemContainer.java
+++ b/src/com/itmill/toolkit/data/util/FilesystemContainer.java
@@ -47,7 +47,8 @@ import com.itmill.toolkit.data.Property;
import com.itmill.toolkit.service.FileTypeResolver;
import com.itmill.toolkit.terminal.Resource;
-/** A hierarchical container wrapper for a filesystem.
+/**
+ * A hierarchical container wrapper for a filesystem.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -55,19 +56,29 @@ import com.itmill.toolkit.terminal.Resource;
*/
public class FilesystemContainer implements Container.Hierarchical {
- /** String identifier of a file's "name" property. */
+ /**
+ * String identifier of a file's "name" property.
+ */
public static String PROPERTY_NAME = "Name";
- /** String identifier of a file's "size" property. */
+ /**
+ * String identifier of a file's "size" property.
+ */
public static String PROPERTY_SIZE = "Size";
- /** String identifier of a file's "icon" property. */
+ /**
+ * String identifier of a file's "icon" property.
+ */
public static String PROPERTY_ICON = "Icon";
- /** String identifier of a file's "last modified" property. */
+ /**
+ * String identifier of a file's "last modified" property.
+ */
public static String PROPERTY_LASTMODIFIED = "Last Modified";
- /** List of the string identifiers for the available properties */
+ /**
+ * List of the string identifiers for the available properties.
+ */
public static Collection FILE_PROPERTIES;
private static Method FILEITEM_LASTMODIFIED;
@@ -104,10 +115,11 @@ public class FilesystemContainer implements Container.Hierarchical {
private FilenameFilter filter = null;
private boolean recursive = true;
- /** Construct a new <code>FileSystemContainer</code> with the specified
+ /**
+ * Constructs a new <code>FileSystemContainer</code> with the specified
* file as the root of the filesystem. The files are included recursively.
*
- * @param root root file for the new file-system container. Null values are ignored.
+ * @param root the root file for the new file-system container. Null values are ignored.
*/
public FilesystemContainer(File root) {
if (root != null) {
@@ -115,10 +127,11 @@ public class FilesystemContainer implements Container.Hierarchical {
}
}
- /** Construct a new <code>FileSystemContainer</code> with the specified
+ /**
+ * Constructs a new <code>FileSystemContainer</code> with the specified
* file as the root of the filesystem. The files are included recursively.
*
- * @param root root file for the new file-system container
+ * @param root the root file for the new file-system container.
* @param recursive should the container recursively contain subdirectories.
*/
public FilesystemContainer(File root, boolean recursive) {
@@ -126,11 +139,12 @@ public class FilesystemContainer implements Container.Hierarchical {
this.setRecursive(recursive);
}
- /** Construct a new <code>FileSystemContainer</code> with the specified
+ /**
+ * Constructs a new <code>FileSystemContainer</code> with the specified
* file as the root of the filesystem.
*
- * @param root root file for the new file-system container
- * @param extension Filename extension (w/o separator) to limit the files in container.
+ * @param root the root file for the new file-system container.
+ * @param extension the Filename extension (w/o separator) to limit the files in container.
* @param recursive should the container recursively contain subdirectories.
*/
public FilesystemContainer(
@@ -142,11 +156,12 @@ public class FilesystemContainer implements Container.Hierarchical {
this.setRecursive(recursive);
}
- /** Construct a new <code>FileSystemContainer</code> with the specified
+ /**
+ * Constructs a new <code>FileSystemContainer</code> with the specified
* root and recursivity status.
*
- * @param root root file for the new file-system container
- * @param filter Filename filter to limit the files in container.
+ * @param root the root file for the new file-system container.
+ * @param filter the Filename filter to limit the files in container.
* @param recursive should the container recursively contain subdirectories.
*/
public FilesystemContainer(
@@ -158,9 +173,10 @@ public class FilesystemContainer implements Container.Hierarchical {
this.setRecursive(recursive);
}
- /** Add new root file directory.
- * Adds a file to be included as root file directory in the FilesystemContainer.
- * @param root File to be added as root directory. Null values are ignored.
+ /**
+ * Adds new root file directory.
+ * Adds a file to be included as root file directory in the <code>FilesystemContainer</code>.
+ * @param root the File to be added as root directory. Null values are ignored.
*/
public void addRoot(File root) {
if (root != null) {
@@ -173,11 +189,12 @@ public class FilesystemContainer implements Container.Hierarchical {
}
}
- /** Tests if the specified Item in the container may have children.
+ /**
+ * Tests if the specified Item in the container may have children.
* Since a <code>FileSystemContainer</code> contains files and
* directories, this method returns <code>true</code> for directory
* Items only.
- *
+ * @param itemId the id of the item.
* @return <code>true</code> if the specified Item is a directory,
* <code>false</code> otherwise.
*/
@@ -187,7 +204,7 @@ public class FilesystemContainer implements Container.Hierarchical {
&& ((File) itemId).isDirectory();
}
- /* Get the ID's of all Items who are children of the specified Item.
+ /* Gets the ID's of all Items who are children of the specified Item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -210,7 +227,7 @@ public class FilesystemContainer implements Container.Hierarchical {
return Collections.unmodifiableCollection(l);
}
- /* Get the parent item of the specified Item.
+ /* Gets the parent item of the specified Item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -221,7 +238,7 @@ public class FilesystemContainer implements Container.Hierarchical {
return ((File) itemId).getParentFile();
}
- /* Test if the specified Item has any children.
+ /* Tests if the specified Item has any children.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -237,7 +254,7 @@ public class FilesystemContainer implements Container.Hierarchical {
return (l != null) && (l.length > 0);
}
- /* Test if the specified Item is the root of the filesystem.
+ /* Tests if the specified Item is the root of the filesystem.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -252,7 +269,7 @@ public class FilesystemContainer implements Container.Hierarchical {
return false;
}
- /* Get the ID's of all root Items in the container.
+ /* Gets the ID's of all root Items in the container.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -279,10 +296,17 @@ public class FilesystemContainer implements Container.Hierarchical {
return Collections.unmodifiableCollection(l);
}
- /** Return false - conversion from files to directories is not
+ /**
+ * Returns <code>false</code> when conversion from files to directories is not
* supported.
- *
- * @return <code>false</code>
+ * @param itemId
+ * the ID of the item.
+ * @param areChildrenAllowed
+ * the boolean value specifying if the Item can have children or not.
+ * @return <code>true</code> if the operaton is successful otherwise
+ * <code>false</code>.
+ * @throws UnsupportedOperationException
+ * if the setChildrenAllowed is not supported.
*/
public boolean setChildrenAllowed(
Object itemId,
@@ -292,10 +316,16 @@ public class FilesystemContainer implements Container.Hierarchical {
throw new UnsupportedOperationException("Conversion file to/from directory is not supported");
}
- /** Return false - moving files around in the filesystem is not
+ /**
+ * Returns <code>false</code> when moving files around in the filesystem is not
* supported.
- *
- * @return <code>false</code>
+ * @param itemId the ID of the item.
+ * @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 is successful otherwise
+ * <code>false</code>.
+ * @throws UnsupportedOperationException
+ * if the setParent is not supported.
*/
public boolean setParent(Object itemId, Object newParentId)
throws UnsupportedOperationException {
@@ -303,7 +333,7 @@ public class FilesystemContainer implements Container.Hierarchical {
throw new UnsupportedOperationException("File moving is not supported");
}
- /* Test if the filesystem contains the specified Item.
+ /* Tests if the filesystem contains the specified Item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -343,7 +373,8 @@ public class FilesystemContainer implements Container.Hierarchical {
return new FileItem((File) itemId);
}
- /** Internal recursive method to add the files under the specified
+ /**
+ * Internal recursive method to add the files under the specified
* directory to the collection.
*
* @param col the collection where the found items are added
@@ -402,13 +433,14 @@ public class FilesystemContainer implements Container.Hierarchical {
}
- /** Gets the specified property of the specified file Item. The
+ /**
+ * Gets the specified property of the specified file Item. The
* available file properties are "Name", "Size" and "Last Modified".
- * If <code>propertyId</code> is not one of those, <code>null</code> is
+ * If propertyId is not one of those, <code>null</code> is
* returned.
*
- * @param itemId ID of the file whose property is requested
- * @param propertyId The property's ID
+ * @param itemId the ID of the file whose property is requested.
+ * @param propertyId the property's ID.
* @return the requested property's value, or <code>null</code>
*/
public Property getContainerProperty(Object itemId, Object propertyId) {
@@ -447,7 +479,8 @@ public class FilesystemContainer implements Container.Hierarchical {
return null;
}
- /** Gets the collection of available file properties.
+ /**
+ * Gets the collection of available file properties.
*
* @return Unmodifiable collection containing all available file
* properties.
@@ -456,12 +489,13 @@ public class FilesystemContainer implements Container.Hierarchical {
return FILE_PROPERTIES;
}
- /** Gets the specified property's data type. "Name" is a
+ /**
+ * Gets the specified property's data type. "Name" is a
* <code>String</code>, "Size" is a <code>Long</code>, "Last Modified"
- * is a <code>Date</code>. If <code>propertyId</code> is not one of
+ * is a <code>Date</code>. If propertyId is not one of
* those, <code>null</code> is returned.
*
- * @param propertyId ID of the property whose type is requested.
+ * @param propertyId the ID of the property whose type is requested.
* @return data type of the requested property, or <code>null</code>
*/
public Class getType(Object propertyId) {
@@ -477,7 +511,8 @@ public class FilesystemContainer implements Container.Hierarchical {
return null;
}
- /** Internal method to recursively calculate the number of files under
+ /**
+ * Internal method to recursively calculate the number of files under
* a root directory.
*
* @param f the root to start counting from.
@@ -499,7 +534,8 @@ public class FilesystemContainer implements Container.Hierarchical {
return ret;
}
- /** Gets the number of Items in the container. In effect, this is the
+ /**
+ * Gets the number of Items in the container. In effect, this is the
* combined amount of files and directories.
*
* @return Number of Items in the container.
@@ -529,22 +565,27 @@ public class FilesystemContainer implements Container.Hierarchical {
}
}
- /** A Item wrapper for files in a filesystem.
+ /**
+ * A Item wrapper for files in a filesystem.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public class FileItem implements Item {
- /** The wrapped file. */
+ /**
+ * The wrapped file.
+ */
private File file;
- /** Construct a FileItem from a existing file. */
+ /**
+ * Constructs a FileItem from a existing file.
+ */
private FileItem(File file) {
this.file = file;
}
- /* Get the specified property of this file.
+ /* Gets the specified property of this file.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -552,7 +593,7 @@ public class FilesystemContainer implements Container.Hierarchical {
return FilesystemContainer.this.getContainerProperty(file, id);
}
- /* Get the IDs of all properties available for this item
+ /* Gets the IDs of all properties available for this item
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -560,7 +601,8 @@ public class FilesystemContainer implements Container.Hierarchical {
return FilesystemContainer.this.getContainerPropertyIds();
}
- /* Calculates a integer hash-code for the Property that's unique
+ /**
+ * Calculates a integer hash-code for the Property that's unique
* inside the Item containing the Property. Two different Properties
* inside the same Item contained in the same list always have
* different hash-codes, though Properties in different Items may
@@ -572,10 +614,11 @@ public class FilesystemContainer implements Container.Hierarchical {
return file.hashCode() ^ FilesystemContainer.this.hashCode();
}
- /* Tests if the given object is the same as the this object.
+ /**
+ * Tests if the given object is the same as the this object.
* Two Properties got from an Item with the same ID are equal.
*
- * @param obj an object to compare with this object
+ * @param obj an object to compare with this object.
* @return <code>true</code> if the given object is the same as
* this object, <code>false</code> if not
*/
@@ -585,23 +628,37 @@ public class FilesystemContainer implements Container.Hierarchical {
FileItem fi = (FileItem) obj;
return fi.getHost() == getHost() && fi.file.equals(file);
}
-
+ /**
+ * Gets the host of this file.
+ */
private FilesystemContainer getHost() {
return FilesystemContainer.this;
}
-
+ /**
+ * Gets the last modified date of this file.
+ * @return Date
+ */
public Date lastModified() {
return new Date(this.file.lastModified());
}
-
+ /**
+ * Gets the name of this file.
+ * @return file name of this file.
+ */
public String getName() {
return this.file.getName();
}
-
+ /**
+ * Gets the icon of this file.
+ * @return the icon of this file.
+ */
public Resource getIcon() {
return FileTypeResolver.getIcon(this.file);
}
-
+ /**
+ * Gets the size of this file.
+ * @return size
+ */
public long getSize() {
if (this.file.isDirectory())
return 0;
@@ -617,7 +674,8 @@ public class FilesystemContainer implements Container.Hierarchical {
return file.getName();
}
- /** Filesystem container does not support adding new properties.
+ /**
+ * Filesystem container does not support adding new properties.
* @see com.itmill.toolkit.data.Item#addItemProperty(Object, Property)
*/
public boolean addItemProperty(Object id, Property property)
@@ -627,7 +685,8 @@ public class FilesystemContainer implements Container.Hierarchical {
+ "does not support adding new properties");
}
- /** Filesystem container does not support removing properties.
+ /**
+ * Filesystem container does not support removing properties.
* @see com.itmill.toolkit.data.Item#removeItemProperty(Object)
*/
public boolean removeItemProperty(Object id)
@@ -637,7 +696,8 @@ public class FilesystemContainer implements Container.Hierarchical {
}
- /** Generic file extension filter for displaying only files having certain extension.
+ /**
+ * Generic file extension filter for displaying only files having certain extension.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -646,14 +706,16 @@ public class FilesystemContainer implements Container.Hierarchical {
private String filter;
- /** Construct new FileExtensionFilter using given extension.
- * @param fileExtension File extension without the separator (dot).
- * */
+ /**
+ * Constructs new FileExtensionFilter using given extension.
+ * @param fileExtension the File extension without the separator (dot).
+ */
public FileExtensionFilter(String fileExtension) {
this.filter = "." + fileExtension;
}
- /** Allow only files with the extension and directories.
+ /**
+ * Allows only files with the extension and directories.
* @see java.io.FilenameFilter#accept(File, String)
*/
public boolean accept(File dir, String name) {
@@ -663,38 +725,45 @@ public class FilesystemContainer implements Container.Hierarchical {
}
}
- /** Returns the file filter used to limit the files in this container.
+ /**
+ * Returns the file filter used to limit the files in this container.
* @return Used filter instance or null if no filter is assigned.
*/
public FilenameFilter getFilter() {
return filter;
}
- /** Sets the file filter used to limit the files in this container.
+ /**
+ * Sets the file filter used to limit the files in this container.
* @param filter The filter to set. <code>null</code> disables filtering.
*/
public void setFilter(FilenameFilter filter) {
this.filter = filter;
}
- /** Sets the file filter used to limit the files in this container.
- * @param extension Filename extension (w/o separator) to limit the files in container.
+ /**
+ * Sets the file filter used to limit the files in this container.
+ * @param extension the Filename extension (w/o separator) to limit the files in container.
*/
public void setFilter(String extension) {
this.filter = new FileExtensionFilter(extension);
}
- /**Is this container recursive filesystem.
- * @return true if container is recursive, false otherwise.
+ /**
+ * Is this container recursive filesystem.
+ * @return <code>true</code> if container is recursive, <code>false</code> otherwise.
*/
public boolean isRecursive() {
return recursive;
}
- /** Sets the container recursive property.
- * Set this to false to limit the files directly under the root file.
- * Note, that this is meaningful only if the root really is a directory.
- * @param New value for recursive property.
+ /**
+ * Sets the container recursive property.
+ * Set this to false to limit the files directly under the root file.
+ * <p>
+ * Note : This is meaningful only if the root really is a directory.
+ * </p>
+ * @param recursive the New value for recursive property.
*/
public void setRecursive(boolean recursive) {
this.recursive = recursive;
diff --git a/src/com/itmill/toolkit/data/util/HierarchicalContainer.java b/src/com/itmill/toolkit/data/util/HierarchicalContainer.java
index 426b8726f3..1c7a773d6d 100644
--- a/src/com/itmill/toolkit/data/util/HierarchicalContainer.java
+++ b/src/com/itmill/toolkit/data/util/HierarchicalContainer.java
@@ -37,7 +37,8 @@ import java.util.HashSet;
import com.itmill.toolkit.data.Container;
import com.itmill.toolkit.data.Item;
-/** A specialized Container whose contents can be accessed like it was a
+/**
+ * A specialized Container whose contents can be accessed like it was a
* tree-like structure.
*
* @author IT Mill Ltd.
@@ -48,16 +49,24 @@ public class HierarchicalContainer
extends IndexedContainer
implements Container.Hierarchical {
- /** Set of IDs of those contained Items that can't have children. */
+ /**
+ * Set of IDs of those contained Items that can't have children.
+ */
private HashSet noChildrenAllowed = new HashSet();
- /** Mapping from Item ID to parent Item */
+ /**
+ * Mapping from Item ID to parent Item.
+ */
private Hashtable parent = new Hashtable();
- /** Mapping from Item ID to a list of child IDs */
+ /**
+ * Mapping from Item ID to a list of child IDs.
+ */
private Hashtable children = new Hashtable();
- /** List that contains all root elements of the container. */
+ /**
+ * List that contains all root elements of the container.
+ */
private LinkedList roots = new LinkedList();
/* Can the specified Item have any children?
@@ -68,7 +77,7 @@ public class HierarchicalContainer
return !noChildrenAllowed.contains(itemId);
}
- /* Get the IDs of the children of the specified Item.
+ /* Gets the IDs of the children of the specified Item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -79,7 +88,7 @@ public class HierarchicalContainer
return Collections.unmodifiableCollection(c);
}
- /* Get the ID of the parent of the specified Item.
+ /* Gets the ID of the parent of the specified Item.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -103,7 +112,7 @@ public class HierarchicalContainer
return parent.get(itemId) == null;
}
- /* Get the IDs of the root elements in the container.
+ /* Gets the IDs of the root elements in the container.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -111,27 +120,30 @@ public class HierarchicalContainer
return Collections.unmodifiableCollection(roots);
}
- /** <p>Sets the given Item's capability to have children. If the Item
- * identified with <code>itemId</code> already has children and
- * <code>areChildrenAllowed</code> is false this method fails and
+ /**
+ * <p>
+ * Sets the given Item's capability to have children. If the Item
+ * identified with the itemId already has children and the
+ * areChildrenAllowed is false this method fails and
* <code>false</code> is returned; the children must be first explicitly
* removed with {@link #setParent(Object itemId, Object newParentId)} or
- * {@link com.itmill.toolkit.data.Container#removeItem(Object itemId)}.</p>
+ * {@link com.itmill.toolkit.data.Container#removeItem(Object itemId)}.
+ * </p>
*
- * @param itemId ID of the Item in the container whose child
- * capability is to be set
- * @param childrenAllowed boolean value specifying if the Item
- * can have children or not
+ * @param itemId 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
*/
public boolean setChildrenAllowed(Object itemId, boolean childrenAllowed) {
- // Check that the item is in the container
+ // Checks that the item is in the container
if (!containsId(itemId))
return false;
- // Update status
+ // Updates status
if (childrenAllowed)
noChildrenAllowed.remove(itemId);
else
@@ -140,29 +152,32 @@ public class HierarchicalContainer
return true;
}
- /** <p>Sets the parent of an Item. The new parent item must exist and be
+ /**
+ * <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>.</p>
+ * by setting the parent <code>null</code>.
+ * </p>
*
- * @param itemId 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>
+ * @param itemId 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
*/
public boolean setParent(Object itemId, Object newParentId) {
- // Check that the item is in the container
+ // Checks that the item is in the container
if (!containsId(itemId))
return false;
- // Get the old parent
+ // Gets the old parent
Object oldParentId = parent.get(itemId);
- // Check if no change is necessary
+ // Checks if no change is necessary
if ((newParentId == null && oldParentId == null)
|| newParentId.equals(oldParentId))
return true;
@@ -170,7 +185,7 @@ public class HierarchicalContainer
// Making root
if (newParentId == null) {
- // Remove from old parents children list
+ // Removes from old parents children list
LinkedList l = (LinkedList) children.get(itemId);
if (l != null) {
l.remove(itemId);
@@ -181,24 +196,24 @@ public class HierarchicalContainer
// Add to be a root
roots.add(itemId);
- // Update parent
+ // Updates parent
parent.remove(itemId);
return true;
}
- // Check that the new parent exists in container and can have
+ // Checks that the new parent exists in container and can have
// children
if (!containsId(newParentId)
|| noChildrenAllowed.contains(newParentId))
return false;
- // Check that setting parent doesn't result to a loop
+ // Checks that setting parent doesn't result to a loop
Object o = newParentId;
while (o != null && !o.equals(itemId)) o = parent.get(o);
if (o != null) return false;
- // Update parent
+ // Updates parent
parent.put(itemId, newParentId);
LinkedList pcl = (LinkedList) children.get(newParentId);
if (pcl == null) {
@@ -207,7 +222,7 @@ public class HierarchicalContainer
}
pcl.add(itemId);
- // Remove from old parent or root
+ // Removes from old parent or root
if (oldParentId == null)
roots.remove(itemId);
else {
diff --git a/src/com/itmill/toolkit/data/util/IndexedContainer.java b/src/com/itmill/toolkit/data/util/IndexedContainer.java
index e11b6193c1..589557a385 100644
--- a/src/com/itmill/toolkit/data/util/IndexedContainer.java
+++ b/src/com/itmill/toolkit/data/util/IndexedContainer.java
@@ -38,7 +38,7 @@ import com.itmill.toolkit.data.Property;
/**
* Indexed container implementation.
* <p>
- * A list implementation of the com.itmill.toolkit.data.Container interface. A
+ * A list implementation of the <code>com.itmill.toolkit.data.Container</code> interface. A
* list is a ordered collection wherein the user has a precise control over
* where in the list each new Item is inserted. The user may access the Items by
* their integer index (position in the list) or by their Item ID.
@@ -58,13 +58,19 @@ public class IndexedContainer implements Container, Container.Indexed,
/* Internal structure *************************************************** */
- /** Linked list of ordered Item IDs */
+ /**
+ * Linked list of ordered Item IDs.
+ */
private ArrayList itemIds = new ArrayList();
- /** Linked list of ordered Property IDs */
+ /**
+ * Linked list of ordered Property IDs.
+ */
private ArrayList propertyIds = new ArrayList();
- /** Property ID to type mapping */
+ /**
+ * Property ID to type mapping.
+ */
private Hashtable types = new Hashtable();
/**
@@ -80,7 +86,7 @@ public class IndexedContainer implements Container, Container.Indexed,
/**
* List of all Property value change event listeners listening all the
- * properties
+ * properties.
*/
private LinkedList propertyValueChangeListeners = null;
@@ -92,16 +98,24 @@ public class IndexedContainer implements Container, Container.Indexed,
*/
private Hashtable singlePropertyValueChangeListeners = null;
- /** List of all Property set change event listeners */
+ /**
+ * List of all Property set change event listeners.
+ */
private LinkedList propertySetChangeListeners = null;
- /** List of all container Item set change event listeners */
+ /**
+ * List of all container Item set change event listeners.
+ */
private LinkedList itemSetChangeListeners = null;
- /** Temporary store for sorting property ids */
+ /**
+ * Temporary store for sorting property ids.
+ */
private Object[] sortPropertyId;
- /** Temporary store for sorting direction */
+ /**
+ * Temporary store for sorting direction.
+ */
private boolean[] sortDirection;
/* Container constructors *********************************************** */
@@ -124,7 +138,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* contain the requested Item, <code>null</code> is returned.
*
* @param itemId
- * ID of the Item to retrieve
+ * the 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 list
*/
@@ -158,7 +172,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* Gets the type of a Property stored in the list.
*
* @param id
- * ID of the Property
+ * the ID of the Property.
* @return Type of the requested Property
*/
public Class getType(Object propertyId) {
@@ -171,9 +185,9 @@ public class IndexedContainer implements Container, Container.Indexed,
* is returned.
*
* @param itemId
- * ID of the Item which contains the requested Property
+ * the ID of the Item which contains the requested Property.
* @param propertyId
- * ID of the Property to retrieve
+ * the ID of the Property to retrieve.
* @return Property with the given ID or <code>null</code>
*
* @see com.itmill.toolkit.data.Container#getContainerProperty(Object,
@@ -198,7 +212,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* Tests if the list contains the specified Item
*
* @param itemId
- * ID the of Item to be tested for
+ * the ID the of Item to be tested for.
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
*/
@@ -207,15 +221,15 @@ public class IndexedContainer implements Container, Container.Indexed,
}
/**
- * Add a new Property to all Items in the list. The Property ID, data type
+ * Adds a new Property to all Items in the list. The Property ID, data type
* and default value of the new Property are given as parameters.
*
* @param propertyId
- * ID of the new Property
+ * the ID of the new Property.
* @param type
- * Data type of the new Property
+ * the Data type of the new Property.
* @param defaultValue
- * The value all created Properties are initialized to
+ * the value all created Properties are initialized to.
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
*/
@@ -230,7 +244,7 @@ public class IndexedContainer implements Container, Container.Indexed,
if (propertyIds.contains(propertyId))
return false;
- // Add the Property to Property list and types
+ // Adds the Property to Property list and types
propertyIds.add(propertyId);
types.put(propertyId, type);
@@ -240,33 +254,34 @@ public class IndexedContainer implements Container, Container.Indexed,
getItem(i.next()).getItemProperty(propertyId).setValue(
defaultValue);
- // Send a change event
+ // Sends a change event
fireContainerPropertySetChange();
return true;
}
/**
- * Remove all Items from the list. Note that Property ID and type
- * information is preserved.
- *
+ * Removes all Items from the list.
+ * <p>
+ * Note : The Property ID and type information is preserved.
+ * </p>
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
*/
public boolean removeAllItems() {
- // Remove all Items
+ // Removes all Items
itemIds.clear();
items.clear();
- // Send a change event
+ // Sends a change event
fireContentsChange();
return true;
}
/**
- * Create a new Item into the list, and assign it an automatic ID. The new
+ * Creates a new Item into the list, and assign it an automatic ID. 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
@@ -277,46 +292,46 @@ public class IndexedContainer implements Container, Container.Indexed,
*/
public Object addItem() {
- // Create a new id
+ // Creates a new id
Object id = new Object();
- // Add the Item into container
+ // Adds the Item into container
addItem(id);
return id;
}
/**
- * Create a new Item with the given ID into the list. The new Item is
+ * Creates a new Item with the given ID into the list. The new 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.
*
* @param itemId
- * ID of the Item to be created
+ * the 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) {
- // Make sure that the Item has not been created yet
+ // Makes sure that the Item has not been created yet
if (items.containsKey(itemId))
return null;
- // Add the Item to container
+ // Adds the Item to container
itemIds.add(itemId);
items.put(itemId, new Hashtable());
- // Send the event
+ // Sends the event
fireContentsChange();
return getItem(itemId);
}
/**
- * Remove the Item corresponding to the given Item ID from the list.
+ * Removes the Item corresponding to the given Item ID from the list.
*
* @param itemId
- * ID of the Item to remove
+ * the ID of the Item to remove.
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
*/
@@ -332,11 +347,11 @@ public class IndexedContainer implements Container, Container.Indexed,
}
/**
- * Remove a Property specified by the given Property ID from the list. Note
+ * Removes a Property specified by the given Property ID from the list. Note
* that the Property will be removed from all Items in the list.
*
* @param propertyId
- * ID of the Property to remove
+ * the ID of the Property to remove.
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
*/
@@ -346,7 +361,7 @@ public class IndexedContainer implements Container, Container.Indexed,
if (!propertyIds.contains(propertyId))
return false;
- // Remove the Property to Property list and types
+ // Removes the Property to Property list and types
propertyIds.remove(propertyId);
types.remove(propertyId);
@@ -354,7 +369,7 @@ public class IndexedContainer implements Container, Container.Indexed,
for (Iterator i = itemIds.iterator(); i.hasNext();)
((Hashtable) items.get(i.next())).remove(propertyId);
- // Send a change event
+ // Sends a change event
fireContainerPropertySetChange();
return true;
@@ -390,11 +405,11 @@ public class IndexedContainer implements Container, Container.Indexed,
/**
* Gets the ID of the Item following the Item that corresponds to
- * <code>itemId</code>. If the given Item is the last or not found in the
+ * the itemId. If the given Item is the last or not found in the
* list, <code>null</code> is returned.
*
* @param itemId
- * ID of an Item in the list
+ * the ID of an Item in the list.
* @return ID of the next Item or <code>null</code>
*/
public Object nextItemId(Object itemId) {
@@ -407,11 +422,11 @@ public class IndexedContainer implements Container, Container.Indexed,
/**
* 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 itemId. If the given Item is the first or not found in
* the list, <code>null</code> is returned.
*
* @param itemId
- * ID of an Item in the list
+ * the ID of an Item in the list.
* @return ID of the previous Item or <code>null</code>
*/
public Object prevItemId(Object itemId) {
@@ -427,7 +442,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* the list.
*
* @param itemId
- * ID of an Item in the list
+ * the ID of an Item in the list.
* @return <code>true</code> if the Item is first in the list,
* <code>false</code> if not
*/
@@ -440,7 +455,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* the list.
*
* @param itemId
- * ID of an Item in the list
+ * the ID of an Item in the list.
* @return <code>true</code> if the Item is last in the list,
* <code>false</code> if not
*/
@@ -483,7 +498,7 @@ public class IndexedContainer implements Container, Container.Indexed,
}
/**
- * Get ID with the index. The following is true for the index: 0 <= index <
+ * Gets ID with the index. The following is true for the index: 0 <= index <
* size().
*
* @return ID in the given index.
@@ -495,7 +510,7 @@ public class IndexedContainer implements Container, Container.Indexed,
}
/**
- * Get the index of an id. The following is true for the index: 0 <= index <
+ * Gets the index of an id. The following is true for the index: 0 <= index <
* size().
*
* @return Index of the Item or -1 if the Item is not in the container.
@@ -515,11 +530,11 @@ public class IndexedContainer implements Container, Container.Indexed,
if (items.containsKey(newItemId))
return null;
- // Add the Item to container
+ // Adds the Item to container
itemIds.add(index, newItemId);
items.put(newItemId, new Hashtable());
- // Send the event
+ // Sends the event
fireContentsChange();
return getItem(newItemId);
@@ -530,10 +545,10 @@ public class IndexedContainer implements Container, Container.Indexed,
*/
public Object addItemAt(int index) {
- // Create a new id
+ // Creates a new id
Object id = new Object();
- // Add the Item into container
+ // Adds the Item into container
addItemAt(index, id);
return id;
@@ -640,7 +655,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* Registers a new Property set change listener for this list.
*
* @param listener
- * the new Listener to be registered
+ * the new Listener to be registered.
*/
public void addListener(Container.PropertySetChangeListener listener) {
if (propertySetChangeListeners == null)
@@ -652,7 +667,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* Removes a previously registered Property set change listener.
*
* @param listener
- * listener to be removed
+ * the listener to be removed.
*/
public void removeListener(Container.PropertySetChangeListener listener) {
if (propertySetChangeListeners != null)
@@ -663,7 +678,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* Adds a Item set change listener for the list.
*
* @param listener
- * listener to be added
+ * the listener to be added.
*/
public void addListener(Container.ItemSetChangeListener listener) {
if (itemSetChangeListeners == null)
@@ -675,7 +690,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* Removes a Item set change listener from the object.
*
* @param listener
- * listener to be removed
+ * the listener to be removed.
*/
public void removeListener(Container.ItemSetChangeListener listener) {
if (itemSetChangeListeners != null)
@@ -698,17 +713,20 @@ public class IndexedContainer implements Container, Container.Indexed,
* Removes a previously registered value change listener.
*
* @param listener
- * listener to be removed
+ * the listener to be removed.
*/
public void removeListener(Property.ValueChangeListener listener) {
if (propertyValueChangeListeners != null)
propertyValueChangeListeners.remove(listener);
}
- /** Send a Property value change event to all interested listeners */
+ /**
+ * Sends a Property value change event to all interested listeners.
+ * @param source the IndexedContainerProperty object.
+ */
private void firePropertyValueChange(IndexedContainerProperty source) {
- // Send event to listeners listening all value changes
+ // Sends event to listeners listening all value changes
if (propertyValueChangeListeners != null) {
Object[] l = propertyValueChangeListeners.toArray();
Property.ValueChangeEvent event = new IndexedContainer.PropertyValueChangeEvent(
@@ -717,7 +735,7 @@ public class IndexedContainer implements Container, Container.Indexed,
((Property.ValueChangeListener) l[i]).valueChange(event);
}
- // Send event to single property value change listeners
+ // Sends event to single property value change listeners
if (singlePropertyValueChangeListeners != null) {
Hashtable propertySetToListenerListMap = (Hashtable) singlePropertyValueChangeListeners
.get(source.propertyId);
@@ -736,7 +754,9 @@ public class IndexedContainer implements Container, Container.Indexed,
}
- /** Send a Property set change event to all interested listeners */
+ /**
+ * Sends a Property set change event to all interested listeners.
+ */
private void fireContainerPropertySetChange() {
if (propertySetChangeListeners != null) {
Object[] l = propertySetChangeListeners.toArray();
@@ -748,7 +768,9 @@ public class IndexedContainer implements Container, Container.Indexed,
}
}
- /** Send Item set change event to all registered interested listeners */
+ /**
+ * Sends Item set change event to all registered interested listeners.
+ */
private void fireContentsChange() {
if (itemSetChangeListeners != null) {
Object[] l = itemSetChangeListeners.toArray();
@@ -760,7 +782,15 @@ public class IndexedContainer implements Container, Container.Indexed,
}
}
- /** Add new single Property change listener */
+ /**
+ * Adds new single Property change listener.
+ * @param propertyId
+ * the ID of the Property to add.
+ * @param itemId
+ * the ID of the Item .
+ * @param listener
+ * the listener to be added.
+ */
private void addSinglePropertyChangeListener(Object propertyId,
Object itemId, Property.ValueChangeListener listener) {
if (listener != null) {
@@ -783,7 +813,15 @@ public class IndexedContainer implements Container, Container.Indexed,
}
}
- /** Remove a previously registered single Property change listener */
+ /**
+ * Removes a previously registered single Property change listener.
+ * @param propertyId
+ * the ID of the Property to remove.
+ * @param itemId
+ * the ID of the Item.
+ * @param listener
+ * the listener to be removed.
+ */
private void removeSinglePropertyChangeListener(Object propertyId,
Object itemId, Property.ValueChangeListener listener) {
if (listener != null && singlePropertyValueChangeListeners != null) {
@@ -816,21 +854,21 @@ public class IndexedContainer implements Container, Container.Indexed,
*/
class IndexedContainerItem implements Item {
- /** Item ID in the host container for this Item */
+ /**
+ * Item ID in the host container for this Item.
+ */
private Object itemId;
/**
* Constructs a new ListItem instance and connects it to a host
* container.
*
- * @param host
- * the list that contains this Item
* @param itemId
- * Item ID of the new Item
+ * the Item ID of the new Item.
*/
private IndexedContainerItem(Object itemId) {
- // Get the item contents from the host
+ // Gets the item contents from the host
if (itemId == null)
throw new NullPointerException();
this.itemId = itemId;
@@ -842,7 +880,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* <code>null</code> is returned.
*
* @param id
- * 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) {
@@ -909,7 +947,10 @@ public class IndexedContainer implements Container, Container.Indexed,
IndexedContainerItem li = (IndexedContainerItem) obj;
return getHost() == li.getHost() && itemId.equals(li.itemId);
}
-
+ /**
+ *
+ * @return
+ */
private IndexedContainer getHost() {
return IndexedContainer.this;
}
@@ -938,7 +979,7 @@ public class IndexedContainer implements Container, Container.Indexed,
}
- /*
+ /**
* A class implementing the com.itmill.toolkit.data.Property interface to be
* contained in the Items contained in the list. @author IT Mill Ltd.
*
@@ -948,10 +989,14 @@ public class IndexedContainer implements Container, Container.Indexed,
private class IndexedContainerProperty implements Property,
Property.ValueChangeNotifier {
- /** ID of the Item, where the Property resides */
+ /**
+ * ID of the Item, where the Property resides.
+ */
private Object itemId;
- /** Id of the Property */
+ /**
+ * Id of the Property.
+ */
private Object propertyId;
/**
@@ -959,12 +1004,12 @@ public class IndexedContainer implements Container, Container.Indexed,
* a ListContainer.
*
* @param itemId
- * ID of the Item to connect the new Property to
+ * the ID of the Item to connect the new Property to.
* @param propertyId
- * Property ID of the new Property
+ * the Property ID of the new Property.
* @param host
* the list that contains the Item to contain the new
- * Property
+ * Property.
*/
private IndexedContainerProperty(Object itemId, Object propertyId) {
if (itemId == null || propertyId == null)
@@ -974,13 +1019,13 @@ public class IndexedContainer implements Container, Container.Indexed,
}
/**
- * Return the type of the Property. The methods <code>getValue</code>
+ * 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 a parameter to <code>setValue</code.
*
- * @return type of the Property
+ * @return the type of the Property.
*/
public Class getType() {
return (Class) types.get(propertyId);
@@ -989,7 +1034,7 @@ public class IndexedContainer implements Container, Container.Indexed,
/**
* Gets the value stored in the Property.
*
- * @return the value stored in the Property
+ * @return the value stored in the Property.
*/
public Object getValue() {
return ((Hashtable) items.get(itemId)).get(propertyId);
@@ -997,24 +1042,24 @@ public class IndexedContainer implements Container, Container.Indexed,
/**
* <p>
- * Test if the Property is in read-only mode. In read-only mode calls to
+ * Tests if the Property is in read-only mode. In read-only mode calls to
* the method <code>setValue</code> will throw
* <code>ReadOnlyException</code> s and will not modify the value of
* the Property.
* </p>
*
* @return <code>true</code> if the Property is in read-only mode,
- * <code>false</code> if it's not
+ * <code>false</code> if it's not.
*/
public boolean isReadOnly() {
return readOnlyProperties.contains(this);
}
/**
- * Set the Property's read-only mode to the specified status.
+ * Sets the Property's read-only mode to the specified status.
*
* @param newStatus
- * new read-only status of the Property
+ * the new read-only status of the Property.
*/
public void setReadOnly(boolean newStatus) {
if (newStatus)
@@ -1030,7 +1075,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* to assign the value,
*
* @param newValue
- * New value of the Property. This should be assignable to
+ * the New value of the Property. This should be assignable to
* the Property's internal type or support
* <code>toString</code>.
*
@@ -1044,7 +1089,7 @@ public class IndexedContainer implements Container, Container.Indexed,
public void setValue(Object newValue)
throws Property.ReadOnlyException, Property.ConversionException {
- // Get the Property set
+ // Gets the Property set
Hashtable propertySet = (Hashtable) items.get(itemId);
// Support null values on all types
@@ -1059,11 +1104,11 @@ public class IndexedContainer implements Container, Container.Indexed,
else
try {
- // Get the string constructor
+ // Gets the string constructor
Constructor constr = getType().getConstructor(
new Class[] { String.class });
- // Create new object from the string
+ // Creates new object from the string
propertySet.put(propertyId, constr
.newInstance(new Object[] { newValue.toString() }));
@@ -1078,7 +1123,7 @@ public class IndexedContainer implements Container, Container.Indexed,
}
/**
- * Return the value of the Property in human readable textual format.
+ * 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.
*
@@ -1129,7 +1174,7 @@ public class IndexedContainer implements Container, Container.Indexed,
* Registers a new value change listener for this Property.
*
* @param listener
- * the new Listener to be registered
+ * the new Listener to be registered.
* @see com.itmill.toolkit.data.Property.ValueChangeNotifier#addListener(ValueChangeListener)
*/
public void addListener(Property.ValueChangeListener listener) {
@@ -1153,15 +1198,13 @@ public class IndexedContainer implements Container, Container.Indexed,
}
- /*
- * (non-Javadoc)
- *
+ /**
* @see com.itmill.toolkit.data.Container.Sortable#sort(java.lang.Object[],
* boolean[])
*/
public synchronized void sort(Object[] propertyId, boolean[] ascending) {
- // Remove any non-sortable property ids
+ // Removes any non-sortable property ids
ArrayList ids = new ArrayList();
ArrayList orders = new ArrayList();
Collection sortable = getSortableContainerPropertyIds();
@@ -1189,9 +1232,7 @@ public class IndexedContainer implements Container, Container.Indexed,
}
- /*
- * (non-Javadoc)
- *
+ /**
* @see com.itmill.toolkit.data.Container.Sortable#getSortableContainerPropertyIds()
*/
public Collection getSortableContainerPropertyIds() {
@@ -1210,7 +1251,7 @@ public class IndexedContainer implements Container, Container.Indexed,
}
/**
- * Compare two items for sorting.
+ * Compares two items for sorting.
*
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
* @see #sort((java.lang.Object[], boolean[])
@@ -1255,10 +1296,15 @@ public class IndexedContainer implements Container, Container.Indexed,
return 0;
}
- /* Support cloning of the IndexedContainer cleanly */
+ /**
+ * Supports cloning of the IndexedContainer cleanly.
+ * @throws CloneNotSupportedException
+ * if an object cannot be cloned.
+.
+ */
public Object clone() throws CloneNotSupportedException {
- // Create the clone
+ // Creates the clone
IndexedContainer nc = new IndexedContainer();
// Clone the shallow properties
@@ -1304,7 +1350,10 @@ public class IndexedContainer implements Container, Container.Indexed,
return nc;
}
-
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
public boolean equals(Object obj) {
// Only ones of the objects of the same class can be equal
@@ -1312,7 +1361,7 @@ public class IndexedContainer implements Container, Container.Indexed,
return false;
IndexedContainer o = (IndexedContainer) obj;
- // Check the properties one by one
+ // Checks the properties one by one
if (itemIds != o.itemIds && o.itemIds != null
&& !o.itemIds.equals(this.itemIds))
return false;
@@ -1356,7 +1405,10 @@ public class IndexedContainer implements Container, Container.Indexed,
return true;
}
-
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
public int hashCode() {
// The hash-code is calculated as combination hash of the members
diff --git a/src/com/itmill/toolkit/data/util/MethodProperty.java b/src/com/itmill/toolkit/data/util/MethodProperty.java
index e80a27de85..d058feb029 100644
--- a/src/com/itmill/toolkit/data/util/MethodProperty.java
+++ b/src/com/itmill/toolkit/data/util/MethodProperty.java
@@ -35,19 +35,26 @@ import java.util.LinkedList;
import com.itmill.toolkit.data.Property;
-/** <p>Proxy class for creating Properties from pairs of getter and setter
+/**
+ * <p>
+ * Proxy class for creating Properties from pairs of getter and setter
* methods of a Bean property. An instance of this class can be thought as
* having been attached to a field of an object. Accessing the object
* through the Property interface directly manipulates the underlying
- * field.</p>
+ * field.
+ * </p>
*
- * <p>It's assumed that the return value returned by the getter method
+ * <p>
+ * It's assumed that the return value returned by the getter method
* is assignable to the type of the property, and the setter method
- * parameter is assignable to that value.</p>
+ * parameter is assignable to that value.
+ * </p>
*
- * <p>A valid getter method must always be available, but instance of this
+ * <p>
+ * A valid getter method must always be available, but instance of this
* class can be constructed with a <code>null</code> setter method in which
- * case the resulting MethodProperty is read-only.</p>
+ * case the resulting MethodProperty is read-only.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -55,48 +62,70 @@ import com.itmill.toolkit.data.Property;
*/
public class MethodProperty implements Property {
- /** The object that includes the property the MethodProperty is bound to */
+ /**
+ * The object that includes the property the MethodProperty is bound to.
+ */
private Object instance;
- /** Argument arrays for the getter and setter methods */
+ /**
+ * Argument arrays for the getter and setter methods.
+ */
private Object[] setArgs, getArgs;
- /** Is the MethodProperty read-only? */
+ /**
+ * Is the MethodProperty read-only?
+ */
private boolean readOnly;
- /** The getter and setter methods */
+ /**
+ * The getter and setter methods.
+ */
private Method setMethod, getMethod;
- /** Index of the new value in the argument list for the setter method.
+ /**
+ * Index of the new value in the argument list for the setter method.
* If the setter method requires several parameters, this index tells
* which one is the actual value to change.
*/
private int setArgumentIndex;
- /** Type of the property */
+ /**
+ * Type of the property.
+ */
private Class type;
- /** List of listeners who are interested in the read-only status changes
+ /**
+ * List of listeners who are interested in the read-only status changes
* of the MethodProperty
*/
private LinkedList readOnlyStatusChangeListeners = null;
- /** <p>Creates a new instance of MethodProperty from a named bean
+ /**
+ * <p>
+ * Creates a new instance of <code>MethodProperty</code> from a named bean
* property. This constructor takes an object and the name of a bean
* property and initializes itself with the accessor methods for the
- * property. The getter method of a MethodProperty instantiated
+ * 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.</p>
+ * setter method with only the new value as the sole argument.
+ * </p>
*
- * <p>If the setter method is unavailable, the resulting MethodProperty
- * will be read-only, otherwise it will be read-write.</p>
+ * <p>
+ * If the setter method is unavailable, the resulting <code>MethodProperty</code>
+ * will be read-only, otherwise it will be read-write.
+ * </p>
*
- * <p>Method names are constucted from the bean property by adding
+ * <p>
+ * Method names are constucted from the bean property by adding
* get/is/are/set prefix and capitalising the first character in the
- * name of the given bean property</p>
+ * name of the given bean property.
+ * </p>
*
- * @param instance object that includes the property
- * @param beanPropertyName name of the property to bind to
+ * @param instance the object that includes the property.
+ * @param beanPropertyName the name of the property to bind to.
*/
public MethodProperty(Object instance, String beanPropertyName) {
@@ -139,7 +168,7 @@ public class MethodProperty implements Property {
// In case the get method is found, resolve the type
type = getMethod.getReturnType();
- // Find the set method
+ // Finds the set method
setMethod = null;
try {
setMethod =
@@ -149,7 +178,7 @@ public class MethodProperty implements Property {
} catch (java.lang.NoSuchMethodException skipped) {
}
- // Get the return type from get method
+ // Gets the return type from get method
if (type.isPrimitive()) {
if (type.equals(Boolean.TYPE))
type = Boolean.class;
@@ -175,19 +204,24 @@ public class MethodProperty implements Property {
this.instance = instance;
}
- /** <p>Creates a new instance of MethodProperty from named getter and
- * setter methods. The getter method of a MethodProperty instantiated
+ /**
+ * <p>
+ * Creates a new instance of <code>MethodProperty</code> from named 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>
+ * setter method with only the new value as the sole argument.
+ * </p>
*
- * <p>If the setter method is <code>null</code>, the resulting
- * MethodProperty will be read-only, otherwise it will be
- * read-write.</p>
+ * <p>
+ * If the setter method is <code>null</code>, the resulting
+ * <code>MethodProperty</code> will be read-only, otherwise it will be
+ * read-write.
+ * </p>
*
- * @param type type of the property
- * @param instance object that includes the property
- * @param getMethodName name of the getter method
- * @param setMethodName name of the setter method
+ * @param type the type of the property.
+ * @param instance the object that includes the property.
+ * @param getMethodName the name of the getter method.
+ * @param setMethodName the name of the setter method.
*
*/
public MethodProperty(
@@ -199,19 +233,24 @@ public class MethodProperty implements Property {
}, new Object[] { null }, 0);
}
- /** <p>Creates a new instance of MethodProperty with the getter and
- * setter methods. The getter method of a MethodProperty instantiated
+ /**
+ * <p>
+ * 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>
+ * setter method with only the new value as the sole argument.
+ * </p>
*
- * <p>If the setter method is <code>null</code>, the resulting
- * MethodProperty will be read-only, otherwise it will be
- * read-write.</p>
+ * <p>
+ * If the setter method is <code>null</code>, the resulting
+ * <code>MethodProperty</code> will be read-only, otherwise it will be
+ * read-write.
+ * </p>
*
- * @param type type of the property
- * @param instance object that includes the property
- * @param getMethod the getter method
- * @param setMethod the setter method
+ * @param type the type of the property.
+ * @param instance the object that includes the property.
+ * @param getMethod the getter method.
+ * @param setMethod the setter method.
*/
public MethodProperty(
Class type,
@@ -222,29 +261,34 @@ public class MethodProperty implements Property {
}, new Object[] { null }, 0);
}
- /** <p>Creates a new instance of MethodProperty from named getter and
+ /**
+ * <p>
+ * Creates a new instance of <code>MethodProperty</code> from named getter and
* setter methods and argument lists. The getter method of a
- * MethodProperty instantiated with this constructor will be called with
- * <code>getArgs</code> as arguments. <code>setArgs</code> will be used
+ * <code>MethodProperty</code> instantiated with this constructor will be called with
+ * the getArgs as arguments. The setArgs will be used
* as the arguments for the setter method, though the argument indexed
- * by <code>setArgumentIndex</code> will be replaced with the argument
- * passed to the {@link #setValue(Object newValue)} method.</p>
+ * by the setArgumentIndex will be replaced with the argument
+ * passed to the {@link #setValue(Object newValue)} method.
+ * </p>
*
- * <p>For example, if the <code>setArgs</code> contains <code>A</code>,
+ * <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
- * <code>{A, X, C}</code></p>
+ * <code>{A, X, C}</code>
+ * </p>
*
- * @param type type of the property
- * @param instance object that includes the property
- * @param getMethodName the name of the getter method
- * @param setMethodName the name of the setter method
- * @param getArgs fixed argument list to be passed to the getter method
- * @param setArgs fixed argument list to be passed to the setter method
+ * @param type the type of the property.
+ * @param instance the object that includes the property.
+ * @param getMethodName the name of the getter method.
+ * @param setMethodName the name of the setter method.
+ * @param getArgs the fixed argument list to be passed to the getter method.
+ * @param setArgs 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
+ * {@link #setValue(Object newValue)} is called.
*/
public MethodProperty(
Class type,
@@ -267,22 +311,22 @@ public class MethodProperty implements Property {
// Find set and get -methods
Method[] m = instance.getClass().getMethods();
- // Find get method
+ // Finds get method
boolean found = false;
for (int i = 0; i < m.length; i++) {
- // Test the name of the get Method
+ // Tests the name of the get Method
if (!m[i].getName().equals(getMethodName)) {
// name does not match, try next method
continue;
}
- // Test return type
+ // Tests return type
if (!type.equals(m[i].getReturnType()))
continue;
- // Test the parameter types
+ // Tests the parameter types
Class[] c = m[i].getParameterTypes();
if (c.length != getArgs.length) {
@@ -318,21 +362,21 @@ public class MethodProperty implements Property {
"Could not find " + getMethodName + "-method");
}
- // Find set method
+ // Finds set method
if (setMethodName != null) {
- // Find setMethod
+ // Finds setMethod
found = false;
for (int i = 0; i < m.length; i++) {
- // Check name
+ // Checks name
if (!m[i].getName().equals(setMethodName)) {
// name does not match, try next method
continue;
}
- // Check parameter compatibility
+ // Checks parameter compatibility
Class[] c = m[i].getParameterTypes();
if (c.length != setArgs.length) {
@@ -373,7 +417,7 @@ public class MethodProperty implements Property {
}
}
- // Get the return type from get method
+ // Gets the return type from get method
if (type.isPrimitive()) {
if (type.equals(Boolean.TYPE))
type = Boolean.class;
@@ -398,23 +442,28 @@ public class MethodProperty implements Property {
this.instance = instance;
}
- /** <p>Creates a new instance of MethodProperty from the getter and
- * setter methods, and argument lists. This constructor behaves exctly
- * like {@link #MethodProperty(Class type, Object instance, String
+ /**
+ * <p>
+ * 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.</p>
+ * methods themselves.
+ * </p>
*
- * @param type type of the property
- * @param instance object that includes the property
- * @param getMethod the getter method
- * @param setMethod the setter method
- * @param getArgs fixed argument list to be passed to the getter method
- * @param setArgs fixed argument list to be passed to the setter method
+ * @param type the type of the property.
+ * @param instance the object that includes the property.
+ * @param getMethod the getter method.
+ * @param setMethod the setter method.
+ * @param getArgs the fixed argument list to be passed to the getter method.
+ * @param setArgs 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
+ * {@link #setValue(Object newValue)} is called.
*/
public MethodProperty(
Class type,
@@ -433,7 +482,7 @@ public class MethodProperty implements Property {
if (setMethod != null && ( setArgumentIndex < 0 || setArgumentIndex >= setArgs.length))
throw new IndexOutOfBoundsException("The setArgumentIndex must be >= 0 and < setArgs.length");
- // Get the return type from get method
+ // Gets the return type from get method
if (type.isPrimitive()) {
if (type.equals(Boolean.TYPE))
type = Boolean.class;
@@ -461,7 +510,8 @@ public class MethodProperty implements Property {
this.type = type;
}
- /** Returns the type of the Property. The methods <code>getValue</code>
+ /**
+ * 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
@@ -473,8 +523,9 @@ public class MethodProperty implements Property {
return type;
}
- /** Tests if the object is in read-only mode. In read-only mode calls
- * to <code>setValue</code> will throw <code>ReadOnlyException</code>s
+ /**
+ * 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.
*
* @return <code>true</code> if the object is in read-only mode,
@@ -484,7 +535,8 @@ public class MethodProperty implements Property {
return readOnly;
}
- /** Gets the value stored in the Property. The value is resolved by
+ /**
+ * Gets the value stored in the Property. The value is resolved by
* calling the specified getter method with the argument specified
* at instantiation.
*
@@ -498,7 +550,8 @@ public class MethodProperty implements Property {
}
}
- /** Returns the value of the MethodProperty in human readable textual
+ /**
+ * Returns the value of the <code>MethodProperty</code> 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.
@@ -512,13 +565,16 @@ public class MethodProperty implements Property {
return value.toString();
}
- /** <p>Sets the setter method and getter method argument lists.</p>
+ /**
+ * <p>
+ * Sets the setter method and getter method argument lists.
+ * </p>
*
- * @param getArgs fixed argument list to be passed to the getter method
- * @param setArgs fixed argument list to be passed to the setter method
+ * @param getArgs the fixed argument list to be passed to the getter method.
+ * @param setArgs 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
+ * {@link #setValue(Object newValue)} is called.
*/
public void setArguments(
Object[] getArgs,
@@ -533,22 +589,24 @@ public class MethodProperty implements Property {
this.setArgumentIndex = setArgumentIndex;
}
- /** Set the value of the property. This method supports setting from
+ /**
+ * 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.
*
- * @param newValue New value of the property.
+ * @param newValue 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>
+ * type directly or through <code>String</code>.
+ * @see #invokeSetMethod(Object)
*/
public void setValue(Object newValue)
throws Property.ReadOnlyException, Property.ConversionException {
- // Check the mode
+ // Checks the mode
if (isReadOnly())
throw new Property.ReadOnlyException();
@@ -562,7 +620,7 @@ public class MethodProperty implements Property {
Object value;
try {
- // Get the string constructor
+ // Gets the string constructor
Constructor constr =
getType().getConstructor(new Class[] { String.class });
@@ -572,13 +630,15 @@ public class MethodProperty implements Property {
throw new Property.ConversionException(e);
}
- // Create new object from the string
+ // Creates new object from the string
invokeSetMethod(value);
}
}
- /** Internal method to actually call the setter method of the wrapped
+ /**
+ * Internal method to actually call the setter method of the wrapped
* property.
+ * @param value
*/
private void invokeSetMethod(Object value) {
@@ -588,7 +648,7 @@ public class MethodProperty implements Property {
setMethod.invoke(instance, new Object[] { value });
else {
- // Set the value to argument array
+ // Sets the value to argument array
Object[] args = new Object[setArgs.length];
for (int i = 0; i < setArgs.length; i++)
args[i] = (i == setArgumentIndex) ? value : setArgs[i];
@@ -602,10 +662,11 @@ public class MethodProperty implements Property {
}
}
- /** Sets the Property's read-only mode to the specified status.
- *
- * @param newStatus new read-only status of the Property
- */
+ /**
+ * Sets the Property's read-only mode to the specified status.
+ *
+ * @param newStatus the new read-only status of the Property.
+ */
public void setReadOnly(boolean newStatus) {
boolean prevStatus = readOnly;
if (newStatus)
@@ -616,7 +677,8 @@ public class MethodProperty implements Property {
fireReadOnlyStatusChange();
}
- /** <code>Exception</code> object that signals that there were
+ /**
+ * <code>Exception</code> object that signals that there were
* problems calling or finding the specified getter or setter methods
* of the property.
* @author IT Mill Ltd.
@@ -629,22 +691,26 @@ public class MethodProperty implements Property {
* Serial generated by eclipse.
*/
private static final long serialVersionUID = 3690473623827855153L;
- /** Cause of the method exception */
+ /**
+ * Cause of the method exception
+ */
private Throwable cause;
- /** Constructs a new <code>MethodException</code> with the
+ /**
+ * Constructs a new <code>MethodException</code> with the
* specified detail message.
*
- * @param msg the detail message
+ * @param msg the detail message.
*/
public MethodException(String msg) {
super(msg);
}
- /** Constructs a new <code>MethodException</code> from another
+ /**
+ * Constructs a new <code>MethodException</code> from another
* exception.
*
- * @param exception cause of the exception
+ * @param cause the cause of the exception.
*/
public MethodException(Throwable cause) {
this.cause = cause;
@@ -656,7 +722,9 @@ public class MethodProperty implements Property {
return cause;
}
- /** Get the method property this exception originates from */
+ /**
+ * Gets the method property this exception originates from.
+ */
public MethodProperty getMethodProperty() {
return MethodProperty.this;
}
@@ -664,7 +732,8 @@ public class MethodProperty implements Property {
/* Events *************************************************************** */
- /** An <code>Event</code> object specifying the Property whose read-only
+ /**
+ * An <code>Event</code> object specifying the Property whose read-only
* status has been changed.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -679,15 +748,17 @@ public class MethodProperty implements Property {
*/
private static final long serialVersionUID = 3258129163305955896L;
- /** Constructs a new read-only status change event for this object.
+ /**
+ * Constructs a new read-only status change event for this object.
*
- * @param source source object of the event
+ * @param source source object of the event.
*/
protected ReadOnlyStatusChangeEvent(MethodProperty source) {
super(source);
}
- /** Gets the Property whose read-only state has changed.
+ /**
+ * Gets the Property whose read-only state has changed.
*
* @return source Property of the event.
*/
@@ -697,9 +768,10 @@ public class MethodProperty implements Property {
}
- /** Registers a new read-only status change listener for this Property.
+ /**
+ * Registers a new read-only status change listener for this Property.
*
- * @param listener the new Listener to be registered
+ * @param listener the new Listener to be registered.
*/
public void addListener(Property.ReadOnlyStatusChangeListener listener) {
if (readOnlyStatusChangeListeners == null)
@@ -707,9 +779,10 @@ public class MethodProperty implements Property {
readOnlyStatusChangeListeners.add(listener);
}
- /** Remove a previously registered read-only status change listener.
+ /**
+ * Removes a previously registered read-only status change listener.
*
- * @param listener listener to be removed
+ * @param listener the listener to be removed.
*/
public void removeListener(
Property.ReadOnlyStatusChangeListener listener) {
@@ -717,7 +790,8 @@ public class MethodProperty implements Property {
readOnlyStatusChangeListeners.remove(listener);
}
- /** Send a read only status change event to all registered listeners.
+ /**
+ * Sends a read only status change event to all registered listeners.
*/
private void fireReadOnlyStatusChange() {
if (readOnlyStatusChangeListeners != null) {
diff --git a/src/com/itmill/toolkit/data/util/ObjectProperty.java b/src/com/itmill/toolkit/data/util/ObjectProperty.java
index c8b8abef4d..21a7669bf6 100644
--- a/src/com/itmill/toolkit/data/util/ObjectProperty.java
+++ b/src/com/itmill/toolkit/data/util/ObjectProperty.java
@@ -33,7 +33,8 @@ import com.itmill.toolkit.data.Property;
import java.lang.reflect.Constructor;
import java.util.LinkedList;
-/** A simple data object containing one typed value. This class is a
+/**
+ * A simple data object containing one typed value. This class is a
* straightforward implementation of the the
* {@link com.itmill.toolkit.data.Property} interface.
*
@@ -44,39 +45,50 @@ import java.util.LinkedList;
public class ObjectProperty implements Property, Property.ValueChangeNotifier,
Property.ReadOnlyStatusChangeNotifier {
- /** A boolean value storing the Property's read-only status
+ /**
+ * A boolean value storing the Property's read-only status
* information.
*/
private boolean readOnly = false;
- /** The value contained by the Property. */
+ /**
+ * The value contained by the Property.
+ */
private Object value;
- /** Data type of the Property's value */
+ /**
+ * Data type of the Property's value.
+ */
private Class type;
- /** Internal list of registered value change listeners. */
+ /**
+ * Internal list of registered value change listeners.
+ */
private LinkedList valueChangeListeners = null;
- /** Internal list of registered read-only status change listeners. */
+ /**
+ * Internal list of registered read-only status change listeners.
+ */
private LinkedList readOnlyStatusChangeListeners = null;
- /** Creates a new instance of ObjectProperty with the given value.
+ /**
+ * Creates a new instance of ObjectProperty with the given value.
* The type of the property is automatically initialized to be
* the type of the given value.
*
- * @param value Initial value of the Property
+ * @param value 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
+ /**
+ * Creates a new instance of ObjectProperty with the given value and
* type.
*
- * @param value Initial value of the Property
- * @param type The type of the value. The value must be assignable to
- * given type
+ * @param value the Initial value of the Property.
+ * @param type the type of the value. The value must be assignable to
+ * given type.
*/
public ObjectProperty(Object value, Class type) {
@@ -85,20 +97,22 @@ Property.ReadOnlyStatusChangeNotifier {
setValue(value);
}
- /** Creates a new instance of ObjectProperty with the given value, type
+ /**
+ * Creates a new instance of ObjectProperty with the given value, type
* and read-only mode status.
*
- * @param value Initial value of the property.
- * @param type The type of the value. <code>value</code> must be
+ * @param value the Initial value of the property.
+ * @param type the type of the value. <code>value</code> must be
* assignable to this type.
- * @param readOnly Sets the read-only mode.
+ * @param readOnly Sets the read-only mode.
*/
public ObjectProperty(Object value, Class type, boolean readOnly) {
this(value,type);
setReadOnly(readOnly);
}
- /** Returns the type of the ObjectProperty. The methods
+ /**
+ * 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
@@ -110,7 +124,8 @@ Property.ReadOnlyStatusChangeNotifier {
return type;
}
- /** Gets the value stored in the Property.
+ /**
+ * Gets the value stored in the Property.
*
* @return the value stored in the Property
*/
@@ -118,7 +133,8 @@ Property.ReadOnlyStatusChangeNotifier {
return value;
}
- /** Returns the value of the ObjectProperty in human readable textual
+ /**
+ * 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.
@@ -134,7 +150,8 @@ Property.ReadOnlyStatusChangeNotifier {
return null;
}
- /** Tests if the Property is in read-only mode. In read-only mode calls
+ /**
+ * Tests if the Property is in read-only mode. In read-only mode calls
* to the method <code>setValue</code> will throw
* <code>ReadOnlyException</code>s and will not modify the value of the
* Property.
@@ -146,9 +163,10 @@ Property.ReadOnlyStatusChangeNotifier {
return readOnly;
}
- /** Sets the Property's read-only mode to the specified status.
+ /**
+ * Sets the Property's read-only mode to the specified status.
*
- * @param newStatus new read-only status of the Property
+ * @param newStatus the new read-only status of the Property.
*/
public void setReadOnly(boolean newStatus) {
if (newStatus != readOnly) {
@@ -157,36 +175,37 @@ Property.ReadOnlyStatusChangeNotifier {
}
}
- /** Set the value of the property. This method supports setting from
- * <code>String</code>s if either <code>String</code> is directly
+ /**
+ * 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.
*
- * @param newValue New value of the property.
+ * @param newValue 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
- * <code>newValue</code> can't be converted into the Property's native
+ * @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 {
- // Check the mode
+ // Checks the mode
if (isReadOnly()) throw new Property.ReadOnlyException();
- // Try to assign the compatible value directly
+ // Tries to assign the compatible value directly
if (newValue == null || type.isAssignableFrom(newValue.getClass()))
value = newValue;
// Otherwise try to convert the value trough string constructor
else try {
- // Get the string constructor
+ // Gets the string constructor
Constructor constr =
getType().getConstructor(new Class[] { String.class });
- // Create new object from the string
+ // Creates new object from the string
value = constr.newInstance(new Object[] {newValue.toString()});
} catch (java.lang.Exception e) {
@@ -198,7 +217,8 @@ Property.ReadOnlyStatusChangeNotifier {
/* Events *************************************************************** */
- /** An <code>Event</code> object specifying the ObjectProperty whose value
+ /**
+ * An <code>Event</code> object specifying the ObjectProperty whose value
* has changed.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -212,24 +232,27 @@ Property.ReadOnlyStatusChangeNotifier {
*/
private static final long serialVersionUID = 3256718468479725873L;
- /** Constructs a new value change event for this object.
+ /**
+ * Constructs a new value change event for this object.
*
- * @param source source object of the event
+ * @param source the source object of the event.
*/
protected ValueChangeEvent(ObjectProperty source) {
super(source);
}
- /** Gets the Property whose read-only state has changed.
+ /**
+ * Gets the Property whose read-only state has changed.
*
- * @return source Property of the event.
+ * @return source the Property of the event.
*/
public Property getProperty() {
return (Property) getSource();
}
}
- /** An <code>Event</code> object specifying the Property whose read-only
+ /**
+ * An <code>Event</code> object specifying the Property whose read-only
* status has been changed.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -243,7 +266,8 @@ Property.ReadOnlyStatusChangeNotifier {
*/
private static final long serialVersionUID = 3907208273529616696L;
- /** Constructs a new read-only status change event for this object.
+ /**
+ * Constructs a new read-only status change event for this object.
*
* @param source source object of the event
*/
@@ -251,7 +275,8 @@ Property.ReadOnlyStatusChangeNotifier {
super(source);
}
- /** Gets the Property whose read-only state has changed.
+ /**
+ * Gets the Property whose read-only state has changed.
*
* @return source Property of the event.
*/
@@ -260,16 +285,18 @@ Property.ReadOnlyStatusChangeNotifier {
}
}
- /** Remove a previously registered value change listener.
+ /**
+ * Removes a previously registered value change listener.
*
- * @param listener listener to be removed
+ * @param listener the listener to be removed.
*/
public void removeListener(Property.ValueChangeListener listener) {
if (valueChangeListeners != null)
valueChangeListeners.remove(listener);
}
- /** Registers a new value change listener for this ObjectProperty.
+ /**
+ * Registers a new value change listener for this ObjectProperty.
*
* @param listener the new Listener to be registered
*/
@@ -279,7 +306,8 @@ Property.ReadOnlyStatusChangeNotifier {
valueChangeListeners.add(listener);
}
- /** Registers a new read-only status change listener for this Property.
+ /**
+ * Registers a new read-only status change listener for this Property.
*
* @param listener the new Listener to be registered
*/
@@ -289,16 +317,18 @@ Property.ReadOnlyStatusChangeNotifier {
readOnlyStatusChangeListeners.add(listener);
}
- /** Remove a previously registered read-only status change listener.
+ /**
+ * Removes a previously registered read-only status change listener.
*
- * @param listener listener to be removed
+ * @param listener the listener to be removed.
*/
public void removeListener(Property.ReadOnlyStatusChangeListener listener) {
if (readOnlyStatusChangeListeners != null)
readOnlyStatusChangeListeners.remove(listener);
}
- /** Send a value change event to all registered listeners.
+ /**
+ * Sends a value change event to all registered listeners.
*/
private void fireValueChange() {
if (valueChangeListeners != null) {
@@ -310,7 +340,8 @@ Property.ReadOnlyStatusChangeNotifier {
}
}
- /** Send a read only status change event to all registered listeners.
+ /**
+ * Sends a read only status change event to all registered listeners.
*/
private void fireReadOnlyStatusChange() {
if (readOnlyStatusChangeListeners != null) {
diff --git a/src/com/itmill/toolkit/data/util/PropertysetItem.java b/src/com/itmill/toolkit/data/util/PropertysetItem.java
index 744a9c9d8e..f2fb4c9279 100644
--- a/src/com/itmill/toolkit/data/util/PropertysetItem.java
+++ b/src/com/itmill/toolkit/data/util/PropertysetItem.java
@@ -40,7 +40,7 @@ import com.itmill.toolkit.data.Property;
/**
* Class for handling a set of identified Properties. The elements contained in
- * a</code> MapItem</code> can be referenced using locally unique identifiers.
+ * a </code>MapItem</code> can be referenced using locally unique identifiers.
* The class supports listeners who are interested in changes to the Property
* set managed by the class.
*
@@ -54,13 +54,19 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
/* Private representation of the item *********************************** */
- /** Mapping from property id to property */
+ /**
+ * Mapping from property id to property.
+ */
private HashMap map = new HashMap();
- /** List of all property ids to maintain the order */
+ /**
+ * List of all property ids to maintain the order.
+ */
private LinkedList list = new LinkedList();
- /** List of property set modification listeners */
+ /**
+ * List of property set modification listeners.
+ */
private LinkedList propertySetChangeListeners = null;
/* Item methods ******************************************************** */
@@ -71,7 +77,7 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
* returned.
*
* @param id
- * 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) {
@@ -96,7 +102,7 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
* <code>false</code>.
*
* @param id
- * 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
*/
@@ -118,9 +124,9 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
* Tries to add a new Property into the Item.
*
* @param id
- * ID of the new Property
+ * the ID of the new Property.
* @param property
- * the Property to be added and associated with <code>id</code>
+ * the Property to be added and associated with the id.
* @return <code>true</code> if the operation succeeded,
* <code>false</code> if not
*/
@@ -198,7 +204,7 @@ public class PropertysetItem implements Item, Item.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) {
if (propertySetChangeListeners == null)
@@ -210,14 +216,16 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
* Removes a previously registered property set change listener.
*
* @param listener
- * Listener to be removed.
+ * the Listener to be removed.
*/
public void removeListener(Item.PropertySetChangeListener listener) {
if (propertySetChangeListeners != null)
propertySetChangeListeners.remove(listener);
}
- /** Send a Property set change event to all interested listeners */
+ /**
+ * Sends a Property set change event to all interested listeners.
+ */
private void fireItemPropertySetChange() {
if (propertySetChangeListeners != null) {
Object[] l = propertySetChangeListeners.toArray();
@@ -228,7 +236,25 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
.itemPropertySetChange(event);
}
}
-
+
+ /**
+ * Creates and returns a copy of this object.
+ * <p>
+ * The method <code>clone</code> performs a shallow copy of the <code>PropertysetItem</code>.
+ * </p>
+ * <p>
+ * Note : All arrays are considered to implement the interface Cloneable.
+ * Otherwise, this method creates a new instance of the class of this object
+ * and initializes all its fields with exactly the contents of the corresponding
+ * fields of this object, as if by assignment, the contents of the fields are not
+ * themselves cloned. Thus, this method performs a "shallow copy" of this object,
+ * not a "deep copy" operation.
+ * </p>
+ * @throws CloneNotSupportedException
+ * if the object's class does not support the Cloneable interface.
+ *
+ * @see java.lang.Object#clone()
+ */
public Object clone() throws CloneNotSupportedException {
PropertysetItem npsi = new PropertysetItem();
@@ -241,7 +267,14 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
return npsi;
}
-
+
+ /**
+ * Returns <code>true</code> if and only if the argument is not <code>null</code> and is a
+ * Boolean object that represents the same 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>.
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof PropertysetItem))
@@ -271,7 +304,12 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
return true;
}
-
+
+ /**
+ * Returns the hash code value for this list.
+ * @return the hash code value.
+ * @see java.lang.Object#hashCode()
+ */
public int hashCode() {
return (list == null ? 0 : list.hashCode())
diff --git a/src/com/itmill/toolkit/data/util/QueryContainer.java b/src/com/itmill/toolkit/data/util/QueryContainer.java
index 33febfe58c..e7ab940892 100644
--- a/src/com/itmill/toolkit/data/util/QueryContainer.java
+++ b/src/com/itmill/toolkit/data/util/QueryContainer.java
@@ -99,7 +99,7 @@ public class QueryContainer implements Container, Container.Ordered,
/**
* Constructs a new <code>QueryContainer</code> with the specified
- * queryStatement
+ * <code>queryStatement</code>.
*
* @param queryStatement
* Database query
@@ -121,7 +121,7 @@ public class QueryContainer implements Container, Container.Ordered,
/**
* Constructs a new <code>QueryContainer</code> with the specified
- * queryStatement using the default resultset type and default resultset concurrency
+ * queryStatement using the default resultset type and default resultset concurrency.
*
* @param queryStatement
* Database query
@@ -140,9 +140,11 @@ public class QueryContainer implements Container, Container.Ordered,
/**
* <p>
- * The <code>init</code> method s invoked by the constructor. This
- * method fills the container with the items and properties
+ * Fills the container with the items and properties. Invoked by the constructor.
* </p>
+ * @throws SQLException
+ * when parameter initialization fails.
+ * @see QueryContainer#QueryContainer(String, Connection, int, int).
*/
private void init() throws SQLException {
refresh();
@@ -162,8 +164,7 @@ public class QueryContainer implements Container, Container.Ordered,
/**
* <p>
- * The <code>refresh</code> method refreshes the items in the container.
- * This method will update the latest data to the container.
+ * Restores the items in the container. This method will update the latest data to the container.
* </p>
* Note : This method should be used to update the container with the latest items.
* @throws SQLException
@@ -181,8 +182,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>close</code> method closes the statement and nullify the
- * statement.
+ * Releases and nullify the statement.
*
* @throws SQLException
* when database operation fails
@@ -195,8 +195,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>getItem</code> method gets the Item with the given Item ID
- * from the Container.
+ * Gets the Item with the given Item ID from the Container.
*
* @param id
* ID of the Item to retrieve
@@ -209,8 +208,7 @@ public class QueryContainer implements Container, Container.Ordered,
/**
* <p>
- * The <code>getContainerPropertyIds</code> method gets the collection of
- * propertyId from the Container.
+ * Gets the collection of propertyId from the Container.
* </p>
*
* @return Collection of Property ID.
@@ -221,9 +219,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>getItemIds</code> method gets the collection of all the item id in the container.
- * </p>
+ * Gets the collection of all the item id in the container.
*
* @return collection of Item IDs
*/
@@ -236,8 +232,7 @@ public class QueryContainer implements Container, Container.Ordered,
/**
* <p>
- * The <code>getContainerProperty</code> method gets the property
- * identified by the given itemId and propertyId from the container.If the
+ * Gets the property identified by the given itemId and propertyId from the container.If the
* container does not contain the property <code>null</code> is returned.
* </p>
*
@@ -266,11 +261,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>getType</code> gets the data type of all properties
- * identified by the given type ID.
- * </p>
- *
+ * Gets the data type of all properties identified by the given type ID.
* @param id
* ID identifying the Properties
*
@@ -282,21 +273,17 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>size</code> method gets the number of items in the container.
+ * Gets the number of items in the container.
*
* @return the number of items in the container.
*/
-
public int size() {
return size;
}
/**
- * <p>
- * The <code>containsId</code> method returns <code>true</code> if given
- * id is there in container else <code>false</code>.
- * <p>
- *
+ * Tests if the list contains the specified Item. Returns <code>true</code> if
+ * given id is there in container else <code>false</code>.
* @param id
* ID the of Item to be tested.
*/
@@ -312,23 +299,23 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>addItem</code> method creates a new Item with the given ID
- * into the Container.
+ * Creates a new Item with the given ID into the Container.
*
- * @param arg0
+ * @param itemId
* ID of the Item to be created.
+ *
+ * @return Created new Item, or <code>null</code> if it fails.
*
* @throws UnsupportedOperationException
* if the addItem method is not supported.
*/
- public Item addItem(Object arg0) throws UnsupportedOperationException {
+ public Item addItem(Object itemId) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * The <code>addItem</code> method creates a new Item into the Container,
- * and assign it an ID.
- *
+ * Creates a new Item into the Container, and assign it an ID.
+ * @return ID of the newly created Item, or <code>null</code> if it fails.
* @throws UnsupportedOperationException
* if the addItem method is not supported.
*/
@@ -337,54 +324,52 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>addItem</code> method removes the Item identified by ItemId
- * from the Container.
- *
+ * 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, otherwise <code>false</code>.
* @throws UnsupportedOperationException
* if the removeItem method is not supported.
*/
- public boolean removeItem(Object arg0) throws UnsupportedOperationException {
+ public boolean removeItem(Object itemId) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * The <code>addContainerProperty</code> method adds a new Property to all
- * Items in the Container.
+ * Adds a new Property to all Items in the Container.
*
- * @param arg0
+ * @param propertyId
* ID of the Property
- * @param arg1
+ * @param type
* Data type of the new Property
- * @param arg2
- * The value all created Properties are initialized to
- *
+ * @param defaultValue
+ * The value all created Properties are initialized to.
+ * @return <code>true</code> if the operation succeeded, otherwise <code>false</code>.
* @throws UnsupportedOperationException
* if the addContainerProperty method is not supported.
*/
- public boolean addContainerProperty(Object arg0, Class arg1, Object arg2)
+ public boolean addContainerProperty(Object propertyId, Class type, Object defaultValue)
throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * The <code>removeContainerProperty</code> method removes a Property
- * specified by the given Property ID from the Container.
+ * Removes a Property specified by the given Property ID from the Container.
*
- * @param arg0
+ * @param propertyId
* ID of the Property to remove
- *
+ * @return <code>true</code> if the operation succeeded, otherwise <code>false</code>.
* @throws UnsupportedOperationException
* if the removeContainerProperty method is not supported.
*/
- public boolean removeContainerProperty(Object arg0)
+ public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * The <code>removeAllItems</code> method removes all Items from the
- * Container
- *
+ * Removes all Items from the Container.
+ * @return <code>true</code> if the operation succeeded, otherwise <code>false</code>.
* @throws UnsupportedOperationException
* if the removeAllItems method is not supported.
*/
@@ -393,36 +378,38 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>addItemAfter</code> method add new item after the given item.
+ * Adds new item after the given item.
*
- * @param arg0
+ * @param previousItemId
* Id of the previous item in ordered container.
- * @param arg1
+ * @param newItemId
* Id of the new item to be added.
+ * @return Returns new item or <code>null</code> if the operation fails.
* @throws UnsupportedOperationException
* if the addItemAfter method is not supported.
*/
- public Item addItemAfter(Object arg0, Object arg1)
+ public Item addItemAfter(Object previousItemId, Object newItemId)
throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * The <code>addItemAfter</code> method add new item after the given item.
+ * Adds new item after the given item.
*
- * @param arg0
+ * @param previousItemId
* Id of the previous item in ordered container.
+ * @return Returns item id created new item or <code>null</code> if the operation fails.
+ * @throws UnsupportedOperationException
+ * if the addItemAfter method is not supported.
*/
- public Object addItemAfter(Object arg0)
+ public Object addItemAfter(Object previousItemId)
throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * <p>
- * The <code>firstItemId</code> method returns id of first item in the
- * Container.
- * </p>
+ * Returns id of first item in the Container.
+ * @return ID of the first Item in the list.
*/
public Object firstItemId() {
if (size < 1)
@@ -431,10 +418,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>isFirstId</code> method return <code>true</code> if given
- * id is first id at first index.
- * </p>
+ * Returns <code>true</code> if given id is first id at first index.
*
* @param id
* ID of an Item in the Container.
@@ -445,13 +429,11 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>isLastId</code> method return <code>true</code> if given id
- * is last id at last index
- * </p>
+ * Returns <code>true</code> if given id is last id at last index.
*
* @param id
* ID of an Item in the Container
+ *
*/
public boolean isLastId(Object id) {
return size > 0 && (id instanceof Integer)
@@ -459,10 +441,8 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>lastItemId</code> method returns id of last item in the
- * Container.
- * </p>
+ * Returns id of last item in the Container.
+ * @return ID of the last Item.
*/
public Object lastItemId() {
if (size < 1)
@@ -471,13 +451,11 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>nextItemId</code> method return id of next item in container
- * at next index.
- * </p>
+ * Returns id of next item in container at next index.
*
* @param id
* ID of an Item in the Container.
+ * @return ID of the next Item or null.
*/
public Object nextItemId(Object id) {
if (size < 1 || !(id instanceof Integer))
@@ -489,14 +467,12 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>prevItemId</code> method return id of previous item in
- * container at previous index.
- * </p>
+ * Returns id of previous item in container at previous index.
*
* @param id
* ID of an Item in the Container.
- */
+ * @return ID of the previous Item or null.
+ */
public Object prevItemId(Object id) {
if (size < 1 || !(id instanceof Integer))
return null;
@@ -507,9 +483,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
* The <code>Row</code> class implements methods of Item.
- * </p>
*/
/** Query result row */
class Row implements Item {
@@ -521,30 +495,23 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>addItemProperty</code> method adds the item property.
- * </p>
- *
- * @param arg0
+ * Adds the item property.
+ * @param id
* ID of the new Property.
- * @param arg1
+ * @param property
* Property to be added and associated with ID.
+ * @return <code>true</code> if the operation succeeded, otherwise <code>false</code>.
* @throws UnsupportedOperationException
* if the addItemProperty method is not supported.
*/
- public boolean addItemProperty(Object arg0, Property arg1)
+ public boolean addItemProperty(Object id, Property property)
throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * <p>
- * The <code>getItemProperty</code> gets the property corresponding to
- * the given property ID stored in the Item. If the Item does not
- * contain the Property, <code>null</code> is returned.
- * </p>
- *
- * @param id
+ * Gets the property corresponding to the given property ID stored in the Item.
+ * @param propertyId
* identifier of the Property to get
* @return the Property with the given ID or <code>null</code>
*/
@@ -553,11 +520,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * <p>
- * The <code>getItemPropertyIds</code> method gets the collection of
- * property IDs stored in the Item.
- * </p>
- *
+ * Gets the collection of property IDs stored in the Item.
* @return unmodifiable collection containing IDs of the Properties
* stored the Item.
*/
@@ -567,15 +530,14 @@ public class QueryContainer implements Container, Container.Ordered,
/**
* <p>
- * The <code>removeItemProperty</code> method removes given item
- * property return <code>true</code> if the item property is removed
+ * Removes given item property return <code>true</code> if the item property is removed
* <code>false</code> if not.
* </p>
- *
+ * @param id ID of the Property to be removed.
* @throws UnsupportedOperationException
* if the removeItemProperty is not supported.
*/
- public boolean removeItemProperty(Object arg0)
+ public boolean removeItemProperty(Object id)
throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
@@ -583,7 +545,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>finalize</code> method closes the statement.
+ * Closes the statement.
*
* @see #close()
*/
@@ -596,42 +558,42 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>addItemAt</code> method adds the given item at the position
- * of given index.
+ * Adds the given item at the position of given index.
*
- * @param arg0
+ * @param index
* Index to add the new item.
- * @param arg1
+ * @param newItemId
* Id of the new item to be added.
- *
+ * @return Returns new item or <code>null</code> if the operation fails.
* @throws UnsupportedOperationException
+ * if the addItemAt is not supported.
*/
- public Item addItemAt(int arg0, Object arg1)
+ public Item addItemAt(int index, Object newItemId)
throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * The <code>addItemAt</code> method adds the item at the position of
- * provided index in the container.
+ * Adds the item at the position of provided index in the container.
*
- * @param arg0
+ * @param index
* Index to add the new item.
+ * @return Returns item id created new item or <code>null</code> if the operation fails.
*
* @throws UnsupportedOperationException
* if the addItemAt is not supported.
*/
- public Object addItemAt(int arg0) throws UnsupportedOperationException {
+ public Object addItemAt(int index) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
- * The <code>getIdByIndex</code> method gets the Index id in the
- * container.
+ * Gets the Index id in the container.
*
* @param index
* Index Id.
+ * @return ID in the given index.
*/
public Object getIdByIndex(int index) {
if (size < 1 || index < 0 || index >= size)
@@ -640,8 +602,7 @@ public class QueryContainer implements Container, Container.Ordered,
}
/**
- * The <code>indexOfId</code> gets the index of the Item corresponding to
- * <code>id</code> in the container.
+ * Gets the index of the Item corresponding to id in the container.
*
* @param id
* ID of an Item in the Container
diff --git a/src/com/itmill/toolkit/data/validator/CompositeValidator.java b/src/com/itmill/toolkit/data/validator/CompositeValidator.java
index 90c01f9eed..cb3bbae900 100644
--- a/src/com/itmill/toolkit/data/validator/CompositeValidator.java
+++ b/src/com/itmill/toolkit/data/validator/CompositeValidator.java
@@ -35,13 +35,12 @@ import java.util.LinkedList;
import com.itmill.toolkit.data.*;
-/** Composite validator.
- *
- * This validator allows you to chain (compose) many validators
+/**
+ * The <code>CompositeValidator</code> allows you to chain (compose) many validators
* to validate one field. The contained validators may be required
* to all validate the value to validate or it may be enough that
* one contained validator validates the value. This behaviour is
- * controlled by the modes AND and OR.
+ * controlled by the modes <code>AND</code> and <code>OR</code>.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -49,43 +48,58 @@ import com.itmill.toolkit.data.*;
*/
public class CompositeValidator implements Validator {
- /** The validators are combined with AND clause: validity of the
+ /**
+ * 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 OR clause: validity of the
+ /**
+ * 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;
- /** The validators are combined with and clause: validity of the
+ /**
+ * The validators are combined with and clause: validity of the
* composite implies validity of the all validators it is composed of
*/
public static final int MODE_DEFAULT = MODE_AND;
- /** Operation mode */
+ /**
+ * Operation mode.
+ */
private int mode = MODE_DEFAULT;
- /** List of contained validators */
+ /**
+ * List of contained validators.
+ */
private LinkedList validators = new LinkedList();
- /** Error message */
+ /**
+ * Error message.
+ */
private String errorMessage;
- /** Construct composite validator in AND mode without error message */
+ /**
+ * Construct composite validator in <code>AND</code> mode without error message.
+ */
public CompositeValidator() {
}
- /** Construct composite validator in given mode */
+ /**
+ * Constructs composite validator in given mode.
+ */
public CompositeValidator(int mode, String errorMessage) {
setMode(mode);
setErrorMessage(errorMessage);
}
- /** Validate the the given value.
+ /**
+ * Validates the given value.
+ * <p>
* The value is valid, if:
* <ul>
* <li><code>MODE_AND</code>: All of the sub-validators are valid
@@ -95,6 +109,10 @@ public class CompositeValidator implements Validator {
* If the value is invalid, validation error is thrown. If the
* error message is set (non-null), it is used. If the error message
* has not been set, the first error occurred is thrown.
+ * </p>
+ * @param value the value to check.
+ * @throws Validator.InvalidValueException
+ * if the value is not valid.
*/
public void validate(Object value) throws Validator.InvalidValueException {
switch (mode) {
@@ -117,15 +135,17 @@ public class CompositeValidator implements Validator {
if (em != null) throw new Validator.InvalidValueException(em);
else throw first;
}
- throw new IllegalStateException("The valitor is in unsupported operation mode");
+ throw new IllegalStateException("The validator is in unsupported operation mode");
}
- /** Check the validity of the the given value.
+ /**
+ * Checks the validity of the the given value.
* The value is valid, if:
* <ul>
* <li><code>MODE_AND</code>: All of the sub-validators are valid
* <li><code>MODE_OR</code>: Any of the sub-validators are valid
* </ul>
+ * @param value the value to check.
*/
public boolean isValid(Object value) {
switch (mode) {
@@ -148,7 +168,8 @@ public class CompositeValidator implements Validator {
throw new IllegalStateException("The valitor is in unsupported operation mode");
}
- /** Get the mode of the validator.
+ /**
+ * Gets the mode of the validator.
* @return Operation mode of the validator:
* <code>MODE_AND</code> or <code>MODE_OR</code>.
*/
@@ -156,11 +177,13 @@ public class CompositeValidator implements Validator {
return mode;
}
- /** Set the mode of the validator. The valid modes are:
+ /**
+ * Sets the mode of the validator. The valid modes are:
* <ul>
* <li><code>MODE_AND</code> (default)
* <li><code>MODE_OR</code>
* </ul>
+ * @param mode the mode to set.
*/
public void setMode(int mode) {
if (mode != MODE_AND && mode != MODE_OR)
@@ -168,7 +191,8 @@ public class CompositeValidator implements Validator {
this.mode = mode;
}
- /** Get the error message for the composite validator.
+ /**
+ * Gets the error message for the composite validator.
* If the error message is null, original error messages of the
* sub-validators are used instead.
*/
@@ -180,37 +204,48 @@ public class CompositeValidator implements Validator {
return null;
}
- /** Set the error message for the composite validator.
+ /**
+ * Sets the error message for the composite validator.
* If the error message is null, original error messages of the
* sub-validators are used instead.
+ * @param errorMessage the Error Message to set.
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
- /** Add validator to the interface */
+ /**
+ * Adds validator to the interface.
+ * @param validator the Validator object which performs validation checks
+ * on this set of data field values.
+ */
public void addValidator(Validator validator) {
if (validator == null)
return;
validators.add(validator);
}
- /** Remove a validator from the composite */
+ /**
+ * Removes a validator from the composite.
+ * @param validator the Validator object which performs validation checks
+ * on this set of data field values.
+ */
public void removeValidator(Validator validator) {
validators.remove(validator);
}
- /** Get sub-validators by class.
+ /**
+ * Gets sub-validators by class.
*
* <p>If the component contains
* directly or recursively (it contains another composite
* containing the validator) validators compatible with given type they
- * are returned. This only applies to AND mode composite
+ * are returned. This only applies to <code>AND</code> mode composite
* validators.</p>
*
- * <p>If the validator is in OR mode or does not contain any
+ * <p>If the validator is in <code>OR</code> mode or does not contain any
* validators of given type null is returned. </p>
- *
+ *
* @return Collection of validators compatible with given type that
* must apply or null if none fould.
*/
diff --git a/src/com/itmill/toolkit/data/validator/NullValidator.java b/src/com/itmill/toolkit/data/validator/NullValidator.java
index 29ee031a91..948c2906ae 100644
--- a/src/com/itmill/toolkit/data/validator/NullValidator.java
+++ b/src/com/itmill/toolkit/data/validator/NullValidator.java
@@ -31,7 +31,8 @@ package com.itmill.toolkit.data.validator;
import com.itmill.toolkit.data.*;
-/* This validator is used for validating properties that
+/**
+ * This validator is used for validating properties that
* do or do not allow null values.
* @author IT Mill Ltd.
* @version @VERSION@
@@ -42,53 +43,64 @@ public class NullValidator implements Validator {
private boolean allowNull;
private String errorMessage;
- /** Create a new NullValidator
- * @param errorMessage - The error message to display on invalidation.
- * @param allowNull - Are nulls allowed?
+ /**
+ * Creates a new NullValidator
+ * @param errorMessage the error message to display on invalidation.
+ * @param allowNull Are nulls allowed?
*/
public NullValidator(String errorMessage,boolean allowNull) {
setErrorMessage(errorMessage);
setNullAllowed(allowNull);
}
- /** Validate the data given in value.
- * @param value - The value to validate.
- * @throws Validator.InvalidValueException - The value was invalid.
+ /**
+ * Validates the data given in value.
+ * @param value the value to validate.
+ * @throws Validator.InvalidValueException if the value was invalid.
*/
public void validate(Object value) throws Validator.InvalidValueException {
if ((allowNull && value != null) || (!allowNull && value == null))
throw new Validator.InvalidValueException(errorMessage);
}
- /** True of the value is valid.
- * @param value - The value to validate.
+ /**
+ * Tests if the given value is valid.
+ * @param value the value to validate.
+ * @returns <code>true</code> for valid value, otherwise <code>false</code>.
*/
public boolean isValid(Object value) {
return allowNull ? value == null : value != null;
}
- /** True if nulls are allowed.
+ /**
+ * Returns <code>true</code> if nulls are allowed otherwise <code>false</code>.
*/
public final boolean isNullAllowed() {
return allowNull;
}
- /** Sets if nulls are to be allowed.
- * @param allowNull - Do we allow nulls?
+ /**
+ * Sets if nulls are to be allowed.
+ * @param allowNull Do we allow nulls?
*/
public void setNullAllowed(boolean allowNull) {
this.allowNull = allowNull;
}
- /** Get the error message that is displayed in case the
+ /**
+ * Gets the error message that is displayed in case the
* value is invalid.
+ * @return the Error Message.
*/
public String getErrorMessage() {
return errorMessage;
}
- /** Set the error message to be displayed on invalid
+ /**
+ * Sets the error message to be displayed on invalid
* value.
+ * @param errorMessage
+ * the Error Message to set.
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
diff --git a/src/com/itmill/toolkit/data/validator/StringLengthValidator.java b/src/com/itmill/toolkit/data/validator/StringLengthValidator.java
index 63dd22f200..bfeb55b5b9 100644
--- a/src/com/itmill/toolkit/data/validator/StringLengthValidator.java
+++ b/src/com/itmill/toolkit/data/validator/StringLengthValidator.java
@@ -30,16 +30,8 @@ package com.itmill.toolkit.data.validator;
import com.itmill.toolkit.data.*;
-
-/**
- * @author IT Mill Ltd.
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-/** This validator is used to validate the lenght of strings.
+/**
+ * This <code>StringLengthValidator</code> is used to validate the length of strings.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -52,21 +44,23 @@ public class StringLengthValidator implements Validator {
private boolean allowNull = true;
private String errorMessage;
- /** Create a new StringLengthValidator with a given error message.
+ /**
+ * Creates a new StringLengthValidator with a given error message.
*
- * @param errorMessage - The message to display in case the value does not validate.
+ * @param errorMessage the message to display in case the value does not validate.
*/
public StringLengthValidator(String errorMessage) {
setErrorMessage(errorMessage);
}
- /** Create a new StringLenghtValidator with a given error message,
- * permissable lenghts and null-string allowance.
+ /**
+ * Creates a new StringLengthValidator with a given error message,
+ * permissable lengths and null-string allowance.
*
- * @param errorMessage - The message to display in case the value does not validate.
- * @param minLenght - The minimum permissable lenght of the string.
- * @param maxLenght - The maximum permissable lenght of the string.
- * @param allowNull - Are null strings permissable?
+ * @param errorMessage the message to display in case the value does not validate.
+ * @param minLength the minimum permissable length of the string.
+ * @param maxLength the maximum permissable length of the string.
+ * @param allowNull Are null strings permissable?
*/
public StringLengthValidator(
String errorMessage,
@@ -79,8 +73,11 @@ public class StringLengthValidator implements Validator {
setNullAllowed(allowNull);
}
- /** Validate the value.
- * @param value - The value to validate.
+ /**
+ * Validates the value.
+ * @param value the value to validate.
+ * @throws Validator.InvalidValueException
+ * if the value was invalid.
*/
public void validate(Object value) throws Validator.InvalidValueException {
if (value == null && !allowNull)
@@ -94,8 +91,10 @@ public class StringLengthValidator implements Validator {
throw new Validator.InvalidValueException(errorMessage);
}
- /** True if the value is valid.
- * @param value - The value to validate.
+ /**
+ * Checks if the given value is valid.
+ * @param value the value to validate.
+ * @return <code>true</code> for valid value, otherwise <code>false</code>.
*/
public boolean isValid(Object value) {
if (value == null && !allowNull)
@@ -110,32 +109,40 @@ public class StringLengthValidator implements Validator {
return true;
}
- /** True if null strings are allowed.
+ /**
+ * Returns <code>true</code> if null strings are allowed.
+ * @return <code>true</code> if allows null string, otherwise <code>false</code>.
*/
public final boolean isNullAllowed() {
return allowNull;
}
- /** Get the maximum permissable length of the string.
+ /**
+ * Gets the maximum permissable length of the string.
+ * @return the maximum length of the string.
*/
public final int getMaxLength() {
return maxLength;
}
- /** Get the minimum permissable lenght of the string.
+ /**
+ * Gets the minimum permissable length of the string.
+ * @return the minimum length of the string.
*/
public final int getMinLength() {
return minLength;
}
- /** Sets wheter null-strings are to be allowed.
+ /**
+ * Sets whether null-strings are to be allowed.
*/
public void setNullAllowed(boolean allowNull) {
this.allowNull = allowNull;
}
- /** Set the maximum permissable length of the string.
- * @param maxLenght - The lenght to set.
+ /**
+ * Sets the maximum permissable length of the string.
+ * @param maxLength the length to set.
*/
public void setMaxLength(int maxLength) {
if (maxLength < -1)
@@ -143,8 +150,9 @@ public class StringLengthValidator implements Validator {
this.maxLength = maxLength;
}
- /** Sets the minimum permissable lenght.
- * @param minLenght - The lenght to set.
+ /**
+ * Sets the minimum permissable length.
+ * @param minLength the length to set.
*/
public void setMinLength(int minLength) {
if (minLength < -1)
@@ -152,15 +160,20 @@ public class StringLengthValidator implements Validator {
this.minLength = minLength;
}
- /** Gets the message to be displayed in case the
+ /**
+ * Gets the message to be displayed in case the
* value does not validate.
+ * @return the Error Message.
*/
public String getErrorMessage() {
return errorMessage;
}
- /** Sets the message to be displayer in case the
+ /**
+ * Sets the message to be displayer in case the
* value does not validate.
+ * @param errorMessage
+ * the Error Message to set.
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
diff --git a/src/com/itmill/toolkit/event/Action.java b/src/com/itmill/toolkit/event/Action.java
index 91d093e54f..34ccd8a192 100644
--- a/src/com/itmill/toolkit/event/Action.java
+++ b/src/com/itmill/toolkit/event/Action.java
@@ -30,7 +30,8 @@ package com.itmill.toolkit.event;
import com.itmill.toolkit.terminal.*;
-/** Implements the action framework. This class contains
+/**
+ * Implements the action framework. This class contains
* subinterfaces for action handling and listing, and for action handler
* registrations and unregistration.
*
@@ -40,108 +41,125 @@ import com.itmill.toolkit.terminal.*;
*/
public class Action {
- /** Action title */
+ /**
+ * Action title.
+ */
private String caption;
- /** Action icon */
+ /**
+ * Action icon.
+ */
private Resource icon = null;
- /** Constructs a new action with the given caption.
+ /**
+ * Constructs a new action with the given caption.
*
- * @param caption caption for the new action.
+ * @param caption the caption for the new action.
*/
public Action(String caption) {
this.caption = caption;
}
- /** Constructs a new action with the given caption string and icon.
+ /**
+ * Constructs a new action with the given caption string and icon.
*
- * @param caption caption for the new action.
- * @param icon icon for the new action
+ * @param caption the caption for the new action.
+ * @param icon the icon for the new action.
*/
public Action(String caption, Resource icon) {
this.caption = caption;
this.icon = icon;
}
- /** Returns the action's caption.
+ /**
+ * Returns the action's caption.
*
- * @return the action's caption as a <code>String</code>
+ * @return the action's caption as a <code>String</code>.
*/
public String getCaption() {
return caption;
}
- /** Returns the action's icon.
+ /**
+ * Returns the action's icon.
*
- * @return Icon
+ * @return the action's Icon.
*/
public Resource getIcon() {
return icon;
}
- /** Interface implemented by classes who wish to handle actions.
+ /**
+ * Interface implemented by classes who wish to handle actions.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface Handler {
- /** Returns the list of actions applicable to this handler.
+ /**
+ * Gets the list of actions applicable to this handler.
*
- * @param target The target handler to list actions for. For item
+ * @param target 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.
+ * @param sender 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);
- /** Handles an action for the given target. The handler method
+ /**
+ * Handles an action for the given target. The handler method
* may just discard the action if it's not suitable.
*
- * @param action The action to be handled
- * @param sender The sender of the action. This is most often the
+ * @param action the action to be handled.
+ * @param sender the sender of the action. This is most often the
* action container.
- * @param target The target of the <code>action</code>. For item
+ * @param target the target of the action. For item
* containers this is the item id.
*/
public void handleAction(Action action, Object sender, Object target);
}
- /** Interface implemented by all components where actions can be
+ /**
+ * Interface implemented by all components where actions can be
* registered. This means that the components lets others to register
* as action handlers to it. When the component receives an action
* targeting its contents it should loop all action handlers registered
- * to it and let them hanle the action.
+ * to it and let them handle the action.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface Container {
- /** Registers a new action handler for this container
+ /**
+ * Registers a new action handler for this container
*
* @param actionHandler the new handler to be added.
*/
public void addActionHandler(Action.Handler actionHandler);
- /** Remove a previously registered action handler for the contents
+ /**
+ * Removes a previously registered action handler for the contents
* of this container.
*
- * @param actionHandler the handler to be removed
+ * @param actionHandler the handler to be removed.
*/
public void removeActionHandler(Action.Handler actionHandler);
}
- /** Sets the caption.
- * @param caption The caption to set
+ /**
+ * Sets the caption.
+ * @param caption the caption to set.
*/
public void setCaption(String caption) {
this.caption = caption;
}
- /** Sets the icon.
- * @param icon The icon to set
+ /**
+ * Sets the icon.
+ * @param icon the icon to set.
*/
public void setIcon(Resource icon) {
this.icon = icon;
diff --git a/src/com/itmill/toolkit/event/EventRouter.java b/src/com/itmill/toolkit/event/EventRouter.java
index 0c04f52a83..d3c1042acd 100644
--- a/src/com/itmill/toolkit/event/EventRouter.java
+++ b/src/com/itmill/toolkit/event/EventRouter.java
@@ -33,7 +33,8 @@ import java.util.LinkedList;
import java.util.Iterator;
import java.lang.reflect.Method;
-/** Event router class implementing the inheritable event
+/**
+ * <code>EventRouter</code> class implementing the inheritable event
* listening model. For more information on the event model see the
* {@link com.itmill.toolkit.event package documentation}.
*
@@ -43,7 +44,9 @@ import java.lang.reflect.Method;
*/
public class EventRouter implements MethodEventSource {
- /** List of registered listeners. */
+ /**
+ * List of registered listeners.
+ */
private LinkedList listenerList = null;
/* Registers a new listener with the specified activation method to
@@ -143,15 +146,18 @@ public class EventRouter implements MethodEventSource {
}
}
- /** Remove all listeners from event router */
+ /**
+ * Removes all listeners from event router.
+ */
public void removeAllListeners() {
listenerList = null;
}
- /** Send an event to all registered listeners. The listeners will decide
+ /**
+ * Sends an event to all registered listeners. The listeners will decide
* if the activation method should be called or not.
*
- * @param event Event to be sent to all listeners
+ * @param event the Event to be sent to all listeners.
*/
public void fireEvent(EventObject event) {
diff --git a/src/com/itmill/toolkit/event/ListenerMethod.java b/src/com/itmill/toolkit/event/ListenerMethod.java
index e73becf66b..66ab99868c 100644
--- a/src/com/itmill/toolkit/event/ListenerMethod.java
+++ b/src/com/itmill/toolkit/event/ListenerMethod.java
@@ -32,18 +32,26 @@ import java.util.EventListener;
import java.util.EventObject;
import java.lang.reflect.Method;
-/** <p>One registered event listener. This class contains the listener
+/**
+ * <p>
+ * One registered event listener. This class contains the listener
* object reference, listened event type, the trigger method to call when
* the event fires, and the optional argument list to pass to the method and
- * the index of the argument to replace with the event object. It provides
- * several constructors that allow omission of the optional arguments, and
- * giving the listener method directly, or having the constructor to reflect
- * it using merely the name of the method.</p>
+ * the index of the argument to replace with the event object.
+ * </p>
*
- * <p>It should be pointed out that the method
+ * <p>
+ * This Class provides several constructors that allow omission of the optional
+ * arguments, and giving the listener method directly, or having the constructor
+ * to reflect it using merely the name of the method.
+ * </p>
+ *
+ * <p>
+ * It should be pointed out that the method
* {@link #receiveEvent(EventObject event)} is the one that filters out the
* events that do not match with the given event type and thus do not result
- * in calling of the trigger method.</p>
+ * in calling of the trigger method.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -51,45 +59,57 @@ import java.lang.reflect.Method;
*/
public class ListenerMethod implements EventListener {
- /** Type of the event that should trigger this listener. Also the
+ /**
+ * Type of the event that should trigger this listener. Also the
* subclasses of this class are accepted to trigger the listener.
*/
private Class eventType;
- /** The object containing the trigger method, */
+ /**
+ * The object containing the trigger method.
+ */
private Object object;
- /** The trigger method to call when an event passing the given criteria
+ /**
+ * The trigger method to call when an event passing the given criteria
* fires.
*/
private Method method;
- /** Optional argument set to pass to the trigger method. */
+ /**
+ * Optional argument set to pass to the trigger method.
+ */
private Object[] arguments;
- /** Optional index to <code>arguments</code> that point out which one
+ /**
+ * Optional index to <code>arguments</code> that point out which one
* should be replaced with the triggering event object and thus be
* passed to the trigger method.
*/
private int eventArgumentIndex;
- /** <p>Constructs a new event listener from a trigger method, it's
+ /**
+ * <p>
+ * Constructs a new event listener from a trigger method, it's
* arguments and the argument index specifying which one is replaced
- * with the event object when the trigger method is called.</p>
+ * with the event object when the trigger method is called.
+ * </p>
*
- * <p>This constructor gets the trigger method as a parameter so it
- * does not need to reflect to find it out.</p>
+ * <p>
+ * This constructor gets the trigger method as a parameter so it
+ * does not need to reflect to find it out.
+ * </p>
*
- * @param eventType The event type that is listener listens to. All
+ * @param eventType the event type that is listener listens to. All
* events of this kind (or its subclasses) result in calling the trigger
* method.
- * @param object The object instance that contains the trigger method
+ * @param object the object instance that contains the trigger method
* @param method the trigger method
- * @param arguments arguments to be passed to the trigger method
+ * @param arguments the arguments to be passed to the trigger method
* @param eventArgumentIndex An index to the argument list. This index
* points out the argument that is replaced with the event object before
* the argument set is passed to the trigger method. If
- * <code>eventArgumentIndex</code> is negative, the triggering event
+ * the eventArgumentIndex is negative, the triggering event
* object will not be passed to the trigger method, though it is still
* called.
* @throws java.lang.IllegalArgumentException if <code>method</code>
@@ -103,15 +123,15 @@ public class ListenerMethod implements EventListener {
int eventArgumentIndex)
throws java.lang.IllegalArgumentException {
- // Check that the object is of correct type
+ // Checks that the object is of correct type
if (!method.getDeclaringClass().isAssignableFrom(object.getClass()))
throw new java.lang.IllegalArgumentException();
- // Check that the event argument is null
+ // Checks that the event argument is null
if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null)
throw new java.lang.IllegalArgumentException();
- // Check the event type is supported by the method
+ // Checks the event type is supported by the method
if (eventArgumentIndex >= 0
&& !method.getParameterTypes()[eventArgumentIndex].isAssignableFrom(
eventType))
@@ -124,26 +144,28 @@ public class ListenerMethod implements EventListener {
this.eventArgumentIndex = eventArgumentIndex;
}
- /** <p>Constructs a new event listener from a trigger method name, it's
+ /**
+ * <p>
+ * Constructs a new event listener from a trigger method name, it's
* arguments and the argument index specifying which one is replaced
* with the event object. The actual trigger method is reflected from
* <code>object</code>, and
* <code>java.lang.IllegalArgumentException</code> is thrown unless
* exactly one match is found.
- *
- * @param eventType The event type that is listener listens to. All
+ * </p>
+ * @param eventType the event type that is listener listens to. All
* events of this kind (or its subclasses) result in calling the trigger
* method.
- * @param object The object instance that contains the trigger method
- * @param methodName The name of the trigger method. If
- * <code>object</code> does not contain the method or it contains more
+ * @param object the object instance that contains the trigger method.
+ * @param methodName the name of the trigger method. If the
+ * object does not contain the method or it contains more
* than one matching methods
* <code>java.lang.IllegalArgumentException</code> is thrown.
- * @param arguments arguments to be passed to the trigger method
+ * @param arguments the arguments to be passed to the trigger method.
* @param eventArgumentIndex An index to the argument list. This index
* points out the argument that is replaced with the event object before
- * the argument set is passed to the trigger method. If
- * <code>eventArgumentIndex</code> is negative, the triggering event
+ * the argument set is passed to the trigger method. If the
+ * eventArgumentIndex is negative, the triggering event
* object will not be passed to the trigger method, though it is still
* called.
* @throws java.lang.IllegalArgumentException unless exactly one match
@@ -157,7 +179,7 @@ public class ListenerMethod implements EventListener {
int eventArgumentIndex)
throws java.lang.IllegalArgumentException {
- // Find the correct method
+ // Finds the correct method
Method[] methods = object.getClass().getMethods();
Method method = null;
for (int i = 0; i < methods.length; i++)
@@ -166,11 +188,11 @@ public class ListenerMethod implements EventListener {
if (method == null)
throw new IllegalArgumentException();
- // Check that the event argument is null
+ // Checks that the event argument is null
if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null)
throw new java.lang.IllegalArgumentException();
- // Check the event type is supported by the method
+ // Checks the event type is supported by the method
if (eventArgumentIndex >= 0
&& !method.getParameterTypes()[eventArgumentIndex].isAssignableFrom(
eventType))
@@ -183,20 +205,25 @@ public class ListenerMethod implements EventListener {
this.eventArgumentIndex = eventArgumentIndex;
}
- /** <p>Constructs a new event listener from the trigger method and it's
+ /**
+ * <p>
+ * Constructs a new event listener from the trigger method and it's
* arguments. Since the the index to the replaced parameter is not
* specified the event triggering this listener will not be passed to
- * the trigger method.</p>
+ * the trigger method.
+ * </p>
*
- * <p>This constructor gets the trigger method as a parameter so it
- * does not need to reflect to find it out.</p>
+ * <p>
+ * This constructor gets the trigger method as a parameter so it
+ * does not need to reflect to find it out.
+ * </p>
*
- * @param eventType The event type that is listener listens to. All
+ * @param eventType the event type that is listener listens to. All
* events of this kind (or its subclasses) result in calling the trigger
* method.
- * @param object The object instance that contains the trigger method
- * @param method the trigger method
- * @param arguments arguments to be passed to the trigger method
+ * @param object the object instance that contains the trigger method.
+ * @param method the trigger method.
+ * @param arguments the arguments to be passed to the trigger method.
* @throws java.lang.IllegalArgumentException if <code>method</code>
* is not a member of <code>object</code>.
*/
@@ -218,24 +245,29 @@ public class ListenerMethod implements EventListener {
this.eventArgumentIndex = -1;
}
- /** <p>Constructs a new event listener from a trigger method name and
+ /**
+ * <p>
+ * Constructs a new event listener from a trigger method name and
* it's arguments. Since the the index to the replaced parameter is not
* specified the event triggering this listener will not be passed to
- * the trigger method.</p>
+ * the trigger method.
+ * </p>
*
- * <p>The actual trigger method is reflected from <code>object</code>,
+ * <p>
+ * The actual trigger method is reflected from <code>object</code>,
* and <code>java.lang.IllegalArgumentException</code> is thrown unless
- * exactly one match is found.</p>
+ * exactly one match is found.
+ * </p>
*
- * @param eventType The event type that is listener listens to. All
+ * @param eventType the event type that is listener listens to. All
* events of this kind (or its subclasses) result in calling the trigger
* method.
- * @param object The object instance that contains the trigger method
- * @param methodName The name of the trigger method. If
- * <code>object</code> does not contain the method or it contains more
+ * @param object the object instance that contains the trigger method.
+ * @param methodName the name of the trigger method. If the
+ * object does not contain the method or it contains more
* than one matching methods
* <code>java.lang.IllegalArgumentException</code> is thrown.
- * @param arguments arguments to be passed to the trigger method
+ * @param arguments the arguments to be passed to the trigger method.
* @throws java.lang.IllegalArgumentException unless exactly one match
* <code>methodName</code> is found in <code>object</code>.
*/
@@ -262,25 +294,30 @@ public class ListenerMethod implements EventListener {
this.eventArgumentIndex = -1;
}
- /** <p>Constructs a new event listener from a trigger method. Since the
+ /**
+ * <p>
+ * Constructs a new event listener from a trigger method. Since the
* argument list is unspecified no parameters are passed to the trigger
- * method when the listener is triggered.</p>
+ * method when the listener is triggered.
+ * </p>
*
- * <p>This constructor gets the trigger method as a parameter so it
- * does not need to reflect to find it out.</p>
+ * <p>
+ * This constructor gets the trigger method as a parameter so it
+ * does not need to reflect to find it out.
+ * </p>
*
- * @param eventType The event type that is listener listens to. All
+ * @param eventType the event type that is listener listens to. All
* events of this kind (or its subclasses) result in calling the trigger
* method.
- * @param object The object instance that contains the trigger method
- * @param method the trigger method
+ * @param object the object instance that contains the trigger method.
+ * @param method the trigger method.
* @throws java.lang.IllegalArgumentException if <code>method</code>
* is not a member of <code>object</code>.
*/
public ListenerMethod(Class eventType, Object object, Method method)
throws java.lang.IllegalArgumentException {
- // Check that the object is of correct type
+ // Checks that the object is of correct type
if (!method.getDeclaringClass().isAssignableFrom(object.getClass()))
throw new java.lang.IllegalArgumentException();
@@ -300,20 +337,25 @@ public class ListenerMethod implements EventListener {
throw new IllegalArgumentException();
}
- /** <p>Constructs a new event listener from a trigger method name. Since
+ /**
+ * <p>
+ * Constructs a new event listener from a trigger method name. Since
* the argument list is unspecified no parameters are passed to the
- * trigger method when the listener is triggered.</p>
+ * trigger method when the listener is triggered.
+ * </p>
*
- * <p>The actual trigger method is reflected from <code>object</code>,
+ * <p>
+ * The actual trigger method is reflected from <code>object</code>,
* and <code>java.lang.IllegalArgumentException</code> is thrown unless
- * exactly one match is found.</p>
+ * exactly one match is found.
+ * </p>
*
- * @param eventType The event type that is listener listens to. All
+ * @param eventType the event type that is listener listens to. All
* events of this kind (or its subclasses) result in calling the trigger
* method.
- * @param object The object instance that contains the trigger method
- * @param methodName The name of the trigger method. If
- * <code>object</code> does not contain the method or it contains more
+ * @param object the object instance that contains the trigger method.
+ * @param methodName the name of the trigger method. If the
+ * object does not contain the method or it contains more
* than one matching methods
* <code>java.lang.IllegalArgumentException</code> is thrown.
* @throws java.lang.IllegalArgumentException unless exactly one match
@@ -322,7 +364,7 @@ public class ListenerMethod implements EventListener {
public ListenerMethod(Class eventType, Object object, String methodName)
throws java.lang.IllegalArgumentException {
- // Find the correct method
+ // Finds the correct method
Method[] methods = object.getClass().getMethods();
Method method = null;
for (int i = 0; i < methods.length; i++)
@@ -347,12 +389,13 @@ public class ListenerMethod implements EventListener {
throw new IllegalArgumentException();
}
- /** Receives one event from the EventRouter and calls the trigger
+ /**
+ * Receives one event from the <code>EventRouter</code> and calls the trigger
* method if it matches with the criteria defined for the listener.
* Only the events of the same or subclass of the specified event
* class result in the trigger method to be called.
*
- * @param event The fired event. Unless the trigger method's
+ * @param event the fired event. Unless the trigger method's
* argument list and the index to the to be replaced argument is
* specified, this event will not be passed to the trigger method.
*/
@@ -387,13 +430,14 @@ public class ListenerMethod implements EventListener {
}
}
- /** Checks if the given object and event match with the ones stored
+ /**
+ * Checks if the given object and event match with the ones stored
* in this listener.
*
- * @param target object to be matched against the object stored by this
- * listener
- * @param eventType type to be tested for equality against the type
- * stored by this listener
+ * @param target the object to be matched against the object stored by this
+ * listener.
+ * @param eventType the type to be tested for equality against the type
+ * stored by this listener.
* @return <code>true</code> if <code>target</code> is the same object
* as the one stored in this object and <code>eventType</code> equals
* the event type stored in this object.
@@ -402,15 +446,16 @@ public class ListenerMethod implements EventListener {
return (target == object) && (eventType.equals(this.eventType));
}
- /** Checks if the given object, event and method match with the ones
+ /**
+ * Checks if the given object, event and method match with the ones
* stored in this listener.
*
- * @param target object to be matched against the object stored by this
- * listener
- * @param eventType type to be tested for equality against the type
- * stored by this listener
- * @param method method to be tested for equality against the method
- * stored by this listener
+ * @param target the object to be matched against the object stored by this
+ * listener.
+ * @param eventType the type to be tested for equality against the type
+ * stored by this listener.
+ * @param method the method to be tested for equality against the method
+ * stored by this listener.
* @return <code>true</code> if <code>target</code> is the same object
* as the one stored in this object, <code>eventType</code> equals
* with the event type stored in this object and <code>method</code>
@@ -421,10 +466,11 @@ public class ListenerMethod implements EventListener {
&& (eventType.equals(this.eventType) && method.equals(this.method));
}
- /** Exception that wraps an exception thrown by an invoked method.
- * When ListenerMethod invokes the target method, it may throw arbitrary
- * exception. The original exception is wrapped into MethodException instance and
- * rethrown by the ListenerMethod.
+ /**
+ * Exception that wraps an exception thrown by an invoked method.
+ * When <code>ListenerMethod</code> invokes the target method, it may throw arbitrary
+ * exception. The original exception is wrapped into MethodException instance and
+ * rethrown by the <code>ListenerMethod</code>.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -443,18 +489,27 @@ public class ListenerMethod implements EventListener {
super(message);
this.cause = cause;
}
-
+ /**
+ * Retrieves the cause of this throwable or <code>null</code> if the cause does not exist or not known.
+ * @return the cause of this throwable or <code>null</code> if the cause is nonexistent or unknown.
+ * @see java.lang.Throwable#getCause()
+ */
public Throwable getCause() {
return this.cause;
}
/**
+ * Returns the error message string of this throwable object.
+ * @return the error message.
* @see java.lang.Throwable#getMessage()
*/
public String getMessage() {
return message;
}
-
+
+ /**
+ * @see java.lang.Throwable#toString()
+ */
public String toString() {
String msg = super.toString();
if (cause != null)
diff --git a/src/com/itmill/toolkit/event/MethodEventSource.java b/src/com/itmill/toolkit/event/MethodEventSource.java
index a98213daa4..4df6d9674f 100644
--- a/src/com/itmill/toolkit/event/MethodEventSource.java
+++ b/src/com/itmill/toolkit/event/MethodEventSource.java
@@ -30,12 +30,17 @@ package com.itmill.toolkit.event;
import java.lang.reflect.Method;
-/** <p>Interface for classes supporting registeration of methods as event
- * receivers.</p>
+/**
+ * <p>
+ * Interface for classes supporting registeration of methods as event
+ * receivers.
+ * </p>
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -43,97 +48,122 @@ import java.lang.reflect.Method;
*/
public interface MethodEventSource {
- /** <p>Registers a new event listener with the specified activation
+ /**
+ * <p>
+ * Registers a new event listener with the specified activation
* method to listen events generated by this component. If the
* activation method does not have any arguments the event object will
- * not be passed to it when it's called.</p>
+ * not be passed to it when it's called.
+ * </p>
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType type of the listened event. Events of this type or
+ * @param eventType 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
- * @param method the activation method
+ * @param object the object instance who owns the activation method.
+ * @param method the activation method.
* @throws java.lang.IllegalArgumentException unless <code>method</code>
* has exactly one match in <code>object</code>
*/
public void addListener(Class eventType, Object object, Method method);
- /** <p>Registers a new listener with the specified activation method to
+ /**
+ * <p>
+ * Registers a new listener with the specified activation method to
* listen events generated by this component. If the activation method
* does not have any arguments the event object will not be passed to it
- * when it's called.</p>
+ * when it's called.
+ * </p>
*
- * <p>This version of <code>addListener</code> gets the name of the
+ * <p>
+ * 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>
+ * <code>java.lang.IllegalArgumentException</code> is thrown.
+ * </p>
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType type of the listened event. Events of this type or
+ * @param eventType 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
- * @param methodName the name of the activation method
+ * @param object the object instance who owns the activation method.
+ * @param methodName the name of the activation method.
* @throws java.lang.IllegalArgumentException 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.
+ /**
+ * 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.
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType exact event type the <code>object</code> listens to
- * @param target target object that has registered to listen to events
- * of type <code>eventType</code> with one or more methods
+ * @param eventType 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.
*/
public void removeListener(Class eventType, Object target);
- /** Removes one registered listener method. The given method owned by
+ /**
+ * Removes one registered listener method. The given method owned by
* the given object will no longer be called when the specified events
* are generated by this component.
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType exact event type the <code>object</code> listens to
- * @param target target object that has registered to listen to events
- * of type <code>eventType</code> with one or more methods
- * @param method the method owned by <code>target</code> that's
- * registered to listen to events of type <code>eventType</code>
+ * @param eventType 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.
+ * @param method 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>Removes one registered listener method. The given method owned by
+ /**
+ * <p>
+ * Removes one registered listener method. The given method owned by
* the given object will no longer be called when the specified events
- * are generated by this component.</p>
+ * are generated by this component.
+ * </p>
*
- * <p>This version of <code>removeListener</code> gets the name of the
+ * <p>
+ * This version of <code>removeListener</code> gets the name of the
* activation method as a parameter. The actual method is reflected from
- * <code>target</code>, and unless exactly one match is found,
- * <code>java.lang.IllegalArgumentException</code> is thrown.</p>
+ * the target, and unless exactly one match is found,
+ * <code>java.lang.IllegalArgumentException</code> is thrown.
+ * </p>
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType exact event type the <code>object</code> listens to
- * @param target target object that has registered to listen to events
- * of type <code>eventType</code> with one or more methods
- * @param methodName name of the method owned by <code>target</code>
- * that's registered to listen to events of type <code>eventType</code>
+ * @param eventType 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.
+ * @param methodName 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);
}
diff --git a/src/com/itmill/toolkit/service/ApplicationContext.java b/src/com/itmill/toolkit/service/ApplicationContext.java
index d5f413dc35..5486c4189f 100644
--- a/src/com/itmill/toolkit/service/ApplicationContext.java
+++ b/src/com/itmill/toolkit/service/ApplicationContext.java
@@ -33,7 +33,8 @@ import java.util.Collection;
import com.itmill.toolkit.Application;
-/** Application context provides information about the running context of
+/**
+ * <code>ApplicationContext</code> provides information about the running context of
* the application. Each context is shared by all applications that are open
* for one user. In web-environment this corresponds to HttpSession.
*
@@ -43,7 +44,8 @@ import com.itmill.toolkit.Application;
*/
public interface ApplicationContext {
- /** Returns application context base directory.
+ /**
+ * Returns application context base directory.
*
* Typically an application is deployed in a such way that is
* has application directory. For web applications this directory is the
@@ -55,9 +57,10 @@ public interface ApplicationContext {
*/
public File getBaseDirectory();
- /** Get the applications in this context.
+ /**
+ * Gets the applications in this context.
*
- * Get all applications in this context. Each application context contains
+ * Gets all applications in this context. Each application context contains
* all applications that are open for one user.
*
* @return Collection containing all applications in this context
@@ -65,33 +68,40 @@ public interface ApplicationContext {
public Collection getApplications();
- /** Add transaction listener to this context.
- * @param listener The listener to be added.
+ /**
+ * Adds transaction listener to this context.
+ * @param listener the listener to be added.
* @see TransactionListener
*/
public void addTransactionListener(TransactionListener listener);
- /** Remove transaction listener from this context.
- * @param listener The listener to be removed.
+ /**
+ * Removes transaction listener from this context.
+ * @param listener the listener to be removed.
* @see TransactionListener
*/
public void removeTransactionListener(TransactionListener listener);
- /** Interface for listening the application transaction events.
- * Implementations of this interface can be used to listen all
- * transactions between the client and the application.
+ /**
+ * Interface for listening the application transaction events.
+ * Implementations of this interface can be used to listen all
+ * transactions between the client and the application.
*
*/
public interface TransactionListener {
- /** Invoked at the beginning of every transaction.
- * @param transactionData Data identifying the transaction.
+ /**
+ * Invoked at the beginning of every transaction.
+ * @param application the Application object.
+ * @param transactionData the Data identifying the transaction.
*/
public void transactionStart(Application application, Object transactionData);
- /** Invoked at the end of every transaction.
- * @param transactionData Data identifying the transaction.
+ /**
+ * Invoked at the end of every transaction.
+ * @param applcation the Application object.
+ * @param transactionData the Data identifying the transaction.
*/
public void transactionEnd(Application application, Object transactionData);
diff --git a/src/com/itmill/toolkit/service/FileTypeResolver.java b/src/com/itmill/toolkit/service/FileTypeResolver.java
index b584c9f57a..9e19d41cad 100644
--- a/src/com/itmill/toolkit/service/FileTypeResolver.java
+++ b/src/com/itmill/toolkit/service/FileTypeResolver.java
@@ -37,23 +37,31 @@ import java.util.StringTokenizer;
import com.itmill.toolkit.terminal.Resource;
import com.itmill.toolkit.terminal.ThemeResource;
-/** Utility class that can figure out mime-types and icons related to files.
- * Note that the icons are associated purely to mime-types, so a file
+/**
+ * Utility class that can figure out mime-types and icons related to files.
+ * <p>
+ * Note : The icons are associated purely to mime-types, so a file
* may not have a custom icon accessible with this class.
- *
+ * </p>
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public class FileTypeResolver {
- /** Default icon given if no icon is specified for a mime-type. */
+ /**
+ * Default icon given if no icon is specified for a mime-type.
+ */
static public Resource DEFAULT_ICON = new ThemeResource("icon/files/file.gif");
- /** Default mime-type. */
+ /**
+ * Default mime-type.
+ */
static public String DEFAULT_MIME_TYPE = "application/octet-stream";
- /** Initial file extension to mime-type mapping. */
+ /**
+ * Initial file extension to mime-type mapping.
+ */
static private String initialExtToMIMEMap =
"application/cu-seeme csm cu,"
+ "application/dsptype tsp,"
@@ -203,10 +211,14 @@ public class FileTypeResolver {
+ "video/x-sgi-movie movie,"
+ "x-world/x-vrml vrm vrml wrl";
- /** File extension to MIME type mapping. */
+ /**
+ * File extension to MIME type mapping.
+ */
static private Hashtable extToMIMEMap = new Hashtable();
- /** MIME type to Icon mapping. */
+ /**
+ * MIME type to Icon mapping.
+ */
static private Hashtable MIMEToIconMap = new Hashtable();
static {
@@ -228,19 +240,20 @@ public class FileTypeResolver {
addIcon("inode/directory", new ThemeResource("icon/files/folder.gif"));
}
- /** Gets the mime-type of a file. Currently the mime-type is resolved
+ /**
+ * Gets the mime-type of a file. Currently the mime-type is resolved
* based only on the file name extension.
*
- * @param fileName name of the file whose mime-type is requested
+ * @param fileName 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) {
- // Check for nulls
+ // Checks for nulls
if (fileName == null)
throw new NullPointerException("Filename can not be null");
- // Calculate the extension of the file
+ // Calculates the extension of the file
int dotIndex = fileName.indexOf(".");
while (dotIndex >= 0 && fileName.indexOf(".",dotIndex+1) >= 0)
dotIndex = fileName.indexOf(".",dotIndex+1);
@@ -257,12 +270,13 @@ public class FileTypeResolver {
return DEFAULT_MIME_TYPE;
}
- /** Gets the descriptive icon representing file, based on the filename.
+ /**
+ * Gets the descriptive icon representing file, based on the filename.
* First the mime-type for the given filename is resolved, and then the
* corresponding icon is fetched from the internal icon storage. If it
* is not found the default icon is returned.
*
- * @param fileName name of the file whose icon is requested
+ * @param fileName the name of the file whose icon is requested.
* @return the icon corresponding to the given file
*/
public static Resource getIcon(String fileName) {
@@ -276,12 +290,13 @@ public class FileTypeResolver {
return DEFAULT_ICON;
}
- /** Gets the descriptive icon representing a file. First the mime-type
+ /**
+ * Gets the descriptive icon representing a file. First the mime-type
* for the given file name is resolved, and then the corresponding
* icon is fetched from the internal icon storage. If it is not found
* the default icon is returned.
*
- * @param file the file whose icon is requested
+ * @param file the file whose icon is requested.
* @return the icon corresponding to the given file
*/
public static Resource getIcon(File file) {
@@ -295,15 +310,16 @@ public class FileTypeResolver {
return DEFAULT_ICON;
}
- /** Gets the mime-type for a file. Currently the returned file type is
+ /**
+ * Gets the mime-type for a file. Currently the returned file type is
* resolved by the filename extension only.
*
- * @param file the file whose mime-type is requested
+ * @param file the file whose mime-type is requested.
* @return the files mime-type <code>String</code>
*/
public static String getMIMEType(File file) {
- // Check for nulls
+ // Checks for nulls
if (file == null)
throw new NullPointerException("File can not be null");
@@ -317,28 +333,31 @@ public class FileTypeResolver {
return getMIMEType(file.getName());
}
- /** Adds a mime-type mapping for the given filename extension. If
+ /**
+ * Adds a mime-type mapping for the given filename extension. If
* the extension is already in the internal mapping it is overwritten.
*
* @param extension the filename extension to be associated with
- * <code>MIMEType</code>
- * @param MIMEType the new mime-type for <code>extension</code>
+ * <code>MIMEType</code>.
+ * @param MIMEType the new mime-type for <code>extension</code>.
*/
public static void addExtension(String extension, String MIMEType) {
extToMIMEMap.put(extension, MIMEType);
}
- /** Adds a icon for the given mime-type. If the mime-type also has a
+ /**
+ * Adds a icon for the given mime-type. If the mime-type also has a
* corresponding icon, it is replaced with the new icon.
*
- * @param MIMEType the mime-type whose icon is to be changed
- * @param icon the new icon to be associated with <code>MIMEType</code>
+ * @param MIMEType the mime-type whose icon is to be changed.
+ * @param icon the new icon to be associated with <code>MIMEType</code>.
*/
public static void addIcon(String MIMEType, Resource icon) {
MIMEToIconMap.put(MIMEType, icon);
}
- /** Gets the internal file extension to mime-type mapping.
+ /**
+ * Gets the internal file extension to mime-type mapping.
*
* @return unmodifiable map containing the current file extension to
* mime-type mapping
@@ -347,7 +366,8 @@ public class FileTypeResolver {
return Collections.unmodifiableMap(extToMIMEMap);
}
- /** Gets the internal mime-type to icon mapping.
+ /**
+ * Gets the internal mime-type to icon mapping.
*
* @return unmodifiable map containing the current mime-type to icon
* mapping
diff --git a/src/com/itmill/toolkit/service/License.java b/src/com/itmill/toolkit/service/License.java
index 61ceea2ff5..3be858666c 100644
--- a/src/com/itmill/toolkit/service/License.java
+++ b/src/com/itmill/toolkit/service/License.java
@@ -59,7 +59,9 @@ import org.xml.sax.SAXException;
public class License {
- /** IT Mill License Manager certificate */
+ /**
+ * IT Mill License Manager certificate.
+ */
private static String certificate = "-----BEGIN CERTIFICATE-----\n"
+ "MIIDJjCCAuQCBEVqxNwwCwYHKoZIzjgEAwUAMHkxCzAJBgNVBAYTAkZJMRAwDgYDVQQIEwdVbmtu\n"
+ "b3duMQ4wDAYDVQQHEwVUdXJrdTEUMBIGA1UEChMLSVQgTWlsbCBMdGQxEDAOBgNVBAsTB1Vua25v\n"
@@ -77,14 +79,18 @@ public class License {
+ "LwAkKye6dzALBgcqhkjOOAQDBQADLwAwLAIUDgvWt7ItRyZfpWNEeJ0P9yaxOwoCFC21LRtwLi1t\n"
+ "c+yomHtX+mpxF7VO\n" + "-----END CERTIFICATE-----\n";
- /** License XML Document */
+ /**
+ * License XML Document.
+ */
private Document licenseXML = null;
- /** The signature has already been checked and is valid */
+ /**
+ * The signature has already been checked and is valid.
+ */
private boolean signatureIsValid = false;
/**
- * Read the license-file from input stream.
+ * Reads the license-file from input stream.
*
* License file can only ne read once, after it has been read it stays.
*
@@ -139,7 +145,18 @@ public class License {
return "true".equalsIgnoreCase(print);
}
-
+ /**
+ * Gets the description for this license.
+ * @return
+ * the description.
+ * @throws LicenseFileHasNotBeenRead
+ * if the license file has not been read.
+ * @throws InvalidLicenseFile
+ * if the license file is not of correct XML format.
+ * @throws LicenseSignatureIsInvalid
+ * if the license file has been changed or signature is
+ * otherwise invalid.
+ */
public String getDescription() throws LicenseFileHasNotBeenRead,
InvalidLicenseFile, LicenseSignatureIsInvalid {
@@ -220,7 +237,7 @@ public class License {
}
/**
- * Check if the license valid for given usage?
+ * Checks if the license valid for given usage?
*
* Checks that the license is valid for specified usage. Throws an exception
* if there is something wrong with the license or use.
@@ -495,14 +512,24 @@ public class License {
return null;
return name;
}
-
+
+ /**
+ * Gets the purpose for this license.
+ * @return the purpose.
+ */
private String getPurpose() {
NodeList purposeL = licenseXML.getElementsByTagName("purpose");
if (purposeL == null || purposeL.getLength() == 0)
return null;
return getTextContent(purposeL.item(0));
}
-
+
+ /**
+ * Gets the license number for this license.
+ * @return the license number of this license, or <code>null</code> if not set.
+ * @throws InvalidLicenseFile
+ * if the license file is not of correct XML format.
+ */
private String getLicenseNumber() throws InvalidLicenseFile {
Element lic = (Element) licenseXML.getElementsByTagName("license")
.item(0);
@@ -600,7 +627,18 @@ public class License {
return base64_decode(base64);
}
-
+
+ /**
+ * Returns whether the signature is valid or not.
+ * @return <code>true</code> if the signature is valid otherwise <code>false</code> .
+ * @throws InvalidLicenseFile
+ * if the license file is not of correct XML format.
+ * @throws LicenseFileHasNotBeenRead
+ * if the license file has not been read.
+ * @throws LicenseSignatureIsInvalid
+ * if the license file has been changed or signature is
+ * otherwise invalid.
+ */
private boolean isSignatureValid() throws InvalidLicenseFile,
LicenseFileHasNotBeenRead, LicenseSignatureIsInvalid {
@@ -712,10 +750,14 @@ public class License {
}
/* ****** BASE64 implementation created by Robert Harder ****** */
- /** The equals sign (=) as a byte. */
+ /**
+ * The equals sign (=) as a byte.
+ */
private final static byte Base64_EQUALS_SIGN = (byte) '=';
- /** Preferred encoding. */
+ /**
+ * Preferred encoding.
+ */
private final static String Base64_PREFERRED_ENCODING = "UTF-8";
/**
@@ -765,22 +807,23 @@ public class License {
* Decodes four bytes from array <var>source</var> and writes the resulting
* bytes (up to three of them) to <var>destination</var>. The source and
* destination arrays can be manipulated anywhere along their length by
- * specifying <var>srcOffset</var> and <var>destOffset</var>. This method
- * does not check to make sure your arrays are large enough to accomodate
- * <var>srcOffset</var> + 4 for the <var>source</var> array or
+ * specifying <var>srcOffset</var> and <var>destOffset</var>.
+ * <p>
+ * This method does not check to make sure your arrays are large enough
+ * to accomodate <var>srcOffset</var> + 4 for the <var>source</var> array or
* <var>destOffset</var> + 3 for the <var>destination</var> array. This
* method returns the actual number of bytes that were converted from the
* Base64 encoding.
- *
+ * </p>
*
* @param source
- * the array to convert
+ * the array to convert.
* @param srcOffset
- * the index where conversion begins
+ * the index where conversion begins.
* @param destination
- * the array to hold the conversion
+ * the array to hold the conversion.
* @param destOffset
- * the index where output will be put
+ * the index where output will be put.
* @return the number of decoded bytes converted
* @since 1.3
*/
@@ -855,11 +898,11 @@ public class License {
* features.
*
* @param source
- * The Base64 encoded data
+ * the Base64 encoded data.
* @param off
- * The offset of where to begin decoding
+ * the offset of where to begin decoding.
* @param len
- * The length of characters to decode
+ * the length of characters to decode.
* @return decoded data
* @since 1.3
*/
@@ -912,7 +955,7 @@ public class License {
* gzip-compressed data and decompressing it.
*
* @param s
- * the string to decode
+ * the string to decode.
* @return the decoded data
* @since 1.4
*/
diff --git a/src/com/itmill/toolkit/terminal/ApplicationResource.java b/src/com/itmill/toolkit/terminal/ApplicationResource.java
index 2307b1e58f..22f286ef66 100644
--- a/src/com/itmill/toolkit/terminal/ApplicationResource.java
+++ b/src/com/itmill/toolkit/terminal/ApplicationResource.java
@@ -30,46 +30,63 @@ package com.itmill.toolkit.terminal;
import com.itmill.toolkit.Application;
-/** This interface must be implemented by classes wishing to provide Application resources.
- *
- * Application resources are a set of named resources (pictures, sounds, etc) associated
+/**
+ * This interface must be implemented by classes wishing to provide Application resources.
+ * <p>
+ * <code>ApplicationResource</code> are a set of named resources (pictures, sounds, etc) associated
* with some specific application. Having named application resources provides a convenient
* method for having inter-theme common resources for an application.
- *
+ * </p>
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface ApplicationResource extends Resource {
- /** Default cache time. */
+ /**
+ * Default cache time.
+ */
public static final long DEFAULT_CACHETIME = 1000*60*60*24;
- /** Get resource as stream */
+ /**
+ * Gets resource as stream.
+ */
public DownloadStream getStream();
- /** Get the application of the resource */
+ /**
+ * Gets the application of the resource.
+ */
public Application getApplication();
- /** Get virtual filename for the resource */
+ /**
+ * Gets the virtual filename for this resource.
+ * @return the file name associated to this resource.
+ */
public String getFilename();
- /** Get lenght of cache expiration time.
+ /**
+ * Gets the length of cache expiration time.
*
- * <p>This gives the adapter the possibility cache streams sent to the
+ * <p>
+ * This gives the adapter the possibility cache streams sent to the
* client. The caching may be made in adapter or at the client if the
- * client supports caching. Default is DEFAULT_CACHETIME.</p>
+ * client supports caching. Default is <code>DEFAULT_CACHETIME</code>.
+ * </p>
*
* @return Cache time in milliseconds
*/
public long getCacheTime();
- /** Get the size of the download buffer used for this resource.
+ /**
+ * Gets the size of the download buffer used for this resource.
*
- * <p>If the buffer size is 0, the buffer size is decided by the
- * terminal adapter. The default value is 0.</p>
+ * <p>
+ * If the buffer size is 0, the buffer size is decided by the
+ * terminal adapter. The default value is 0.
+ * </p>
*
- * @return int The size of the buffer in bytes.
+ * @return int
+ * the size of the buffer in bytes.
*/
public int getBufferSize();
diff --git a/src/com/itmill/toolkit/terminal/ClassResource.java b/src/com/itmill/toolkit/terminal/ClassResource.java
index dd71c36739..fece5b75df 100644
--- a/src/com/itmill/toolkit/terminal/ClassResource.java
+++ b/src/com/itmill/toolkit/terminal/ClassResource.java
@@ -31,10 +31,11 @@ package com.itmill.toolkit.terminal;
import com.itmill.toolkit.Application;
import com.itmill.toolkit.service.FileTypeResolver;
-/** Class resource is a named resource accessed with the class loader.
+/**
+ * <code>ClassResource</code> is a named resource accessed with the class loader.
*
- * This can be used to access resources such as icons, files, etc.
- * @see java.lang.Class#getResource(java.lang.String)
+ * This can be used to access resources such as icons, files, etc.
+ * @see java.lang.Class#getResource(java.lang.String)
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -42,26 +43,37 @@ import com.itmill.toolkit.service.FileTypeResolver;
*/
public class ClassResource implements ApplicationResource {
- /** Default buffer size for this stream resource */
+ /**
+ * Default buffer size for this stream resource.
+ */
private int bufferSize = 0;
- /** Default cache time for this stream resource */
+ /**
+ * Default cache time for this stream resource.
+ */
private long cacheTime = DEFAULT_CACHETIME;
- /** Associated class used for indetifying the source of the resource */
+ /**
+ * Associated class used for indetifying the source of the resource.
+ */
private Class associatedClass;
- /** Name of the resource is relative to the associated class */
+ /**
+ * Name of the resource is relative to the associated class.
+ */
private String resourceName;
- /** Application used for serving the class */
+ /**
+ * Application used for serving the class.
+ */
private Application application;
- /** Create new application resource instance.
+ /**
+ * Creates new application resource instance.
* The resource id is relative to the location of the application class.
*
- * @param resourceName Unique identifier of the resource within the application.
- * @param application The application this resource will be added to.
+ * @param resourceName the Unique identifier of the resource within the application.
+ * @param application the application this resource will be added to.
* */
public ClassResource(String resourceName, Application application) {
this.associatedClass = application.getClass();
@@ -72,12 +84,13 @@ public class ClassResource implements ApplicationResource {
application.addResource(this);
}
- /** Create new application resource instance.
+ /**
+ * Creates new application resource instance.
*
- * @param associatedClass The class of the which the resource is associated.
- * @param resourceName Unique identifier of the resource within the application.
- * @param application The application this resource will be added to.
- * */
+ * @param associatedClass the class of the which the resource is associated.
+ * @param resourceName the Unique identifier of the resource within the application.
+ * @param application the application this resource will be added to.
+ */
public ClassResource(
Class associatedClass,
String resourceName,
@@ -89,15 +102,25 @@ public class ClassResource implements ApplicationResource {
throw new NullPointerException();
application.addResource(this);
}
-
+ /**
+ * Gets the MIME type of this resource.
+ * @see com.itmill.toolkit.terminal.Resource#getMIMEType()
+ */
public String getMIMEType() {
return FileTypeResolver.getMIMEType(this.resourceName);
}
-
+ /**
+ * Gets the application of this resource.
+ * @see com.itmill.toolkit.terminal.ApplicationResource#getApplication()
+ */
public Application getApplication() {
return application;
}
-
+ /**
+ * Gets the virtual filename for this resource.
+ * @return the file name associated to this resource.
+ * @see com.itmill.toolkit.terminal.ApplicationResource#getFilename()
+ */
public String getFilename() {
int index = 0;
int next = 0;
@@ -106,7 +129,10 @@ public class ClassResource implements ApplicationResource {
index = next + 1;
return resourceName.substring(index);
}
-
+ /**
+ * Gets resource as stream.
+ * @see com.itmill.toolkit.terminal.ApplicationResource#getStream()
+ */
public DownloadStream getStream() {
DownloadStream ds = new DownloadStream(
associatedClass.getResourceAsStream(resourceName),
@@ -122,8 +148,9 @@ public class ClassResource implements ApplicationResource {
return bufferSize;
}
- /** Set the size of the download buffer used for this resource.
- * @param bufferSize The size of the buffer in bytes.
+ /**
+ * Sets the size of the download buffer used for this resource.
+ * @param bufferSize the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
@@ -134,14 +161,17 @@ public class ClassResource implements ApplicationResource {
return cacheTime;
}
- /** Set lenght of cache expiration time.
+ /**
+ * Sets the length of cache expiration time.
*
- * <p>This gives the adapter the possibility cache streams sent to the
+ * <p>
+ * This gives the adapter the possibility cache streams sent to the
* client. The caching may be made in adapter or at the client if the
* client supports caching. Zero or negavive value disbales the
- * caching of this stream.</p>
+ * caching of this stream.
+ * </p>
*
- * @param cacheTime The cache time in milliseconds.
+ * @param cacheTime the cache time in milliseconds.
*
*/
public void setCacheTime(long cacheTime) {
diff --git a/src/com/itmill/toolkit/terminal/CompositeErrorMessage.java b/src/com/itmill/toolkit/terminal/CompositeErrorMessage.java
index 8ef96c982c..778df1a41e 100644
--- a/src/com/itmill/toolkit/terminal/CompositeErrorMessage.java
+++ b/src/com/itmill/toolkit/terminal/CompositeErrorMessage.java
@@ -33,7 +33,8 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-/** Class for combining multiple error messages together.
+/**
+ * Class for combining multiple error messages together.
*
* @author IT Mill Ltd
* @version @VERSION@
@@ -41,19 +42,22 @@ import java.util.List;
*/
public class CompositeErrorMessage implements ErrorMessage {
- /** Array of all the errors */
+ /**
+ * Array of all the errors.
+ */
private List errors;
- /** Level of the error */
+ /**
+ * Level of the error.
+ */
private int level;
- /** Constructor for CompositeErrorMessage.
+ /**
+ * Constructor for CompositeErrorMessage.
*
- * @param errorMessages Array of error messages that are listed togeter.
+ * @param errorMessages the Array of error messages that are listed togeter.
* Nulls are ignored, but at least one message is required.
- * @throws NullPointerException if errorMessages is null.
- * * @throws IllegalArgumentException if the array was empty.
- */
+ */
public CompositeErrorMessage(ErrorMessage[] errorMessages) {
errors = new ArrayList(errorMessages.length);
level = Integer.MIN_VALUE;
@@ -67,11 +71,10 @@ public class CompositeErrorMessage implements ErrorMessage {
}
- /** Constructor for CompositeErrorMessage.
- * @param errorMessages Collection of error messages that are listed
+ /**
+ * Constructor for CompositeErrorMessage.
+ * @param errorMessages the Collection of error messages that are listed
* togeter. At least one message is required.
- * @throws NullPointerException if the collection is null.
- * @throws IllegalArgumentException if the collection was empty.
*/
public CompositeErrorMessage(Collection errorMessages) {
errors = new ArrayList(errorMessages.size());
@@ -85,16 +88,18 @@ public class CompositeErrorMessage implements ErrorMessage {
throw new IllegalArgumentException("Composite error message must have at least one error");
}
- /** The error level is the largest error level in
+ /**
+ * The error level is the largest error level in
* @see com.itmill.toolkit.terminal.ErrorMessage#getErrorLevel()
*/
public final int getErrorLevel() {
return level;
}
- /** Add a error message into this composite message.
- * Updates the level field.
- * @param error The error message to be added. Duplicate errors are ignored.
+ /**
+ * Adds a error message into this composite message.
+ * Updates the level field.
+ * @param error the error message to be added. Duplicate errors are ignored.
*/
private void addErrorMessage(ErrorMessage error) {
if (error != null && !errors.contains(error)) {
@@ -105,11 +110,17 @@ public class CompositeErrorMessage implements ErrorMessage {
}
}
- /** Get Error Iterator. */
+ /**
+ * Gets Error Iterator.
+ * @return the error iterator.
+ */
public Iterator iterator() {
return errors.iterator();
}
-
+
+ /**
+ * @see com.itmill.toolkit.terminal.Paintable#paint(com.itmill.toolkit.terminal.PaintTarget)
+ */
public void paint(PaintTarget target) throws PaintException {
if (errors.size() == 1)
@@ -153,7 +164,8 @@ public class CompositeErrorMessage implements ErrorMessage {
public void requestRepaintRequests() {
}
- /** Returns a comma separated list of the error messages.
+ /**
+ * Returns a comma separated list of the error messages.
* @return String, comma separated list of error messages.
*/
public String toString() {
diff --git a/src/com/itmill/toolkit/terminal/DownloadStream.java b/src/com/itmill/toolkit/terminal/DownloadStream.java
index 74473ff4db..c4b481e70e 100644
--- a/src/com/itmill/toolkit/terminal/DownloadStream.java
+++ b/src/com/itmill/toolkit/terminal/DownloadStream.java
@@ -33,7 +33,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-/** Downloadable stream.
+/**
+ * Downloadable stream.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -41,10 +42,14 @@ import java.util.Map;
*/
public class DownloadStream {
- /** Maximum cache time. */
+ /**
+ * Maximum cache time.
+ */
public static final long MAX_CACHETIME = Long.MAX_VALUE;
- /** Default cache time. */
+ /**
+ * Default cache time.
+ */
public static final long DEFAULT_CACHETIME = 1000*60*60*24;
private InputStream stream;
@@ -54,7 +59,9 @@ public class DownloadStream {
private long cacheTime = DEFAULT_CACHETIME;
private int bufferSize = 0;
- /** Creates a new instance of DownloadStream */
+ /**
+ * Creates a new instance of DownloadStream.
+ */
public DownloadStream(
InputStream stream,
String contentType,
@@ -64,57 +71,64 @@ public class DownloadStream {
setFileName(fileName);
}
- /** Get downloadable stream.
+ /**
+ * Gets downloadable stream.
* @return output stream.
*/
public InputStream getStream() {
return this.stream;
}
- /** Sets the stream.
+ /**
+ * Sets the stream.
* @param stream The stream to set
*/
public void setStream(InputStream stream) {
this.stream = stream;
}
- /** Get stream content type.
+ /**
+ * Gets stream content type.
* @return type of the stream content.
*/
public String getContentType() {
return this.contentType;
}
- /** Set stream content type.
- * @param contentType The contentType to set
+ /**
+ * Sets stream content type.
+ * @param contentType the contentType to set
*/
public void setContentType(String contentType) {
this.contentType = contentType;
}
- /** Returns the file name.
- * @return The name of the file.
+ /**
+ * Returns the file name.
+ * @return the name of the file.
*/
public String getFileName() {
return fileName;
}
- /** Sets the file name.
- * @param fileName The file name to set
+ /**
+ * Sets the file name.
+ * @param fileName the file name to set.
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
- /** Set a paramater for download stream.
- * Parameters are optional information about the downloadable stream
- * and their meaning depends on the used adapter. For example in
- * WebAdapter they are interpreted as HTTP response headers.
+ /**
+ * Sets a paramater for download stream.
+ * Parameters are optional information about the downloadable stream
+ * and their meaning depends on the used adapter. For example in
+ * WebAdapter they are interpreted as HTTP response headers.
*
- * If the parameters by this name exists, the old value is replaced.
+ * If the parameters by this name exists, the old value is replaced.
*
- * @param name Name of the parameter to set.
- * @param value Value of the parameter to set.
+ * @param name the Name of the parameter to set.
+ * @param value the Value of the parameter to set.
*/
public void setParameter(String name, String value) {
if (this.params == null) {
@@ -123,12 +137,13 @@ public class DownloadStream {
this.params.put(name, value);
}
- /** Get a paramater for download stream.
- * Parameters are optional information about the downloadable stream
- * and their meaning depends on the used adapter. For example in
- * WebAdapter they are interpreted as HTTP response headers.
- * @param name Name of the parameter to set.
- * @return Value of the parameter or null if the parameter does not exist.
+ /**
+ * Gets a paramater for download stream.
+ * Parameters are optional information about the downloadable stream
+ * and their meaning depends on the used adapter. For example in
+ * WebAdapter they are interpreted as HTTP response headers.
+ * @param name 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) {
if (this.params != null)
@@ -136,8 +151,9 @@ public class DownloadStream {
return null;
}
- /** Get the names of the parameters.
- * @return Iteraror of names or null if no parameters are set.
+ /**
+ * Gets the names of the parameters.
+ * @return Iterator of names or null if no parameters are set.
*/
public Iterator getParameterNames() {
if (this.params != null)
@@ -145,35 +161,39 @@ public class DownloadStream {
return null;
}
- /** Get lenght of cache expiration time.
- * This gives the adapter the possibility cache streams sent to the client.
- * The caching may be made in adapter or at the client if the client supports
- * caching. Default is DEFAULT_CACHETIME.
+ /**
+ * Gets length of cache expiration time.
+ * This gives the adapter the possibility cache streams sent to the client.
+ * The caching may be made in adapter or at the client if the client supports
+ * caching. Default is <code>DEFAULT_CACHETIME</code>.
* @return Cache time in milliseconds
*/
public long getCacheTime() {
return cacheTime;
}
- /** Set lenght of cache expiration time.
- * This gives the adapter the possibility cache streams sent to the client.
- * The caching may be made in adapter or at the client if the client supports
- * caching. Zero or negavive value disbales the caching of this stream.
- * @param cacheTime The cache time in milliseconds.
+ /**
+ * Sets length of cache expiration time.
+ * This gives the adapter the possibility cache streams sent to the client.
+ * The caching may be made in adapter or at the client if the client supports
+ * caching. Zero or negavive value disbales the caching of this stream.
+ * @param cacheTime the cache time in milliseconds.
*/
public void setCacheTime(long cacheTime) {
this.cacheTime = cacheTime;
}
- /** Get the size of the download buffer.
+ /**
+ * Gets the size of the download buffer.
* @return int The size of the buffer in bytes.
*/
public int getBufferSize() {
return bufferSize;
}
- /** Set the size of the download buffer.
- * @param bufferSize The size of the buffer in bytes.
+ /**
+ * Sets the size of the download buffer.
+ * @param bufferSize the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
diff --git a/src/com/itmill/toolkit/terminal/ErrorMessage.java b/src/com/itmill/toolkit/terminal/ErrorMessage.java
index c6a6463e6b..5e0d52f296 100644
--- a/src/com/itmill/toolkit/terminal/ErrorMessage.java
+++ b/src/com/itmill/toolkit/terminal/ErrorMessage.java
@@ -28,7 +28,8 @@
package com.itmill.toolkit.terminal;
-/** Interface for rendering error messages to terminal. All the visible errors
+/**
+ * Interface for rendering error messages to terminal. All the visible errors
* shown to user must implement this interface.
*
* @author IT Mill Ltd.
@@ -37,42 +38,56 @@ package com.itmill.toolkit.terminal;
*/
public interface ErrorMessage extends Paintable {
- /** Error code for system errors and bugs. */
+ /**
+ * Error code for system errors and bugs.
+ */
public static final int SYSTEMERROR = 5000;
- /** Error code for critical error messages. */
+ /**
+ * Error code for critical error messages.
+ */
public static final int CRITICAL = 4000;
- /** Error code for regular error messages. */
+ /**
+ * Error code for regular error messages.
+ */
public static final int ERROR = 3000;
- /** Error code for warning messages. */
+ /**
+ * Error code for warning messages.
+ */
public static final int WARNING = 2000;
- /** Error code for informational messages. */
+ /**
+ * Error code for informational messages.
+ */
public static final int INFORMATION = 1000;
- /** Gets the errors level.
+ /**
+ * Gets the errors level.
*
- * @return the level of error as an integer.
+ * @return the level of error as an integer.
*/
public int getErrorLevel();
- /** Error messages are inmodifiable and thus listeners are not needed. This
+ /**
+ * Error messages are inmodifiable and thus listeners are not needed. This
* method should be implemented as empty.
- *
+ * @param listener the listener to be added.
* @see com.itmill.toolkit.terminal.Paintable#addListener(Paintable.RepaintRequestListener)
*/
public void addListener(RepaintRequestListener listener);
- /** Error messages are inmodifiable and thus listeners are not needed. This
+ /**
+ * Error messages are inmodifiable and thus listeners are not needed. This
* method should be implemented as empty.
- *
+ * @param listener the listener to be removed.
* @see com.itmill.toolkit.terminal.Paintable#removeListener(Paintable.RepaintRequestListener)
*/
public void removeListener(RepaintRequestListener listener);
- /** Error messages are inmodifiable and thus listeners are not needed. This
+ /**
+ * Error messages are inmodifiable and thus listeners are not needed. This
* method should be implemented as empty.
*
* @see com.itmill.toolkit.terminal.Paintable#requestRepaint()
diff --git a/src/com/itmill/toolkit/terminal/ExternalResource.java b/src/com/itmill/toolkit/terminal/ExternalResource.java
index 2c6b95cc64..6b3df1b35a 100644
--- a/src/com/itmill/toolkit/terminal/ExternalResource.java
+++ b/src/com/itmill/toolkit/terminal/ExternalResource.java
@@ -32,7 +32,8 @@ import java.net.URL;
import com.itmill.toolkit.service.FileTypeResolver;
-/** External resource implements source for resources fetched from
+/**
+ * <code>ExternalResource</code> implements source for resources fetched from
* location specified by URL:s. The resources are fetched directly by the
* client terminal and are not fetched trough the terminal adapter.
*
@@ -42,12 +43,16 @@ import com.itmill.toolkit.service.FileTypeResolver;
*/
public class ExternalResource implements Resource {
- /** Url of the download */
+ /**
+ * Url of the download.
+ */
private String sourceURL = null;
- /** Create new download component for downloading directly from given URL.
- * */
+ /**
+ * Creates new download component for downloading directly from given URL.
+ * @param sourceURL the source URL.
+ */
public ExternalResource(URL sourceURL) {
if (sourceURL == null)
throw new RuntimeException("Source must be non-null");
@@ -55,8 +60,10 @@ public class ExternalResource implements Resource {
this.sourceURL = sourceURL.toString();
}
- /** Create new download component for downloading directly from given URL.
- * */
+ /**
+ * Creates new download component for downloading directly from given URL.
+ * @param sourceURL the source URL.
+ */
public ExternalResource(String sourceURL) {
if (sourceURL == null)
throw new RuntimeException("Source must be non-null");
@@ -64,11 +71,18 @@ public class ExternalResource implements Resource {
this.sourceURL = sourceURL.toString();
}
- /** Get the URL of the external resource */
+ /**
+ * Gets the URL of the external resource.
+ * @return the URL of the external resource.
+ */
public String getURL() {
return sourceURL;
}
+ /**
+ * Gets the MIME type of the resource.
+ * @see com.itmill.toolkit.terminal.Resource#getMIMEType()
+ */
public String getMIMEType() {
return FileTypeResolver.getMIMEType(getURL().toString());
}
diff --git a/src/com/itmill/toolkit/terminal/FileResource.java b/src/com/itmill/toolkit/terminal/FileResource.java
index dcc06cbed5..351edb7377 100644
--- a/src/com/itmill/toolkit/terminal/FileResource.java
+++ b/src/com/itmill/toolkit/terminal/FileResource.java
@@ -35,8 +35,9 @@ import java.io.FileNotFoundException;
import com.itmill.toolkit.Application;
import com.itmill.toolkit.service.FileTypeResolver;
-/** File resources are files or directories on local filesystem. The files and directories
- * are served trough URI:s to the client terminal and thus must be registered to an
+/**
+ * <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.
*
@@ -46,19 +47,28 @@ import com.itmill.toolkit.service.FileTypeResolver;
*/
public class FileResource implements ApplicationResource {
- /** Default buffer size for this stream resource */
+ /**
+ * Default buffer size for this stream resource.
+ */
private int bufferSize = 0;
- /** File where the downloaded content is fetched from. */
+ /**
+ * File where the downloaded content is fetched from.
+ */
private File sourceFile;
- /** Application */
+ /**
+ * Application.
+ */
private Application application;
- /** Default cache time for this stream resource */
+ /**
+ * Default cache time for this stream resource.
+ */
private long cacheTime = DownloadStream.DEFAULT_CACHETIME;
- /** Create new file resource for providing given file for
+ /**
+ * Creates new file resource for providing given file for
* client terminals.
*/
public FileResource(File sourceFile, Application application) {
@@ -66,7 +76,11 @@ public class FileResource implements ApplicationResource {
setSourceFile(sourceFile);
application.addResource(this);
}
-
+
+ /**
+ * Gets the resource as stream.
+ * @see com.itmill.toolkit.terminal.ApplicationResource#getStream()
+ */
public DownloadStream getStream() {
try {
DownloadStream ds = new DownloadStream(
@@ -81,15 +95,17 @@ public class FileResource implements ApplicationResource {
}
}
- /** Returns the source file.
- * @return File
+ /**
+ * Gets the source file.
+ * @return the source File.
*/
public File getSourceFile() {
return sourceFile;
}
- /** Sets the source file.
- * @param sourceFile The source file to set
+ /**
+ * Sets the source file.
+ * @param sourceFile the source file to set.
*/
public void setSourceFile(File sourceFile) {
this.sourceFile = sourceFile;
@@ -116,21 +132,23 @@ public class FileResource implements ApplicationResource {
return FileTypeResolver.getMIMEType(sourceFile);
}
- /** Get lenght of cache expiration time.
- * This gives the adapter the possibility cache streams sent to the client.
- * The caching may be made in adapter or at the client if the client supports
- * caching. Default is DownloadStream.DEFAULT_CACHETIME.
- * @return Cache time in milliseconds
+ /**
+ * Gets the length of cache expiration time.
+ * This gives the adapter the possibility cache streams sent to the client.
+ * The caching may be made in adapter or at the client if the client supports
+ * caching. Default is <code>DownloadStream.DEFAULT_CACHETIME</code>.
+ * @return Cache time in milliseconds.
*/
public long getCacheTime() {
return cacheTime;
}
- /** Set lenght of cache expiration time.
- * This gives the adapter the possibility cache streams sent to the client.
- * The caching may be made in adapter or at the client if the client supports
- * caching. Zero or negavive value disbales the caching of this stream.
- * @param cacheTime The cache time in milliseconds.
+ /**
+ * Sets the length of cache expiration time.
+ * This gives the adapter the possibility cache streams sent to the client.
+ * The caching may be made in adapter or at the client if the client supports
+ * caching. Zero or negavive value disbales the caching of this stream.
+ * @param cacheTime the cache time in milliseconds.
*/
public void setCacheTime(long cacheTime) {
this.cacheTime = cacheTime;
@@ -141,8 +159,9 @@ public class FileResource implements ApplicationResource {
return bufferSize;
}
- /** Set the size of the download buffer used for this resource.
- * @param bufferSize The size of the buffer in bytes.
+ /**
+ * Sets the size of the download buffer used for this resource.
+ * @param bufferSize the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
diff --git a/src/com/itmill/toolkit/terminal/KeyMapper.java b/src/com/itmill/toolkit/terminal/KeyMapper.java
index cc220b630d..871fa10751 100644
--- a/src/com/itmill/toolkit/terminal/KeyMapper.java
+++ b/src/com/itmill/toolkit/terminal/KeyMapper.java
@@ -30,8 +30,9 @@ package com.itmill.toolkit.terminal;
import java.util.Hashtable;
-/** 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 @VERSION@
@@ -43,7 +44,10 @@ public class KeyMapper {
private Hashtable objectKeyMap = new Hashtable();
private Hashtable keyObjectMap = new Hashtable();
- /** Get key for an object */
+ /**
+ * Gets key for an object.
+ * @param o the object.
+ */
public String key(Object o) {
if (o == null) return "null";
@@ -60,32 +64,44 @@ public class KeyMapper {
return key;
}
- /** Check if the key belongs to a new id.
+ /**
+ * Checks if the key belongs to a new id.
* <p>Usage of new id:s are specific to components, but for example Select
* component uses newItemId:s for selection of newly added items in
- * <code>allowNewItems</code>-mode
+ * <code>allowNewItems</code>-mode.
+ * @param key
+ * @return <code>true</code> if the key belongs to the new id,otherwise <code>false</code>.
*/
public boolean isNewIdKey(String key) {
return "NEW".equals(key);
}
- /** Retrieve object with the key*/
+ /**
+ * Retrieves object with the key.
+ * @param key the name with the desired value.
+ * @return the object with the key.
+ */
public Object get(String key) {
return keyObjectMap.get(key);
}
- /** Remove object from the mapper. */
- public void remove(Object o) {
- String key = (String) objectKeyMap.get(o);
+ /**
+ * Removes object from the mapper.
+ * @param removeobj the object to be removed.
+ */
+ public void remove(Object removeobj) {
+ String key = (String) objectKeyMap.get(removeobj);
if (key != null) {
objectKeyMap.remove(key);
- keyObjectMap.remove(o);
+ keyObjectMap.remove(removeobj);
}
}
- /** Remove all objects from the mapper. */
+ /**
+ * Removes all objects from the mapper.
+ */
public void removeAll() {
objectKeyMap.clear();
keyObjectMap.clear();
diff --git a/src/com/itmill/toolkit/terminal/PaintException.java b/src/com/itmill/toolkit/terminal/PaintException.java
index 5f3154aa43..766e964b22 100644
--- a/src/com/itmill/toolkit/terminal/PaintException.java
+++ b/src/com/itmill/toolkit/terminal/PaintException.java
@@ -30,7 +30,8 @@ package com.itmill.toolkit.terminal;
import java.io.IOException;
-/** Paint exepction is trown if painting of a component fails.
+/**
+ * <code>PaintExcepection</code> is thrown if painting of a component fails.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -43,15 +44,17 @@ public class PaintException extends IOException {
*/
private static final long serialVersionUID = 3762535607221891897L;
- /** Constructs an instance of <code>PaintExecption</code> with the specified detail message.
+ /**
+ * Constructs an instance of <code>PaintExeception</code> with the specified detail message.
* @param msg the detail message.
*/
public PaintException(String msg) {
super(msg);
}
- /** Constructs an instance of <code>PaintExecption</code> from IOException.
- * @param exception The original exception.
+ /**
+ * Constructs an instance of <code>PaintExeception</code> from IOException.
+ * @param exception the original exception.
*/
public PaintException(IOException exception) {
super(exception.getMessage());
diff --git a/src/com/itmill/toolkit/terminal/PaintTarget.java b/src/com/itmill/toolkit/terminal/PaintTarget.java
index 645ac0a4fd..6202b2c399 100644
--- a/src/com/itmill/toolkit/terminal/PaintTarget.java
+++ b/src/com/itmill/toolkit/terminal/PaintTarget.java
@@ -28,8 +28,9 @@
package com.itmill.toolkit.terminal;
-/** This interface defines the methods for
- * painting XML to the UIDL stream.
+/**
+ * This interface defines the methods for
+ * painting XML to the UIDL stream.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -37,27 +38,33 @@ package com.itmill.toolkit.terminal;
*/
public interface PaintTarget {
- /** Print single XMLsection.
+ /**
+ * Prints single XMLsection.
*
* Prints full XML section. The section data is escaped from XML tags and
* surrounded by XML start and end-tags.
+ * @param sectionTagName the name of the tag.
+ * @param sectionData the scetion data.
+ * @throws PaintException if the paint operation failed.
*/
public void addSection(String sectionTagName, String sectionData)
throws PaintException;
- /** Print element start tag of a paintable section.
+ /**
+ * Prints element start tag of a paintable section.
* Starts a paintable section using the given tag. The PaintTarget may
* implement a caching scheme, that checks the paintable has actually
* changed or can a cached version be used instead. This method should call
* the startTag method.
- *
+ * <p>
* If the Paintable is found in cache and this function returns true it may
* omit the content and close the tag, in which case cached content should
* be used.
- *
- * @param paintable The paintable to start
- * @param tagName The name of the start tag
- * @return true if paintable found in cache, false otherwise.
+ * </p>
+ * @param paintable 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.
+ * @throws PaintException if the paint operation failed.
* @see #startTag(String)
* @since 3.1
*/
@@ -65,141 +72,175 @@ public interface PaintTarget {
throws PaintException;
- /** Print element start tag.
+ /**
+ * Prints element start tag.
*
* <pre>Todo:
* Checking of input values
* </pre>
*
- * @param tagName The name of the start tag
- *
+ * @param tagName the name of the start tag.
+ * @throws PaintException if the paint operation failed.
*/
public void startTag(String tagName) throws PaintException;
- /** Print element end tag.
+ /**
+ * Prints element end tag.
*
* If the parent tag is closed before
* every child tag is closed an PaintException is raised.
*
- * @param tag The name of the end tag
- * @exception IOException The writing failed due to input/output error
+ * @param tagName the name of the end tag.
+ * @throws PaintException if the paint operation failed.
*/
public void endTag(String tagName) throws PaintException;
- /** Adds a boolean attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a boolean attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Attribute name
- * @param value Attribute value
- * @return this object
+ * @param name the Attribute name.
+ * @param value the Attribute value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, boolean value) throws PaintException;
- /** Adds a integer attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a integer attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Attribute name
- * @param value Attribute value
- * @return this object
+ * @param name the Attribute name.
+ * @param value the Attribute value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, int value) throws PaintException;
- /** Adds a resource attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a resource attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Attribute name
- * @param value Attribute value
- * @return this object
+ * @param name the Attribute name
+ * @param value the Attribute value
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, Resource value)
throws PaintException;
- /** Adds a long attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a long attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Attribute name
- * @param value Attribute value
- * @return this object
+ * @param name the Attribute name.
+ * @param value the Attribute value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, long value) throws PaintException;
- /** Adds a string attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a string attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Boolean attribute name
- * @param value Boolean attribute value
- * @return this object
+ * @param name the Boolean attribute name.
+ * @param value the Boolean attribute value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, String value) throws PaintException;
- /** Add a string type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a string type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ * @param value the Variable initial value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String value)
throws PaintException;
- /** Add a int type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a int type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ * @param value the Variable initial value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, int value)
throws PaintException;
- /** Add a boolean type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a boolean type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ * @param value the Variable initial value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, boolean value)
throws PaintException;
- /** Add a string array type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a string array type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ * @param value the Variable initial value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String[] value)
throws PaintException;
- /** Add a upload stream type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a upload stream type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addUploadStreamVariable(VariableOwner owner, String name)
throws PaintException;
- /** Print single XML section.
- *
- * Prints full XML section. The section data must be XML and it is
- * surrounded by XML start and end-tags.
- */
+ /**
+ * Prints single XML section.
+ * <p>
+ * Prints full XML section. The section data must be XML and it is
+ * surrounded by XML start and end-tags.
+ * </p>
+ * @param sectionTagName the tag name.
+ * @param sectionData the section data to be printed.
+ * @param namespace the namespace.
+ * @throws PaintException if the paint operation failed.
+ */
public void addXMLSection(
String sectionTagName,
String sectionData,
String namespace)
throws PaintException;
- /** Add UIDL directly.
+ /**
+ * Adds UIDL directly.
* The UIDL must be valid in accordance with the UIDL.dtd
+ * @param uidl the UIDL to be added.
+ * @throws PaintException if the paint operation failed.
*/
public void addUIDL(java.lang.String uidl) throws PaintException;
- /** Add text node. All the contents of the text are XML-escaped.
- * @param text Text to add
+ /**
+ * Adds text node. All the contents of the text are XML-escaped.
+ * @param text the Text to add
+ * @throws PaintException if the paint operation failed.
*/
void addText(String text) throws PaintException;
- /** Add CDATA node to target UIDL-tree.
- * @param text Character data to add
+ /**
+ * Adds CDATA node to target UIDL-tree.
+ * @param text the Character data to add
+ * @throws PaintException if the paint operation failed.
* @since 3.1
*/
void addCharacterData(String text) throws PaintException;
diff --git a/src/com/itmill/toolkit/terminal/Paintable.java b/src/com/itmill/toolkit/terminal/Paintable.java
index 2f91a81bdd..65b25e0247 100644
--- a/src/com/itmill/toolkit/terminal/Paintable.java
+++ b/src/com/itmill/toolkit/terminal/Paintable.java
@@ -30,7 +30,8 @@ package com.itmill.toolkit.terminal;
import java.util.EventObject;
-/** Interface implemented by all classes that can be painted.
+/**
+ * Interface implemented by all classes that can be painted.
* Classes implementing this interface know how to output themselves
* to a UIDL stream and that way describing to the terminal how it
* should be displayed in the UI.
@@ -41,28 +42,33 @@ import java.util.EventObject;
*/
public interface Paintable extends java.util.EventListener {
- /** <p>Paints the paintable into a UIDL stream. This method creates
+ /**
+ * <p>
+ * Paints the paintable into a UIDL stream. This method creates
* the UIDL sequence describing it and outputs it to the given UIDL
- * stream.</p>
+ * stream.
+ * </p>
*
- * <p>It's is called when the contents of the component should be
+ * <p>
+ * It is called when the contents of the component should be
* painted in response to the component first being shown or having been
- * altered so that its visual representation is changed.</p>
+ * altered so that its visual representation is changed.
+ * </p>
*
- * @param target target UIDL stream where the component should paint
- * itself to
- * @throws PaintException if the paint operation failed
- * @throws InvalidUIDLException if incorrect UIDL is writted, and
- * the error can be dealt with inside this method call.
+ * @param target the target UIDL stream where the component should paint
+ * itself to.
+ * @throws PaintException if the paint operation failed.
*/
public void paint(PaintTarget target) throws PaintException;
- /** Requests that the paintable should be repainted as soon as possible.
+ /**
+ * Requests that the paintable should be repainted as soon as possible.
*/
public void requestRepaint();
- /** Repaint request event is thrown when the paintable needs to be repainted.
- * This is typically done when the paint() method would return dissimilar
+ /**
+ * Repaint request event is thrown 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.
*/
public class RepaintRequestEvent extends EventObject {
@@ -72,15 +78,17 @@ public interface Paintable extends java.util.EventListener {
*/
private static final long serialVersionUID = 3256725095530442805L;
- /** Construct new event.
- * @param source The paintable needing repaint
+ /**
+ * Constructs new event.
+ * @param source the paintable needing repaint.
*/
public RepaintRequestEvent(Paintable source) {
super(source);
}
- /** Get the paintable needing repainting.
- * @return Paintable for which the paint() method will return
+ /**
+ * 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.
*/
public Paintable getPaintable() {
@@ -88,41 +96,47 @@ public interface Paintable extends java.util.EventListener {
}
}
- /** Listen repaint requests. The repaintRequested() method is called when the
+ /**
+ * Listens repaint requests. The <code>repaintRequested</code> method is called when the
* paintable needs to be repainted.
- * This is typically done when the paint() method would return dissimilar
+ * This is typically done when the <code>paint</code> method would return dissimilar
* UIDL from the previous call of the method.
*/
public interface RepaintRequestListener {
- /** Receive repaint request events.
- * @param event The repaint request event specifying the paintable source.
+ /**
+ * Receives repaint request events.
+ * @param event the repaint request event specifying the paintable source.
*/
public void repaintRequested(RepaintRequestEvent event);
}
- /** Add repaint request listener. In order to assure that no repaint requests are
+ /**
+ * Adds repaint request listener. In order to assure that no repaint requests are
* missed, the new repaint listener should paint the paintable right after adding
* itself as listener.
- * @param listener to be added
+ * @param listener the listener to be added.
*/
public void addListener(RepaintRequestListener listener);
- /** Remove repaint request listener.
- * @param listener to be removed
+ /**
+ * Removes repaint request listener.
+ * @param listener the listener to be removed.
*/
public void removeListener(RepaintRequestListener listener);
- /** Request sending of repaint events on any further visible changes.
+ /**
+ * Request sending of repaint events on any further visible changes.
* Normally the paintable only send up to one repaint request
* for listeners after paint as the paintable as the paintable
* assumes that the listeners already know about the repaint need.
* This method resets the assumtion. Paint implicitly does the
* assumtion reset functionality implemented by this method.
- *
+ * <p>
* This method is normally used only by the terminals to note
* paintables about implicit repaints (painting the component
* without actually invoking paint method).
+ * </p>
*/
public void requestRepaintRequests();
}
diff --git a/src/com/itmill/toolkit/terminal/ParameterHandler.java b/src/com/itmill/toolkit/terminal/ParameterHandler.java
index f9ff314092..f46c67e0a4 100644
--- a/src/com/itmill/toolkit/terminal/ParameterHandler.java
+++ b/src/com/itmill/toolkit/terminal/ParameterHandler.java
@@ -30,14 +30,17 @@ package com.itmill.toolkit.terminal;
import java.util.Map;
-/** Interface implemented by all the classes capable of handling external parameters.
+/**
+ * Interface implemented by all the classes capable of handling external parameters.
*
- * <p>Some terminals can provide external parameters for application. For example
+ * <p>
+ * Some terminals can provide external parameters for application. For example
* GET and POST parameters are passed to application as external parameters on
* Web Adapter. The parameters can be received at any time during the application
* lifecycle. All the parameter handlers implementing this interface and registered
* to {@link com.itmill.toolkit.ui.Window} receive all the parameters got from
- * the terminal in the given window.</p>
+ * the terminal in the given window.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -45,21 +48,27 @@ import java.util.Map;
*/
public interface ParameterHandler {
- /** Handle parameters.
- *
- * <p>Handle the given parameters. The parameters are given as inmodifieable
+ /**
+ * <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.</p>
+ * All the parameter values are arrays of strings.
+ * </p>
*
- * @param parameters Inmodifiable name to value[] mapping.
+ * @param parameters the Inmodifiable name to value[] mapping.
*
*/
public void handleParameters(Map parameters);
- /** ParameterHandler error event */
+ /**
+ * ParameterHandler error event.
+ */
public interface ErrorEvent extends Terminal.ErrorEvent {
- /** Get the source ParameterHandler. */
+ /**
+ * Gets the source ParameterHandler.
+ * @return the source Parameter Handler.
+ */
public ParameterHandler getParameterHandler();
}
diff --git a/src/com/itmill/toolkit/terminal/Resource.java b/src/com/itmill/toolkit/terminal/Resource.java
index 66eb23f8bc..74163b8ef5 100644
--- a/src/com/itmill/toolkit/terminal/Resource.java
+++ b/src/com/itmill/toolkit/terminal/Resource.java
@@ -28,8 +28,9 @@
package com.itmill.toolkit.terminal;
-/** Resource provided to the client terminal. Support for actually displaying the resource type
- * is left to the terminal.
+/**
+ * <code>Resource</code> provided to the client terminal. Support for actually
+ * displaying the resource type is left to the terminal.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -37,6 +38,9 @@ package com.itmill.toolkit.terminal;
*/
public interface Resource {
- /** Get the MIME type of the resource. */
+ /**
+ * Gets the MIME type of the resource.
+ * @return the MIME type of the resource.
+ */
public String getMIMEType();
}
diff --git a/src/com/itmill/toolkit/terminal/Scrollable.java b/src/com/itmill/toolkit/terminal/Scrollable.java
index 87ece18c5d..dcc1528e66 100644
--- a/src/com/itmill/toolkit/terminal/Scrollable.java
+++ b/src/com/itmill/toolkit/terminal/Scrollable.java
@@ -28,10 +28,11 @@
package com.itmill.toolkit.terminal;
-/** Scrollable interface.
- *
- * <p>This interface is implemented by all visual objects that can be scrolled.
- * The unit of scrolling is pixel.</p>
+/**
+ * <p>
+ * This interface is implemented by all visual objects that can be scrolled.
+ * The unit of scrolling is pixel.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -40,7 +41,8 @@ package com.itmill.toolkit.terminal;
public interface Scrollable {
- /** Get scroll X offset.
+ /**
+ * Gets scroll X offset.
*
* <p>Scrolling offset is the number of pixels this scrollable has
* been scrolled to left.</p>
@@ -49,16 +51,18 @@ public interface Scrollable {
*/
public int getScrollOffsetX();
- /** Set scroll X offset.
+ /**
+ * Sets scroll X offset.
*
* <p>Scrolling offset is the number of pixels this scrollable has
* been scrolled to left.</p>
*
- * @param xOffset.
+ * @param pixelsScrolledLeft the xOffset.
*/
public void setScrollOffsetX(int pixelsScrolledLeft);
- /** Get scroll Y offset.
+ /**
+ * Gets scroll Y offset.
*
* <p>Scrolling offset is the number of pixels this scrollable has
* been scrolled to down.</p>
@@ -67,30 +71,33 @@ public interface Scrollable {
*/
public int getScrollOffsetY();
- /** Set scroll Y offset.
+ /**
+ * Sets scroll Y offset.
*
* <p>Scrolling offset is the number of pixels this scrollable has
* been scrolled to down.</p>
*
- * @param yOffset.
+ * @param pixelsScrolledDown the yOffset.
*/
public void setScrollOffsetY(int pixelsScrolledDown);
- /** Is the scrolling enabled.
+ /**
+ * Is the scrolling enabled.
*
* <p>Enabling scrolling allows the user to scroll the scrollable view
* interactively</p>
*
- * @return True iff the scrolling is allowed.
+ * @return <code>true</code> if the scrolling is allowed, otherwise <code>false</code>.
*/
public boolean isScrollable();
- /** Enable or disable scrolling..
+ /**
+ * Enables or disables scrolling..
*
* <p>Enabling scrolling allows the user to scroll the scrollable view
* interactively</p>
*
- * @param isScrollingEnabled True iff the scrolling is allowed.
+ * @param isScrollingEnabled true if the scrolling is allowed.
*/
public void setScrollable(boolean isScrollingEnabled);
diff --git a/src/com/itmill/toolkit/terminal/Sizeable.java b/src/com/itmill/toolkit/terminal/Sizeable.java
index 92e64d274d..3a191b52f3 100644
--- a/src/com/itmill/toolkit/terminal/Sizeable.java
+++ b/src/com/itmill/toolkit/terminal/Sizeable.java
@@ -28,9 +28,10 @@
package com.itmill.toolkit.terminal;
-/** Interface to be implemented by components wishing to
- * display some object that may be dynamically
- * resized during runtime.
+/**
+ * Interface to be implemented by components wishing to
+ * display some object that may be dynamically
+ * resized during runtime.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -38,100 +39,127 @@ package com.itmill.toolkit.terminal;
*/
public interface Sizeable {
- /** Unit code representing pixels. */
+ /**
+ * Unit code representing pixels.
+ */
public static final int UNITS_PIXELS = 0;
- /** Unit code representing points (1/72nd of an inch). */
+ /**
+ * Unit code representing points (1/72nd of an inch).
+ */
public static final int UNITS_POINTS = 1;
- /** Unit code representing picas (12 points). */
+ /**
+ * Unit code representing picas (12 points).
+ */
public static final int UNITS_PICAS = 2;
- /** Unit code representing the font-size of the relevant font. */
+ /**
+ * Unit code representing the font-size of the relevant font.
+ */
public static final int UNITS_EM = 3;
- /** Unit code representing the x-height of the relevant font. */
+ /**
+ * Unit code representing the x-height of the relevant font.
+ */
public static final int UNITS_EX = 4;
- /** Unit code representing millimetres. */
+ /**
+ * Unit code representing millimetres.
+ */
public static final int UNITS_MM = 5;
- /** Unit code representing centimetres. */
+ /**
+ * Unit code representing centimetres.
+ */
public static final int UNITS_CM = 6;
- /** Unit code representing inches. */
+ /**
+ * Unit code representing inches.
+ */
public static final int UNITS_INCH = 7;
- /** Unit code representing in percentage of the containing element
- * defined by terminal.
+ /**
+ * Unit code representing in percentage of the containing element
+ * defined by terminal.
*/
public static final int UNITS_PERCENTAGE = 8;
- /** Unit code representing in rows of text. This unit is only applicaple
+ /**
+ * Unit code representing in rows of text. This unit is only applicaple
* to some components can it's meaning is specified by component implementation.
*/
public static final int UNITS_ROWS = 9;
- /** Textual representations of units symbols.
- * Supported units and their symbols are:
- * <ul>
- * <li><code>UNITS_PIXELS</code>: "" (unit is omitted for pixels)</li>
- * <li><code>UNITS_POINTS</code>: "pt"</li>
- * <li><code>UNITS_PICAS</code>: "pc"</li>
- * <li><code>UNITS_EM</code>: "em"</li>
- * <li><code>UNITS_EX</code>: "ex"</li>
- * <li><code>UNITS_MM</code>: "mm"</li>
- * <li><code>UNITS_CM</code>. "cm"</li>
- * <li><code>UNITS_INCH</code>: "in"</li>
- * <li><code>UNITS_PERCENTAGE</code>: "%"</li>
- * <li><code>UNITS_ROWS</code>: "rows"</li>
- * </ul>
- * These can be used like <code>Sizeable.UNIT_SYMBOLS[UNITS_PIXELS]</code>.
+ /**
+ * Textual representations of units symbols.
+ * Supported units and their symbols are:
+ * <ul>
+ * <li><code>UNITS_PIXELS</code>: "" (unit is omitted for pixels)</li>
+ * <li><code>UNITS_POINTS</code>: "pt"</li>
+ * <li><code>UNITS_PICAS</code>: "pc"</li>
+ * <li><code>UNITS_EM</code>: "em"</li>
+ * <li><code>UNITS_EX</code>: "ex"</li>
+ * <li><code>UNITS_MM</code>: "mm"</li>
+ * <li><code>UNITS_CM</code>. "cm"</li>
+ * <li><code>UNITS_INCH</code>: "in"</li>
+ * <li><code>UNITS_PERCENTAGE</code>: "%"</li>
+ * <li><code>UNITS_ROWS</code>: "rows"</li>
+ * </ul>
+ * These can be used like <code>Sizeable.UNIT_SYMBOLS[UNITS_PIXELS]</code>.
*/
public static final String[] UNIT_SYMBOLS =
{ "", "pt", "pc", "em", "ex", "mm", "cm", "in", "%", "rows" };
- /** Get width of the object. Negative number implies unspecified size
+ /**
+ * Gets the width of the object. Negative number implies unspecified size
* (terminal is free to set the size).
* @return width of the object in units specified by widthUnits property.
*/
public int getWidth();
- /** Set width of the object. Negative number implies unspecified size
+ /**
+ * Sets the width of the object. Negative number implies unspecified size
* (terminal is free to set the size).
- * @param width width of the object in units specified by widthUnits property.
+ * @param width the width of the object in units specified by widthUnits property.
*/
public void setWidth(int width);
- /** Get height of the object. Negative number implies unspecified size
+ /**
+ * Gets the height of the object. Negative number implies unspecified size
* (terminal is free to set the size).
* @return height of the object in units specified by heightUnits property.
*/
public int getHeight();
- /** Set height of the object. Negative number implies unspecified size
+ /**
+ * Sets the height of the object. Negative number implies unspecified size
* (terminal is free to set the size).
- * @param height height of the object in units specified by heightUnits property.
+ * @param height the height of the object in units specified by heightUnits property.
*/
public void setHeight(int height);
- /** Get width property units.
+ /**
+ * Gets the width property units.
* @return units used in width property.
*/
public int getWidthUnits();
- /** Set width property units.
- * @param units units used in width property.
+ /**
+ * Sets the width property units.
+ * @param units the units used in width property.
*/
public void setWidthUnits(int units);
- /** Get height property units.
+ /**
+ * Gets the height property units.
* @return units used in height property.
*/
public int getHeightUnits();
- /** Set height property units.
- * @param units units used in height property.
+ /**
+ * Sets the height property units.
+ * @param units the units used in height property.
*/
public void setHeightUnits(int units);
diff --git a/src/com/itmill/toolkit/terminal/StreamResource.java b/src/com/itmill/toolkit/terminal/StreamResource.java
index 8d2a38e004..af0201c0c2 100644
--- a/src/com/itmill/toolkit/terminal/StreamResource.java
+++ b/src/com/itmill/toolkit/terminal/StreamResource.java
@@ -33,35 +33,54 @@ import java.io.InputStream;
import com.itmill.toolkit.Application;
import com.itmill.toolkit.service.FileTypeResolver;
-/** Stream resource is a resource provided to the client directly
+/**
+ * <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 @VERSION@
* @since 3.0
*/
public class StreamResource implements ApplicationResource {
- /** Source streamthe downloaded content is fetched from */
+ /**
+ * Source stream the downloaded content is fetched from.
+ */
private StreamSource streamSource = null;
- /** Explicit mime-type */
+ /**
+ * Explicit mime-type.
+ */
private String MIMEType = null;
- /** Filename */
+ /**
+ * Filename.
+ */
private String filename;
- /** Application */
+ /**
+ * Application.
+ */
private Application application;
- /** Default buffer size for this stream resource */
+ /**
+ * Default buffer size for this stream resource.
+ */
private int bufferSize = 0;
- /** Default cache time for this stream resource */
+ /**
+ * Default cache time for this stream resource.
+ */
private long cacheTime = DEFAULT_CACHETIME;
- /** Create new stream resource for downloading from stream. */
+ /**
+ * Creates new stream resource for downloading from stream.
+ * @param streamSource the source Stream.
+ * @param filename the name of the file.
+ * @param application the Application object.
+ */
public StreamResource(
StreamSource streamSource,
String filename,
@@ -75,45 +94,54 @@ public class StreamResource implements ApplicationResource {
application.addResource(this);
}
-
+ /**
+ * @see com.itmill.toolkit.terminal.Resource#getMIMEType()
+ */
public String getMIMEType() {
if (MIMEType != null)
return MIMEType;
return FileTypeResolver.getMIMEType(filename);
}
- /** Set the mime type of the resource */
+ /**
+ * Sets the mime type of the resource.
+ * @param MIMEType the MIME type to be set.
+ */
public void setMIMEType(String MIMEType) {
this.MIMEType = MIMEType;
}
- /** Returns the source for this StreamResource.
- * 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.
*/
public StreamSource getStreamSource() {
return streamSource;
}
- /** Sets the source for this StreamResource.
- * StreamSource is queried when the resource is about to be streamed
- * to the client.
- * @param streamSource The source to set
+ /**
+ * Sets the source for this <code>StreamResource</code>.
+ * <code>StreamSource</code> is queried when the resource is about to be streamed
+ * to the client.
+ * @param streamSource the source to set.
*/
public void setStreamSource(StreamSource streamSource) {
this.streamSource = streamSource;
}
- /** Returns the filename.
- * @return String
+ /**
+ * Gets the filename.
+ * @return the filename.
*/
public String getFilename() {
return filename;
}
- /** Sets the filename.
- * @param filename The filename to set
+ /**
+ * Sets the filename.
+ * @param filename the filename to set.
*/
public void setFilename(String filename) {
this.filename = filename;
@@ -139,15 +167,18 @@ public class StreamResource implements ApplicationResource {
return ds;
}
- /** Interface implemented by the source of a StreamResource.
+ /**
+ * Interface implemented by the source of a StreamResource.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface StreamSource {
- /** Return new input stream that is used for reading
- * the resource */
+ /**
+ * Returns new input stream that is used for reading
+ * the resource.
+ */
public InputStream getStream();
}
@@ -156,8 +187,9 @@ public class StreamResource implements ApplicationResource {
return bufferSize;
}
- /** Set the size of the download buffer used for this resource.
- * @param bufferSize The size of the buffer in bytes.
+ /**
+ * Sets the size of the download buffer used for this resource.
+ * @param bufferSize the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
@@ -168,14 +200,15 @@ public class StreamResource implements ApplicationResource {
return cacheTime;
}
- /** Set lenght of cache expiration time.
+ /**
+ * Sets the length of cache expiration time.
*
* <p>This gives the adapter the possibility cache streams sent to the
* client. The caching may be made in adapter or at the client if the
* client supports caching. Zero or negavive value disbales the
* caching of this stream.</p>
*
- * @param cacheTime The cache time in milliseconds.
+ * @param cacheTime the cache time in milliseconds.
*
*/
public void setCacheTime(long cacheTime) {
diff --git a/src/com/itmill/toolkit/terminal/SystemError.java b/src/com/itmill/toolkit/terminal/SystemError.java
index c6dfe77c49..617bfe43b4 100644
--- a/src/com/itmill/toolkit/terminal/SystemError.java
+++ b/src/com/itmill/toolkit/terminal/SystemError.java
@@ -31,8 +31,9 @@ package com.itmill.toolkit.terminal;
import java.io.PrintWriter;
import java.io.StringWriter;
-/** System error is a runtime exception caused by error in system. The system
- * error can be shown to the user as it implements ErrorMessage interface,
+/**
+ * <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.
*
* @author IT Mill Ltd.
@@ -46,37 +47,48 @@ public class SystemError extends RuntimeException implements ErrorMessage {
*/
private static final long serialVersionUID = 3256445789512675891L;
- /** The cause of the system error. The cause is stored separately as
- * JDK 1.3 does not support causes natively */
+ /**
+ * The cause of the system error. The cause is stored separately as
+ * JDK 1.3 does not support causes natively.
+ */
private Throwable cause = null;
- /** Constructor for SystemError with error message specified.
- * @param message Textual error description.
+ /**
+ * Constructor for SystemError with error message specified.
+ * @param message the Textual error description.
*/
public SystemError(String message) {
super(message);
}
- /** Constructor for SystemError with causing exception and error message.
- * @param message Textual error description.
- * @param cause The throwable causing the system error.
+ /**
+ * Constructor for SystemError with causing exception and error message.
+ * @param message the Textual error description.
+ * @param cause the throwable causing the system error.
*/
public SystemError(String message, Throwable cause) {
super(message);
this.cause = cause;
}
- /** Constructor for SystemError with cause.
- * @param cause The throwable causing the system error.
+ /**
+ * Constructor for SystemError with cause.
+ * @param cause the throwable causing the system error.
*/
public SystemError(Throwable cause) {
this.cause = cause;
}
-
+
+ /**
+ * @see com.itmill.toolkit.terminal.ErrorMessage#getErrorLevel()
+ */
public final int getErrorLevel() {
return ErrorMessage.SYSTEMERROR;
}
-
+
+ /**
+ * @see com.itmill.toolkit.terminal.Paintable#paint(com.itmill.toolkit.terminal.PaintTarget)
+ */
public void paint(PaintTarget target) throws PaintException {
target.startTag("error");
@@ -100,10 +112,14 @@ public class SystemError extends RuntimeException implements ErrorMessage {
}
target.endTag("error");
-
+
}
- /** Get cause for the error */
+ /**
+ * Gets cause for the error.
+ * @return the cause.
+ * @see java.lang.Throwable#getCause()
+ */
public Throwable getCause() {
return cause;
}
diff --git a/src/com/itmill/toolkit/terminal/Terminal.java b/src/com/itmill/toolkit/terminal/Terminal.java
index b9dfd4bb5d..d1ab02239e 100644
--- a/src/com/itmill/toolkit/terminal/Terminal.java
+++ b/src/com/itmill/toolkit/terminal/Terminal.java
@@ -28,7 +28,8 @@
package com.itmill.toolkit.terminal;
-/** Interface for different terminal types.
+/**
+ * Interface for different terminal types.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -37,33 +38,45 @@ package com.itmill.toolkit.terminal;
public interface Terminal {
- /** Get name of the default theme
- * @return Name of the terminal window
+ /**
+ * Gets the name of the default theme.
+ * @return the Name of the terminal window.
*/
public String getDefaultTheme();
- /** Get width of the terminal window in pixels
- * @return Width of the terminal window
+ /**
+ * Gets the width of the terminal window in pixels.
+ * @return the Width of the terminal window.
*/
public int getScreenWidth();
- /** Get height of the terminal window in pixels
- * @return Height of the terminal window
+ /**
+ * Gets the height of the terminal window in pixels.
+ * @return the Height of the terminal window.
*/
public int getScreenHeight();
- /** Terminal error event */
+ /**
+ * Terminal error event.
+ */
public interface ErrorEvent {
- /** Get the contained throwable */
+ /**
+ * Gets the contained throwable.
+ */
public Throwable getThrowable();
}
- /** Terminal error listener interface */
+ /**
+ * Terminal error listener interface.
+ */
public interface ErrorListener {
- /** Invoked when terminal error occurs. */
+ /**
+ * Invoked when terminal error occurs.
+ * @param event the fired event.
+ */
public void terminalError(Terminal.ErrorEvent event);
}
}
diff --git a/src/com/itmill/toolkit/terminal/ThemeResource.java b/src/com/itmill/toolkit/terminal/ThemeResource.java
index 3f1c518bbb..5215ade6ab 100644
--- a/src/com/itmill/toolkit/terminal/ThemeResource.java
+++ b/src/com/itmill/toolkit/terminal/ThemeResource.java
@@ -30,7 +30,8 @@ package com.itmill.toolkit.terminal;
import com.itmill.toolkit.service.FileTypeResolver;
-/** Theme resource is a named theme dependant resource provided and
+/**
+ * <code>ThemeResource</code> is a named theme dependant resource provided and
* managed by a theme. The actual resource contents are dynamically
* resolved to comply with the used theme by the terminal adapter.
* This is commonly used to provide static images, flash,
@@ -42,10 +43,15 @@ import com.itmill.toolkit.service.FileTypeResolver;
*/
public class ThemeResource implements Resource {
- /** Id of the terminal managed resource. */
+ /**
+ * Id of the terminal managed resource.
+ */
private String resourceID = null;
- /** Create a resource. */
+ /**
+ * Creates a resource.
+ * @param resourceId the Id of the resource.
+ */
public ThemeResource(String resourceId) {
if (resourceId == null)
throw new NullPointerException("Resource ID must not be null");
@@ -59,11 +65,12 @@ public class ThemeResource implements Resource {
this.resourceID = resourceId;
}
- /** Tests if the given object equals this Resource.
+ /**
+ * Tests if the given object equals this Resource.
*
- * @param obj the object to be tested for equality
+ * @param obj the object to be tested for equality.
* @return <code>true</code> if the given object equals this Icon,
- * <code>false</code> if not
+ * <code>false</code> if not.
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object obj) {
@@ -71,21 +78,31 @@ public class ThemeResource implements Resource {
resourceID.equals(((ThemeResource)obj).resourceID);
}
- /** @see java.lang.Object#hashCode()
+ /**
+ * @see java.lang.Object#hashCode()
*/
public int hashCode() {
return resourceID.hashCode();
}
+ /**
+ * @see java.lang.Object#toString()
+ */
public String toString() {
return resourceID.toString();
}
- /** Get the resource id */
+ /**
+ * Gets the resource id.
+ * @return the resource id.
+ */
public String getResourceId() {
return resourceID;
}
+ /**
+ * @see com.itmill.toolkit.terminal.Resource#getMIMEType()
+ */
public String getMIMEType() {
return FileTypeResolver.getMIMEType(getResourceId());
}
diff --git a/src/com/itmill/toolkit/terminal/URIHandler.java b/src/com/itmill/toolkit/terminal/URIHandler.java
index 77ebea9688..0f709191c4 100644
--- a/src/com/itmill/toolkit/terminal/URIHandler.java
+++ b/src/com/itmill/toolkit/terminal/URIHandler.java
@@ -30,10 +30,13 @@ package com.itmill.toolkit.terminal;
import java.net.URL;
-/** Interface implemented by all the classes capable of handling URI:s.
+/**
+ * Interface implemented by all the classes capable of handling URI:s.
*
- * <p>URI handlers can provide <code>DownloadStream</code>
- * for transferring data for client.</p>
+ * <p>
+ * <code>URIHandler</code> can provide <code>DownloadStream</code>
+ * for transferring data for client.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -41,19 +44,25 @@ import java.net.URL;
*/
public interface URIHandler {
- /** Handle uri.
- *
- * Handle the given relative URI. If the URI handling wants to emit
+ /**
+ * Handles the given relative URI. If the URI handling wants to emit
* a downloadable stream it can return download stream object. If no
* emitting stream is necessary, null should be returned instead.
- *
+ * @param context the URl.
+ * @param relativeUri the relative uri.
+ * @return the download stream object.
*/
public DownloadStream handleURI(URL context, String relativeUri);
- /** URIHandler error event */
+ /**
+ * URIHandler error event.
+ */
public interface ErrorEvent extends Terminal.ErrorEvent {
- /** Get the source URIHandler. */
+ /**
+ * Gets the source URIHandler.
+ * @return the URIHandler.
+ */
public URIHandler getURIHandler();
}
diff --git a/src/com/itmill/toolkit/terminal/UploadStream.java b/src/com/itmill/toolkit/terminal/UploadStream.java
index cc7e8c1e0a..5877800233 100644
--- a/src/com/itmill/toolkit/terminal/UploadStream.java
+++ b/src/com/itmill/toolkit/terminal/UploadStream.java
@@ -30,7 +30,8 @@ package com.itmill.toolkit.terminal;
import java.io.InputStream;
-/** Defines a variable type, that is used for passing uploaded files from
+/**
+ * Defines a variable type, that is used for passing uploaded files from
* terminal. Most often, file upload is implented using the
* {@link com.itmill.toolkit.ui.Upload Upload} component.
*
@@ -40,25 +41,29 @@ import java.io.InputStream;
*/
public interface UploadStream {
- /** Get the name of the stream.
- * @return name of the stream.
+ /**
+ * Gets the name of the stream.
+ * @return the name of the stream.
*/
public String getStreamName();
- /** Get input stream.
- * @return Input stream.
+ /**
+ * Gets the input stream.
+ * @return the Input stream.
*/
public InputStream getStream();
- /** Get input stream content type.
- * @return content type of the input stream.
+ /**
+ * Gets the input stream content type.
+ * @return the content type of the input stream.
*/
public String getContentType();
- /** Get stream content name.
- * Stream content name usually differs from the actual stream name.
- * it is used toi identify the content of the stream.
- * @return Name of the stream content.
+ /**
+ * Gets stream content name.
+ * Stream content name usually differs from the actual stream name.
+ * It is used to identify the content of the stream.
+ * @return the Name of the stream content.
*/
public String getContentName();
}
diff --git a/src/com/itmill/toolkit/terminal/UserError.java b/src/com/itmill/toolkit/terminal/UserError.java
index f71d40ab17..2a838d0b8a 100644
--- a/src/com/itmill/toolkit/terminal/UserError.java
+++ b/src/com/itmill/toolkit/terminal/UserError.java
@@ -28,7 +28,8 @@
package com.itmill.toolkit.terminal;
-/** User error is a controlled error occurred in application. User errors
+/**
+ * <code>UserError</code> is a controlled error occurred in application. User errors
* are occur in normal usage of the application and guide the user.
*
* @author IT Mill Ltd.
@@ -37,37 +38,51 @@ package com.itmill.toolkit.terminal;
*/
public class UserError implements ErrorMessage {
- /** Content mode, where the error contains only plain text.
+ /**
+ * Content mode, where the error contains only plain text.
*/
public static final int CONTENT_TEXT = 0;
- /** Content mode, where the error contains preformatted text.
+ /**
+ * Content mode, where the error contains preformatted text.
*/
public static final int CONTENT_PREFORMATTED = 1;
- /** Formatted content mode, where the contents is XML restricted to the
+ /**
+ * Formatted content mode, where the contents is XML restricted to the
* UIDL 1.0 formatting markups.
*/
public static final int CONTENT_UIDL = 2;
- /** Content mode */
+ /**
+ * Content mode.
+ */
private int mode = CONTENT_TEXT;
- /** Message in content mode */
+ /**
+ * Message in content mode.
+ */
private String msg;
- /** Error level */
+ /**
+ * Error level.
+ */
private int level = ErrorMessage.ERROR;
- /** Create a textual error message of level ERROR.
+ /**
+ * Creates a textual error message of level ERROR.
*
- * @param textErrorMessage The text of the error message.
+ * @param textErrorMessage the text of the error message.
*/
public UserError(String textErrorMessage) {
this.msg = textErrorMessage;
}
- /** Create error message with level and content mode.
+ /**
+ * Creates error message with level and content mode.
+ * @param message the error message.
+ * @param contentMode the content Mode.
+ * @param errorLevel the level of error.
*/
public UserError(String message, int contentMode, int errorLevel) {
diff --git a/src/com/itmill/toolkit/terminal/VariableOwner.java b/src/com/itmill/toolkit/terminal/VariableOwner.java
index d442557716..a56460c517 100644
--- a/src/com/itmill/toolkit/terminal/VariableOwner.java
+++ b/src/com/itmill/toolkit/terminal/VariableOwner.java
@@ -31,22 +31,29 @@ package com.itmill.toolkit.terminal;
import java.util.Map;
import java.util.Set;
-/** <p>Listener interface for UI variable changes. The user communicates
+/**
+ * <p>
+ * Listener interface for UI variable changes. The user communicates
* with the application using the so-called <i>variables</i>. When the user
* makes a change using the UI the terminal trasmits the changed variables
* to the application, and the components owning those variables may then
- * process those changes.</p>
+ * process those changes.
+ * </p>
*
- * <p>The variable-owning components can be linked with <i>dependency
+ * <p>
+ * The variable-owning components can be linked with <i>dependency
* relationships</i>. A dependency between two components means that all
* variable change events to the depended component will be handled
- * before any such events to the depending component.</p>
+ * before any such events to the depending component.
+ * </p>
*
- * <p>For example, the commit button for a text field will depend on that
+ * <p>
+ * For example, the commit button for a text field will depend on that
* text field. This is because we want to handle any pending changes the
- * user makes to the contents on the text field before before we accept the
+ * user makes to the contents on the text field before we accept the
* click of the commit button which starts processing the text field
- * contents.</p>
+ * contents.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -54,47 +61,53 @@ import java.util.Set;
*/
public interface VariableOwner {
- /** Gets the variable change listeners this <code>VariableOwner</code>
+ /**
+ * Gets the variable change listeners this <code>VariableOwner</code>
* directly depends on. This list does not contain any indirect
* dependencies, for example, if A depends on B and B depends on C,
* the dependency list of A does not include C.
*
- * @return Set of <code>VariableOwner</code>s this component directly
+ * @return Set of <code>VariableOwners</code> this component directly
* depend on, <code>null</code> if this component does not depend on
* anybody.
*/
public Set getDirectDependencies();
- /** Called when one or more variables handled by the implementing class
+ /**
+ * Called when one or more variables handled by the implementing class
* are changed.
*
- * @param source Source of the variable change. This is the origin of the
+ * @param source the Source of the variable change. This is the origin of the
* event. For example in Web Adapter this is the request.
- * @param variables Mapping from variable names to new variable values
+ * @param variables the Mapping from variable names to new variable values.
*/
public void changeVariables(Object source, Map variables);
- /** Makes this <code>VariableOwner</code> depend on the given
+ /**
+ * Makes this <code>VariableOwner</code> depend on the given
* <code>VariableOwner</code>. This means that any variable change
* events relating to <code>depended</code> must be sent before any
* such events that relate to this object.
*
- * @param denpended the <code>VariableOwner</code> component who
- * this component depends on
+ * @param depended the <code>VariableOwner</code> component who
+ * this component depends on.
*/
public void dependsOn(VariableOwner depended);
- /** Removes the given component from this component's dependency list.
+ /**
+ * Removes the given component from this component's dependency list.
* After the call this component will no longer depend on
* <code>depended</code> wdepende direct dependency from the component.
* Indirect dependencies are not removed.
*
- * @param denpended the component to be removed from this component's
+ * @param depended the component to be removed from this component's
* dependency list.
*/
public void removeDirectDependency(VariableOwner depended);
- /** <p>Tests if the variable owner is enabled or not. The terminal
+ /**
+ * <p>
+ * Tests if the variable owner is enabled or not. The terminal
* should not send any variable changes to disabled variable owners.
* </p>
*
@@ -103,26 +116,35 @@ public interface VariableOwner {
*/
public boolean isEnabled();
- /** <p>Tests if the variable owner is in immediate mode or not. Being in
+ /**
+ * <p>
+ * Tests if the variable owner is in immediate mode or not. Being in
* immediate mode means that all variable changes are required to be sent
* back from the terminal immediately when they occur.
* </p>
*
- * <p><strong>Note:</strong> <code>VariableOwner</code> does not include a
+ * <p>
+ * <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()}.</p>
+ * in {@link #isImmediate()}.
+ * </p>
*
* @return <code>true</code> if the component is in immediate mode,
- * <code>false</code> if not
+ * <code>false</code> if not.
*/
public boolean isImmediate();
- /** VariableOwner error event */
+ /**
+ * VariableOwner error event.
+ */
public interface ErrorEvent extends Terminal.ErrorEvent {
- /** Get the source VariableOwner. */
+ /**
+ * Gets the source VariableOwner.
+ * @return the variable owner.
+ */
public VariableOwner getVariableOwner();
}
diff --git a/src/com/itmill/toolkit/terminal/web/AjaxApplicationManager.java b/src/com/itmill/toolkit/terminal/web/AjaxApplicationManager.java
index bf8bbf9629..2e43005574 100644
--- a/src/com/itmill/toolkit/terminal/web/AjaxApplicationManager.java
+++ b/src/com/itmill/toolkit/terminal/web/AjaxApplicationManager.java
@@ -61,8 +61,9 @@ import com.itmill.toolkit.ui.Component;
import com.itmill.toolkit.ui.FrameWindow;
import com.itmill.toolkit.ui.Window;
-/** Application manager processes changes and paints for single
- * application instance.
+/**
+ * Application manager processes changes and paints for single
+ * application instance.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -94,7 +95,11 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
public AjaxApplicationManager(Application application) {
this.application = application;
}
-
+
+/**
+ *
+ * @return
+ */
private AjaxVariableMap getVariableMap() {
AjaxVariableMap vm = (AjaxVariableMap) applicationToVariableMapMap
.get(application);
@@ -104,18 +109,32 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
}
return vm;
}
-
+
+/**
+ *
+ *
+ */
public void takeControl() {
application.addListener((Application.WindowAttachListener) this);
application.addListener((Application.WindowDetachListener) this);
}
-
+
+/**
+ *
+ *
+ */
public void releaseControl() {
application.removeListener((Application.WindowAttachListener) this);
application.removeListener((Application.WindowDetachListener) this);
}
-
+
+/**
+ *
+ * @param request the HTTP Request.
+ * @param response the HTTP Response.
+ * @throws IOException if the writing failed due to input/output error.
+ */
public void handleUidlRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException {
@@ -138,35 +157,35 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
Map unhandledParameters = getVariableMap().handleVariables(
request, application);
- // Handle the URI if the application is still running
+ // Handles the URI if the application is still running
if (application.isRunning())
download = handleURI(application, request, response);
// If this is not a download request
if (download == null) {
- // Find the window within the application
+ // Finds the window within the application
Window window = null;
if (application.isRunning())
window = getApplicationWindow(request, application);
- // Handle the unhandled parameters if the application is
+ // Handles the unhandled parameters if the application is
// still running
if (window != null && unhandledParameters != null
&& !unhandledParameters.isEmpty())
window.handleParameters(unhandledParameters);
- // Remove application if it has stopped
+ // Removes application if it has stopped
if (!application.isRunning()) {
endApplication(request, response, application);
return;
}
- // Return if no window found
+ // Returns if no window found
if (window == null)
return;
- // Set the response type
+ // Sets the response type
response.setContentType("application/xml; charset=UTF-8");
paintTarget = new AjaxPaintTarget(
@@ -190,13 +209,13 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
}
}
- // Paint components
+ // Paints components
Set paintables;
if (repaintAll) {
paintables = new LinkedHashSet();
paintables.add(window);
- // Add all non-native windows
+ // Adds all non-native windows
for (Iterator i=window.getApplication().getWindows().iterator(); i.hasNext();) {
Window w = (Window) i.next();
if (!"native".equals(w.getStyle()) && w != window)
@@ -206,10 +225,10 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
paintables = getDirtyComponents();
if (paintables != null) {
- // Create "working copy" of the current state.
+ // Creates "working copy" of the current state.
List currentPaintables = new ArrayList(paintables);
- // Sort the paintable so that parent windows
+ // Sorts the paintable so that parent windows
// are always painted before child windows
Collections.sort(currentPaintables, new Comparator() {
@@ -304,7 +323,7 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
out.close();
} catch (Throwable e) {
- // Write the error report to client
+ // Writes the error report to client
OutputStreamWriter w = new OutputStreamWriter(out);
PrintWriter err = new PrintWriter(w);
err
@@ -320,14 +339,16 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
}
/**
- * Get the existing application or create a new one. Get a window within an
+ * Gets the existing application or create a new one. Get a window within an
* application based on the requested URI.
*
* @param request
- * HTTP Request.
+ * the HTTP Request.
* @param application
- * Application to query for window.
+ * the Application to query for window.
* @return Window mathing the given URI or null if not found.
+ * @throws ServletException if an exception has occurred that interferes with the
+ * servlet's normal operation.
*/
private Window getApplicationWindow(HttpServletRequest request,
Application application) throws ServletException {
@@ -365,21 +386,20 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
}
/**
- * Handle the requested URI. An application can add handlers to do special
+ * Handles the requested URI. An application can add handlers to do special
* processing, when a certain URI is requested. The handlers are invoked
* before any windows URIs are processed and if a DownloadStream is returned
* it is sent to the client.
*
- * @see com.itmill.toolkit.terminal.URIHandler
- *
* @param application
- * Application owning the URI
+ * the Application owning the URI.
* @param request
- * HTTP request instance
+ * the HTTP request instance.
* @param response
- * HTTP response to write to.
- * @return boolean True if the request was handled and further processing
- * should be suppressed, false otherwise.
+ * the HTTP response to write to.
+ * @return boolean <code>true</code> if the request was handled and further processing
+ * should be suppressed, otherwise <code>false</code>.
+ * @see com.itmill.toolkit.terminal.URIHandler
*/
private DownloadStream handleURI(Application application,
HttpServletRequest request, HttpServletResponse response) {
@@ -406,21 +426,18 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
}
/**
- * Handle the requested URI. An application can add handlers to do special
+ * Handles the requested URI. An application can add handlers to do special
* processing, when a certain URI is requested. The handlers are invoked
* before any windows URIs are processed and if a DownloadStream is returned
* it is sent to the client.
- *
- * @see com.itmill.toolkit.terminal.URIHandler
- *
- * @param application
- * Application owning the URI
+ * @param stream the downloadable stream.
+ *
* @param request
- * HTTP request instance
+ * the HTTP request instance.
* @param response
- * HTTP response to write to.
- * @return boolean True if the request was handled and further processing
- * should be suppressed, false otherwise.
+ * the HTTP response to write to.
+ *
+ * @see com.itmill.toolkit.terminal.URIHandler
*/
private void handleDownload(DownloadStream stream,
HttpServletRequest request, HttpServletResponse response) {
@@ -429,10 +446,10 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
InputStream data = stream.getStream();
if (data != null) {
- // Set content type
+ // Sets content type
response.setContentType(stream.getContentType());
- // Set cache headers
+ // Sets cache headers
long cacheTime = stream.getCacheTime();
if (cacheTime <= 0) {
response.setHeader("Cache-Control", "no-cache");
@@ -480,7 +497,13 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
}
- /** End application */
+ /**
+ * Ends the Application.
+ * @param request the HTTP request instance.
+ * @param response the HTTP response to write to.
+ * @param application the Application to end.
+ * @throws IOException if the writing failed due to input/output error.
+ */
private void endApplication(HttpServletRequest request,
HttpServletResponse response, Application application)
throws IOException {
@@ -497,10 +520,11 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
out.println("</redirect>");
}
- /**
- * @param window
- * @return
- */
+ /**
+ * Gets the Paintable Id.
+ * @param paintable
+ * @return the paintable Id.
+ */
public synchronized String getPaintableId(Paintable paintable) {
String id = (String) paintableIdMap.get(paintable);
@@ -511,7 +535,11 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
return id;
}
-
+
+/**
+ *
+ * @return
+ */
public synchronized Set getDirtyComponents() {
// Remove unnecessary repaints from the list
@@ -536,11 +564,18 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
return Collections.unmodifiableSet(dirtyPaintabletSet);
}
-
+
+ /**
+ * Clears the Dirty Components.
+ *
+ */
public synchronized void clearDirtyComponents() {
dirtyPaintabletSet.clear();
}
-
+
+ /**
+ * @see com.itmill.toolkit.terminal.Paintable.RepaintRequestListener#repaintRequested(com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent)
+ */
public void repaintRequested(RepaintRequestEvent event) {
Paintable p = event.getPaintable();
dirtyPaintabletSet.add(p);
@@ -552,9 +587,10 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
}
}
- /** Recursively request repaint for all frames in frameset.
+ /**
+ * Recursively request repaint for all frames in frameset.
*
- * @param fs Framewindow.Frameset
+ * @param fs the Framewindow.Frameset.
*/
private void repaintFrameset(FrameWindow.Frameset fs) {
List frames = fs.getFrames();
@@ -570,43 +606,73 @@ public class AjaxApplicationManager implements Paintable.RepaintRequestListener,
}
}
}
-
+
+/**
+ *
+ * @param p
+ */
public void paintablePainted(Paintable p) {
dirtyPaintabletSet.remove(p);
p.requestRepaintRequests();
}
-
+
+/**
+ *
+ * @param paintable
+ * @return
+ */
public boolean isDirty(Paintable paintable) {
return (dirtyPaintabletSet.contains(paintable));
}
-
+
+ /**
+ * @see com.itmill.toolkit.Application.WindowAttachListener#windowAttached(com.itmill.toolkit.Application.WindowAttachEvent)
+ */
public void windowAttached(WindowAttachEvent event) {
event.getWindow().addListener(this);
dirtyPaintabletSet.add(event.getWindow());
}
-
+
+ /**
+ * @see com.itmill.toolkit.Application.WindowDetachListener#windowDetached(com.itmill.toolkit.Application.WindowDetachEvent)
+ */
public void windowDetached(WindowDetachEvent event) {
event.getWindow().removeListener(this);
// Notify client of the close operation
removedWindows.add(event.getWindow());
}
-
+
+/**
+ *
+ * @return
+ */
public synchronized Set getRemovedWindows() {
return Collections.unmodifiableSet(removedWindows);
}
-
+
+/**
+ *
+ * @param w
+ */
private void removedWindowNotified(Window w) {
this.removedWindows.remove(w);
}
- /** Implementation of URIHandler.ErrorEvent interface. */
+ /**
+ * Implementation of URIHandler.ErrorEvent interface.
+ */
public class URIHandlerErrorImpl implements URIHandler.ErrorEvent {
private URIHandler owner;
private Throwable throwable;
-
+
+/**
+ *
+ * @param owner
+ * @param throwable
+ */
private URIHandlerErrorImpl(URIHandler owner, Throwable throwable) {
this.owner = owner;
this.throwable = throwable;
diff --git a/src/com/itmill/toolkit/terminal/web/AjaxHttpUploadStream.java b/src/com/itmill/toolkit/terminal/web/AjaxHttpUploadStream.java
index 80529d6de8..29a9abc192 100644
--- a/src/com/itmill/toolkit/terminal/web/AjaxHttpUploadStream.java
+++ b/src/com/itmill/toolkit/terminal/web/AjaxHttpUploadStream.java
@@ -30,7 +30,8 @@ package com.itmill.toolkit.terminal.web;
import java.io.InputStream;
-/** AjaxAdapter implementation of the UploadStream interface.
+/**
+ * AjaxAdapter implementation of the UploadStream interface.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -39,22 +40,24 @@ import java.io.InputStream;
public class AjaxHttpUploadStream
implements com.itmill.toolkit.terminal.UploadStream {
- /** Holds value of property variableName. */
+ /**
+ * Holds value of property variableName.
+ */
private String streamName;
private String contentName;
private String contentType;
- /** Holds value of property variableValue. */
+ /**
+ * Holds value of property variableValue.
+ */
private InputStream stream;
- /** Creates a new instance of UploadStreamImpl
- * @param name of the stream
- * @param stream input stream
- * @param contentName name of the content
- * @param contentType type of the content
- * @param time Time of event creation
- * (for parallel events (for example in
- * same http request), times are equal)
+ /**
+ * Creates a new instance of UploadStreamImpl.
+ * @param name the name of the stream.
+ * @param stream the input stream.
+ * @param contentName the name of the content.
+ * @param contentType the type of the content.
*/
public AjaxHttpUploadStream(
String name,
@@ -67,31 +70,35 @@ public class AjaxHttpUploadStream
this.contentType = contentType;
}
- /** Get the name of the stream.
- * @return name of the stream.
+ /**
+ * Gets the name of the stream.
+ * @return the name of the stream.
*/
public String getStreamName() {
return this.streamName;
}
- /** Get input stream.
- * @return Input stream.
+ /**
+ * Gets the input stream.
+ * @return the Input stream.
*/
public InputStream getStream() {
return this.stream;
}
- /** Get input stream content type.
- * @return content type of the input stream.
+ /**
+ * Gets the input stream content type.
+ * @return the content type of the input stream.
*/
public String getContentType() {
return this.contentType;
}
- /** Get stream content name.
- * Stream content name usually differs from the actual stream name.
- * it is used toi identify the content of the stream.
- * @return Name of the stream content.
+ /**
+ * Gets the stream content name.
+ * Stream content name usually differs from the actual stream name.
+ * It is used to identify the content of the stream.
+ * @return the Name of the stream content.
*/
public String getContentName() {
return this.contentName;
diff --git a/src/com/itmill/toolkit/terminal/web/AjaxPaintTarget.java b/src/com/itmill/toolkit/terminal/web/AjaxPaintTarget.java
index fe080e2758..5db631fe2b 100644
--- a/src/com/itmill/toolkit/terminal/web/AjaxPaintTarget.java
+++ b/src/com/itmill/toolkit/terminal/web/AjaxPaintTarget.java
@@ -82,22 +82,24 @@ public class AjaxPaintTarget implements PaintTarget {
private int numberOfPaints = 0;
/**
- * Create a new XMLPrintWriter, without automatic line flushing.
+ * Creates a new XMLPrintWriter, without automatic line flushing.
*
- *
- * @param out
+ * @param variableMap
+ * @param manager
+ * @param output
* A character-output stream.
+ * @throws PaintException if the paint operation failed.
*/
public AjaxPaintTarget(AjaxVariableMap variableMap, AjaxApplicationManager manager,
OutputStream output) throws PaintException {
- // Set the cache
+ // Sets the cache
this.manager = manager;
- // Set the variable map
+ // Sets the variable map
this.variableMap = variableMap;
- // Set the target for UIDL writing
+ // Sets the target for UIDL writing
try {
this.uidlBuffer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(output,"UTF-8")));
} catch (UnsupportedEncodingException e) {
@@ -108,10 +110,10 @@ public class AjaxPaintTarget implements PaintTarget {
mOpenTags = new Stack();
mTagArgumentListOpen = false;
- //Add document declaration
+ //Adds document declaration
this.print(UIDL_XML_DECL + "\n\n");
- // Add UIDL start tag and its attributes
+ // Adds UIDL start tag and its attributes
this.startTag("changes");
}
@@ -127,16 +129,16 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Method append.
+ * Method append.This method is thread safe.
*
- * @param string
+ * @param string the text to insert.
*/
private void append(String string) {
uidlBuffer.print(string);
}
/**
- * Print element start tag.
+ * Prints the element start tag.
*
* <pre>
* Todo:
@@ -145,7 +147,8 @@ public class AjaxPaintTarget implements PaintTarget {
* </pre>
*
* @param tagName
- * The name of the start tag
+ * the name of the start tag.
+ * @throws PaintException if the paint operation failed.
*
*/
public void startTag(String tagName) throws PaintException {
@@ -153,37 +156,38 @@ public class AjaxPaintTarget implements PaintTarget {
if (tagName == null)
throw new NullPointerException();
- // Incerement paint tracker
+ // Increments paint tracker
if (this.isTrackPaints()) {
this.numberOfPaints++;
}
- //Ensure that the target is open
+ //Ensures that the target is open
if (this.closed)
throw new PaintException(
"Attempted to write to a closed PaintTarget.");
- // Make sure that the open start tag is closed before
+ // Makes sure that the open start tag is closed before
// anything is written.
ensureClosedTag();
- // Check tagName and attributes here
+ // Checks tagName and attributes here
mOpenTags.push(tagName);
- // Print the tag with attributes
+ // Prints the tag with attributes
append("<" + tagName);
mTagArgumentListOpen = true;
}
/**
- * Print element end tag.
+ * Prints the element end tag.
*
* If the parent tag is closed before every child tag is closed an
* PaintException is raised.
*
* @param tag
- * The name of the end tag
+ * the name of the end tag.
+ * @throws Paintexception if the paint operation failed.
*/
public void endTag(String tagName) throws PaintException {
// In case of null data output nothing:
@@ -209,14 +213,15 @@ public class AjaxPaintTarget implements PaintTarget {
mTagArgumentListOpen = false;
}
- //Write the end (closing) tag
+ //Writes the end (closing) tag
append("</" + lastTag + ">");
flush();
}
/**
- * Substitute the XML sensitive characters with predefined XML entities.
- *
+ * Substitutes the XML sensitive characters with predefined XML entities.
+ * @param xml
+ * the String to be substituted.
* @return A new string instance where all occurrences of XML sensitive
* characters are substituted with entities.
*/
@@ -227,10 +232,10 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Substitute the XML sensitive characters with predefined XML 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.
*
@@ -254,10 +259,10 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Substitute a XML sensitive character with predefined XML entity.
+ * Substitutes a XML sensitive character with predefined XML entity.
*
* @param c
- * 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.
*/
@@ -279,7 +284,7 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Print XML.
+ * Prints XML.
*
* Writes pre-formatted XML to stream. Well-formness of XML is checked.
*
@@ -288,6 +293,7 @@ public class AjaxPaintTarget implements PaintTarget {
* TODO: XML checking should be made
*
* </pre>
+ * @param str the string to print.
*/
private void print(String str) {
// In case of null data output nothing:
@@ -303,7 +309,9 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Print XML-escaped text.
+ * Prints XML-escaped text.
+ * @param str
+ * @throws PaintException if the paint operation failed.
*
*/
public void addText(String str) throws PaintException {
@@ -315,9 +323,10 @@ public class AjaxPaintTarget implements PaintTarget {
* content is written.
*
* @param name
- * Attribute name
+ * the Attribute name.
* @param value
- * Attribute value
+ * the Attribute value.
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, boolean value) throws PaintException {
addAttribute(name, String.valueOf(value));
@@ -328,9 +337,11 @@ public class AjaxPaintTarget implements PaintTarget {
* any content is written.
*
* @param name
- * Attribute name
+ * the Attribute name.
* @param value
- * Attribute value
+ * the Attribute value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, Resource value) throws PaintException {
@@ -365,10 +376,11 @@ public class AjaxPaintTarget implements PaintTarget {
* content is written.
*
* @param name
- * Attribute name
+ * the Attribute name.
* @param value
- * Attribute value
- * @return this object
+ * the Attribute value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, int value) throws PaintException {
addAttribute(name, String.valueOf(value));
@@ -379,10 +391,11 @@ public class AjaxPaintTarget implements PaintTarget {
* content is written.
*
* @param name
- * Attribute name
+ * the Attribute name.
* @param value
- * Attribute value
- * @return this object
+ * the Attribute value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, long value) throws PaintException {
addAttribute(name, String.valueOf(value));
@@ -393,10 +406,11 @@ public class AjaxPaintTarget implements PaintTarget {
* content is written.
*
* @param name
- * Boolean attribute name
+ * the Boolean attribute name.
* @param value
- * Boolean attribute value
- * @return this object
+ * the Boolean attribute value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, String value) throws PaintException {
// In case of null data output nothing:
@@ -417,15 +431,16 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Add a string type variable.
+ * Adds a string type variable.
*
* @param owner
- * Listener for variable changes
+ * the Listener for variable changes.
* @param name
- * Variable name
+ * the Variable name.
* @param value
- * Variable initial value
- * @return Reference to this.
+ * the Variable initial value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String value)
throws PaintException {
@@ -439,15 +454,16 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Add a int type variable.
+ * Adds a int type variable.
*
* @param owner
- * Listener for variable changes
+ * the Listener for variable changes.
* @param name
- * Variable name
+ * the Variable name.
* @param value
- * Variable initial value
- * @return Reference to this.
+ * the Variable initial value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, int value)
throws PaintException {
@@ -461,15 +477,16 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Add a boolean type variable.
+ * Adds a boolean type variable.
*
* @param owner
- * Listener for variable changes
+ * the Listener for variable changes.
* @param name
- * Variable name
+ * the Variable name.
* @param value
- * Variable initial value
- * @return Reference to this.
+ * the Variable initial value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, boolean value)
throws PaintException {
@@ -483,15 +500,16 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Add a string array type variable.
+ * Adds a string array type variable.
*
* @param owner
- * Listener for variable changes
+ * the Listener for variable changes.
* @param name
- * Variable name
+ * the Variable name.
* @param value
- * Variable initial value
- * @return Reference to this.
+ * the Variable initial value.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String[] value)
throws PaintException {
@@ -506,15 +524,14 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Add a upload stream type variable.
+ * Adds a upload stream type variable.
*
* @param owner
- * Listener for variable changes
+ * the Listener for variable changes.
* @param name
- * Variable name
- * @param value
- * Variable initial value
- * @return Reference to this.
+ * the Variable name.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addUploadStreamVariable(VariableOwner owner, String name)
throws PaintException {
@@ -527,10 +544,13 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Print single text section.
+ * Prints the single text section.
*
* Prints full text section. The section data is escaped from XML tags and
* surrounded by XML start and end-tags.
+ * @param sectionTagName the name of the tag.
+ * @param sectionData the section data to be printed.
+ * @throws PaintException if the paint operation failed.
*/
public void addSection(String sectionTagName, String sectionData)
throws PaintException {
@@ -539,7 +559,11 @@ public class AjaxPaintTarget implements PaintTarget {
endTag(sectionTagName);
}
- /** Add XML dirctly to UIDL */
+ /**
+ * Adds XML directly to UIDL.
+ * @param xml the Xml to be added.
+ * @throws PaintException if the paint operation failed.
+ */
public void addUIDL(String xml) throws PaintException {
//Ensure that the target is open
@@ -558,7 +582,11 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Add XML section with namespace
+ * Adds XML section with namespace.
+ * @param sectionTagName the name of the tag.
+ * @param sectionData the section data.
+ * @param namespace the namespace to be added.
+ * @throws PaintException if the paint operation failed.
*
* @see com.itmill.toolkit.terminal.PaintTarget#addXMLSection(String,
* String, String)
@@ -583,8 +611,9 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Get the UIDL already printed to stream. Paint target must be closed
- * before the getUIDL() cn be called.
+ * Gets the UIDL already printed to stream. Paint target must be closed
+ * before the <code>getUIDL</code> can be called.
+ * @return the UIDL.
*/
public String getUIDL() {
if (this.closed) {
@@ -595,10 +624,11 @@ public class AjaxPaintTarget implements PaintTarget {
}
/**
- * Close the paint target. Paint target must be closed before the getUIDL()
- * cn be called. Subsequent attempts to write to paint target. If the target
+ * 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 ignored. will generate an
* exception.
+ * @throws PaintException if the paint operation failed.
*/
public void close() throws PaintException {
if (!this.closed) {
@@ -631,9 +661,7 @@ public class AjaxPaintTarget implements PaintTarget {
return false;
}
- /*
- * (non-Javadoc)
- *
+ /**
* @see com.itmill.toolkit.terminal.PaintTarget#addCharacterData(java.lang.String)
*/
public void addCharacterData(String text) throws PaintException {
@@ -641,23 +669,29 @@ public class AjaxPaintTarget implements PaintTarget {
ensureClosedTag();
append(escapeXML(text));
}
-
+
+/**
+ *
+ * @return
+ */
public boolean isTrackPaints() {
return trackPaints;
}
- /** Get number of paints.
+ /**
+ * Gets the number of paints.
*
- * @return
+ * @return the number of paints.
*/
public int getNumberOfPaints() {
return numberOfPaints;
}
- /** Set tracking to true or false.
+ /**
+ * Sets the tracking to true or false.
*
* This also resets the number of paints.
- * @param trackPaints
+ * @param enabled is the tracking is enabled or not.
* @see #getNumberOfPaints()
*/
public void setTrackPaints(boolean enabled) {
diff --git a/src/com/itmill/toolkit/terminal/web/AjaxVariableMap.java b/src/com/itmill/toolkit/terminal/web/AjaxVariableMap.java
index a9f1300d1d..eb257facf1 100644
--- a/src/com/itmill/toolkit/terminal/web/AjaxVariableMap.java
+++ b/src/com/itmill/toolkit/terminal/web/AjaxVariableMap.java
@@ -50,7 +50,8 @@ import com.itmill.toolkit.terminal.Terminal;
import com.itmill.toolkit.terminal.UploadStream;
import com.itmill.toolkit.terminal.VariableOwner;
-/** Variable map for ajax applications.
+/**
+ * Variable map for ajax applications.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -66,11 +67,18 @@ public class AjaxVariableMap {
private Map idToValueMap = new HashMap();
private Map ownerToNameToIdMap = new WeakHashMap();
private Object mapLock = new Object();
-
+
// Id generator
private long lastId = 0;
- /** Convert the string to a supported class */
+ /**
+ * Converts the string to a supported class.
+ * @param type
+ * @param value
+ * @return
+ * @throws java.lang.ClassCastException if the code has
+ * attempted to cast an object to a subclass of which it is not an instance
+ */
private static Object convert(Class type, String value)
throws java.lang.ClassCastException {
try {
@@ -94,8 +102,12 @@ public class AjaxVariableMap {
}
}
- /** Register a new variable.
- *
+ /**
+ * Registers a new variable.
+ * @param name the Variable name.
+ * @param type
+ * @param value
+ * @param owner the Listener for variable changes.
* @return id to assigned for this variable.
*/
public String registerVariable(
@@ -104,7 +116,7 @@ public class AjaxVariableMap {
Object value,
VariableOwner owner) {
- // Check that the type of the class is supported
+ // Checks that the type of the class is supported
if (!(type.equals(Boolean.class)
|| type.equals(Integer.class)
|| type.equals(String.class)
@@ -115,7 +127,7 @@ public class AjaxVariableMap {
synchronized (mapLock) {
- // Check if the variable is already mapped
+ // Checks if the variable is already mapped
HashMap nameToIdMap = (HashMap) ownerToNameToIdMap.get(owner);
if (nameToIdMap == null) {
nameToIdMap = new HashMap();
@@ -124,7 +136,7 @@ public class AjaxVariableMap {
String id = (String) nameToIdMap.get(name);
if (id == null) {
- // Generate new id and register it
+ // Generates new id and register it
id = "v" + String.valueOf(++lastId);
nameToIdMap.put(name, id);
idToOwnerMap.put(id, new WeakReference(owner));
@@ -138,7 +150,11 @@ public class AjaxVariableMap {
}
}
- /** Unregisters a variable. */
+ /**
+ * Unregisters the variable.
+ * @param name the Variable name.
+ * @param owner the Listener for variable changes.
+ */
public void unregisterVariable(String name, VariableOwner owner) {
synchronized (mapLock) {
@@ -170,20 +186,31 @@ public class AjaxVariableMap {
*/
private class ParameterContainer {
- /** Construct the mapping: listener to set of listened parameter names */
+ /**
+ * Constructs the mapping: listener to set of listened parameter names.
+ */
private HashMap parameters = new HashMap();
- /** Parameter values */
+ /**
+ * Parameter values.
+ */
private HashMap values = new HashMap();
- /** Multipart parser used for parsing the request */
+ /**
+ * Multipart parser used for parsing the request.
+ */
private ServletMultipartRequest parser = null;
- /** Name - Value mapping of parameters that are not variables */
+ /**
+ * Name - Value mapping of parameters that are not variables.
+ */
private HashMap nonVariables = new HashMap();
- /** Create new parameter container and parse the parameters from the request using
+ /**
+ * Creates new parameter container and parse the parameters from the request using
* GET, POST and POST/MULTIPART parsing
+ * @param req the Http request to handle.
+ * @throws IOException if the writing failed due to input/output error.
*/
public ParameterContainer(HttpServletRequest req) throws IOException {
// Parse GET / POST parameters
@@ -235,7 +262,11 @@ public class AjaxVariableMap {
}
- /** Add parameter to container */
+ /**
+ * Adds the parameter to container.
+ * @param name the Parameter name.
+ * @param value the Parameter value.
+ */
private void addParam(String name, String[] value) {
// Support name="set:name=value" value="ignored" notation
@@ -378,13 +409,13 @@ public class AjaxVariableMap {
value = new String[0];
}
- // Get the owner
+ // Gets the owner
WeakReference ref = (WeakReference) idToOwnerMap.get(name);
VariableOwner owner = null;
if (ref != null)
owner = (VariableOwner) ref.get();
- // Add the parameter to mapping only if they have owners
+ // Adds the parameter to mapping only if they have owners
if (owner != null) {
Set p = (Set) parameters.get(owner);
if (p == null)
@@ -407,69 +438,88 @@ public class AjaxVariableMap {
idToValueMap.remove(name);
}
- // Add the parameter to set of non-variables
+ // Adds the parameter to set of non-variables
nonVariables.put(name, value);
}
}
- /** Get the set of all parameters connected to given variable owner */
+ /**
+ * Gets the set of all parameters connected to given variable owner.
+ * @param owner the Listener for variable changes.
+ * @return the set of all the parameters.
+ */
public Set getParameters(VariableOwner owner) {
if (owner == null)
return null;
return (Set) parameters.get(owner);
}
- /** Get the set of all variable owners owning parameters in this request */
+ /**
+ * Gets the set of all variable owners owning parameters in this request.
+ * @return the set of all varaible owners.
+ */
public Set getOwners() {
return parameters.keySet();
}
- /** Get the value of a parameter */
+ /**
+ * Gets the value of a parameter.
+ * @param parameterName the name of the parameter.
+ * @return the value of the parameter.
+ */
public String[] getValue(String parameterName) {
return (String[]) values.get(parameterName);
}
- /** Get the servlet multipart parser */
+ /**
+ * Gets the servlet multipart parser.
+ * @return the parser.
+ */
public ServletMultipartRequest getParser() {
return parser;
}
- /** Get the name - value[] mapping of non variable paramteres */
+ /**
+ * Gets the name - value[] mapping of non variable parameters.
+ * @return the mapping of non variable parameters.
+ */
public Map getNonVariables() {
return nonVariables;
}
}
- /** Handle all variable changes in this request.
- * @param req Http request to handle
- * @param listeners If the list is non null, only the listed listeners are
- * served. Otherwise all the listeners are served.
- * @return Name to Value[] mapping of unhandled variables
- */
+ /**
+ * Handles all variable changes in this request.
+ * @param req the Http request to handle.
+ * @param errorListener the listeners If the list is non null, only the listed listeners are
+ * served. Otherwise all the listeners are served.
+ * @return Name to Value[] mapping of unhandled variables.
+ * @throws IOException if the writing failed due to input/output error.
+ */
public Map handleVariables(
HttpServletRequest req,
Terminal.ErrorListener errorListener)
throws IOException {
- // Get the parameters
+ // Gets the parameters
ParameterContainer parcon = new ParameterContainer(req);
- // Sort listeners to dependency order
+ // Sorts listeners to dependency order
List listeners = getDependencySortedListenerList(parcon.getOwners());
- // Handle all parameters for all listeners
+ // Handles all parameters for all listeners
while (!listeners.isEmpty()) {
VariableOwner listener = (VariableOwner) listeners.remove(0);
boolean changed = false; // Has any of this owners variabes changed
- // Handle all parameters for listener
+ // Handles all parameters for listener
Set params = parcon.getParameters(listener);
if (params != null) { // Name value mapping
Map variables = new HashMap();
for (Iterator pi = params.iterator(); pi.hasNext();) {
- // Get the name of the parameter
+ // Gets the name of the parameter
String param = (String) pi.next();
- // Extract more information about the parameter
+ // Extracts more information about the parameter
String varName = (String) idToNameMap.get(param);
Class varType = (Class) idToTypeMap.get(param);
Object varOldValue = idToValueMap.get(param);
@@ -487,7 +537,7 @@ public class AjaxVariableMap {
ServletMultipartRequest parser = parcon.getParser();
- // Upload events
+ // Uploads events
if (varType.equals(UploadStream.class)) {
if (parser != null
&& parser.getFileParameter(
@@ -585,10 +635,16 @@ public class AjaxVariableMap {
return parcon.getNonVariables();
}
- /** Implementation of VariableOwner.Error interface. */
+ /**
+ * Implementation of VariableOwner.Error interface.
+ */
public class TerminalErrorImpl implements Terminal.ErrorEvent {
private Throwable throwable;
-
+
+/**
+ *
+ * @param throwable
+ */
private TerminalErrorImpl(Throwable throwable) {
this.throwable = throwable;
}
@@ -602,13 +658,19 @@ public class AjaxVariableMap {
}
- /** Implementation of VariableOwner.Error interface. */
+ /**
+ * Implementation of VariableOwner.Error interface.
+ */
public class VariableOwnerErrorImpl
extends TerminalErrorImpl
implements VariableOwner.ErrorEvent {
private VariableOwner owner;
-
+/**
+ *
+ * @param owner the Listener for variable changes.
+ * @param throwable
+ */
private VariableOwnerErrorImpl(
VariableOwner owner,
Throwable throwable) {
@@ -625,12 +687,13 @@ public class AjaxVariableMap {
}
- /** Resolve the VariableOwners needed from the request and sort
+ /**
+ * Resolves the VariableOwners needed from the request and sort
* them to assure that the dependencies are met (as well as possible).
+ *
+ * @param listeners
* @return List of variable list changers, that are needed for handling
* all the variables in the request
- * @param req request to be handled
- * @param parser multipart parser for the request
*/
private List getDependencySortedListenerList(Set listeners) {
@@ -698,12 +761,12 @@ public class AjaxVariableMap {
}
}
- // Add the listeners with dependencies in sane order to the result
+ // Adds the listeners with dependencies in sane order to the result
for (Iterator li = deepdeps.keySet().iterator(); li.hasNext();) {
VariableOwner l = (VariableOwner) li.next();
boolean immediate = l.isImmediate();
- // Add each listener after the last depended listener already in
+ // Adds each listener after the last depended listener already in
// the list
int index = -1;
for (Iterator di = ((Set) deepdeps.get(l)).iterator();
@@ -726,7 +789,7 @@ public class AjaxVariableMap {
}
}
- // Append immediate listeners to normal listeners
+ // Appends immediate listeners to normal listeners
// This way the normal handlers are always called before
// immediate ones
resultNormal.addAll(resultImmediate);
diff --git a/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java
index fc0c61e516..0476e60b42 100644
--- a/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java
+++ b/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java
@@ -103,16 +103,24 @@ public class ApplicationServlet extends HttpServlet implements
private static final long serialVersionUID = -4937882979845826574L;
- /** Version number of this release. For example "4.0.0" */
+ /**
+ * Version number of this release. For example "4.0.0".
+ */
public static final String VERSION;
- /** Major version number. For example 4 in 4.1.0. */
+ /**
+ * Major version number. For example 4 in 4.1.0.
+ */
public static final int VERSION_MAJOR;
- /** Minor version number. For example 1 in 4.1.0. */
+ /**
+ * Minor version number. For example 1 in 4.1.0.
+ */
public static final int VERSION_MINOR;
- /** Build number. For example 0-beta1 in 4.0.0-beta1. */
+ /**
+ * Builds number. For example 0-beta1 in 4.0.0-beta1.
+ */
public static final String VERSION_BUILD;
/* Initialize version numbers from string replaced by build-script. */
@@ -222,9 +230,9 @@ public class ApplicationServlet extends HttpServlet implements
* is being placed into service.
*
* @param servletConfig
- * object containing the servlet's configuration and
+ * the object containing the servlet's configuration and
* initialization parameters
- * @throws ServletException
+ * @throws javax.servlet.ServletException
* if an exception has occurred that interferes with the
* servlet's normal operation.
*/
@@ -232,14 +240,14 @@ public class ApplicationServlet extends HttpServlet implements
throws javax.servlet.ServletException {
super.init(servletConfig);
- // Get the application class name
+ // Gets the application class name
String applicationClassName = servletConfig
.getInitParameter("application");
if (applicationClassName == null) {
Log.error("Application not specified in servlet parameters");
}
- // Store the application parameters into Properties object
+ // Stores the application parameters into Properties object
this.applicationProperties = new Properties();
for (Enumeration e = servletConfig.getInitParameterNames(); e
.hasMoreElements();) {
@@ -248,7 +256,7 @@ public class ApplicationServlet extends HttpServlet implements
.getInitParameter(name));
}
- // Override with server.xml parameters
+ // Overrides with server.xml parameters
ServletContext context = servletConfig.getServletContext();
for (Enumeration e = context.getInitParameterNames(); e
.hasMoreElements();) {
@@ -257,48 +265,48 @@ public class ApplicationServlet extends HttpServlet implements
.getInitParameter(name));
}
- // Get the debug window parameter
+ // Gets the debug window parameter
String debug = getApplicationOrSystemProperty(PARAMETER_DEBUG, "")
.toLowerCase();
- // Enable application specific debug
+ // Enables application specific debug
if (!"".equals(debug) && !"true".equals(debug)
&& !"false".equals(debug))
throw new ServletException(
"If debug parameter is given for an application, it must be 'true' or 'false'");
this.debugMode = debug;
- // Get the maximum number of simultaneous transformers
+ // Gets the maximum number of simultaneous transformers
this.maxConcurrentTransformers = Integer
.parseInt(getApplicationOrSystemProperty(
PARAMETER_MAX_TRANSFORMERS, "-1"));
if (this.maxConcurrentTransformers < 1)
this.maxConcurrentTransformers = DEFAULT_MAX_TRANSFORMERS;
- // Get cache time for transformers
+ // Gets cache time for transformers
this.transformerCacheTime = Integer
.parseInt(getApplicationOrSystemProperty(
PARAMETER_TRANSFORMER_CACHETIME, "-1")) * 1000;
- // Get cache time for theme resources
+ // Gets cache time for theme resources
this.themeCacheTime = Integer.parseInt(getApplicationOrSystemProperty(
PARAMETER_THEME_CACHETIME, "-1")) * 1000;
if (this.themeCacheTime < 0) {
this.themeCacheTime = DEFAULT_THEME_CACHETIME;
}
- // Add all specified theme sources
+ // Adds all specified theme sources
this.themeSource = new CollectionThemeSource();
List directorySources = getThemeSources();
for (Iterator i = directorySources.iterator(); i.hasNext();) {
this.themeSource.add((ThemeSource) i.next());
}
- // Add the default theme source
+ // Adds the default theme source
String[] defaultThemeFiles = new String[] { getApplicationOrSystemProperty(
PARAMETER_DEFAULT_THEME_JAR, DEFAULT_THEME_JAR) };
File f = findDefaultThemeJar(defaultThemeFiles);
try {
- // Add themes.jar if exists
+ // Adds themes.jar if exists
if (f != null && f.exists())
this.themeSource.add(new JarThemeSource(f, this, ""));
else {
@@ -311,7 +319,7 @@ public class ApplicationServlet extends HttpServlet implements
+ Arrays.asList(defaultThemeFiles), e);
}
- // Check that at least one themesource was loaded
+ // Checks that at least one themesource was loaded
if (this.themeSource.getThemes().size() <= 0) {
throw new ServletException(
"No themes found in specified themesources. "
@@ -320,7 +328,7 @@ public class ApplicationServlet extends HttpServlet implements
+ "to WEB-INF/lib directory.");
}
- // Initialize the transformer factory, if not initialized
+ // Initializes the transformer factory, if not initialized
if (this.transformerFactory == null) {
this.transformerFactory = new UIDLTransformerFactory(
@@ -328,7 +336,7 @@ public class ApplicationServlet extends HttpServlet implements
this.transformerCacheTime);
}
- // Load the application class using the same class loader
+ // Loads the application class using the same class loader
// as the servlet itself
ClassLoader loader = this.getClass().getClassLoader();
try {
@@ -340,12 +348,12 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Get an application or system property value.
+ * Gets an application or system property value.
*
* @param parameterName
- * Name or the parameter
+ * the Name or the parameter.
* @param defaultValue
- * Default to be used
+ * the Default to be used.
* @return String value or default if not found
*/
private String getApplicationOrSystemProperty(String parameterName,
@@ -390,13 +398,21 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Get ThemeSources from given path. Construct the list of avalable themes
- * in path using the following sources: 1. content of THEME_PATH directory
- * (if available) 2. The themes listed in THEME_LIST_FILE 3. "themesource"
- * application parameter - "ThemeSource" system property
- *
- * @param THEME_DIRECTORY_PATH
- * @return List
+ * Gets ThemeSources from given path. Construct the list of avalable themes
+ * in path using the following sources:
+ * <p>
+ * 1. Content of <code>THEME_PATH</code> directory (if available).
+ * </p>
+ * <p>
+ * 2. The themes listed in <code>THEME_LIST_FILE</code>.
+ * </p>
+ * <p>
+ * 3. "themesource" application parameter - "ThemeSource" system property.
+ * </p>
+ * @return the List
+ * @throws ServletException
+ * if an exception has occurred that interferes with the
+ * servlet's normal operation.
*/
private List getThemeSources() throws ServletException {
@@ -446,7 +462,7 @@ public class ApplicationServlet extends HttpServlet implements
}
}
- // Add the theme sources from application properties
+ // Adds the theme sources from application properties
String paramValue = getApplicationOrSystemProperty(
PARAMETER_THEMESOURCE, null);
if (paramValue != null) {
@@ -456,7 +472,7 @@ public class ApplicationServlet extends HttpServlet implements
}
}
- // Construct appropriate theme source instances for each path
+ // Constructs appropriate theme source instances for each path
for (Iterator i = sourcePaths.iterator(); i.hasNext();) {
String source = (String) i.next();
File sourceFile = new File(source);
@@ -482,7 +498,7 @@ public class ApplicationServlet extends HttpServlet implements
}
}
- // Return the constructed list of theme sources
+ // Returns the constructed list of theme sources
return returnValue;
}
@@ -491,16 +507,16 @@ public class ApplicationServlet extends HttpServlet implements
* dispatches them.
*
* @param request
- * object that contains the request the client made of the
- * servlet
+ * the object that contains the request the client made of the
+ * servlet.
* @param response
- * object that contains the response the servlet returns to the
- * client
+ * the object that contains the response the servlet returns to the
+ * client.
* @throws ServletException
* if an input or output error occurs while the servlet is
- * handling the TRACE request
+ * handling the TRACE request.
* @throws IOException
- * if the request for the TRACE cannot be handled
+ * if the request for the TRACE cannot be handled.
*/
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
@@ -513,25 +529,25 @@ public class ApplicationServlet extends HttpServlet implements
Application application = null;
try {
- // Handle resource requests
+ // Handles resource requests
if (handleResourceRequest(request, response))
return;
- // Handle server commands
+ // Handles server commands
if (handleServerCommands(request, response))
return;
- // Get the application
+ // Gets the application
application = getApplication(request);
- // Create application if it doesn't exist
+ // Creates application if it doesn't exist
if (application == null)
application = createApplication(request);
- // Set the last application request date
+ // Sets the last application request date
applicationToLastRequestDate.put(application, new Date());
- // Invoke context transaction listeners
+ // Invokes context transaction listeners
((WebApplicationContext) application.getContext())
.startTransaction(application, request);
@@ -543,7 +559,7 @@ public class ApplicationServlet extends HttpServlet implements
// made
synchronized (application) {
- // Handle UIDL requests?
+ // Handles UIDL requests?
String resourceId = request.getPathInfo();
if (resourceId != null && resourceId.startsWith(AJAX_UIDL_URI)) {
@@ -553,7 +569,7 @@ public class ApplicationServlet extends HttpServlet implements
return;
}
- // Get the variable map
+ // Gets the variable map
variableMap = getVariableMap(application, request);
if (variableMap == null)
return;
@@ -612,7 +628,7 @@ public class ApplicationServlet extends HttpServlet implements
}
}
- // Handle the URI if the application is still running
+ // Handles the URI if the application is still running
if (application.isRunning())
download = handleURI(application, request, response);
@@ -624,13 +640,13 @@ public class ApplicationServlet extends HttpServlet implements
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
- // Find the window within the application
+ // Finds the window within the application
Window window = null;
if (application.isRunning())
window = getApplicationWindow(request, application,
unhandledParameters);
- // Handle the unhandled parameters if the application is
+ // Handles the unhandled parameters if the application is
// still running
if (window != null && unhandledParameters != null
&& !unhandledParameters.isEmpty()) {
@@ -643,13 +659,13 @@ public class ApplicationServlet extends HttpServlet implements
}
}
- // Remove application if it has stopped
+ // Removes application if it has stopped
if (!application.isRunning()) {
endApplication(request, response, application);
return;
}
- // Return blank page, if no window found
+ // Returns blank page, if no window found
if (window == null) {
response.setContentType("text/html");
BufferedWriter page = new BufferedWriter(
@@ -673,12 +689,12 @@ public class ApplicationServlet extends HttpServlet implements
return;
}
- // Set terminal type for the window, if not already set
+ // Sets terminal type for the window, if not already set
if (window.getTerminal() == null) {
window.setTerminal(wb);
}
- // Find theme
+ // Finds theme
String themeName = window.getTheme() != null ? window
.getTheme() : DEFAULT_THEME;
if (unhandledParameters.get("theme") != null) {
@@ -720,14 +736,14 @@ public class ApplicationServlet extends HttpServlet implements
transformer = this.transformerFactory
.getTransformer(transformerType);
- // Set the response type
+ // Sets the response type
response.setContentType(wb.getContentType());
- // Create UIDL writer
+ // Creates UIDL writer
WebPaintTarget paintTarget = transformer
.getPaintTarget(variableMap);
- // Assure that the correspoding debug window will be
+ // Assures that the correspoding debug window will be
// repainted property
// by clearing it before the actual paint.
DebugWindow debugWindow = (DebugWindow) application
@@ -736,7 +752,7 @@ public class ApplicationServlet extends HttpServlet implements
debugWindow.setWindowUIDL(window, "Painting...");
}
- // Paint window
+ // Paints window
window.paint(paintTarget);
paintTarget.close();
@@ -760,7 +776,7 @@ public class ApplicationServlet extends HttpServlet implements
.setWindowUIDL(window, paintTarget.getUIDL());
}
- // Set the function library state for this thread
+ // Sets the function library state for this thread
ThemeFunctionLibrary.setState(application, window,
transformerType.getWebBrowser(), request
.getSession(), this, transformerType
@@ -790,7 +806,7 @@ public class ApplicationServlet extends HttpServlet implements
} catch (UIDLTransformerException te) {
try {
- // Write the error report to client
+ // Writes the error report to client
response.setContentType("text/html");
BufferedWriter err = new BufferedWriter(new OutputStreamWriter(
out));
@@ -805,7 +821,7 @@ public class ApplicationServlet extends HttpServlet implements
+ ". Original exception was: ", te);
}
- // Add previously dirty windows to dirtyWindowList in order
+ // Adds previously dirty windows to dirtyWindowList in order
// to make sure that eventually they are repainted
Application currentApplication = getApplication(request);
for (Iterator iter = currentlyDirtyWindowsForThisApplication
@@ -819,21 +835,35 @@ public class ApplicationServlet extends HttpServlet implements
throw new ServletException(e);
} finally {
- // Release transformer
+ // Releases transformer
if (transformer != null)
transformerFactory.releaseTransformer(transformer);
- // Notify transaction end
+ // Notifies transaction end
if (application != null)
((WebApplicationContext) application.getContext())
.endTransaction(application, request);
- // Clean the function library state for this thread
+ // Cleans the function library state for this thread
// for security reasons
ThemeFunctionLibrary.cleanState();
}
}
-
+/**
+ *
+ * @param request the HTTP request.
+ * @param response the HTTP response to write to.
+ * @param out
+ * @param unhandledParameters
+ * @param window
+ * @param terminalType
+ * @param theme
+ * @throws IOException
+ * if the writing failed due to input/output error.
+ * @throws MalformedURLException
+ * if the application is denied access
+ * the persistent data store represented by the given URL.
+ */
private void writeAjaxPage(HttpServletRequest request,
HttpServletResponse response, OutputStream out,
Map unhandledParameters, Window window, WebBrowser terminalType,
@@ -931,21 +961,20 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Handle the requested URI. An application can add handlers to do special
+ * Handles the requested URI. An application can add handlers to do special
* processing, when a certain URI is requested. The handlers are invoked
* before any windows URIs are processed and if a DownloadStream is returned
* it is sent to the client.
*
- * @see com.itmill.toolkit.terminal.URIHandler
- *
* @param application
- * Application owning the URI
+ * the Application owning the URI.
* @param request
- * HTTP request instance
+ * the HTTP request instance.
* @param response
- * HTTP response to write to.
- * @return boolean True if the request was handled and further processing
- * should be suppressed, false otherwise.
+ * the HTTP response to write to.
+ * @return boolean <code>true</code> if the request was handled and further processing
+ * should be suppressed, <code>false</code> otherwise.
+ * @see com.itmill.toolkit.terminal.URIHandler
*/
private DownloadStream handleURI(Application application,
HttpServletRequest request, HttpServletResponse response) {
@@ -956,11 +985,11 @@ public class ApplicationServlet extends HttpServlet implements
if (uri == null || uri.length() == 0 || uri.equals("/"))
return null;
- // Remove the leading /
+ // Removes the leading /
while (uri.startsWith("/") && uri.length() > 0)
uri = uri.substring(1);
- // Handle the uri
+ // Handles the uri
DownloadStream stream = null;
try {
stream = application.handleURI(application.getURL(), uri);
@@ -972,21 +1001,19 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Handle the requested URI. An application can add handlers to do special
+ * Handles the requested URI. An application can add handlers to do special
* processing, when a certain URI is requested. The handlers are invoked
* before any windows URIs are processed and if a DownloadStream is returned
* it is sent to the client.
*
- * @see com.itmill.toolkit.terminal.URIHandler
- *
- * @param application
- * Application owning the URI
+ * @param stream the download stream.
+ *
* @param request
- * HTTP request instance
+ * the HTTP request instance.
* @param response
- * HTTP response to write to.
- * @return boolean True if the request was handled and further processing
- * should be suppressed, false otherwise.
+ * the HTTP response to write to.
+ *
+ * @see com.itmill.toolkit.terminal.URIHandler
*/
private void handleDownload(DownloadStream stream,
HttpServletRequest request, HttpServletResponse response) {
@@ -995,10 +1022,10 @@ public class ApplicationServlet extends HttpServlet implements
InputStream data = stream.getStream();
if (data != null) {
- // Set content type
+ // Sets content type
response.setContentType(stream.getContentType());
- // Set cache headers
+ // Sets cache headers
long cacheTime = stream.getCacheTime();
if (cacheTime <= 0) {
response.setHeader("Cache-Control", "no-cache");
@@ -1047,8 +1074,8 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Look for default theme JAR file.
- *
+ * Looks for default theme JAR file.
+ * @param fileList
* @return Jar file or null if not found.
*/
private File findDefaultThemeJar(String[] fileList) {
@@ -1094,13 +1121,13 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Create a temporary file for given stream.
+ * Creates a temporary file for given stream.
*
* @param stream
- * Stream to be stored into temporary file.
+ * the Stream to be stored into temporary file.
* @param extension
- * File type extension
- * @return File
+ * the File type extension.
+ * @return the temporary File.
*/
private File createTemporaryFile(InputStream stream, String extension) {
File tmpFile;
@@ -1125,15 +1152,17 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Handle theme resource file requests. Resources supplied with the themes
+ * Handles theme resource file requests. Resources supplied with the themes
* are provided by the WebAdapterServlet.
*
* @param request
- * HTTP request
+ * the HTTP request.
* @param response
- * HTTP response
- * @return boolean True if the request was handled and further processing
- * should be suppressed, false otherwise.
+ * the HTTP response.
+ * @return boolean <code>true</code> if the request was handled and further processing
+ * should be suppressed, <code>false</code> otherwise.
+ * @throws ServletException if an exception has occurred that interferes with the
+ * servlet's normal operation.
*/
private boolean handleResourceRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException {
@@ -1148,14 +1177,14 @@ public class ApplicationServlet extends HttpServlet implements
String resourceId = request.getPathInfo();
- // Check if this really is a resource request
+ // Checks if this really is a resource request
if (resourceId == null || !resourceId.startsWith(RESOURCE_URI))
return false;
- // Check the resource type
+ // Checks the resource type
resourceId = resourceId.substring(RESOURCE_URI.length());
InputStream data = null;
- // Get theme resources
+ // Gets theme resources
try {
data = themeSource.getResource(resourceId);
} catch (ThemeSource.ThemeException e) {
@@ -1163,7 +1192,7 @@ public class ApplicationServlet extends HttpServlet implements
data = null;
}
- // Write the response
+ // Writes the response
try {
if (data != null) {
response.setContentType(FileTypeResolver
@@ -1180,7 +1209,7 @@ public class ApplicationServlet extends HttpServlet implements
// caching in some
// Tomcats
}
- // Write the data to client
+ // Writes the data to client
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int bytesRead = 0;
OutputStream out = response.getOutputStream();
@@ -1201,20 +1230,26 @@ public class ApplicationServlet extends HttpServlet implements
return true;
}
- /** Get the variable map for the session */
+ /**
+ * Gets the variable map for the session.
+ * @param application
+ * @param request the HTTP request.
+ * @return the variable map.
+ *
+ */
private static synchronized HttpVariableMap getVariableMap(
Application application, HttpServletRequest request) {
HttpSession session = request.getSession();
- // Get the application to variablemap map
+ // Gets the application to variablemap map
Map varMapMap = (Map) session.getAttribute(SESSION_ATTR_VARMAP);
if (varMapMap == null) {
varMapMap = new WeakHashMap();
session.setAttribute(SESSION_ATTR_VARMAP, varMapMap);
}
- // Create a variable map, if it does not exists.
+ // Creates a variable map, if it does not exists.
HttpVariableMap variableMap = (HttpVariableMap) varMapMap
.get(application);
if (variableMap == null) {
@@ -1225,7 +1260,12 @@ public class ApplicationServlet extends HttpServlet implements
return variableMap;
}
- /** Get the current application URL from request */
+ /**
+ * Gets the current application URL from request.
+ * @param request the HTTP request.
+ * @throws MalformedURLException if the application is denied access to the
+ * persistent data store represented by the given URL.
+ */
private URL getApplicationUrl(HttpServletRequest request)
throws MalformedURLException {
@@ -1255,23 +1295,25 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Get the existing application for given request. Looks for application
+ * Gets the existing application for given request. Looks for application
* instance for given request based on the requested URL.
*
* @param request
- * HTTP request
+ * the HTTP request.
* @return Application instance, or null if the URL does not map to valid
* application.
+ * @throws MalformedURLException if the application is denied access to the
+ * persistent data store represented by the given URL.
*/
private Application getApplication(HttpServletRequest request)
throws MalformedURLException {
- // Ensure that the session is still valid
+ // Ensures that the session is still valid
HttpSession session = request.getSession(false);
if (session == null)
return null;
- // Get application list for the session.
+ // Gets application list for the session.
LinkedList applications = (LinkedList) session
.getAttribute(SESSION_ATTR_APPS);
if (applications == null)
@@ -1291,7 +1333,7 @@ public class ApplicationServlet extends HttpServlet implements
application = a;
}
- // Remove stopped applications from the list
+ // Removes stopped applications from the list
if (application != null && !application.isRunning()) {
applications.remove(application);
application = null;
@@ -1301,14 +1343,27 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Create a new application.
- *
- * @return New application instance
- * @throws SAXException
- * @throws LicenseViolation
- * @throws InvalidLicenseFile
- * @throws LicenseSignatureIsInvalid
+ * Creates a new application.
+ * @param request the HTTP request.
+ * @return the New application instance.
+ * @throws MalformedURLException
+ * if the application is denied access to the persistent
+ * data store represented by the given URL.
+ * @throws InstantiationException
+ * if a new instance of the class cannot be instantiated.
+ * @throws IllegalAccessException
+ * if it does not have access to the property accessor method.
* @throws LicenseFileHasNotBeenRead
+ * if the license file has not been read.
+ * @throws LicenseSignatureIsInvalid
+ * if the license file has been changed or signature is
+ * otherwise invalid.
+ * @throws InvalidLicenseFile
+ * if the license file is not of correct XML format.
+ * @throws LicenseViolation
+ *
+ * @throws SAXException
+ * the Error parsing the license file.
*/
private Application createApplication(HttpServletRequest request)
throws MalformedURLException, InstantiationException,
@@ -1318,10 +1373,10 @@ public class ApplicationServlet extends HttpServlet implements
Application application = null;
- // Get the application url
+ // Gets the application url
URL applicationUrl = getApplicationUrl(request);
- // Get application list.
+ // Gets application list.
HttpSession session = request.getSession();
if (session == null)
return null;
@@ -1336,19 +1391,19 @@ public class ApplicationServlet extends HttpServlet implements
sessionBindingListener);
}
- // Create new application and start it
+ // Creates new application and start it
try {
application = (Application) this.applicationClass.newInstance();
applications.add(application);
- // Listen to window add/removes (for web mode)
+ // Listens to window add/removes (for web mode)
application.addListener((Application.WindowAttachListener) this);
application.addListener((Application.WindowDetachListener) this);
- // Set localte
+ // Sets localte
application.setLocale(request.getLocale());
- // Get application context for this session
+ // Gets application context for this session
WebApplicationContext context = (WebApplicationContext) session
.getAttribute(SESSION_ATTR_CONTEXT);
if (context == null) {
@@ -1356,7 +1411,7 @@ public class ApplicationServlet extends HttpServlet implements
session.setAttribute(SESSION_ATTR_CONTEXT, context);
}
- // Start application and check license
+ // Starts application and check license
initializeLicense(application);
application.start(applicationUrl, this.applicationProperties,
context);
@@ -1374,7 +1429,11 @@ public class ApplicationServlet extends HttpServlet implements
return application;
}
-
+
+/**
+ *
+ * @param application
+ */
private void initializeLicense(Application application) {
License license = (License) licenseForApplicationClass.get(application
@@ -1385,7 +1444,22 @@ public class ApplicationServlet extends HttpServlet implements
}
application.setToolkitLicense(license);
}
-
+
+/**
+ *
+ * @param application
+ * @throws LicenseFileHasNotBeenRead
+ * if the license file has not been read.
+ * @throws LicenseSignatureIsInvalid
+ * if the license file has been changed or signature is
+ * otherwise invalid.
+ * @throws InvalidLicenseFile
+ * if the license file is not of correct XML format.
+ * @throws LicenseViolation
+ *
+ * @throws SAXException
+ * the Error parsing the license file.
+ */
private void checkLicense(Application application)
throws LicenseFileHasNotBeenRead, LicenseSignatureIsInvalid,
InvalidLicenseFile, LicenseViolation, SAXException {
@@ -1422,7 +1496,7 @@ public class ApplicationServlet extends HttpServlet implements
System.out.print(license.getDescription());
}
- // Check license validity
+ // Checks license validity
try {
license.check(applicationClass, getNumberOfActiveUsers() + 1,
VERSION_MAJOR, VERSION_MINOR, "IT Mill Toolkit", null);
@@ -1442,13 +1516,13 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Get the number of active application-user pairs.
+ * Gets the number of active application-user pairs.
*
* This returns total number of all applications in the server that are
* considered to be active. For an application to be active, it must have
* been accessed less than ACTIVE_USER_REQUEST_INTERVAL ms.
*
- * @return Number of active application instances in the server.
+ * @return the Number of active application instances in the server.
*/
private int getNumberOfActiveUsers() {
@@ -1464,7 +1538,13 @@ public class ApplicationServlet extends HttpServlet implements
return active;
}
- /** End application */
+ /**
+ * Ends the application.
+ * @param request the HTTP request.
+ * @param response the HTTP response to write to.
+ * @param application the application to end.
+ * @throws IOException if the writing failed due to input/output error.
+ */
private void endApplication(HttpServletRequest request,
HttpServletResponse response, Application application)
throws IOException {
@@ -1485,21 +1565,23 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Get the existing application or create a new one. Get a window within an
+ * Gets the existing application or create a new one. Get a window within an
* application based on the requested URI.
*
* @param request
- * HTTP Request.
+ * the HTTP Request.
* @param application
- * Application to query for window.
+ * the Application to query for window.
* @return Window mathing the given URI or null if not found.
+ * @throws ServletException if an exception has occurred that interferes with the
+ * servlet's normal operation.
*/
private Window getApplicationWindow(HttpServletRequest request,
Application application, Map params) throws ServletException {
Window window = null;
- // Find the window where the request is handled
+ // Finds the window where the request is handled
String path = request.getPathInfo();
// Main window as the URI is empty
@@ -1539,7 +1621,7 @@ public class ApplicationServlet extends HttpServlet implements
return null;
}
}
- // Create and open new debug window for application if requested
+ // Creates and open new debug window for application if requested
Window debugWindow = application.getWindow(DebugWindow.WINDOW_NAME);
if (debugWindow == null) {
if (isDebugMode(params)
@@ -1567,12 +1649,12 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Get relative location of a theme resource.
+ * Gets relative location of a theme resource.
*
* @param theme
- * Theme name
+ * the Theme name.
* @param resource
- * Theme resource
+ * the Theme resource.
* @return External URI specifying the resource
*/
public String getResourceLocation(String theme, ThemeResource resource) {
@@ -1583,10 +1665,10 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Check if web adapter is in debug mode. Extra output is generated to log
+ * Checks if web adapter is in debug mode. Extra output is generated to log
* when debug mode is enabled.
- *
- * @return Debug mode
+ * @param parameters
+ * @return <code>true</code> if the web adapter is in debug mode. otherwise <code>false</code>.
*/
public boolean isDebugMode(Map parameters) {
if (parameters != null) {
@@ -1606,7 +1688,12 @@ public class ApplicationServlet extends HttpServlet implements
public ThemeSource getThemeSource() {
return themeSource;
}
-
+
+/**
+ *
+ * @param application
+ * @param window
+ */
protected void addDirtyWindow(Application application, Window window) {
synchronized (applicationToDirtyWindowSetMap) {
HashSet dirtyWindows = (HashSet) applicationToDirtyWindowSetMap
@@ -1618,7 +1705,12 @@ public class ApplicationServlet extends HttpServlet implements
dirtyWindows.add(window);
}
}
-
+
+/**
+ *
+ * @param application
+ * @param window
+ */
protected void removeDirtyWindow(Application application, Window window) {
synchronized (applicationToDirtyWindowSetMap) {
HashSet dirtyWindows = (HashSet) applicationToDirtyWindowSetMap
@@ -1654,11 +1746,12 @@ public class ApplicationServlet extends HttpServlet implements
event.getWindow().removeListener(
(Paintable.RepaintRequestListener) this);
- // Add dirty window reference for closing the window
+ // Adds dirty window reference for closing the window
addDirtyWindow(event.getApplication(), event.getWindow());
}
/**
+ * Receives repaint request events.
* @see com.itmill.toolkit.terminal.Paintable.RepaintRequestListener#repaintRequested(Paintable.RepaintRequestEvent)
*/
public void repaintRequested(RepaintRequestEvent event) {
@@ -1678,7 +1771,11 @@ public class ApplicationServlet extends HttpServlet implements
}
}
- /** Get the list of dirty windows in application */
+ /**
+ * Gets the list of dirty windows in application.
+ * @param app
+ * @return
+ */
protected Set getDirtyWindows(Application app) {
HashSet dirtyWindows;
synchronized (applicationToDirtyWindowSetMap) {
@@ -1687,14 +1784,20 @@ public class ApplicationServlet extends HttpServlet implements
return dirtyWindows;
}
- /** Remove a window from the list of dirty windows */
+ /**
+ * Removes a window from the list of dirty windows.
+ * @param app
+ * @param window
+ */
private void windowPainted(Application app, Window window) {
removeDirtyWindow(app, window);
}
/**
- * Generate server commands stream. If the server commands are not
- * requested, return false
+ * Generates server commands stream. If the server commands are not
+ * requested, return false.
+ * @param request the HTTP request instance.
+ * @param response the HTTP response to write to.
*/
private boolean handleServerCommands(HttpServletRequest request,
HttpServletResponse response) {
@@ -1703,7 +1806,7 @@ public class ApplicationServlet extends HttpServlet implements
if (request.getParameter(SERVER_COMMAND_PARAM) == null)
return false;
- // Get the application
+ // Gets the application
Application application;
try {
application = getApplication(request);
@@ -1713,13 +1816,13 @@ public class ApplicationServlet extends HttpServlet implements
if (application == null)
return false;
- // Create continuous server commands stream
+ // Creates continuous server commands stream
try {
// Writer for writing the stream
PrintWriter w = new PrintWriter(response.getOutputStream());
- // Print necessary http page headers and padding
+ // Prints necessary http page headers and padding
w.println("<html><head></head><body>");
for (int i = 0; i < SERVER_COMMAND_HEADER_PADDING; i++)
w.print(' ');
@@ -1782,7 +1885,7 @@ public class ApplicationServlet extends HttpServlet implements
}
}
- // Send the generated commands and newline immediately to
+ // Sends the generated commands and newline immediately to
// browser
w.println(" ");
w.flush();
@@ -1810,7 +1913,10 @@ public class ApplicationServlet extends HttpServlet implements
private class SessionBindingListener implements HttpSessionBindingListener {
private LinkedList applications;
-
+/**
+ *
+ * @param applications
+ */
protected SessionBindingListener(LinkedList applications) {
this.applications = applications;
}
@@ -1839,7 +1945,7 @@ public class ApplicationServlet extends HttpServlet implements
// Close app
((Application) apps[i]).close();
- // Stop application server commands stream
+ // Stops application server commands stream
Object lock = applicationToServerCommandStreamLock
.get(apps[i]);
if (lock != null)
@@ -1857,14 +1963,20 @@ public class ApplicationServlet extends HttpServlet implements
}
- /** Implementation of ParameterHandler.ErrorEvent interface. */
+ /**
+ * Implementation of ParameterHandler.ErrorEvent interface.
+ */
public class ParameterHandlerErrorImpl implements
ParameterHandler.ErrorEvent {
private ParameterHandler owner;
private Throwable throwable;
-
+/**
+ *
+ * @param owner
+ * @param throwable
+ */
private ParameterHandlerErrorImpl(ParameterHandler owner,
Throwable throwable) {
this.owner = owner;
@@ -1872,6 +1984,7 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
+ * Gets the contained throwable.
* @see com.itmill.toolkit.terminal.Terminal.ErrorEvent#getThrowable()
*/
public Throwable getThrowable() {
@@ -1879,6 +1992,7 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
+ * Gets the source ParameterHandler.
* @see com.itmill.toolkit.terminal.ParameterHandler.ErrorEvent#getParameterHandler()
*/
public ParameterHandler getParameterHandler() {
@@ -1887,19 +2001,26 @@ public class ApplicationServlet extends HttpServlet implements
}
- /** Implementation of URIHandler.ErrorEvent interface. */
+ /**
+ * Implementation of URIHandler.ErrorEvent interface.
+ */
public class URIHandlerErrorImpl implements URIHandler.ErrorEvent {
private URIHandler owner;
private Throwable throwable;
-
+/**
+ *
+ * @param owner
+ * @param throwable
+ */
private URIHandlerErrorImpl(URIHandler owner, Throwable throwable) {
this.owner = owner;
this.throwable = throwable;
}
/**
+ * Gets the contained throwable.
* @see com.itmill.toolkit.terminal.Terminal.ErrorEvent#getThrowable()
*/
public Throwable getThrowable() {
@@ -1907,6 +2028,7 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
+ * Gets the source URIHandler.
* @see com.itmill.toolkit.terminal.URIHandler.ErrorEvent#getURIHandler()
*/
public URIHandler getURIHandler() {
@@ -1915,7 +2037,7 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Get AJAX application manager for an application.
+ * Gets AJAX application manager for an application.
*
* If this application has not been running in ajax mode before, new manager
* is created and web adapter stops listening to changes.
@@ -1930,11 +2052,11 @@ public class ApplicationServlet extends HttpServlet implements
// This application is going from Web to AJAX mode, create new manager
if (mgr == null) {
- // Create new manager
+ // Creates new manager
mgr = new AjaxApplicationManager(application);
applicationToAjaxAppMgrMap.put(application, mgr);
- // Stop sending changes to this servlet because manager will take
+ // Stops sending changes to this servlet because manager will take
// control
application.removeListener((Application.WindowAttachListener) this);
application.removeListener((Application.WindowDetachListener) this);
@@ -1952,11 +2074,12 @@ public class ApplicationServlet extends HttpServlet implements
}
/**
- * Get resource path using different implementations. Required fo supporting
+ * Gets resource path using different implementations. Required fo supporting
* different servlet container implementations (application servers).
*
- * @param path
- * @return
+ * @param servletContext
+ * @param path the resource path.
+ * @return the resource path.
*/
protected static String getResourcePath(ServletContext servletContext,
String path) {
diff --git a/src/com/itmill/toolkit/terminal/web/CollectionThemeSource.java b/src/com/itmill/toolkit/terminal/web/CollectionThemeSource.java
index 55b3bcf189..1b94e1e836 100644
--- a/src/com/itmill/toolkit/terminal/web/CollectionThemeSource.java
+++ b/src/com/itmill/toolkit/terminal/web/CollectionThemeSource.java
@@ -50,6 +50,7 @@ public class CollectionThemeSource implements ThemeSource {
private List sources = new LinkedList();
/**
+ * Gets the name of the ThemeSource.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getName()
*/
public String getName() {
@@ -57,6 +58,7 @@ public class CollectionThemeSource implements ThemeSource {
}
/**
+ * Gets the XSL stream for the specified theme and web-browser type.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getXSLStreams(Theme,
* WebBrowser)
*/
@@ -64,10 +66,10 @@ public class CollectionThemeSource implements ThemeSource {
throws ThemeException {
Collection xslFiles = new LinkedList();
- // Add parent theme XSL
+ // Adds parent theme XSL
xslFiles.addAll(this.getParentXSLStreams(theme, type));
- // Add theme XSL, Handle subdirectories: return the first match
+ // Adds theme XSL, Handle subdirectories: return the first match
for (Iterator i = this.sources.iterator(); i.hasNext();) {
ThemeSource source = (ThemeSource) i.next();
if (source.getThemes().contains(theme))
@@ -76,7 +78,15 @@ public class CollectionThemeSource implements ThemeSource {
return xslFiles;
}
-
+
+/**
+ *
+ * @param theme
+ * @param type
+ * @return
+ * @throws ThemeException If the resource is not found or there was
+ * some problem finding the resource.
+ */
private Collection getParentXSLStreams(Theme theme, WebBrowser type)
throws ThemeException {
Collection xslFiles = new LinkedList();
@@ -94,6 +104,7 @@ public class CollectionThemeSource implements ThemeSource {
}
/**
+ * Gets the last modification time, used to reload theme on changes.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getModificationTime()
*/
public long getModificationTime() {
@@ -107,11 +118,12 @@ public class CollectionThemeSource implements ThemeSource {
}
/**
+ * Gets the input stream for the resource with the specified resource id.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getResource(String)
*/
public InputStream getResource(String resourceId) throws ThemeException {
- // Resolve theme name and resource name
+ // Resolves theme name and resource name
int delim = resourceId.indexOf("/");
String subResourceId = "";
String themeName = "";
@@ -120,7 +132,7 @@ public class CollectionThemeSource implements ThemeSource {
themeName = resourceId.substring(0, delim);
}
- // Get list of themes to look for the resource
+ // Gets the list of themes to look for the resource
List themes = new LinkedList();
while (themeName != null && themeName.length() > 0) {
Theme t = this.getThemeByName(themeName);
@@ -151,6 +163,7 @@ public class CollectionThemeSource implements ThemeSource {
}
/**
+ * Gets the list of themes in the theme source.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getThemes()
*/
public Collection getThemes() {
@@ -163,6 +176,8 @@ public class CollectionThemeSource implements ThemeSource {
}
/**
+ * Gets the theme instance by name.
+ * @param name the theme name.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getThemeByName(String)
*/
public Theme getThemeByName(String name) {
@@ -175,10 +190,10 @@ public class CollectionThemeSource implements ThemeSource {
}
/**
- * Add new theme source to this collection.
+ * Adds new theme source to this collection.
*
* @param source
- * Theme source to be added.
+ * the Theme source to be added.
*/
public void add(ThemeSource source) {
this.sources.add(source);
diff --git a/src/com/itmill/toolkit/terminal/web/DebugWindow.java b/src/com/itmill/toolkit/terminal/web/DebugWindow.java
index 7b59fd8e7f..eaafa0c219 100644
--- a/src/com/itmill/toolkit/terminal/web/DebugWindow.java
+++ b/src/com/itmill/toolkit/terminal/web/DebugWindow.java
@@ -54,7 +54,7 @@ import com.itmill.toolkit.ui.*;
* This class provides a debugging window where one may view the UIDL of
* the current window, or in a tabset the UIDL of an active frameset.
*
- * It is primarily inteded for creating and debugging themes.
+ * It is primarily intended for creating and debugging themes.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -73,10 +73,11 @@ public class DebugWindow extends Window {
private Select themeSelector;
private Label applicationInfo = new Label("", Label.CONTENT_XHTML);
- /**Create new debug window for an application.
- * @param debuggedApplication Application to be debugged.
- * @param session Session to be debugged.
- * @param servlet Servlet to be debugged.
+ /**
+ * Creates the new debug window for an application.
+ * @param debuggedApplication the Application to be debugged.
+ * @param session the Session to be debugged.
+ * @param servlet the Servlet to be debugged.
*/
protected DebugWindow(
Application debuggedApplication,
@@ -90,7 +91,7 @@ public class DebugWindow extends Window {
setBorder(Window.BORDER_NONE);
- // Create control buttons
+ // Creates control buttons
OrderedLayout controls =
new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
controls.addComponent(
@@ -103,7 +104,7 @@ public class DebugWindow extends Window {
names.add(((Theme) i.next()).getName());
}
- // Create theme selector
+ // Creates theme selector
themeSelector = new Select("Application Theme", names);
themeSelector.setWriteThrough(false);
@@ -150,11 +151,18 @@ public class DebugWindow extends Window {
termInfo.addComponent(browser);
termInfo.addComponent(setbrowser);
- // Set the debugged application
+ // Sets the debugged application
setDebuggedApplication(debuggedApplication);
}
-
+
+/**
+ *
+ * @param caption
+ * @param keys
+ * @param names
+ * @return
+ */
protected Select createSelect(
String caption,
Object[] keys,
@@ -167,7 +175,10 @@ public class DebugWindow extends Window {
s.setItemCaptionPropertyId("name");
return s;
}
-
+
+ /**
+ * Saves the UIDL.
+ */
public void saveUIDL() {
synchronized (rawUIDL) {
@@ -200,20 +211,36 @@ public class DebugWindow extends Window {
}
}
}
-
+
+ /**
+ * Commits the theme.
+ *
+ */
public void commitTheme() {
themeSelector.commit();
}
-
+
+ /**
+ * Clears the session.
+ */
public void clearSession() {
session.invalidate();
}
-
+
+ /**
+ * Restarts the Application.
+ *
+ */
public void restartApplication() {
if (debuggedApplication != null)
debuggedApplication.close();
}
-
+
+/**
+ *
+ * @param window
+ * @param uidl
+ */
protected void setWindowUIDL(Window window, String uidl) {
String caption = "UIDL:" + window.getName();
synchronized (tabs) {
@@ -236,7 +263,13 @@ public class DebugWindow extends Window {
}
}
}
-
+
+/**
+ *
+ * @param caption
+ * @param uidl
+ * @return
+ */
protected String getHTMLFormattedUIDL(String caption, String uidl) {
StringBuffer sb = new StringBuffer();
@@ -318,22 +351,21 @@ public class DebugWindow extends Window {
* with characters in the specified <code>String</code>. The substring
* begins at the specified <code>start</code> and extends to the character
* at index <code>end - 1</code> or to the end of the
- * <code>String</code> if no such character exists. First the
- * characters in the substring are removed and then the specified
+ * <code>String</code> if no such character exists.
+ * <p>
+ * First the characters in the substring are removed and then the specified
* <code>String</code> is inserted at <code>start</code>. (The
* <code>StringBuffer</code> will be lengthened to accommodate the
* specified String if necessary.)
+ * </p>
* <p>
* NOTE: This operation is slow.
* </p>
- *
- * @param start The beginning index, inclusive.
- * @param end The ending index, exclusive.
- * @param str String that will replace previous contents.
+ * @param text
+ * @param start the beginning index, inclusive.
+ * @param end the ending index, exclusive.
+ * @param str the String that will replace previous contents.
* @return This string buffer.
- * @exception StringIndexOutOfBoundsException if <code>start</code>
- * is negative, greater than <code>length()</code>, or
- * greater than <code>end</code>.
*/
protected static String replace(
String text,
@@ -342,7 +374,14 @@ public class DebugWindow extends Window {
String str) {
return new StringBuffer(text).replace(start, end, str).toString();
}
-
+
+/**
+ *
+ * @param text
+ * @param oldStr
+ * @param newStr
+ * @return
+ */
protected static String replaceAll(
String text,
String oldStr,
@@ -368,7 +407,7 @@ public class DebugWindow extends Window {
/**
* Sets the application.
- * @param application The application to set
+ * @param application the application to set.
*/
protected void setDebuggedApplication(Application application) {
this.debuggedApplication = application;
@@ -383,7 +422,7 @@ public class DebugWindow extends Window {
/**
* Returns the servlet.
- * @return WebAdapterServlet
+ * @return the WebAdapterServlet.
*/
protected ApplicationServlet getServlet() {
return servlet;
@@ -391,7 +430,7 @@ public class DebugWindow extends Window {
/**
* Returns the session.
- * @return HttpSession
+ * @return the HttpSession.
*/
protected HttpSession getSession() {
return session;
@@ -399,7 +438,7 @@ public class DebugWindow extends Window {
/**
* Sets the servlet.
- * @param servlet The servlet to set
+ * @param servlet the servlet to set.
*/
protected void setServlet(ApplicationServlet servlet) {
this.servlet = servlet;
@@ -407,7 +446,7 @@ public class DebugWindow extends Window {
/**
* Sets the session.
- * @param session The session to set
+ * @param session the session to set.
*/
protected void setSession(HttpSession session) {
this.session = session;
diff --git a/src/com/itmill/toolkit/terminal/web/DirectoryThemeSource.java b/src/com/itmill/toolkit/terminal/web/DirectoryThemeSource.java
index eeff3f1c86..f2df815716 100644
--- a/src/com/itmill/toolkit/terminal/web/DirectoryThemeSource.java
+++ b/src/com/itmill/toolkit/terminal/web/DirectoryThemeSource.java
@@ -49,14 +49,20 @@ public class DirectoryThemeSource implements ThemeSource {
private Theme theme;
private ApplicationServlet webAdapterServlet;
- /** Collection of subdirectory entries */
+ /**
+ * Collection of subdirectory entries.
+ */
private Collection subdirs = new LinkedList();
- /** Creates a new instance of ThemeRepository by reading the themes
+ /**
+ * Creates a new instance of ThemeRepository by reading the themes
* from a local directory.
- * @param path Path to the source directory .
- * @param url External URL of the repository
- * @throws FileNotFoundException if no theme files are found
+ * @param path the Path to the source directory .
+ * @param webAdapterServlet
+ * @throws ThemeException If the resource is not found or there was
+ * some problem finding the resource.
+ * @throws FileNotFoundException if no theme files are found.
+ * @throws IOException if the writing failed due to input/output error.
*/
public DirectoryThemeSource(File path, ApplicationServlet webAdapterServlet)
throws ThemeException, FileNotFoundException, IOException {
@@ -69,7 +75,7 @@ public class DirectoryThemeSource implements ThemeSource {
throw new java.io.FileNotFoundException(
"Theme path must be a directory ('" + this.path + "')");
- // Load description file
+ // Loads description file
File description = new File(path, Theme.DESCRIPTIONFILE);
if (description.exists()) {
try {
@@ -109,6 +115,7 @@ public class DirectoryThemeSource implements ThemeSource {
}
/**
+ * Gets the XSL stream for the specified theme and web-browser type.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getXSLStreams(Theme, WebBrowser)
*/
public Collection getXSLStreams(Theme theme, WebBrowser type)
@@ -123,7 +130,7 @@ public class DirectoryThemeSource implements ThemeSource {
Log.info("DirectoryThemeSource: Loading XSL from: " + theme);
}
- // Reload the description file
+ // Reloads the description file
File description = new File(path, Theme.DESCRIPTIONFILE);
if (description.exists()) {
try {
@@ -136,7 +143,7 @@ public class DirectoryThemeSource implements ThemeSource {
Collection fileNames = theme.getFileNames(type, Theme.MODE_HTML);
- // Add all XSL file streams
+ // Adds all XSL file streams
for (Iterator i = fileNames.iterator(); i.hasNext();) {
File f = new File(this.path, (String) i.next());
if (f.getName().endsWith(".xsl"))
@@ -149,7 +156,7 @@ public class DirectoryThemeSource implements ThemeSource {
} else {
- // Handle subdirectories: return the first match
+ // Handles subdirectories: return the first match
for (Iterator i = this.subdirs.iterator(); i.hasNext();) {
ThemeSource source = (ThemeSource) i.next();
if (source.getThemes().contains(theme))
@@ -157,12 +164,13 @@ public class DirectoryThemeSource implements ThemeSource {
}
}
- // Return the concatenated stream
+ // Returns the concatenated stream
return xslFiles;
}
/**
+ * Gets the last modification time, used to reload theme on changes.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getModificationTime()
*/
public long getModificationTime() {
@@ -170,13 +178,13 @@ public class DirectoryThemeSource implements ThemeSource {
long modTime = 0;
// If this directory contains a theme
- // return XSL from this theme
+ // returns XSL from this theme
if (this.theme != null) {
- // Get modification time of the description file
+ // Gets modification time of the description file
modTime = new File(this.path, Theme.DESCRIPTIONFILE).lastModified();
- // Get modification time of the themes directory itself
+ // Gets modification time of the themes directory itself
if (this.path.lastModified() > modTime) {
modTime = this.path.lastModified();
}
@@ -190,7 +198,7 @@ public class DirectoryThemeSource implements ThemeSource {
}
}
} else {
- // Handle subdirectories
+ // Handles subdirectories
for (Iterator i = this.subdirs.iterator(); i.hasNext();) {
ThemeSource source = (ThemeSource) i.next();
long t = source.getModificationTime();
@@ -204,6 +212,7 @@ public class DirectoryThemeSource implements ThemeSource {
}
/**
+ * Gets the input stream for the resource with the specified resource id.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getResource(String)
*/
public InputStream getResource(String resourceId)
@@ -240,6 +249,7 @@ public class DirectoryThemeSource implements ThemeSource {
}
/**
+ * Gets the list of themes in the theme source.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getThemes()
*/
public Collection getThemes() {
@@ -257,6 +267,7 @@ public class DirectoryThemeSource implements ThemeSource {
}
/**
+ * Gets the name of the ThemeSource.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getName()
*/
public String getName() {
@@ -268,6 +279,7 @@ public class DirectoryThemeSource implements ThemeSource {
}
/**
+ * Gets the Theme instance by name.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getThemeByName(String)
*/
public Theme getThemeByName(String name) {
diff --git a/src/com/itmill/toolkit/terminal/web/HttpUploadStream.java b/src/com/itmill/toolkit/terminal/web/HttpUploadStream.java
index c3d2deb35e..0a54120ed9 100644
--- a/src/com/itmill/toolkit/terminal/web/HttpUploadStream.java
+++ b/src/com/itmill/toolkit/terminal/web/HttpUploadStream.java
@@ -30,7 +30,8 @@ package com.itmill.toolkit.terminal.web;
import java.io.InputStream;
-/** WebAdapter implementation of the UploadStream interface.
+/**
+ * WebAdapter implementation of the UploadStream interface.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -39,22 +40,24 @@ import java.io.InputStream;
public class HttpUploadStream
implements com.itmill.toolkit.terminal.UploadStream {
- /** Holds value of property variableName. */
+ /**
+ * Holds value of property variableName.
+ */
private String streamName;
private String contentName;
private String contentType;
- /** Holds value of property variableValue. */
+ /**
+ * Holds value of property variableValue.
+ */
private InputStream stream;
- /** Creates a new instance of UploadStreamImpl
- * @param name of the stream
- * @param stream input stream
- * @param contentName name of the content
- * @param contentType type of the content
- * @param time Time of event creation
- * (for parallel events (for example in
- * same http request), times are equal)
+ /**
+ * Creates a new instance of UploadStreamImpl
+ * @param name the name of the stream.
+ * @param stream the input stream.
+ * @param contentName the name of the content.
+ * @param contentType the type of the content.
*/
public HttpUploadStream(
String name,
@@ -67,31 +70,35 @@ public class HttpUploadStream
this.contentType = contentType;
}
- /** Get the name of the stream.
- * @return name of the stream.
+ /**
+ * Gets the name of the stream.
+ * @return the name of the stream.
*/
public String getStreamName() {
return this.streamName;
}
- /** Get input stream.
- * @return Input stream.
+ /**
+ * Gets the input stream.
+ * @return the Input stream.
*/
public InputStream getStream() {
return this.stream;
}
- /** Get input stream content type.
- * @return content type of the input stream.
+ /**
+ * Gets the input stream content type.
+ * @return the content type of the input stream.
*/
public String getContentType() {
return this.contentType;
}
- /** Get stream content name.
- * Stream content name usually differs from the actual stream name.
- * it is used toi identify the content of the stream.
- * @return Name of the stream content.
+ /**
+ * Gets the stream content name.
+ * Stream content name usually differs from the actual stream name.
+ * It is used to identify the content of the stream.
+ * @return the Name of the stream content.
*/
public String getContentName() {
return this.contentName;
diff --git a/src/com/itmill/toolkit/terminal/web/HttpVariableMap.java b/src/com/itmill/toolkit/terminal/web/HttpVariableMap.java
index de296b1eec..ee7033c61b 100644
--- a/src/com/itmill/toolkit/terminal/web/HttpVariableMap.java
+++ b/src/com/itmill/toolkit/terminal/web/HttpVariableMap.java
@@ -70,7 +70,12 @@ public class HttpVariableMap {
// Id generator
private long lastId = 0;
- /** Convert the string to a supported class */
+ /**
+ * Converts the string to a supported class.
+ * @param type
+ * @param value
+ * @throws java.lang.ClassCastException
+ */
private static Object convert(Class type, String value)
throws java.lang.ClassCastException {
try {
@@ -94,7 +99,12 @@ public class HttpVariableMap {
}
}
- /** Register a new variable.
+ /**
+ * Registers a new variable.
+ * @param name the name of the variable.
+ * @param type
+ * @param value
+ * @param owner the Listener for variable changes.
*
* @return id to assigned for this variable.
*/
@@ -104,7 +114,7 @@ public class HttpVariableMap {
Object value,
VariableOwner owner) {
- // Check that the type of the class is supported
+ // Checks that the type of the class is supported
if (!(type.equals(Boolean.class)
|| type.equals(Integer.class)
|| type.equals(String.class)
@@ -115,7 +125,7 @@ public class HttpVariableMap {
synchronized (mapLock) {
- // Check if the variable is already mapped
+ // Checks if the variable is already mapped
HashMap nameToIdMap = (HashMap) ownerToNameToIdMap.get(owner);
if (nameToIdMap == null) {
nameToIdMap = new HashMap();
@@ -124,7 +134,7 @@ public class HttpVariableMap {
String id = (String) nameToIdMap.get(name);
if (id == null) {
- // Generate new id and register it
+ // Generates new id and register it
id = "v" + String.valueOf(++lastId);
nameToIdMap.put(name, id);
idToOwnerMap.put(id, new WeakReference(owner));
@@ -138,12 +148,16 @@ public class HttpVariableMap {
}
}
- /** Unregisters a variable. */
+ /**
+ * Unregisters the variable.
+ * @param name the name of the variable.
+ * @param owner the Listener for variable changes.
+ */
public void unregisterVariable(String name, VariableOwner owner) {
synchronized (mapLock) {
- // Get the id
+ // Gets the id
HashMap nameToIdMap = (HashMap) ownerToNameToIdMap.get(owner);
if (nameToIdMap == null)
return;
@@ -151,7 +165,7 @@ public class HttpVariableMap {
if (id != null)
return;
- // Remove all the mappings
+ // Removes all the mappings
nameToIdMap.remove(name);
if (nameToIdMap.isEmpty())
ownerToNameToIdMap.remove(owner);
@@ -170,20 +184,31 @@ public class HttpVariableMap {
*/
private class ParameterContainer {
- /** Construct the mapping: listener to set of listened parameter names */
+ /**
+ * Constructs the mapping: listener to set of listened parameter names.
+ */
private HashMap parameters = new HashMap();
- /** Parameter values */
+ /**
+ * Parameter values.
+ */
private HashMap values = new HashMap();
- /** Multipart parser used for parsing the request */
+ /**
+ * Multipart parser used for parsing the request.
+ */
private ServletMultipartRequest parser = null;
- /** Name - Value mapping of parameters that are not variables */
+ /**
+ * Name - Value mapping of parameters that are not variables.
+ */
private HashMap nonVariables = new HashMap();
- /** Create new parameter container and parse the parameters from the request using
- * GET, POST and POST/MULTIPART parsing
+ /**
+ * Creates the new parameter container and parse the parameters from the request using
+ * GET, POST and POST/MULTIPART parsing.
+ * @param req the HTTP request.
+ * @throws IOException if the writing failed due to input/output error.
*/
public ParameterContainer(HttpServletRequest req) throws IOException {
// Parse GET / POST parameters
@@ -235,7 +260,11 @@ public class HttpVariableMap {
}
- /** Add parameter to container */
+ /**
+ * Adds the parameter to container.
+ * @param name the name of the parameter.
+ * @param value
+ */
private void addParam(String name, String[] value) {
// Support name="set:name=value" value="ignored" notation
@@ -330,7 +359,7 @@ public class HttpVariableMap {
String[] curVal = (String[]) values.get(name);
ArrayList elems = new ArrayList();
- // Add old values if present.
+ // Adds old values if present.
if (curVal != null) {
for (int i = 0; i < curVal.length; i++)
elems.add(curVal[i]);
@@ -355,7 +384,7 @@ public class HttpVariableMap {
String[] curVal = (String[]) values.get(name);
ArrayList elems = new ArrayList();
- // Add old values if present.
+ // Adds old values if present.
if (curVal != null) {
for (int i = 0; i < curVal.length; i++)
elems.add(curVal[i]);
@@ -378,13 +407,13 @@ public class HttpVariableMap {
value = new String[0];
}
- // Get the owner
+ // Gets the owner
WeakReference ref = (WeakReference) idToOwnerMap.get(name);
VariableOwner owner = null;
if (ref != null)
owner = (VariableOwner) ref.get();
- // Add the parameter to mapping only if they have owners
+ // Adds the parameter to mapping only if they have owners
if (owner != null) {
Set p = (Set) parameters.get(owner);
if (p == null)
@@ -407,58 +436,77 @@ public class HttpVariableMap {
idToValueMap.remove(name);
}
- // Add the parameter to set of non-variables
+ // Adds the parameter to set of non-variables
nonVariables.put(name, value);
}
}
- /** Get the set of all parameters connected to given variable owner */
+ /**
+ * Gets the set of all parameters connected to given variable owner.
+ * @param owner the Listener for variable changes.
+ * @return the set of all parameters connected to variable owner.
+ */
public Set getParameters(VariableOwner owner) {
if (owner == null)
return null;
return (Set) parameters.get(owner);
}
- /** Get the set of all variable owners owning parameters in this request */
+ /**
+ * Gets the set of all variable owners owning parameters in this request.
+ * @return
+ */
public Set getOwners() {
return parameters.keySet();
}
- /** Get the value of a parameter */
+ /**
+ * Gets the value of a parameter.
+ * @param parameterName the name of the parameter.
+ * @return the value of the parameter.
+ */
public String[] getValue(String parameterName) {
return (String[]) values.get(parameterName);
}
- /** Get the servlet multipart parser */
+ /**
+ * Gets the servlet multipart parser.
+ * @return the parser.
+ */
public ServletMultipartRequest getParser() {
return parser;
}
- /** Get the name - value[] mapping of non variable paramteres */
+ /**
+ * Gets the name - value[] mapping of non variable paramteres.
+ * @return
+ */
public Map getNonVariables() {
return nonVariables;
}
}
- /** Handle all variable changes in this request.
- * @param req Http request to handle
- * @param listeners If the list is non null, only the listed listeners are
- * served. Otherwise all the listeners are served.
- * @return Name to Value[] mapping of unhandled variables
- */
+ /**
+ * Handles all variable changes in this request.
+ * @param req the Http request to handle.
+ * @param errorListener If the list is non null, only the listed listeners are
+ * served. Otherwise all the listeners are served.
+ * @return Name to Value[] mapping of unhandled variables.
+ * @throws IOException if the writing failed due to input/output error.
+ */
public Map handleVariables(
HttpServletRequest req,
Terminal.ErrorListener errorListener)
throws IOException {
- // Get the parameters
+ // Gets the parameters
ParameterContainer parcon = new ParameterContainer(req);
- // Sort listeners to dependency order
+ // Sorts listeners to dependency order
List listeners = getDependencySortedListenerList(parcon.getOwners());
- // Handle all parameters for all listeners
+ // Handles all parameters for all listeners
while (!listeners.isEmpty()) {
VariableOwner listener = (VariableOwner) listeners.remove(0);
boolean changed = false; // Has any of this owners variabes changed
@@ -467,9 +515,9 @@ public class HttpVariableMap {
if (params != null) { // Name value mapping
Map variables = new HashMap();
for (Iterator pi = params.iterator(); pi.hasNext();) {
- // Get the name of the parameter
+ // Gets the name of the parameter
String param = (String) pi.next();
- // Extract more information about the parameter
+ // Extracts more information about the parameter
String varName = (String) idToNameMap.get(param);
Class varType = (Class) idToTypeMap.get(param);
Object varOldValue = idToValueMap.get(param);
@@ -582,15 +630,22 @@ public class HttpVariableMap {
return parcon.getNonVariables();
}
- /** Implementation of VariableOwner.Error interface. */
+ /**
+ * Implementation of VariableOwner.Error interface.
+ */
public class TerminalErrorImpl implements Terminal.ErrorEvent {
private Throwable throwable;
-
+
+/**
+ *
+ * @param throwable
+ */
private TerminalErrorImpl(Throwable throwable) {
this.throwable = throwable;
}
/**
+ * Gets the contained throwable.
* @see com.itmill.toolkit.terminal.Terminal.ErrorEvent#getThrowable()
*/
public Throwable getThrowable() {
@@ -599,13 +654,20 @@ public class HttpVariableMap {
}
- /** Implementation of VariableOwner.Error interface. */
+ /**
+ * Implementation of VariableOwner.Error interface.
+ */
public class VariableOwnerErrorImpl
extends TerminalErrorImpl
implements VariableOwner.ErrorEvent {
private VariableOwner owner;
-
+
+/**
+ *
+ * @param owner the Listener for variable changes.
+ * @param throwable
+ */
private VariableOwnerErrorImpl(
VariableOwner owner,
Throwable throwable) {
@@ -614,6 +676,7 @@ public class HttpVariableMap {
}
/**
+ * Gets the source VariableOwner.
* @see com.itmill.toolkit.terminal.VariableOwner.ErrorEvent#getVariableOwner()
*/
public VariableOwner getVariableOwner() {
@@ -622,12 +685,13 @@ public class HttpVariableMap {
}
- /** Resolve the VariableOwners needed from the request and sort
+ /**
+ * Resolves the VariableOwners needed from the request and sort
* them to assure that the dependencies are met (as well as possible).
+ *
+ * @param listeners
* @return List of variable list changers, that are needed for handling
* all the variables in the request
- * @param req request to be handled
- * @param parser multipart parser for the request
*/
private List getDependencySortedListenerList(Set listeners) {
@@ -695,12 +759,12 @@ public class HttpVariableMap {
}
}
- // Add the listeners with dependencies in sane order to the result
+ // Adds the listeners with dependencies in sane order to the result
for (Iterator li = deepdeps.keySet().iterator(); li.hasNext();) {
VariableOwner l = (VariableOwner) li.next();
boolean immediate = l.isImmediate();
- // Add each listener after the last depended listener already in
+ // Adds each listener after the last depended listener already in
// the list
int index = -1;
for (Iterator di = ((Set) deepdeps.get(l)).iterator();
@@ -723,7 +787,7 @@ public class HttpVariableMap {
}
}
- // Append immediate listeners to normal listeners
+ // Appends immediate listeners to normal listeners
// This way the normal handlers are always called before
// immediate ones
resultNormal.addAll(resultImmediate);
diff --git a/src/com/itmill/toolkit/terminal/web/JarThemeSource.java b/src/com/itmill/toolkit/terminal/web/JarThemeSource.java
index 0851b2a7cb..4a0707e7b0 100644
--- a/src/com/itmill/toolkit/terminal/web/JarThemeSource.java
+++ b/src/com/itmill/toolkit/terminal/web/JarThemeSource.java
@@ -69,7 +69,9 @@ public class JarThemeSource implements ThemeSource {
private Cache resourceCache = new Cache();
- /** Collection of subdirectory entries */
+ /**
+ * Collection of subdirectory entries.
+ */
private Collection subdirs = new LinkedList();
/**
@@ -77,11 +79,18 @@ public class JarThemeSource implements ThemeSource {
* local directory.
*
* @param file
- * Path to the JAR archive .
+ * the Path to the JAR archive .
+ * @param webAdapterServlet
* @param path
- * Path inside the archive to be processed.
+ * the Path inside the archive to be processed.
+ * @throws ThemeException
+ * If the resource is not found or there was
+ * some problem finding the resource.
+ *
* @throws FileNotFoundException
- * if no theme files are found
+ * if no theme files are found.
+ * @throws IOException
+ * if the writing failed due to input/output error.
*/
public JarThemeSource(File file, ApplicationServlet webAdapterServlet,
String path) throws ThemeException, FileNotFoundException,
@@ -101,7 +110,7 @@ public class JarThemeSource implements ThemeSource {
this.webAdapterServlet = webAdapterServlet;
- // Load description file
+ // Loads description file
JarEntry entry = jar.getJarEntry(this.path + Theme.DESCRIPTIONFILE);
if (entry != null) {
try {
@@ -142,6 +151,7 @@ public class JarThemeSource implements ThemeSource {
}
/**
+ * Gets the XSL stream for the specified theme and web-browser type.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getXSLStreams(Theme,
* WebBrowser)
*/
@@ -199,7 +209,7 @@ public class JarThemeSource implements ThemeSource {
}
/**
- * Return modication time of the jar file.
+ * Returns modication time of the jar file.
*
* @see com.itmill.toolkit.terminal.web.ThemeSource#getModificationTime()
*/
@@ -208,6 +218,7 @@ public class JarThemeSource implements ThemeSource {
}
/**
+ * Gets the input stream for the resource with the specified resource id.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getResource(String)
*/
public InputStream getResource(String resourceId)
@@ -220,7 +231,7 @@ public class JarThemeSource implements ThemeSource {
.substring(this.theme.getName().length() + 1);
}
- // Return the resource inside the jar file
+ // Returns the resource inside the jar file
JarEntry entry = jar.getJarEntry(resourceId);
if (entry != null)
try {
@@ -230,7 +241,7 @@ public class JarThemeSource implements ThemeSource {
if (data != null)
return new ByteArrayInputStream(data);
- // Read data
+ // Reads data
int bufSize = 1024;
ByteArrayOutputStream out = new ByteArrayOutputStream(bufSize);
InputStream in = jar.getInputStream(entry);
@@ -253,6 +264,7 @@ public class JarThemeSource implements ThemeSource {
}
/**
+ * Gets the list of themes in the theme source.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getThemes()
*/
public Collection getThemes() {
@@ -269,6 +281,7 @@ public class JarThemeSource implements ThemeSource {
}
/**
+ * Gets the name of the ThemeSource.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getName()
*/
public String getName() {
@@ -280,6 +293,7 @@ public class JarThemeSource implements ThemeSource {
}
/**
+ * Gets the Theme instance by name.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getThemeByName(String)
*/
public Theme getThemeByName(String name) {
@@ -301,18 +315,32 @@ public class JarThemeSource implements ThemeSource {
private class Cache {
private Map data = new HashMap();
-
+
+/**
+ *
+ * @param key
+ * @param value
+ */
public void put(Object key, Object value) {
data.put(key, new SoftReference(new CacheItem(value)));
}
-
+
+/**
+ *
+ * @param key
+ * @return
+ */
public Object get(Object key) {
SoftReference ref = (SoftReference) data.get(key);
if (ref != null)
return ((CacheItem) ref.get()).getData();
return null;
}
-
+
+ /**
+ * Clears the data.
+ *
+ */
public void clear() {
data.clear();
}
@@ -327,15 +355,26 @@ public class JarThemeSource implements ThemeSource {
private class CacheItem {
private Object data;
-
+
+/**
+ *
+ * @param data
+ */
public CacheItem(Object data) {
this.data = data;
}
-
+
+/**
+ *
+ * @return
+ */
public Object getData() {
return this.data;
};
-
+
+ /**
+ * @see java.lang.Object#finalize()
+ */
public void finalize() throws Throwable {
this.data = null;
super.finalize();
diff --git a/src/com/itmill/toolkit/terminal/web/Log.java b/src/com/itmill/toolkit/terminal/web/Log.java
index 5feec4874d..a46ba3a01b 100644
--- a/src/com/itmill/toolkit/terminal/web/Log.java
+++ b/src/com/itmill/toolkit/terminal/web/Log.java
@@ -28,24 +28,29 @@
package com.itmill.toolkit.terminal.web;
-/** <p>Class providing centralized logging services. The logger defines
+/**
+ * <p>
+ * Class providing centralized logging services. The logger defines
* five message types, and provides methods to create messages of those
- * types. These types are:</p>
+ * types. These types are:
+ * </p>
*
* <ul>
* <li> <code>info</code> - Useful information generated during normal
- * operation of the application
+ * operation of the application.
* <li> <code>warning</code> - An error situation has occurred, but the
- * operation was able to finish succesfully
+ * operation was able to finish succesfully.
* <li> <code>error</code> - An error situation which prevented the
- * operation from finishing succesfully
+ * operation from finishing succesfully.
* <li> <code>debug</code> - Internal information from the application meant
- * for developers
+ * for developers.
* <li> <code>exception</code> - A Java exception reported using the logger.
- * Includes the exception stack trace and a possible free-form message
+ * Includes the exception stack trace and a possible free-form message.
* </ul>
*
- * <p>Currently the class offers logging only to the standard output</p>
+ * <p>
+ * Currently the class offers logging only to the standard output.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -61,33 +66,37 @@ public class Log {
private static String LOG_MSG_DEBUG = "[DEBUG]";
private static String LOG_MSG_EXCEPT = "[EXCEPTION]";
- /** Logs a <code>warning</code> message.
+ /**
+ * Logs the <code>warning</code> message.
*
- * @param message Message <code>String</code> to be logged.
+ * @param message the Message String to be logged.
*/
protected static synchronized void warn(java.lang.String message) {
if (Log.useStdOut) System.out.println(LOG_MSG_WARN+ " "+message);
}
- /** Logs a <code>debug</code> message.
+ /**
+ * Logs the <code>debug</code> message.
*
- * @param message Message <code>String</code> to be logged.
+ * @param message the Message String to be logged.
*/
protected static synchronized void debug(java.lang.String message) {
if (Log.useStdOut) System.out.println(LOG_MSG_DEBUG+ " "+message);
}
- /** Logs an <code>info</code> message.
+ /**
+ * Logs an <code>info</code> message.
*
- * @param message Message <code>String</code> to be logged.
+ * @param message the Message String to be logged.
*/
protected static synchronized void info(java.lang.String message) {
if (Log.useStdOut) System.out.println(LOG_MSG_INFO+ " "+message);
}
- /** Logs a Java exception and an accompanying error message.
+ /**
+ * Logs the Java exception and an accompanying error message.
*
- * @param message Message <code>String</code> to be logged.
- * @param e Exception to be logged.
+ * @param message the Message String to be logged.
+ * @param e the Exception to be logged.
*/
protected static synchronized void except(java.lang.String message, Exception e) {
if (Log.useStdOut) {
@@ -96,9 +105,10 @@ public class Log {
}
}
- /** Logs an <code>error</code> message.
+ /**
+ * Logs the <code>error</code> message.
*
- * @param message Message <code>String</code> to be logged.
+ * @param message the Message String to be logged.
*/
protected static synchronized void error(java.lang.String message) {
if (Log.useStdOut) System.out.println(LOG_MSG_ERROR+ " "+message);
diff --git a/src/com/itmill/toolkit/terminal/web/MultipartRequest.java b/src/com/itmill/toolkit/terminal/web/MultipartRequest.java
index 0791983b99..a6358480db 100644
--- a/src/com/itmill/toolkit/terminal/web/MultipartRequest.java
+++ b/src/com/itmill/toolkit/terminal/web/MultipartRequest.java
@@ -44,75 +44,76 @@ import java.util.Vector;
import java.io.File;
/**
- A Multipart form data parser. Parses an input stream and writes out any files found,
- making available a hashtable of other url parameters. As of version 1.17 the files can
- be saved to memory, and optionally written to a database, etc.
-
- <BR>
- <BR>
- Copyright (C)2001 Jason Pell.
- <BR>
-
- <PRE>
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- <BR>
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- <BR>
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- <BR>
- Email: jasonpell@hotmail.com
- Url: http://www.geocities.com/jasonpell
- </PRE>
-
- @author Jason Pell
-
- @version 1.18 Fixed some serious bugs. A new method readAndWrite(InputStream in, OutputStream out) which now does
- the generic processing in common for readAndWriteFile and readFile. The differences are that now
- the two extra bytes at the end of a file upload are processed once, instead of after each line. Also
- if an empty file is encountered, an outputstream is opened, but then deleted if no data written to it.
- The getCharArray() method has been removed. Replaced by the new String(bytes, encoding) method using
- a specific encoding (Defaults to ISO-8859-1) to ensure that extended characters are supported.
- All strings are processed using this encoding. The addition of static methods setEncoding(String)
- and getEncoding() to allow the use of MultipartRequest with a specific encoding type. All instances
- of MultipartRequest will utilise the static charEncoding variable value, that the setEncoding() method
- can be used to set. Started to introduce support for multiple file uploads with the same form field
- name, but not completed for v1.18. 26/06/2001
- @version 1.17 A few _very_ minor fixes. Plus a cool new feature added. The ability to save files into memory.
- <b>Thanks to Mark Latham for the idea and some of the code.</b> 11/04/2001
- @version 1.16 Added support for multiple parameter values. Also fixed getCharArray(...) method to support
- parameters with non-english ascii values (ascii above 127). Thanks to Stefan Schmidt &
- Michael Elvers for this. (No fix yet for reported problems with Tomcat 3.2 or a single extra
- byte appended to uploads of certain files). By 1.17 hopefully will have a resolution for the
- second problem. 14/03/2001
- @version 1.15 A new parameter added, intMaxReadBytes, to allow arbitrary length files. Released under
- the LGPL (Lesser General Public License). 03/02/2001
- @version 1.14 Fix for IE problem with filename being empty. This is because IE includes a default Content-Type
- even when no file is uploaded. 16/02/2001
- @version 1.13 If an upload directory is not specified, then all file contents are sent into oblivion, but the
- rest of the parsing works as normal.
- @version 1.12 Fix, was allowing zero length files. Will not even create the output file until there is
- something to write. getFile(String) now returns null, if a zero length file was specified. 06/11/2000
- @version 1.11 Fix, in case Content-type is not specified.
- @version 1.1 Removed dependence on Servlets. Now passes in a generic InputStream instead.
- "Borrowed" readLine from Tomcat 3.1 ServletInputStream class,
- so we can remove some of the dependencies on ServletInputStream.
- Fixed bug where a empty INPUT TYPE="FILE" value, would cause an exception.
- @version 1.0 Initial Release.
-*/
+ * A Multipart form data parser. Parses an input stream and writes out any files found,
+ * making available a hashtable of other url parameters. As of version 1.17 the files can
+ * be saved to memory, and optionally written to a database, etc.
+ *
+ * <BR>
+ * <BR>
+ * Copyright (C)2001 Jason Pell.
+ * <BR>
+ *
+ * <PRE>
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * <BR>
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * <BR>
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * <BR>
+ * Email: jasonpell@hotmail.com
+ * Url: http://www.geocities.com/jasonpell
+ * </PRE>
+ *
+ * @author Jason Pell
+ *
+ * @version 1.18 Fixed some serious bugs. A new method readAndWrite(InputStream in, OutputStream out) which now does
+ * the generic processing in common for readAndWriteFile and readFile. The differences are that now
+ * the two extra bytes at the end of a file upload are processed once, instead of after each line. Also
+ * if an empty file is encountered, an outputstream is opened, but then deleted if no data written to it.
+ * The <code>getCharArray</code> method has been removed. Replaced by the new String(bytes, encoding) method using
+ * a specific encoding (Defaults to ISO-8859-1) to ensure that extended characters are supported.
+ * All strings are processed using this encoding. The addition of static methods setEncoding(String)
+ * and <code>getEncoding</code> method to allow the use of <code>MultipartRequest</code> with a specific encoding type. All instances
+ * of MultipartRequest will utilise the static charEncoding variable value, that the <code>setEncoding</code> method
+ * can be used to set. Started to introduce support for multiple file uploads with the same form field
+ * name, but not completed for v1.18. 26/06/2001
+ *
+ * @version 1.17 A few _very_ minor fixes. Plus a cool new feature added. The ability to save files into memory.
+ * <b>Thanks to Mark Latham for the idea and some of the code.</b> 11/04/2001
+ * @version 1.16 Added support for multiple parameter values. Also fixed getCharArray(...) method to support
+ * parameters with non-english ascii values (ascii above 127). Thanks to Stefan Schmidt &
+ * Michael Elvers for this. (No fix yet for reported problems with Tomcat 3.2 or a single extra
+ * byte appended to uploads of certain files). By 1.17 hopefully will have a resolution for the
+ * second problem. 14/03/2001
+ * @version 1.15 A new parameter added, intMaxReadBytes, to allow arbitrary length files. Released under
+ * the LGPL (Lesser General Public License). 03/02/2001
+ * @version 1.14 Fix for IE problem with filename being empty. This is because IE includes a default Content-Type
+ * even when no file is uploaded. 16/02/2001
+ * @version 1.13 If an upload directory is not specified, then all file contents are sent into oblivion, but the
+ * rest of the parsing works as normal.
+ * @version 1.12 Fix, was allowing zero length files. Will not even create the output file until there is
+ * something to write. getFile(String) now returns null, if a zero length file was specified. 06/11/2000
+ * @version 1.11 Fix, in case Content-type is not specified.
+ * @version 1.1 Removed dependence on Servlets. Now passes in a generic InputStream instead.
+ * "Borrowed" readLine from Tomcat 3.1 ServletInputStream class,
+ * so we can remove some of the dependencies on ServletInputStream.
+ * Fixed bug where a empty INPUT TYPE="FILE" value, would cause an exception.
+ * @version 1.0 Initial Release.
+ */
public class MultipartRequest
{
/**
- Define Character Encoding method here.
- */
+ * Defines Character Encoding method here.
+ */
private String charEncoding = "UTF-8";
// If not null, send debugging out here.
@@ -131,61 +132,61 @@ public class MultipartRequest
private long intTotalRead = -1;
/**
- Prevent a denial of service by defining this, will never read more data.
- If Content-Length is specified to be more than this, will throw an exception.
-
- This limits the maximum number of bytes to the value of an int, which is 2 Gigabytes.
- */
+ * Prevent a denial of service by defining this, will never read more data.
+ * If Content-Length is specified to be more than this, will throw an exception.
+ *
+ * This limits the maximum number of bytes to the value of an int, which is 2 Gigabytes.
+ */
public static final int MAX_READ_BYTES = Integer.MAX_VALUE;
/**
- Defines the number of bytes to read per readLine call. 128K
- */
+ * Defines the number of bytes to read per readLine call. 128K
+ */
public static final int READ_LINE_BLOCK = 1024 * 128;
/**
- Store a read from the input stream here. Global so we do not keep creating new arrays each read.
- */
+ * Store a read from the input stream here. Global so we do not keep creating new arrays each read.
+ */
private byte[] blockOfBytes = null;
/**
- Type constant for File FILENAME.
- */
+ * Type constant for File FILENAME.
+ */
public static final int FILENAME = 0;
/**
- Type constant for the File CONTENT_TYPE.
- */
+ * Type constant for the File CONTENT_TYPE.
+ */
public static final int CONTENT_TYPE = 1;
/**
- Type constant for the File SIZE.
- */
+ * Type constant for the File SIZE.
+ */
public static final int SIZE = 2;
/**
- Type constant for the File CONTENTS.
-
- <b>Note: </b>Only used for file upload to memory.
- */
+ * Type constant for the File CONTENTS.
+ *
+ * <b>Note: </b>Only used for file upload to memory.
+ */
public static final int CONTENTS = 3;
/**
- This method should be called on the MultipartRequest itself, not on any
- instances of MultipartRequest, because this sets up the encoding for all
- instances of multipartrequest. You can set the encoding to null, in which
- case the default encoding will be applied. The default encoding if this method
- is not called has been set to ISO-8859-1, which seems to offer the best hope
- of support for international characters, such as german "Umlaut" characters.
-
- <p><b>Warning:</b> In multithreaded environments it is the responsibility of the
- implementer to make sure that this method is not called while another instance
- is being constructed. When an instance of MultipartRequest is constructed, it parses
- the input data, and uses the result of getEncoding() to convert between bytes and
- strings. If setEncoding() is called by another thread, while the private parse() is
- executing, the method will utilise this new encoding, which may cause serious
- problems.</p>
- */
+ * This method should be called on the <code>MultipartRequest</code> itself, not on any
+ * instances of <code>MultipartRequest</code>, because this sets up the encoding for all
+ * instances of multipartrequest. You can set the encoding to null, in which
+ * case the default encoding will be applied. The default encoding if this method
+ * is not called has been set to ISO-8859-1, which seems to offer the best hope
+ * of support for international characters, such as german "Umlaut" characters.
+ *
+ * <p><b>Warning:</b> In multithreaded environments it is the responsibility of the
+ * implementer to make sure that this method is not called while another instance
+ * is being constructed. When an instance of MultipartRequest is constructed, it parses
+ * the input data, and uses the result of <code>getEncoding</code> method to convert between bytes and
+ * strings. If <code>setEncoding</code> method is called by another thread, while the private <code>parse</code> method is
+ * executing, the method will utilise this new encoding, which may cause serious
+ * problems.</p>
+ */
public void setEncoding(String enc) throws UnsupportedEncodingException
{
if (enc==null || enc.trim()=="")
@@ -200,8 +201,9 @@ public class MultipartRequest
}
/**
- Returns the current encoding method.
- */
+ * Gets the current encoding method.
+ * @return the encoding method.
+ */
public String getEncoding()
{
return charEncoding;
@@ -210,10 +212,10 @@ public class MultipartRequest
/**
* Constructor.
*
- * @param strContentTypeText The &quot;Content-Type&quot; HTTP header value.
- * @param intContentLength The &quot;Content-Length&quot; HTTP header value.
- * @param in The InputStream to read and parse.
- * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
+ * @param strContentTypeText the &quot;Content-Type&quot; HTTP header value.
+ * @param intContentLength the &quot;Content-Length&quot; HTTP header value.
+ * @param in the InputStream to read and parse.
+ * @param strSaveDirectory the temporary directory to save the file from where they can then be moved to wherever by the
* calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
* will be silently ignored.</b>
*
@@ -233,10 +235,10 @@ public class MultipartRequest
/**
* Constructor.
*
- * @param strContentTypeText The &quot;Content-Type&quot; HTTP header value.
- * @param intContentLength The &quot;Content-Length&quot; HTTP header value.
- * @param in The InputStream to read and parse.
- * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
+ * @param strContentTypeText the &quot;Content-Type&quot; HTTP header value.
+ * @param intContentLength the &quot;Content-Length&quot; HTTP header value.
+ * @param in the InputStream to read and parse.
+ * @param strSaveDirectory the temporary directory to save the file from where they can then be moved to wherever by the
* calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
* will be silently ignored.</B>
* @param intMaxReadBytes Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
@@ -259,10 +261,10 @@ public class MultipartRequest
* Constructor.
*
* @param debug A PrintWriter that can be used for debugging.
- * @param strContentTypeText The &quot;Content-Type&quot; HTTP header value.
- * @param intContentLength The &quot;Content-Length&quot; HTTP header value.
- * @param in The InputStream to read and parse.
- * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
+ * @param strContentTypeText the &quot;Content-Type&quot; HTTP header value.
+ * @param intContentLength the &quot;Content-Length&quot; HTTP header value.
+ * @param in the InputStream to read and parse.
+ * @param strSaveDirectory the temporary directory to save the file from where they can then be moved to wherever by the
* calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
* will be silently ignored.</B>
*
@@ -287,9 +289,9 @@ public class MultipartRequest
* Constructor - load into memory constructor
*
* @param debug A PrintWriter that can be used for debugging.
- * @param strContentTypeText The &quot;Content-Type&quot; HTTP header value.
- * @param intContentLength The &quot;Content-Length&quot; HTTP header value.
- * @param in The InputStream to read and parse.
+ * @param strContentTypeText the &quot;Content-Type&quot; HTTP header value.
+ * @param intContentLength the &quot;Content-Length&quot; HTTP header value.
+ * @param in the InputStream to read and parse.
* @param intMaxReadBytes Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
*
* @exception IllegalArgumentException If the strContentTypeText does not contain a Content-Type of "multipart/form-data" or the boundary is not found.
@@ -313,10 +315,10 @@ public class MultipartRequest
* Constructor.
*
* @param debug A PrintWriter that can be used for debugging.
- * @param strContentTypeText The &quot;Content-Type&quot; HTTP header value.
- * @param intContentLength The &quot;Content-Length&quot; HTTP header value.
- * @param in The InputStream to read and parse.
- * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
+ * @param strContentTypeText the &quot;Content-Type&quot; HTTP header value.
+ * @param intContentLength the &quot;Content-Length&quot; HTTP header value.
+ * @param in the InputStream to read and parse.
+ * @param strSaveDirectory the temporary directory to save the file from where they can then be moved to wherever by the
* calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
* will be silently ignored.</B>
* @param intMaxReadBytes Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
@@ -351,10 +353,10 @@ public class MultipartRequest
* Initialise the parser.
*
* @param debug A PrintWriter that can be used for debugging.
- * @param strContentTypeText The &quot;Content-Type&quot; HTTP header value.
- * @param intContentLength The &quot;Content-Length&quot; HTTP header value.
- * @param in The InputStream to read and parse.
- * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
+ * @param strContentTypeText the &quot;Content-Type&quot; HTTP header value.
+ * @param intContentLength the &quot;Content-Length&quot; HTTP header value.
+ * @param in the InputStream to read and parse.
+ * @param strSaveDirectory the temporary directory to save the file from where they can then be moved to wherever by the
* calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
* will be silently ignored.</B>
* @param intMaxReadBytes Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
@@ -370,7 +372,7 @@ public class MultipartRequest
InputStream in,
int intMaxReadBytes) throws IllegalArgumentException, IOException
{
- // save reference to debug stream for later.
+ // saves reference to debug stream for later.
this.debug = debug;
if (strContentTypeText!=null && strContentTypeText.startsWith("multipart/form-data") && strContentTypeText.indexOf("boundary=")!=-1)
@@ -402,10 +404,13 @@ public class MultipartRequest
}
/**
- Return the value of the strName URLParameter.
- If more than one value for a particular Parameter, will return the first.
- If an error occurs will return null.
- */
+ * Gets the value of the strName URLParameter.
+ * If more than one value for a particular Parameter, will return the first.
+ * If an error occurs will return null.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @return the value of the URL Parameter.
+ */
public String getURLParameter(String strName)
{
Object value = htParameters.get(strName);
@@ -416,11 +421,14 @@ public class MultipartRequest
}
/**
- Return an enumeration of all values for the strName parameter.
- Even if a single value for, will always return an enumeration, although
- it may actually be empty if no value was encountered for strName or
- it is an invalid parameter name.
- */
+ * Gets an enumeration of all values for the strName parameter.
+ * Even if a single value for, will always return an enumeration, although
+ * it may actually be empty if no value was encountered for strName or
+ * it is an invalid parameter name.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @return the enumeration of all values.
+ */
public Enumeration getURLParameters(String strName)
{
Object value = htParameters.get(strName);
@@ -436,27 +444,29 @@ public class MultipartRequest
}
/**
- An enumeration of all URL Parameters for the current HTTP Request.
- */
+ * Gets the enumeration of all URL Parameters for the current HTTP Request.
+ * @return the enumeration of URl Parameters.
+ */
public Enumeration getParameterNames()
{
return htParameters.keys();
}
/**
- This enumeration will return all INPUT TYPE=FILE parameter NAMES as encountered
- during the upload.
- */
+ * Gets the enumeration of all INPUT TYPE=FILE parameter NAMES as encountered
+ * during the upload.
+ * @return
+ */
public Enumeration getFileParameterNames()
{
return htFiles.keys();
}
/**
- Returns the Content-Type of a file.
-
- @see #getFileParameter(java.lang.String, int)
- */
+ * Returns the Content-Type of a file.
+ *
+ * @see #getFileParameter(java.lang.String, int)
+ */
public String getContentType(String strName)
{
// Can cast null, it will be ignored.
@@ -464,14 +474,14 @@ public class MultipartRequest
}
/**
- If files were uploaded into memory, this method will retrieve the contents
- of the file as a InputStream.
-
- @return the contents of the file as a InputStream, or null if not file uploaded,
- or file uploaded to file system directory.
-
- @see #getFileParameter(java.lang.String, int)
- */
+ * If files were uploaded into memory, this method will retrieve the contents
+ * of the file as a InputStream.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @return the contents of the file as a InputStream, or null if not file uploaded,
+ * or file uploaded to file system directory.
+ * @see #getFileParameter(java.lang.String, int)
+ */
public InputStream getFileContents(String strName)
{
Object obj = getFileParameter(strName, CONTENTS);
@@ -482,19 +492,22 @@ public class MultipartRequest
}
/**
- Returns a File reference to the uploaded file. This reference is to the files uploaded location,
- and allows you to read/move/delete the file.
-
- This method is only of use, if files were uploaded to the file system. Will return null if
- uploaded to memory, in which case you should use getFileContents(strName) instead.
-
- @return Returns a null file reference if a call to getFileSize(strName) returns zero or files were
- uploaded to memory.
-
- @see #getFileSize(java.lang.String)
- @see #getFileContents(java.lang.String)
- @see #getFileSystemName(java.lang.String)
- */
+ * Returns a File reference to the uploaded file. This
+ * reference is to the files uploaded location,
+ * and allows you to read/move/delete the file.
+ * This method is only of use, if files were uploaded to the
+ * file system. Will return null if
+ * uploaded to memory, in which case you should use
+ * getFileContents(strName) instead.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @return a null file reference if a call to
+ * getFileSize(strName) returns zero or files were
+ * uploaded to memory.
+ * @see #getFileSize(java.lang.String)
+ * @see #getFileContents(java.lang.String)
+ * @see #getFileSystemName(java.lang.String)
+ */
public File getFile(String strName)
{
String filename = getFileSystemName(strName);
@@ -506,12 +519,13 @@ public class MultipartRequest
}
/**
- Get the file system basename of an uploaded file.
-
- @return null if strName not found.
-
- @see #getFileParameter(java.lang.String, int)
- */
+ * Gets the file system basename of an uploaded file.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @return null if strName not found.
+ *
+ * @see #getFileParameter(java.lang.String, int)
+ */
public String getFileSystemName(String strName)
{
// Can cast null, it will be ignored.
@@ -519,12 +533,13 @@ public class MultipartRequest
}
/**
- Returns the File Size of a uploaded file.
-
- @return -1 if file size not defined.
-
- @see #getFileParameter(java.lang.String, int)
- */
+ * Returns the File Size of a uploaded file.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @return -1 if file size not defined.
+ *
+ * @see #getFileParameter(java.lang.String, int)
+ */
public long getFileSize(String strName)
{
Object obj = getFileParameter(strName, SIZE);
@@ -535,32 +550,30 @@ public class MultipartRequest
}
/**
- Access an attribute of a file upload parameter record.
-
- @param strName is the form field name, used to upload the file. This identifies
- the formfield location in the storage facility.
-
- @param strFilename This is the FileSystemName of the file
- @param type What attribute you want from the File Parameter.
- The following types are supported:
- MultipartRequest.FILENAME,
- MultipartRequest.CONTENT_TYPE,
- MultipartRequest.SIZE,
- MultipartRequest.CONTENTS
-
- <p>The getFileSystemName(String strName),getFileSize(String strName),getContentType(String strName),
- getContents(String strName) methods all use this method passing in a different type argument.</p>
-
- <p><b>Note: </b>This class has been changed to provide for future functionality where you
- will be able to access all files uploaded, even if they are uploaded using the same
- form field name. At this point however, only the first file uploaded via a form
- field name is accessible.</p>
-
- @see #getContentType(java.lang.String)
- @see #getFileSize(java.lang.String)
- @see #getFileContents(java.lang.String)
- @see #getFileSystemName(java.lang.String)
- */
+ * Access an attribute of a file upload parameter record.
+ * <p>The getFileSystemName(String strName),getFileSize(String strName),getContentType(String strName),
+ * getContents(String strName) methods all use this method passing in a different type argument.</p>
+ *
+ * <p><b>Note: </b>This class has been changed to provide for future functionality where you
+ * will be able to access all files uploaded, even if they are uploaded using the same
+ * form field name. At this point however, only the first file uploaded via a form
+ * field name is accessible.</p>
+ *
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ *
+ * @param type What attribute you want from the File Parameter.
+ * The following types are supported:
+ * MultipartRequest.FILENAME,
+ * MultipartRequest.CONTENT_TYPE,
+ * MultipartRequest.SIZE,
+ * MultipartRequest.CONTENTS
+ *
+ * @see #getContentType(java.lang.String)
+ * @see #getFileSize(java.lang.String)
+ * @see #getFileContents(java.lang.String)
+ * @see #getFileSystemName(java.lang.String)
+ */
public Object getFileParameter(String strName, int type)
{
Object[] objArray = null;
@@ -578,8 +591,11 @@ public class MultipartRequest
}
/**
- This is the main parse method.
- */
+ * This is the main parse method.
+ * @param in the InputStream to read and parse.
+ * @throws IOException If the intContentLength is higher than MAX_READ_BYTES or
+ * strSaveDirectory is invalid or cannot be written to.
+ */
private void parse(InputStream in) throws IOException
{
String strContentType = null;
@@ -690,9 +706,12 @@ public class MultipartRequest
}
/**
- So we can put the logic for supporting multiple parameters with the same
- form field name in the one location.
- */
+ * So we can put the logic for supporting multiple parameters with the same
+ * form field name in the one location.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @param value the form field value.
+ */
private void addParameter(String strName, String value)
{
// Fix NPE in case of null name
@@ -702,7 +721,7 @@ public class MultipartRequest
// Fix 1.16: for multiple parameter values.
Object objParms = htParameters.get(strName);
- // Add an new entry to the param vector.
+ // Adds an new entry to the param vector.
if (objParms instanceof Vector)
((Vector)objParms).addElement(value);
else if (objParms instanceof String)// There is only one entry, so we create a vector!
@@ -718,11 +737,14 @@ public class MultipartRequest
}
/**
- So we can put the logic for supporting multiple files with the same
- form field name in the one location.
-
- Assumes that this method will never be called with a null fileObj or strFilename.
- */
+ * So we can put the logic for supporting multiple files with the same
+ * form field name in the one location.
+ *
+ * Assumes that this method will never be called with a null fileObj or strFilename.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @param fileObj
+ */
private void addFileParameter(String strName, Object[] fileObj)
{
Object objParms = htFiles.get(strName);
@@ -743,10 +765,11 @@ public class MultipartRequest
}
/**
- Read parameters, assume already passed Content-Disposition and blank line.
-
- @return the value read in.
- */
+ * Reads the parameters, assume already passed Content-Disposition and blank line.
+ * @param in the InputStream to read and parse.
+ * @return the value read in.
+ * @throws IOException if an error occurs writing the file.
+ */
private String readParameter(InputStream in) throws IOException
{
StringBuffer buf = new StringBuffer();
@@ -773,8 +796,11 @@ public class MultipartRequest
}
/**
- Read from in, write to out, minus last two line ending bytes.
- */
+ * Read from in, write to out, minus last two line ending bytes.
+ * @param in the InputStream to read and parse.
+ * @param out the OutputStream.
+ * @throws IOException if an error occurs writing the file.
+ */
private long readAndWrite(InputStream in, OutputStream out) throws IOException
{
long fileSize = 0;
@@ -794,7 +820,7 @@ public class MultipartRequest
// Found boundary.
if (read<blockOfBytes.length && new String(blockOfBytes, 0, read, charEncoding).indexOf(this.strBoundary)!=-1)
{
- // Write the line, minus any line ending bytes.
+ // Writes the line, minus any line ending bytes.
//The secondLineOfBytes will NEVER BE NON-NULL if out==null, so there is no need to included this in the test
if(sizeOfSecondArray!=0)
{
@@ -803,7 +829,7 @@ public class MultipartRequest
if (actualLength>0 && out!=null)
{
out.write(secondLineOfBytes, 0, actualLength);
- // Update file size.
+ // Updates the file size.
fileSize+=actualLength;
}
}
@@ -811,12 +837,12 @@ public class MultipartRequest
}
else
{
- // Write out previous line.
+ // Writes the out previous line.
//The sizeOfSecondArray will NEVER BE ZERO if out==null, so there is no need to included this in the test
if(sizeOfSecondArray!=0)
{
out.write(secondLineOfBytes, 0, sizeOfSecondArray);
- // Update file size.
+ // Updates the file size.
fileSize+=sizeOfSecondArray;
}
@@ -831,21 +857,21 @@ public class MultipartRequest
}
}
- //Return the number of bytes written to outstream.
+ //Returns the number of bytes written to outstream.
return fileSize;
}
/**
- Read a Multipart section that is a file type. Assumes that the Content-Disposition/Content-Type and blank line
- have already been processed. So we read until we hit a boundary, then close file and return.
-
- @exception IOException if an error occurs writing the file.
-
- @return the number of bytes read.
- */
+ * Reads a Multipart section that is a file type. Assumes that the Content-Disposition/Content-Type and blank line
+ * have already been processed. So we read until we hit a boundary, then close file and return.
+ * @param in the InputStream to read and parse.
+ * @param strFilename the FileSystemName of the file.
+ * @return the number of bytes read.
+ * @throws IOException if an error occurs writing the file.
+ */
private long readAndWriteFile(InputStream in, String strFilename) throws IOException
{
- // Store a reference to this, as we may need to delete it later.
+ // Stores a reference to this, as we may need to delete it later.
File outFile = new File(fileOutPutDirectory, strFilename);
BufferedOutputStream out = null;
@@ -863,17 +889,18 @@ public class MultipartRequest
else
{
out.close();
- // Delete file as empty. We should be able to delete it, if we can open it!
+ // Deletes the file as empty. We should be able to delete it, if we can open it!
outFile.delete();
}
return count;
}
/**
- * If the fileOutPutDirectory wasn't specified, just read the file to memory.
+ * If the fileOutPutDirectory wasn't specified, just read the file to memory.
*
- * @param strName - Url parameter this file was loaded under.
- * @return contents of file, from which you can garner the size as well.
+ * @param in the InputStream to read and parse.
+ * @return contents of file, from which you can garner the size as well.
+ * @throws IOException if the writing failed due to input/output error.
*/
private byte[] readFile(InputStream in) throws IOException
{
@@ -892,12 +919,13 @@ public class MultipartRequest
}
/**
- Returns the length of the line minus line ending.
-
- @param endOfArray This is because in many cases the byteLine will have garbage data at the end, so we
- act as though the actual end of the array is this parameter. If you want to process
- the complete byteLine, specify byteLine.length as the endOfArray parameter.
- */
+ * Gets the length of the line minus line ending.
+ * @param byteLine
+ * @param endOfArray This is because in many cases the byteLine will have garbage data at the end, so we
+ * act as though the actual end of the array is this parameter. If you want to process
+ * the complete byteLine, specify byteLine.length as the endOfArray parameter.
+ *@return the length.
+ */
private static final int getLengthMinusEnding(byte byteLine[], int endOfArray)
{
if (byteLine==null)
@@ -910,7 +938,12 @@ public class MultipartRequest
else
return endOfArray;
}
-
+
+ /**
+ *
+ * @param buf
+ * @return
+ */
private static final int getLengthMinusEnding(StringBuffer buf)
{
if (buf.length()>=2 && buf.charAt(buf.length()-2) == '\r' && buf.charAt(buf.length()-1) == '\n')
@@ -922,17 +955,19 @@ public class MultipartRequest
}
/**
- Reads at most READ_BLOCK blocks of data, or a single line whichever is smaller.
- Returns -1, if nothing to read, or we have reached the specified content-length.
-
- Assumes that bytToBeRead.length indicates the block size to read.
-
- @return -1 if stream has ended, before a newline encountered (should never happen) OR
- we have read past the Content-Length specified. (Should also not happen). Otherwise
- return the number of characters read. You can test whether the number returned is less
- than bytesToBeRead.length, which indicates that we have read the last line of a file or parameter or
- a border line, or some other formatting stuff.
- */
+ * Reads at most READ_BLOCK blocks of data, or a single line whichever is smaller.
+ * Returns -1, if nothing to read, or we have reached the specified content-length.
+ *
+ * Assumes that bytToBeRead.length indicates the block size to read.
+ * @param in the InputStream to read and parse.
+ * @param bytesToBeRead the bytes to be read.
+ * @return -1 if stream has ended, before a newline encountered (should never happen) OR
+ * we have read past the Content-Length specified. (Should also not happen). Otherwise
+ * return the number of characters read. You can test whether the number returned is less
+ * than bytesToBeRead.length, which indicates that we have read the last line of a file or parameter or
+ * a border line, or some other formatting stuff.
+ * @throws IOException if the writing failed due to input/output error.
+ */
private int readLine(InputStream in, byte[] bytesToBeRead) throws IOException
{
// Ensure that there is still stuff to read...
@@ -956,11 +991,11 @@ public class MultipartRequest
}
/**
- This needs to support the possibility of a / or a \ separator.
-
- Returns strFilename after removing all characters before the last
- occurence of / or \.
- */
+ * This needs to support the possibility of a / or a \ separator.
+ * @param strFilename the FileSystemName of the file.
+ * @return the strFilename after removing all characters before the last
+ * occurence of / or \.
+ */
private static final String getBasename (String strFilename)
{
if (strFilename==null)
@@ -977,15 +1012,17 @@ public class MultipartRequest
}
/**
- trimQuotes trims any quotes from the start and end of a string and returns the trimmed string...
- */
+ * Trims any quotes from the start and end of a string.
+ * @param strItem
+ * @return the trimmed string.
+ */
private static final String trimQuotes (String strItem)
{
// Saves having to go any further....
if (strItem==null || strItem.indexOf("\"")==-1)
return strItem;
- // Get rid of any whitespace..
+ // Gets the rid of any whitespace..
strItem = strItem.trim();
if (strItem.charAt(0) == '\"')
@@ -998,10 +1035,13 @@ public class MultipartRequest
}
/**
- Format of string name=value; name=value;
-
- If not found, will return null.
- */
+ * Format of string name=value; name=value;
+ * If not found, will return null.
+ * @param strName the form field name, used to upload the file. This identifies
+ * the formfield location in the storage facility.
+ * @param strToDecode
+ *
+ */
private static final String getValue(String strName, String strToDecode)
{
strName = strName + "=";
@@ -1040,23 +1080,23 @@ public class MultipartRequest
*
* <p>This method <u><b>does not</b></u> returns -1 if it reaches the end of the input
* stream before reading the maximum number of bytes, it returns -1, if no bytes read.
+ * @param in the InputStream to read and parse.
+ * @param b an array of bytes into which data is read.
*
- * @param b an array of bytes into which data is read
- *
- * @param off an integer specifying the character at which
- * this method begins reading
+ * @param off an integer specifying the character at which
+ * this method begins reading.
*
- * @param len an integer specifying the maximum number of
- * bytes to read
+ * @param len an integer specifying the maximum number of
+ * bytes to read.
*
- * @return an integer specifying the actual number of bytes
- * read, or -1 if the end of the stream is reached
+ * @return an integer specifying the actual number of bytes
+ * read, or -1 if the end of the stream is reached.
*
- * @exception IOException if an input or output exception has occurred
+ * @throws IOException if an input or output exception has occurred
*
-
- Note: We have a problem with Tomcat reporting an erroneous number of bytes, so we need to check this.
- This is the method where we get an infinite loop, but only with binary files.
+ *
+ * Note: We have a problem with Tomcat reporting an erroneous number of bytes, so we need to check this.
+ * This is the method where we get an infinite loop, but only with binary files.
*/
private int readLine(InputStream in, byte[] b, int off, int len) throws IOException
{
@@ -1077,8 +1117,9 @@ public class MultipartRequest
}
/**
- Use when debugging this object.
- */
+ * Prints the given debugging message.
+ * @param x the message to print.
+ */
protected void debug(String x)
{
if (debug!=null)
@@ -1089,7 +1130,7 @@ public class MultipartRequest
}
/**
- For debugging.
+ * Gets the Html Table.For debugging.
*/
public String getHtmlTable()
{
diff --git a/src/com/itmill/toolkit/terminal/web/ServletMultipartRequest.java b/src/com/itmill/toolkit/terminal/web/ServletMultipartRequest.java
index 6e4e99f587..193129d95a 100644
--- a/src/com/itmill/toolkit/terminal/web/ServletMultipartRequest.java
+++ b/src/com/itmill/toolkit/terminal/web/ServletMultipartRequest.java
@@ -32,8 +32,9 @@ import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
-/** This class wraps the MultipartRequest class by Jason Pell
- * for the Servlet environment.
+/**
+ * This class wraps the MultipartRequest class by Jason Pell
+ * for the Servlet environment.
*
* @author IT Mill Ltd
* @version @VERSION@
@@ -43,15 +44,17 @@ public class ServletMultipartRequest extends MultipartRequest
{
/**
* Constructor wrapper, unwraps the InputStream,
- * content type and content lenght from the servlet request object.
+ * content type and content length from the servlet request object.
*
- * @param request The HttpServletRequest will be used to initialise the MultipartRequest super class.
- * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
+ * @param request the HttpServletRequest will be used to initialise the MultipartRequest super class.
+ * @param strSaveDirectory the temporary directory to save the file from where they can then be moved to wherever by the
* calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
* will be silently ignored.</B>
*
- * @exception IllegalArgumentException If the request.getContentType() does not contain a Content-Type of "multipart/form-data" or the boundary is not found.
- * @exception IOException If the request.getContentLength() is higher than MAX_READ_BYTES or strSaveDirectory is invalid or cannot be written to.
+ * @throws IllegalArgumentException If the request.getContentType() does not contain a Content-Type
+ * of "multipart/form-data" or the boundary is not found.
+ * @throws IOException If the request.getContentLength() is higher than MAX_READ_BYTES or
+ * strSaveDirectory is invalid or cannot be written to.
*
* @see MultipartRequest#MAX_READ_BYTES
*/
@@ -68,16 +71,18 @@ public class ServletMultipartRequest extends MultipartRequest
/**
* Constructor wrapper, unwraps the InputStream,
* content type and content lenght from the servlet request object.
- * Also allow to explicitly set the max permissable lenght of the request.
+ * Also allow to explicitly set the max permissable length of the request.
*
- * @param request The HttpServletRequest will be used to initialise the MultipartRequest super class.
- * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
+ * @param request the HttpServletRequest will be used to initialise the MultipartRequest super class.
+ * @param strSaveDirectory the temporary directory to save the file from where they can then be moved to wherever by the
* calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
* will be silently ignored.</B>
* @param intMaxReadBytes Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
*
- * @exception IllegalArgumentException If the request.getContentType() does not contain a Content-Type of "multipart/form-data" or the boundary is not found.
- * @exception IOException If the request.getContentLength() is higher than MAX_READ_BYTES or strSaveDirectory is invalid or cannot be written to.
+ * @throws IllegalArgumentException If the request.getContentType() does not contain a Content-Type
+ * of "multipart/form-data" or the boundary is not found.
+ * @throws IOException If the request.getContentLength() is higher than MAX_READ_BYTES
+ * or strSaveDirectory is invalid or cannot be written to.
*
* @see MultipartRequest#MAX_READ_BYTES
*/
@@ -94,11 +99,14 @@ public class ServletMultipartRequest extends MultipartRequest
/**
* Constructor wrapper for loading the request into memory rather than temp-file.
*
- * @param request The HttpServletRequest will be used to initialise the MultipartRequest super class.
+ * @param request the HttpServletRequest will be used to initialise the
+ * MultipartRequest super class.
* @param intMaxReadBytes Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
*
- * @exception IllegalArgumentException If the request.getContentType() does not contain a Content-Type of "multipart/form-data" or the boundary is not found.
- * @exception IOException If the request.getContentLength() is higher than MAX_READ_BYTES or strSaveDirectory is invalid or cannot be written to.
+ * @throws IllegalArgumentException If the request.getContentType() does not contain a Content-Type
+ * of "multipart/form-data" or the boundary is not found.
+ * @throws IOException If the request.getContentLength() is higher than MAX_READ_BYTES
+ * or strSaveDirectory is invalid or cannot be written to.
*
* @see MultipartRequest#MAX_READ_BYTES
*/
diff --git a/src/com/itmill/toolkit/terminal/web/ServletThemeSource.java b/src/com/itmill/toolkit/terminal/web/ServletThemeSource.java
index ed8e3b0406..231ffdc969 100644
--- a/src/com/itmill/toolkit/terminal/web/ServletThemeSource.java
+++ b/src/com/itmill/toolkit/terminal/web/ServletThemeSource.java
@@ -64,7 +64,9 @@ public class ServletThemeSource implements ThemeSource {
private Cache resourceCache = new Cache();
- /** Collection of subdirectory entries */
+ /**
+ * Collection of subdirectory entries.
+ */
private URL descFile;
/**
@@ -72,11 +74,13 @@ public class ServletThemeSource implements ThemeSource {
* local directory.
*
* @param file
- * Path to the JAR archive .
+ * the Path to the JAR archive .
* @param path
- * Path inside the archive to be processed.
- * @throws FileNotFoundException
- * if no theme files are found
+ * the Path inside the archive to be processed.
+ * @throws IOException
+ * if the writing failed due to input/output error.
+ * @throws ThemeException If the resource is not found or there was
+ * some problem finding the resource.
*/
public ServletThemeSource(ServletContext context,
ApplicationServlet webAdapterServlet, String path)
@@ -86,7 +90,7 @@ public class ServletThemeSource implements ThemeSource {
this.webAdapterServlet = webAdapterServlet;
this.context = context;
- // Format path
+ // Formats path
this.path = path;
if ((this.path.length() > 0) && !this.path.endsWith("/")) {
this.path = this.path + "/";
@@ -95,7 +99,7 @@ public class ServletThemeSource implements ThemeSource {
this.path = "/" + this.path;
}
- // Load description file
+ // Loads description file
this.descFile = context.getResource(this.path + Theme.DESCRIPTIONFILE);
InputStream entry = context.getResourceAsStream(this.path
+ Theme.DESCRIPTIONFILE);
@@ -126,6 +130,7 @@ public class ServletThemeSource implements ThemeSource {
}
/**
+ * Gets the XSL stream for the specified theme and web-browser type.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getXSLStreams(Theme,
* WebBrowser)
*/
@@ -141,7 +146,7 @@ public class ServletThemeSource implements ThemeSource {
Log.info("ServletThemeSource: Loading theme: " + theme);
}
- // Reload the description file
+ // Reloads the description file
InputStream entry = context.getResourceAsStream(this.path
+ Theme.DESCRIPTIONFILE);
try {
@@ -160,7 +165,7 @@ public class ServletThemeSource implements ThemeSource {
}
Collection fileNames = theme.getFileNames(type, Theme.MODE_HTML);
- // Add all XSL file streams
+ // Adds all XSL file streams
for (Iterator i = fileNames.iterator(); i.hasNext();) {
String entryName = (String) i.next();
if (entryName.endsWith(".xsl")) {
@@ -176,7 +181,7 @@ public class ServletThemeSource implements ThemeSource {
}
/**
- * Return modication time of the description file.
+ * Returns the modification time of the description file.
*
* @see com.itmill.toolkit.terminal.web.ThemeSource#getModificationTime()
*/
@@ -192,12 +197,13 @@ public class ServletThemeSource implements ThemeSource {
}
/**
+ * Gets the input stream for the resource with the specified resource id.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getResource(String)
*/
public InputStream getResource(String resourceId)
throws ThemeSource.ThemeException {
- // Check the id
+ // Checks the id
String name = this.getName();
int namelen = name.length();
if (resourceId == null || !resourceId.startsWith(name + "/")
@@ -205,7 +211,7 @@ public class ServletThemeSource implements ThemeSource {
return null;
}
- // Find the resource
+ // Finds the resource
String streamName = this.path + resourceId.substring(namelen + 1);
InputStream stream = context.getResourceAsStream(streamName);
if (stream != null)
@@ -241,6 +247,7 @@ public class ServletThemeSource implements ThemeSource {
}
/**
+ * Gets the list of themes in the theme source.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getThemes()
*/
public Collection getThemes() {
@@ -252,6 +259,7 @@ public class ServletThemeSource implements ThemeSource {
}
/**
+ * Gets the name of the ThemeSource.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getName()
*/
public String getName() {
@@ -259,6 +267,7 @@ public class ServletThemeSource implements ThemeSource {
}
/**
+ * Gets the Theme instance by name.
* @see com.itmill.toolkit.terminal.web.ThemeSource#getThemeByName(String)
*/
public Theme getThemeByName(String name) {
@@ -280,18 +289,40 @@ public class ServletThemeSource implements ThemeSource {
private class Cache {
private Map data = new HashMap();
-
+
+ /**
+ * Associates the specified value with the specified key in this map.
+ * If the map previously contained a mapping for this key, the old value
+ * is replaced by the specified value.
+ * @param key the key with which the specified value is to be associated.
+ * @param value the value to be associated with the specified key.
+ */
public void put(Object key, Object value) {
data.put(key, new SoftReference(new CacheItem(value)));
}
-
+
+ /**
+ * Returns the value to which this map maps the specified key. Returns null
+ * if the map contains no mapping for this key.
+ * <p>
+ * A return value of null does not necessarily indicate that the map contains
+ * no mapping for the key; it's also possible that the map explicitly maps
+ * the key to null. The containsKey operation may be used to distinguish these two cases.
+ * </p>
+ * @param key the key whose associated value is to be returned.
+ * @return the value to which this map maps the specified key, or null
+ * if the map contains no mapping for this key.
+ */
public Object get(Object key) {
SoftReference ref = (SoftReference) data.get(key);
if (ref != null)
return ((CacheItem) ref.get()).getData();
return null;
}
-
+
+ /**
+ * Clears the data and removes all mappings from this map .
+ */
public void clear() {
data.clear();
}
@@ -306,15 +337,35 @@ public class ServletThemeSource implements ThemeSource {
private class CacheItem {
private Object data;
-
+
+ /**
+ *
+ * @param data
+ */
public CacheItem(Object data) {
this.data = data;
}
-
+
+ /**
+ * Gets the data.
+ * @return the data.
+ */
public Object getData() {
return this.data;
};
-
+
+ /**
+ * Called by the garbage collector on an object when garbage collection
+ * determines that there are no more references to the object. A subclass
+ * overrides the finalize method to dispose of system resources or to
+ * perform other cleanup.
+ * <p>
+ * The finalize method is never invoked more than once by a Java virtual
+ * machine for any given object.
+ * </p>
+ * @throws Throwable the Exception raised by this method
+ * @see java.lang.Object#finalize()
+ */
public void finalize() throws Throwable {
this.data = null;
super.finalize();
diff --git a/src/com/itmill/toolkit/terminal/web/Theme.java b/src/com/itmill/toolkit/terminal/web/Theme.java
index e7e61badbd..271add00f6 100644
--- a/src/com/itmill/toolkit/terminal/web/Theme.java
+++ b/src/com/itmill/toolkit/terminal/web/Theme.java
@@ -87,7 +87,9 @@ import org.xml.sax.Attributes;
*/
public class Theme extends DefaultHandler {
- /** Default description file name. */
+ /**
+ * Default description file name.
+ */
public static final String DESCRIPTIONFILE = "description.xml";
private static final String TAG_THEME = "theme";
@@ -136,40 +138,64 @@ public class Theme extends DefaultHandler {
public static final String MODE_FALLBACK = MODE_HTML;
- /** Name of the theme. */
+ /**
+ * Name of the theme.
+ */
private String name;
- /** Theme description. */
+ /**
+ * Theme description.
+ */
private String description;
- /** Author of the theme. */
+ /**
+ * Author of the theme.
+ */
private Author author;
- /** Name of the theme, which this theme extends */
+ /**
+ * Name of the theme, which this theme extends.
+ */
private String parentTheme = null;
- /** Fileset of included XSL files. */
+ /**
+ * Fileset of included XSL files.
+ */
private Fileset files = null;
- /** Stack of fileset used while parsing XML. */
+ /**
+ * Stack of fileset used while parsing XML.
+ */
private Stack openFilesets = new Stack();
- /** Stack of string buffers used while parsing XML. */
+ /**
+ * Stack of string buffers used while parsing XML.
+ */
private Stack openStrings = new Stack();
- /** Supported modes name-to-requirements */
+ /**
+ * Supported modes name-to-requirements.
+ */
private LinkedHashMap supportedModes = new LinkedHashMap();
- /** Currently open mode */
+ /**
+ * Currently open mode.
+ */
private String currentlyOpenMode = null;
- /** Are we processing modes */
+ /**
+ * Are we processing modes.
+ */
private boolean modesListCurrentlyOpen = false;
- /** Is a NOT requirement element open. */
+ /**
+ * Is a NOT requirement element open.
+ */
private boolean isNOTRequirementOpen = false;
- /** Currently open requirements while parsing. */
+ /**
+ * Currently open requirements while parsing.
+ */
private Stack openRequirements = new Stack();
/**
@@ -177,7 +203,7 @@ public class Theme extends DefaultHandler {
* by loading the description from given File.
*
* @param descriptionFile
- * Description file
+ * the Description file.
* @throws FileNotFoundException
* Thrown if the given file is not found.
*/
@@ -190,7 +216,7 @@ public class Theme extends DefaultHandler {
* theme, by loading the description from given InputSource.
*
* @param descriptionStream
- * XML input to parse
+ * the XML input to parse
*/
public Theme(InputStream descriptionStream) {
try {
@@ -204,8 +230,10 @@ public class Theme extends DefaultHandler {
}
/**
- * Get the preferred operating mode supported by this theme for given
+ * Gets the preferred operating mode supported by this theme for given
* terminal.
+ * @param terminal the type of the web browser.
+ * @param themeSource
*/
public String getPreferredMode(WebBrowser terminal, ThemeSource themeSource) {
@@ -229,7 +257,12 @@ public class Theme extends DefaultHandler {
return null;
}
- /** Tests if this theme suppors given mode */
+ /**
+ * Tests if this theme suppors given mode.
+ * @param mode
+ * @param terminal the type of the web browser.
+ * @param themeSource
+ */
public boolean supportsMode(String mode, WebBrowser terminal, ThemeSource themeSource) {
// Theme must explicitly support the given mode
@@ -252,10 +285,10 @@ public class Theme extends DefaultHandler {
}
/**
- * Parse XML data.
+ * Parses the XML data.
*
* @param descriptionSource
- * XML input source to parse
+ * the XML input source to parse.
*/
private synchronized void parse(InputSource descriptionSource) {
@@ -288,7 +321,7 @@ public class Theme extends DefaultHandler {
}
/**
- * Parse start tag in XML stream.
+ * Parses start tag in XML stream.
*
* @see org.xml.sax.ContentHandler#startElement(java.lang.String,
* java.lang.String, java.lang.String, org.xml.sax.Attributes)
@@ -329,12 +362,12 @@ public class Theme extends DefaultHandler {
+ MODE_HTML + "' and '" + MODE_AJAX + "')");
fs = new Fileset(mode);
- // Use the first fileset as root fileset
+ // Uses the first fileset as root fileset
if (this.files == null) {
this.files = fs;
}
- // Add inner filesets to parent
+ // Adds inner filesets to parent
if (!this.openFilesets.isEmpty()) {
((Fileset) this.openFilesets.peek()).addFile(fs);
}
@@ -401,7 +434,7 @@ public class Theme extends DefaultHandler {
}
/**
- * Parse end tag in XML stream.
+ * Parses the end tag in XML stream.
*
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
@@ -430,7 +463,7 @@ public class Theme extends DefaultHandler {
}
/**
- * Parse character data in XML stream.
+ * Parses the character data in XML stream.
*
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
*/
@@ -446,19 +479,19 @@ public class Theme extends DefaultHandler {
}
/**
- * Add all requirements specified in attributes to fileset.
+ * Adds all requirements specified in attributes to fileset.
*
* @param atts
- * Attribute set
+ * the Attribute set.
* @param requirements
- * Collection where to add requirement rules.
+ * the Collection where to add requirement rules.
* @param applyNot
- * Should the meaning of these requirement be negated.
+ * the Should the meaning of these requirement be negated.
*/
private void addRequirements(Attributes atts,
RequirementCollection requirements, boolean applyNot) {
- // Create temporary collection for requirements
+ // Creates temporary collection for requirements
Collection tmpReqs = new LinkedList();
Requirement req = null;
@@ -473,12 +506,12 @@ public class Theme extends DefaultHandler {
req = new MarkupLanguageRequirement(WebBrowser
.parseHTMLVersion(atts.getValue(i)));
}
- // Add to temporary requirement collection and clear reference
+ // Adds to temporary requirement collection and clear reference
if (req != null)
tmpReqs.add(req);
}
- // Create implicit AND requirement if more than one
+ // Creates implicit AND requirement if more than one
// Rrequirements were specified in attributes
if (tmpReqs.size() > 1) {
req = new AndRequirement(tmpReqs);
@@ -489,14 +522,14 @@ public class Theme extends DefaultHandler {
req = new NotRequirement(req);
}
- // Add to requirements
+ // Adds to requirements
requirements.addRequirement(req);
}
/**
- * Get list of all files in this theme.
+ * Gets the list of all files in this theme.
*
- * @return List of filenames belonging to this theme.
+ * @return the List of filenames belonging to this theme.
*/
public List getFileNames() {
if (files == null)
@@ -505,9 +538,10 @@ public class Theme extends DefaultHandler {
}
/**
- * Get list of file names matching WebBrowserType.
- *
- * @return list of filenames in this theme supporting the given terminal.
+ * Gets the list of file names matching WebBrowserType.
+ * @param terminal the type of the web browser.
+ * @param mode
+ * @return the list of filenames in this theme supporting the given terminal.
*/
public List getFileNames(WebBrowser terminal, String mode) {
if (files == null)
@@ -536,29 +570,34 @@ public class Theme extends DefaultHandler {
* @since 3.0
*/
public class Author {
-
+ //name of the author.
private String name;
-
+ //email address of the author.
private String email;
-
+
+ /**
+ * Constructor for Author Information Class.
+ * @param name the name of the author.
+ * @param email the email address of the author.
+ */
public Author(String name, String email) {
this.name = name;
this.email = email;
}
/**
- * Get the name of the author.
+ * Gets the name of the author.
*
- * @return Name of the author.
+ * @return the Name of the author.
*/
public String getName() {
return this.name;
}
/**
- * Get the email address of the author.
+ * Gets the email address of the author.
*
- * @return Email address of the author.
+ * @return the Email address of the author.
*/
public String getEmail() {
return this.email;
@@ -573,7 +612,7 @@ public class Theme extends DefaultHandler {
}
/**
- * Generic requirement. Interface implemented by reuirements introducing
+ * Generic requirement. Interface implemented by requirements introducing
* method for checking compability with given terminal.
*
* @author IT Mill Ltd.
@@ -584,12 +623,12 @@ public class Theme extends DefaultHandler {
public interface Requirement {
/**
- * Check that this requirement is met by given type of browser.
+ * Checks that this requirement is met by given type of browser.
*
* @param terminal
- * type of the web browser.
- * @return True if terminal is compatible with this rule. False
- * otherwise.
+ * the type of the web browser.
+ * @return <code>true</code> if terminal is compatible with this rule,otherwise <code>false</code>.
+ *
*/
public boolean isMet(WebBrowser terminal);
@@ -607,18 +646,18 @@ public class Theme extends DefaultHandler {
public interface RequirementCollection extends Requirement {
/**
- * Add new requirement to this collection.
+ * Adds the new requirement to this collection.
*
* @param requirement
- * Requirement to be added.
+ * the Requirement to be added.
*/
public void addRequirement(Requirement requirement);
/**
- * Remove a requirement from this collection.
+ * Removes the requirement from this collection.
*
* @param requirement
- * Requirement to be removed.
+ * the Requirement to be removed.
*/
public void removeRequirement(Requirement requirement);
}
@@ -639,7 +678,7 @@ public class Theme extends DefaultHandler {
* Create new NOT requirement based on another requirement.
*
* @param requirement
- * The requirement to ne negated.
+ * the requirement to be negated.
*/
public NotRequirement(Requirement requirement) {
this.requirement = requirement;
@@ -649,9 +688,9 @@ public class Theme extends DefaultHandler {
* Check that this requirement is met by given type of browser.
*
* @param terminal
- * type of the web browser.
- * @return True if terminal is compatible with this rule. False
- * otherwise.
+ * the type of the web browser.
+ * @return <code>true</code> if terminal is compatible with this rule,otherwise <code>false</code>.
+ *
*/
public boolean isMet(WebBrowser terminal) {
return !this.requirement.isMet(terminal);
@@ -681,27 +720,44 @@ public class Theme extends DefaultHandler {
public AndRequirement() {
}
-
+
+ /**
+ *
+ * @param requirements
+ */
public AndRequirement(Collection requirements) {
this.requirements.addAll(requirements);
}
-
+
+ /**
+ *
+ * @param req1
+ * @param req2
+ */
public AndRequirement(Requirement req1, Requirement req2) {
this.addRequirement(req1);
this.addRequirement(req2);
}
-
+
+ /**
+ * Adds the new requirement to this collection.
+ * @see com.itmill.toolkit.terminal.web.Theme.RequirementCollection#addRequirement(com.itmill.toolkit.terminal.web.Theme.Requirement)
+ */
public void addRequirement(Requirement requirement) {
this.requirements.add(requirement);
}
-
+
+ /**
+ * Removes the requirement from this collection.
+ * @see com.itmill.toolkit.terminal.web.Theme.RequirementCollection#removeRequirement(com.itmill.toolkit.terminal.web.Theme.Requirement)
+ */
public void removeRequirement(Requirement requirement) {
this.requirements.remove(requirement);
}
/**
* Checks that all os the requirements in this collection are met.
- *
+ * @param terminal the type of the web browser.
* @see Theme.Requirement#isMet(WebBrowser)
*/
public boolean isMet(WebBrowser terminal) {
@@ -712,7 +768,10 @@ public class Theme extends DefaultHandler {
}
return true;
}
-
+
+ /**
+ * @see java.lang.Object#toString()
+ */
public String toString() {
String str = "";
for (Iterator i = this.requirements.iterator(); i.hasNext();) {
@@ -740,27 +799,44 @@ public class Theme extends DefaultHandler {
public OrRequirement() {
}
-
+
+ /**
+ *
+ * @param requirements
+ */
public OrRequirement(Collection requirements) {
this.requirements.addAll(requirements);
}
-
+
+ /**
+ *
+ * @param req1
+ * @param req2
+ */
public OrRequirement(Requirement req1, Requirement req2) {
this.addRequirement(req1);
this.addRequirement(req2);
}
-
+
+ /**
+ * Adds the new requirement to this collection.
+ * @see com.itmill.toolkit.terminal.web.Theme.RequirementCollection#addRequirement(com.itmill.toolkit.terminal.web.Theme.Requirement)
+ */
public void addRequirement(Requirement requirement) {
this.requirements.add(requirement);
}
-
+
+ /**
+ * Removes the requirement from this collection.
+ * @see com.itmill.toolkit.terminal.web.Theme.RequirementCollection#removeRequirement(com.itmill.toolkit.terminal.web.Theme.Requirement)
+ */
public void removeRequirement(Requirement requirement) {
this.requirements.remove(requirement);
}
/**
* Checks that some of the requirements in this collection is met.
- *
+ * @param terminal the type of the web browser.
* @see Theme.Requirement#isMet(WebBrowser)
*/
public boolean isMet(WebBrowser terminal) {
@@ -771,7 +847,10 @@ public class Theme extends DefaultHandler {
}
return false;
}
-
+
+ /**
+ * @see java.lang.Object#toString()
+ */
public String toString() {
String str = "";
for (Iterator i = this.requirements.iterator(); i.hasNext();) {
@@ -796,11 +875,19 @@ public class Theme extends DefaultHandler {
public class AgentRequirement implements Requirement {
private String agentSubstring;
-
+
+ /**
+ *
+ * @param agentSubString
+ */
public AgentRequirement(String agentSubString) {
this.agentSubstring = agentSubString;
}
-
+
+ /**
+ * Checks that this requirement is met by given type of browser.
+ * @see com.itmill.toolkit.terminal.web.Theme.Requirement#isMet(com.itmill.toolkit.terminal.web.WebBrowser)
+ */
public boolean isMet(WebBrowser terminal) {
return terminal.getBrowserApplication().indexOf(this.agentSubstring) >= 0;
}
@@ -825,12 +912,20 @@ public class Theme extends DefaultHandler {
public class JavaScriptRequirement implements Requirement {
private WebBrowser.JavaScriptVersion requiredVersion;
-
+
+ /**
+ *
+ * @param requiredVersion
+ */
public JavaScriptRequirement(
WebBrowser.JavaScriptVersion requiredVersion) {
this.requiredVersion = requiredVersion;
}
-
+
+ /**
+ * Checks that this requirement is met by given type of browser.
+ * @see com.itmill.toolkit.terminal.web.Theme.Requirement#isMet(com.itmill.toolkit.terminal.web.WebBrowser)
+ */
public boolean isMet(WebBrowser terminal) {
if (terminal.getJavaScriptVersion().supports(this.requiredVersion))
return true;
@@ -846,7 +941,7 @@ public class Theme extends DefaultHandler {
}
/**
- * Markup language version requirement This requirement is used to ensure a
+ * Markup language version requirement. This requirement is used to ensure a
* certain level of Markup language version support.
*
* @author IT Mill Ltd.
@@ -857,12 +952,20 @@ public class Theme extends DefaultHandler {
public class MarkupLanguageRequirement implements Requirement {
private WebBrowser.MarkupVersion requiredVersion;
-
+
+ /**
+ *
+ * @param requiredVersion
+ */
public MarkupLanguageRequirement(
WebBrowser.MarkupVersion requiredVersion) {
this.requiredVersion = requiredVersion;
}
-
+
+ /**
+ * Checks that this requirement is met by given type of browser.
+ * @see com.itmill.toolkit.terminal.web.Theme.Requirement#isMet(com.itmill.toolkit.terminal.web.WebBrowser)
+ */
public boolean isMet(WebBrowser terminal) {
if (terminal.getMarkupVersion().supports(this.requiredVersion))
return true;
@@ -893,20 +996,20 @@ public class Theme extends DefaultHandler {
private String name;
/**
- * Create new file.
+ * Creates the new file.
*
* @param name
- * Name of the file.
+ * the Name of the file.
*/
public File(String name) {
this.name = name;
}
/**
- * Get name of the file. The file name is relative and unique within a
+ * Gets the name of the file. The file name is relative and unique within a
* theme.
*
- * @return Name of the file.
+ * @return the Name of the file.
*/
public String getName() {
return this.name;
@@ -915,9 +1018,9 @@ public class Theme extends DefaultHandler {
/**
* Does this file support the given terminal. Single file requirements
* are not supported and therefore this always returns true.
- *
- * @see Theme.Fileset
+ * @param terminal the type of the web browser.
* @return Always returns true.
+ * @see Theme.Fileset
*/
public boolean supports(WebBrowser terminal) {
return true;
@@ -949,30 +1052,36 @@ public class Theme extends DefaultHandler {
private String mode;
/**
- * Create new empty fileset.
+ * Creates the new empty fileset.
*
- * @param name
- * Name of the fileset.
+ * @param mode
+ *
*/
public Fileset(String mode) {
super(null);
this.mode = mode;
}
- /** Add a file into fileset. */
+ /**
+ * Adds a file into fileset.
+ * @param file the file to add.
+ */
private void addFile(File file) {
this.files.add(file);
}
- /** Get requirements in this fileset. */
+ /**
+ * Gets the requirements in this fileset.
+ * @return the requirements.
+ */
private RequirementCollection getRequirements() {
return this.requirements;
}
/**
- * Get list of all files in this theme.
+ * Gets the list of all files in this theme.
*
- * @return list of filenames.
+ * @return the list of filenames.
*/
public List getFileNames() {
@@ -993,9 +1102,10 @@ public class Theme extends DefaultHandler {
}
/**
- * Get list of file names matching WebBrowserType.
- *
- * @return list of filenames supporting the given terminal.
+ * Gets the list of file names matching WebBrowserType.
+ * @param terminal the type of the web browser.
+ * @param mode
+ * @return the list of filenames supporting the given terminal.
*/
public List getFileNames(WebBrowser terminal, String mode) {
@@ -1025,7 +1135,7 @@ public class Theme extends DefaultHandler {
/**
* Does this file support the given terminal.
- *
+ * @terminal the type of the web browser.
* @return True if fileset supports the given browser. False otherwise.
*/
public boolean supports(WebBrowser terminal) {
@@ -1044,32 +1154,35 @@ public class Theme extends DefaultHandler {
}
/**
- * Returns the author of this theme.
+ * Gets the author of this theme.
*
- * @return Author of the theme.
+ * @return the Author of the theme.
*/
public Author getAuthor() {
return author;
}
/**
- * Returns the name of this theme.
+ * Gets the name of this theme.
*
- * @return Name of the theme.
+ * @return the Name of the theme.
*/
public String getName() {
return name;
}
/**
- * Returns the name of the parent theme.
- *
+ * Gets the name of the parent theme.
+ * @return the name of the parent theme.
*/
public String getParent() {
return parentTheme;
}
- /** Get theme description */
+ /**
+ * Gets the theme description.
+ * @return the theme description.
+ */
public String getDescription() {
return description;
}
diff --git a/src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java b/src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java
index 41b6e63d38..79417700b6 100644
--- a/src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java
+++ b/src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java
@@ -48,7 +48,7 @@ import javax.servlet.http.HttpSession;
* This a function library that can be used from the theme XSL-files. It
* provides easy access to current application, window, theme, webbrowser and
* session. The internal threadlocal state must be maintained by the webadapter
- * in order go guarantee that it works.
+ * in order to guarantee that it works.
*
* @author IT Mill Ltd.
* @version
@@ -71,7 +71,16 @@ public class ThemeFunctionLibrary {
static private final int THEME = 5;
static private ThreadLocal state = new ThreadLocal();
-
+
+/**
+ *
+ * @param application
+ * @param window
+ * @param webBrowser
+ * @param session
+ * @param webAdapterServlet
+ * @param theme
+ */
static protected void setState(Application application, Window window,
WebBrowser webBrowser, HttpSession session,
ApplicationServlet webAdapterServlet, String theme) {
@@ -132,7 +141,7 @@ public class ThemeFunctionLibrary {
}
/**
- * Return a reference to the current theme name that is associated with the
+ * Returns a reference to the current theme name that is associated with the
* session that the call came from.
*/
static public String theme() {
@@ -144,7 +153,9 @@ public class ThemeFunctionLibrary {
}
/**
- * Return an URI to the named resource from the named theme.
+ * Returns an URI to the named resource from the named theme.
+ * @param resource
+ * @param theme
*/
static public String resource(String resource, String theme) {
try {
@@ -156,7 +167,8 @@ public class ThemeFunctionLibrary {
}
/**
- * Return an URI to the named resource.
+ * Returns an URI to the named resource.
+ * @param resource
*/
static public String resource(String resource) {
try {
@@ -168,7 +180,7 @@ public class ThemeFunctionLibrary {
}
/**
- * Generate JavaScript for page that performs client-side combility checks.
+ * Generates the JavaScript for page that performs client-side combility checks.
*/
static public boolean probeClient() {
return (browser().performClientCheck() && !browser()
@@ -176,7 +188,7 @@ public class ThemeFunctionLibrary {
}
/**
- * Generate JavaScript for page header that handles window refreshing,
+ * Generates the JavaScript for page header that handles window refreshing,
* opening and closing.
*
* Generates script that:
@@ -185,7 +197,7 @@ public class ThemeFunctionLibrary {
* <li>Sets the window name</li>
* <li>Closes window if it is set to be closed </li>
* <ul>
- *
+ * @return
*/
static public String windowScript() {
return generateWindowScript(
@@ -194,14 +206,22 @@ public class ThemeFunctionLibrary {
(ApplicationServlet) ((Object[]) state.get())[WEBADAPTERSERVLET],
browser());
}
-
+
+/**
+ *
+ * @param window
+ * @param app
+ * @param wa
+ * @param browser
+ * @return
+ */
static protected String generateWindowScript(Window window,
Application app, ApplicationServlet wa, WebBrowser browser) {
StringBuffer script = new StringBuffer();
LinkedList update = new LinkedList();
- // Add all the windows needto update list
+ // Adds all the windows needto update list
Set dirtyWindows = wa != null ? wa.getDirtyWindows(app) : null;
if (dirtyWindows != null)
for (Iterator i = dirtyWindows.iterator(); i.hasNext();) {
@@ -214,7 +234,7 @@ public class ThemeFunctionLibrary {
}
}
- // Remove all windows that are in frames, of such frame windows that
+ // Removes all windows that are in frames, of such frame windows that
// will be updated anyway
Object[] u = update.toArray();
if (u.length > 0 && (window != null && window instanceof FrameWindow))
@@ -241,13 +261,13 @@ public class ThemeFunctionLibrary {
}
}
- // Set window name
+ // Sets window name
if (window != null) {
script.append("window.name = \"" + getWindowTargetName(app, window)
+ "\";\n");
}
- // Generate window updatescript
+ // Generates window updatescript
for (Iterator i = update.iterator(); i.hasNext();) {
Window w = (Window) i.next();
script.append(getWindowRefreshScript(app, w, browser));
@@ -259,7 +279,7 @@ public class ThemeFunctionLibrary {
w.requestRepaintRequests();
}
- // Close current window if it is not visible
+ // Closes current window if it is not visible
if (window == null || !window.isVisible())
script.append("window.close();\n");
@@ -268,12 +288,10 @@ public class ThemeFunctionLibrary {
/**
* Returns an unique target name for a given window name.
- *
- * @param windowName
- * Name of the window.
- * @return An unique ID for window target
- * @throws IllegalStateException
- * If application for window is null.
+ * @param application
+ * @param window
+ * the Name of the window.
+ * @return An unique ID for window target.
*/
static public String getWindowTargetName(Application application,
Window window) {
@@ -287,7 +305,7 @@ public class ThemeFunctionLibrary {
/**
* Returns an unique target name for current window.
*
- * @return An unique ID for window target
+ * @return An unique ID for window target.
*/
static public String getWindowTargetName() {
return getWindowTargetName(application(), window());
@@ -295,10 +313,8 @@ public class ThemeFunctionLibrary {
/**
* Returns an unique target name for current window.
- *
- * @return An unique ID for window target
- * @throws IllegalStateException
- * If application for window is null.
+ * @param name the name of the window.
+ * @return An unique ID for window target.
*/
static public String getWindowTargetName(String name) {
Window w = application().getWindow(name);
@@ -316,8 +332,8 @@ public class ThemeFunctionLibrary {
/**
* Returns the country and region code for current application locale.
*
+ * @return the language Country code of the current application locale.
* @see Locale#getCountry()
- * @return language Country code of the current application locale.
*/
static public String getLocaleCountryId() {
try {
@@ -331,8 +347,8 @@ public class ThemeFunctionLibrary {
/**
* Returns the language code for current application locale.
*
+ * @return the Language code for current application locale.
* @see Locale#getLanguage()
- * @return language Language code for current application locale.
*/
static public String getLocaleLanguageId() {
try {
@@ -344,11 +360,8 @@ public class ThemeFunctionLibrary {
}
/**
- * Get name for week day.
- *
- * @param Number
- * of week day. 0 first day of week.
- * @return Name of week day in applications current locale.
+ * Gets the name of first day of the week.
+ * @return
*/
static public int getFirstDayOfWeek() {
try {
@@ -366,11 +379,11 @@ public class ThemeFunctionLibrary {
}
/**
- * Get name for week day.
+ * Gets the name for week day.
*
- * @param Number
- * of week day. 0 sunday, 1 monday, ...
- * @return Name of week day in applications current locale.
+ * @param dayOfWeek
+ * the Number of week day. 0 sunday, 1 monday, ...
+ * @return the Name of week day in applications current locale.
*/
static public String getShortWeekday(int dayOfWeek) {
try {
@@ -383,11 +396,11 @@ public class ThemeFunctionLibrary {
}
/**
- * Get short name for month.
+ * Gets the short name for month.
*
- * @param Number
- * of month. 0 is January, 1 is February, and so on.
- * @return Name of month in applications current locale.
+ * @param month
+ * the Number of month. 0 is January, 1 is February, and so on.
+ * @return the Name of month in applications current locale.
*/
static public String getShortMonth(int month) {
try {
@@ -401,11 +414,11 @@ public class ThemeFunctionLibrary {
}
/**
- * Get name for month.
+ * Gets the name for month.
*
- * @param Number
- * of month. 0 is January, 1 is February, and so on.
- * @return Name of month in applications current locale.
+ * @param month
+ * the Number of month. 0 is January, 1 is February, and so on.
+ * @return the Name of month in applications current locale.
*/
static public String getMonth(int month) {
try {
@@ -419,14 +432,14 @@ public class ThemeFunctionLibrary {
}
/**
- * Get Form Action URL for the requested window.
+ * Gets Form Action URL for the requested window.
*
* <p>
* This returns the action for the window main form. This action can be set
* through WebApplicationContect setWindowFormAction method..
* </p>
*
- * @return Form action for the current window.
+ * @return the Form action for the current window.
*/
static public String getFormAction() {
@@ -437,7 +450,10 @@ public class ThemeFunctionLibrary {
.getWindowFormAction(win);
}
- /** Generate links for CSS files to be included in html head. */
+ /**
+ * Generates the links for CSS files to be included in html head.
+ * @return
+ */
static public String getCssLinksForHead() {
ApplicationServlet as = (ApplicationServlet) ((Object[]) state.get())[WEBADAPTERSERVLET];
Theme t = as.getThemeSource().getThemeByName(theme());
@@ -451,7 +467,7 @@ public class ThemeFunctionLibrary {
themes.add(t);
}
- // Generate links
+ // Generates links
StringBuffer links = new StringBuffer();
for (int k = themes.size() - 1; k >= 0; k--) {
Collection allFiles = ((Theme)themes.get(k)).getFileNames(browser(), Theme.MODE_HTML);
@@ -468,7 +484,10 @@ public class ThemeFunctionLibrary {
return links.toString();
}
- /** Generate links for JavaScript files to be included in html head. */
+ /**
+ * Generates the links for JavaScript files to be included in html head.
+ * @return
+ */
static public String getJavaScriptLinksForHead() {
ApplicationServlet as = (ApplicationServlet) ((Object[]) state.get())[WEBADAPTERSERVLET];
Theme t = as.getThemeSource().getThemeByName(theme());
@@ -482,7 +501,7 @@ public class ThemeFunctionLibrary {
themes.add(t);
}
- // Generate links
+ // Generates links
StringBuffer links = new StringBuffer();
for (int k = themes.size() - 1; k >= 0; k--) {
Collection allFiles = ((Theme) themes.get(k)).getFileNames(
@@ -499,7 +518,13 @@ public class ThemeFunctionLibrary {
return links.toString();
}
- /** Generate JavaScript for updating given window */
+ /**
+ * Generates the JavaScript for updating given window.
+ * @param application
+ * @param window
+ * @param browser
+ * @return
+ */
static protected String getWindowRefreshScript(Application application,
Window window, WebBrowser browser) {
diff --git a/src/com/itmill/toolkit/terminal/web/ThemeSource.java b/src/com/itmill/toolkit/terminal/web/ThemeSource.java
index d8089f9f92..dfbfbccb94 100644
--- a/src/com/itmill/toolkit/terminal/web/ThemeSource.java
+++ b/src/com/itmill/toolkit/terminal/web/ThemeSource.java
@@ -31,60 +31,72 @@ package com.itmill.toolkit.terminal.web;
import java.io.InputStream;
import java.util.Collection;
-/** Interface implemented by theme sources.
+/**
+ * Interface implemented by theme sources.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface ThemeSource {
- /** Get the name of the ThemeSource.
- * @return Name of the theme source.
+ /**
+ * Gets the name of the ThemeSource.
+ * @return the Name of the theme source.
*/
public String getName();
- /** Get XSL stream for the specified theme and web-browser type.
- * Returns the XSL templates, which are used to process the
- * UIDL data. The <code>type</code> parameter is used to limit
- * the templates, which are returned based on the theme fileset
- * requirements.
- *
- * This implicitly operates in xslt mode.
- *
- * @param theme Theme, which XSL should be returned
- * @param type The type of the current client.
- * @return Collection of ThemeSource.XSLStream objects.
- * @see Theme
+ /**
+ * Gets the XSL stream for the specified theme and web-browser type.
+ * Returns the XSL templates, which are used to process the
+ * UIDL data. The <code>type</code> parameter is used to limit
+ * the templates, which are returned based on the theme fileset
+ * requirements.
+ * <p>
+ * Note : This implicitly operates in xslt mode.
+ * </p>
+ * @param theme the Theme, which XSL should be returned.
+ * @param type the type of the current client.
+ * @return Collection of ThemeSource.XSLStream objects.
+ * @throws ThemeException If the resource is not found or there was
+ * some problem finding the resource.
+ * @see Theme
*/
public Collection getXSLStreams(Theme theme, WebBrowser type)
throws ThemeException;
- /** Get the last modification time, used to reload theme on changes.
- * @return Last modification time of the theme source.
+ /**
+ * Gets the last modification time, used to reload theme on changes.
+ * @return the Last modification time of the theme source.
*/
public long getModificationTime();
- /** Get input stream for the resource with the specified resource id.
- * @return Stream where the resource can be read.
- * @throws ThemeException If the resource is not found or there was
- * some problem finding the resource.
+ /**
+ * Gets the input stream for the resource with the specified resource id.
+ * @param resourceId the resource id.
+ * @return Stream where the resource can be read.
+ * @throws ThemeException If the resource is not found or there was
+ * some problem finding the resource.
*/
public InputStream getResource(String resourceId) throws ThemeException;
- /** Get list of themes in the theme source.
- * @return List of themes included in the theme source.
+ /**
+ * Gets the list of themes in the theme source.
+ * @return the List of themes included in the theme source.
*/
public Collection getThemes();
- /** Return Theme instance by name.
- * @param name Theme name.
- * @return Theme instance matching the name, or null if not found.
+ /**
+ * Returns the Theme instance by name.
+ * @param name the Theme name.
+ * @return the Theme instance matching the name, or null if not found.
*/
public Theme getThemeByName(String name);
- /** Theme exception.
- * Thrown by classes implementing the ThemeSource interface
- * if some error occurs during processing.
+ /**
+ * <code>ThemeException</code> is thrown by classes implementing
+ * the <code>ThemeSource</code> interface if some error occurs during processing.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -93,42 +105,53 @@ public interface ThemeSource {
private static final long serialVersionUID = -7823850742197580285L;
- /** Create new theme exception.
- * @param message Error message.
+ /**
+ * Creates the new theme exception.
+ * @param message the Error message.
*/
public ThemeException(String message) {
super(message);
}
- /** Createa new theme exception.
+ /**
+ * Creates the new theme exception.
*
- * @param message
- * @param e
+ * @param message the error message.
+ * @param cause the cause of the exception.
*/
public ThemeException(String message, Throwable cause) {
super(message,cause);
}
}
- /** Wrapper class for XSL InputStreams */
+ /**
+ * Wrapper class for XSL InputStreams.
+ */
public class XSLStream {
private String id;
private InputStream stream;
-
+
+/**
+ *
+ * @param id
+ * @param stream the input stream.
+ */
public XSLStream(String id, InputStream stream) {
this.id = id;
this.stream = stream;
}
- /** Return id of this stream.
- * @return
+ /**
+ * Returns id of this stream.
+ * @return the id of the stream.
*/
public String getId() {
return id;
}
- /** Return the actual XSL Stream.
- * @return
+ /**
+ * Returns the actual XSL Stream.
+ * @return the XSL Stream.
*/
public InputStream getStream() {
return stream;
diff --git a/src/com/itmill/toolkit/terminal/web/UIDLTransformer.java b/src/com/itmill/toolkit/terminal/web/UIDLTransformer.java
index 225aeac81f..a6e4c21f25 100644
--- a/src/com/itmill/toolkit/terminal/web/UIDLTransformer.java
+++ b/src/com/itmill/toolkit/terminal/web/UIDLTransformer.java
@@ -51,13 +51,14 @@ import javax.xml.transform.ErrorListener;
import javax.xml.transform.SourceLocator;
import javax.xml.transform.OutputKeys;
-/** Class implementing the UIDLTransformer.
+/**
+ * Class implementing the UIDLTransformer.
*
- * The thansformer should not be created directly; it should be contructed
- * using getTransformer() provided by UIDLTransformerFactory.
+ * The transformer should not be created directly; it should be contructed
+ * using <code>getTransformer</code> provided by <code>UIDLTransformerFactory</code>.
*
* After the transform has been done, the transformer can be recycled with
- * releaseTransformer() by UIDLTransformerFactory.
+ * <code>releaseTransformer</code> by <code>UIDLTransformerFactory</code>.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -66,7 +67,9 @@ import javax.xml.transform.OutputKeys;
public class UIDLTransformer {
- /** XSLT factory */
+ /**
+ * XSLT factory.
+ */
protected static javax.xml.transform.TransformerFactory xsltFactory;
static {
xsltFactory = javax.xml.transform.TransformerFactory.newInstance();
@@ -77,28 +80,40 @@ public class UIDLTransformer {
+ "not included in classpath.");
}
- /** Source of the transform containing UIDL */
+ /**
+ * Source of the transform containing UIDL.
+ */
private WebPaintTarget paintTarget;
- /** Holds the type of the transformer. */
+ /**
+ * Holds the type of the transformer.
+ */
private UIDLTransformerType transformerType;
- /** Prepared XSLT transformer for UIDL transformations */
+ /**
+ * Prepared XSLT transformer for UIDL transformations.
+ */
private javax.xml.transform.Transformer uidlTransformer;
- /** Error handled used */
+ /**
+ * Error handled used.
+ */
private TransformerErrorHandler errorHandler;
- /** Theme repository used for late error reporting */
+ /**
+ * Theme repository used for late error reporting.
+ */
private ThemeSource themeSource;
private ApplicationServlet webAdapterServlet;
- /** UIDLTransformer constructor.
- * @param type Type of the transformer
- * @param themes Theme implemented by the transformer
+ /**
+ * UIDLTransformer constructor.
+ * @param type the Type of the transformer.
+ * @param themes the theme implemented by the transformer.
+ * @param webAdapterServlet the Adapter servlet.
* @throws UIDLTransformerException UIDLTransformer exception is thrown,
- * if the transform can not be created.
+ * if the transform can not be created.
*/
public UIDLTransformer(
UIDLTransformerType type,
@@ -109,17 +124,17 @@ public class UIDLTransformer {
this.themeSource = themes;
this.webAdapterServlet = webAdapterServlet;
- // Register error handler
+ // Registers the error handler
errorHandler = new TransformerErrorHandler();
xsltFactory.setErrorListener(errorHandler);
try {
- // Create XML Reader to be used by
+ // Creates XML Reader to be used by
// XSLReader as the actual parser object.
XMLReader parser = XMLReaderFactory.createXMLReader();
- // Create XML reader for concatenating
+ // Creates XML reader for concatenating
// multiple XSL files as one.
XMLReader xmlReader =
@@ -131,23 +146,23 @@ public class UIDLTransformer {
xmlReader.setErrorHandler(errorHandler);
- // Create own SAXSource using a dummy inputSource.
+ // Creates own SAXSource using a dummy inputSource.
SAXSource source = new SAXSource(xmlReader, new InputSource());
uidlTransformer = xsltFactory.newTransformer(source);
if (uidlTransformer != null) {
- // Register transformer error handler
+ // Registers transformer error handler
uidlTransformer.setErrorListener(errorHandler);
- // Ensure HTML output
+ // Ensures HTML output
uidlTransformer.setOutputProperty(OutputKeys.METHOD, "html");
- // Ensure no indent
+ // Ensures no indent
uidlTransformer.setOutputProperty(OutputKeys.INDENT, "no");
}
- // Check if transform itself failed, meaning either
+ // Checks if transform itself failed, meaning either
// UIDL error or error in XSL/T semantics (like XPath)
if (errorHandler.hasFatalErrors()) {
throw new UIDLTransformerException(
@@ -169,16 +184,18 @@ public class UIDLTransformer {
}
}
- /** Get the type of the transformer.
- * @return Type of the transformer.
- */
+ /**
+ * Gets the type of the transformer.
+ * @return the Type of the transformer.
+ */
public UIDLTransformerType getTransformerType() {
return this.transformerType;
}
- /** Attach the output stream to transformer and get corresponding UIDLStream for
+ /**
+ * Attaches the output stream to transformer and get corresponding UIDLStream for
* writing UI description language trough transform to given output.
- * @param variableMap The variable map used for UIDL creation.
+ * @param variableMap the variable map used for UIDL creation.
* @return returns UI description language stream, that can be used for writing UIDL to
* transformer.
*/
@@ -198,9 +215,10 @@ public class UIDLTransformer {
return paintTarget;
}
- /** Reset the transformer, before it can be used again. This also interrupts
+ /**
+ * Resets the transformer, before it can be used again. This also interrupts
* any ongoing transform and thus should not be called before the transform
- * is ready. This is automaticalled by the UIDLTransformFactory, when the UIDLTransformer
+ * is ready. This is automatically called by the UIDLTransformFactory, when the UIDLTransformer
* has been released.
* @see UIDLTransformerFactory#releaseTransformer(UIDLTransformer)
*/
@@ -218,9 +236,11 @@ public class UIDLTransformer {
}
/**
- * Transform the UIDL to HTML and output to the OutputStream.
+ * Transforms the UIDL to HTML and output to the OutputStream.
*
- * @param servletOutputStream - The output stream to render to.
+ * @param outputStream the output stream to render to.
+ * @throws UIDLTransformerException UIDLTransformer exception is thrown,
+ * if the transform can not be created.
*/
public void transform(OutputStream outputStream)
throws UIDLTransformerException {
@@ -236,7 +256,7 @@ public class UIDLTransformer {
org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
reader.setErrorHandler(this.errorHandler);
- // Validate if requested. We validate the UIDL separately,
+ // Validates if requested. We validate the UIDL separately,
// toget the SAXExceptions instead of TransformerExceptions.
// This is required to get the line numbers right.
/* FIXME: Disable due abnormalities in DTD handling.
@@ -261,7 +281,7 @@ public class UIDLTransformer {
errorHandler.getUIDLErrorReport());
}
- // Check if transform itself failed, meaning either
+ // Checks if transform itself failed, meaning either
// UIDL error or error in XSL/T semantics (like XPath)
if (errorHandler.hasFatalErrors()) {
throw new UIDLTransformerException(
@@ -274,7 +294,12 @@ public class UIDLTransformer {
transformerType));
}
}
-
+
+/**
+ *
+ *
+ *
+ */
protected class TransformerErrorHandler
implements ErrorListener, org.xml.sax.ErrorHandler {
@@ -283,21 +308,36 @@ public class UIDLTransformer {
LinkedList fatals = new LinkedList();
Hashtable rowToErrorMap = new Hashtable();
Hashtable errorToRowMap = new Hashtable();
-
+
+/**
+ *
+ * @return
+ */
public boolean hasNoErrors() {
return errors.isEmpty() && warnings.isEmpty() && fatals.isEmpty();
}
-
+
+/**
+ *
+ * @return
+ */
public boolean hasFatalErrors() {
return !fatals.isEmpty();
}
-
+
+/**
+ *
+ *
+ */
public void clear() {
errors.clear();
warnings.clear();
fatals.clear();
}
-
+
+ /**
+ * @see java.lang.Object#toString()
+ */
public String toString() {
return getHTMLErrors("Fatal Errors", fatals)
+ "<br />"
@@ -306,7 +346,13 @@ public class UIDLTransformer {
+ getHTMLErrors("Warnings", warnings)
+ "<br />";
}
-
+
+/**
+ *
+ * @param title
+ * @param l
+ * @return
+ */
private String getHTMLErrors(String title, LinkedList l) {
String r = "";
r = "<b>" + title + "</b><br />";
@@ -405,12 +451,16 @@ public class UIDLTransformer {
}
}
- /** Gets the formated error report on XSL. */
+ /**
+ * Gets the formated error report on XSL.
+ * @param themes
+ * @param type
+ */
public String getXSLErrorReport(
ThemeSource themes,
UIDLTransformerType type) {
- // Recreate XSL for error reporting
+ // Recreates the XSL for error reporting
StringBuffer readBuffer = new StringBuffer();
try {
Collection c =
@@ -517,7 +567,10 @@ public class UIDLTransformer {
return sb.toString();
}
- /** Gets the formated error report on UIDL. */
+ /**
+ * Gets the formated error report on UIDL.
+ * @return the formatted error report.
+ */
public String getUIDLErrorReport() {
String uidl = "UIDL Source Not Available.";
@@ -525,16 +578,16 @@ public class UIDLTransformer {
uidl = paintTarget.getUIDL();
StringBuffer sb = new StringBuffer();
- // Print formatted UIDL with errors embedded
+ // Prints the formatted UIDL with errors embedded
int row = 0;
int prev = 0;
int index = 0;
boolean lastLineWasEmpty = false;
- // Append error report
+ // Appends the error report
sb.append(toString());
- // Append UIDL
+ // Appends UIDL
sb.append(
"<table width=\"100%\" style=\"border-left: 1px solid black; "
+ "border-right: 1px solid black; border-bottom: "
@@ -575,7 +628,11 @@ public class UIDLTransformer {
return sb.toString();
}
- /** Highlight the XML source. */
+ /**
+ * Highlights the XML source.
+ * @param xmlSnippet
+ * @return
+ */
private String xmlHighlight(String xmlSnippet) {
String res = xmlSnippet;
@@ -597,7 +654,10 @@ public class UIDLTransformer {
return res;
}
- /** Get the first fatal error. */
+ /**
+ * Gets the first fatal error.
+ * @return the fatal error.
+ */
public Throwable getFirstFatalError() {
return (Throwable) fatals.iterator().next();
}
diff --git a/src/com/itmill/toolkit/terminal/web/UIDLTransformerException.java b/src/com/itmill/toolkit/terminal/web/UIDLTransformerException.java
index b147379e8d..a974c2f987 100644
--- a/src/com/itmill/toolkit/terminal/web/UIDLTransformerException.java
+++ b/src/com/itmill/toolkit/terminal/web/UIDLTransformerException.java
@@ -28,7 +28,8 @@
package com.itmill.toolkit.terminal.web;
-/** Exception in transform process.
+/**
+ * Exception in the transform process.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -50,8 +51,8 @@ public class UIDLTransformerException extends java.lang.Exception {
/**
* Constructs an instance of UIDLTransformerException with the specified
* detail message.
- * @param msg description of exception that occurred
- * @param te Transform exception that occurred.
+ * @param msg the description of exception that occurred.
+ * @param te the Transform exception that occurred.
* @param desc the detailed description.
*/
public UIDLTransformerException(String msg, Throwable te, String desc) {
@@ -59,15 +60,18 @@ public class UIDLTransformerException extends java.lang.Exception {
this.transformException = te;
this.HTMLDescription = desc;
}
- /** Returns the detailed description.
- * @return Detailed description of exception.
+
+ /**
+ * Returns the detailed description.
+ * @return the Detailed description of exception.
*/
public String getHTMLDescription() {
return HTMLDescription;
}
- /** Returns the nested transform exception that occurred.
- * @return Throwable
+ /**
+ * Returns the nested transform exception that occurred.
+ * @return the transform exception
*/
public Throwable getTransformException() {
return transformException;
diff --git a/src/com/itmill/toolkit/terminal/web/UIDLTransformerFactory.java b/src/com/itmill/toolkit/terminal/web/UIDLTransformerFactory.java
index 8a2fb0cf0a..6bf66dd942 100644
--- a/src/com/itmill/toolkit/terminal/web/UIDLTransformerFactory.java
+++ b/src/com/itmill/toolkit/terminal/web/UIDLTransformerFactory.java
@@ -35,7 +35,8 @@ import java.util.LinkedList;
import java.util.Map;
import java.util.Iterator;
-/** Class implementing the UIDLTransformer Factory.
+/**
+ * Class implementing the UIDLTransformer Factory.
* The factory creates and maintains a pool of transformers that are used
* for transforming UIDL to HTML.
*
@@ -46,25 +47,39 @@ import java.util.Iterator;
public class UIDLTransformerFactory {
- /** Time between repository modified queries. */
+ /**
+ * Time between repository modified queries.
+ */
private static final int CACHE_CHECK_INTERVAL_MILLIS = 5 * 1000;
- /** The time transformers are cached by default*/
+ /**
+ * The time transformers are cached by default.
+ */
private static final long DEFAULT_TRANSFORMER_CACHETIME = 60 * 60 * 1000;
- /** Maximum number of transformers in use */
+ /**
+ * Maximum number of transformers in use.
+ */
private int maxConcurrentTransformers = 1;
- /** Last time theme modification time was checked */
+ /**
+ * Last time theme modification time was checked.
+ */
private long lastModificationCheckTime = 0;
- /** Last time theme source was modified */
+ /**
+ * Last time theme source was modified.
+ */
private long themeSourceModificationTime = 0;
- /** How long to cache transformers. */
+ /**
+ * How long to cache transformers.
+ */
private long cacheTime = DEFAULT_TRANSFORMER_CACHETIME;
- /** Spool manager thread */
+ /**
+ * Spool manager thread.
+ */
private SpoolManager spoolManager;
private Map transformerSpool = new HashMap();
@@ -73,12 +88,13 @@ public class UIDLTransformerFactory {
private int transformerCount = 0;
private int transformersInUse = 0;
- /** Constructor for transformer factory.
+ /**
+ * Constructor for transformer factory.
* Method UIDLTransformerFactory.
- * @param themeSource Theme source to be used for themes.
- * @param webAdapterServlet The Adapter servlet.
- * @param maxConcurrentTransformers Maximum number of concurrent themes in use.
- * @param cacheTime Time to cache the transformers.
+ * @param themeSource the Theme source to be used for themes.
+ * @param webAdapterServlet the Adapter servlet.
+ * @param maxConcurrentTransformers the Maximum number of concurrent themes in use.
+ * @param cacheTime the Time to cache the transformers.
*/
public UIDLTransformerFactory(
ThemeSource themeSource,
@@ -100,10 +116,12 @@ public class UIDLTransformerFactory {
this.spoolManager.start();
}
- /** Get new transformer of the specified type
- * @param type Type of the requested transformer.
- * @param variableMap WebVariable map used by the transformer
+ /**
+ * Gets the new transformer of the specified type.
+ * @param type the Type of the requested transformer.
* @return Created new transformer.
+ * @throws UIDLTransformerException
+ * if the transform can not be created.
*/
public synchronized UIDLTransformer getTransformer(UIDLTransformerType type)
throws UIDLTransformerException {
@@ -116,18 +134,18 @@ public class UIDLTransformerFactory {
}
}
- // Get list of transformers for this type
+ // Gets the list of transformers for this type
TransformerList list =
(TransformerList) this.transformerSpool.get(type);
- // Check the modification time between fixed intervals
+ // Checks the modification time between fixed intervals
long now = System.currentTimeMillis();
if (now - CACHE_CHECK_INTERVAL_MILLIS
> this.lastModificationCheckTime) {
this.lastModificationCheckTime = now;
- // Check if the theme source has been modified and flush
+ // Checks if the theme source has been modified and flush
// list if necessary
long lastmod = this.themeSource.getModificationTime();
if (list != null && this.themeSourceModificationTime < lastmod) {
@@ -156,7 +174,7 @@ public class UIDLTransformerFactory {
}
} else {
- // Create new transformer and return it. Transformers are added to
+ // Creates the new transformer and return it. Transformers are added to
// spool when they are released.
t = new UIDLTransformer(type, themeSource, webAdapterServlet);
transformerCount++;
@@ -168,7 +186,7 @@ public class UIDLTransformerFactory {
+ type);
}
- // Create new list, if not found
+ // Creates the new list, if not found
if (list == null) {
list = new TransformerList();
this.transformerSpool.put(type, list);
@@ -182,14 +200,15 @@ public class UIDLTransformerFactory {
return t;
}
- /** Recycle a used transformer back to spool.
+ /**
+ * Recycle a used transformer back to spool.
* One must guarantee not to use the transformer after it have been released.
- * @param transformer UIDLTransformer to be recycled
+ * @param transformer the UIDLTransformer to be recycled.
*/
public synchronized void releaseTransformer(UIDLTransformer transformer) {
try {
- // Reset the transformer before returning it to spool
+ // Resets the transformer before returning it to spool
transformer.reset();
// Recycle the transformer back to spool
@@ -222,29 +241,54 @@ public class UIDLTransformerFactory {
notifyAll();
}
}
-
+
+/**
+ *
+ *
+ *
+ */
private class TransformerList {
private LinkedList list = new LinkedList();
private long lastUsed = 0;
-
+
+/**
+ *
+ * @param transformer
+ */
public void add(UIDLTransformer transformer) {
list.add(transformer);
}
-
+
+/**
+ *
+ * @return
+ */
public UIDLTransformer removeFirst() {
return (UIDLTransformer) ((LinkedList) list).removeFirst();
}
-
+
+/**
+ *
+ * @return
+ */
public boolean isEmpty() {
return list.isEmpty();
}
-
+
+/**
+ *
+ * @return
+ */
public int size() {
return list.size();
}
}
-
+
+/**
+ *
+ *
+ */
private synchronized void removeUnusedTransformers() {
long currentTime = System.currentTimeMillis();
HashSet keys = new HashSet();
@@ -269,7 +313,8 @@ public class UIDLTransformerFactory {
}
}
- /** Class for periodically remove unused transformers from memory.
+ /**
+ * Class for periodically remove unused transformers from memory.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -277,12 +322,20 @@ public class UIDLTransformerFactory {
protected class SpoolManager extends Thread {
long refreshTime;
-
+
+/**
+ *
+ * @param refreshTime
+ */
public SpoolManager(long refreshTime) {
super("UIDLTransformerFactory.SpoolManager");
this.refreshTime = refreshTime;
}
-
+
+ /**
+ *
+ * @see java.lang.Thread#run()
+ */
public void run() {
while (true) {
try {
diff --git a/src/com/itmill/toolkit/terminal/web/UIDLTransformerType.java b/src/com/itmill/toolkit/terminal/web/UIDLTransformerType.java
index 3193ab32ff..b42a2c43ce 100644
--- a/src/com/itmill/toolkit/terminal/web/UIDLTransformerType.java
+++ b/src/com/itmill/toolkit/terminal/web/UIDLTransformerType.java
@@ -28,7 +28,8 @@
package com.itmill.toolkit.terminal.web;
-/** Type of the transformer.
+/**
+ * Type of the transformer.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -36,13 +37,21 @@ package com.itmill.toolkit.terminal.web;
*/
public class UIDLTransformerType {
- /** Holds value of property webBrowserType. */
+ /**
+ * Holds the value of property webBrowserType.
+ */
private WebBrowser webBrowser;
- /** Holds value of property theme. */
+ /**
+ * Holds the value of property theme.
+ */
private Theme theme;
- /** Creates a new instance of TransformerType */
+ /**
+ * Creates the new instance of TransformerType.
+ * @param webBrowserType the web browser type.
+ * @param theme the property theme.
+ */
public UIDLTransformerType(WebBrowser webBrowserType, Theme theme) {
if (webBrowserType == null || theme == null)
throw new IllegalArgumentException("WebBrowserType and Theme must be non-null values");
@@ -50,37 +59,48 @@ public class UIDLTransformerType {
this.theme = theme;
}
- /** The hash code of the equal types are the same */
+ /**
+ * Returns the hash code for this string.
+ * @return the hash code value.
+ */
public int hashCode() {
return this.toString().hashCode();
}
- /** Get the web browser type used in the UIDLTransformer of this type.
- * @return Web browser type used.
+ /**
+ * Gets the web browser type used in the UIDLTransformer of this type.
+ * @return the Web browser type used.
*/
public WebBrowser getWebBrowser() {
return this.webBrowser;
}
- /** Get the theme used in the UIDLTransformer of this type.
- * @return Theme used.
+ /**
+ * Gets the theme used in the UIDLTransformer of this type.
+ * @return the Theme used.
*/
public Theme getTheme() {
return this.theme;
}
- /** Two types are equal, if their properties are equal */
+ /**
+ * Two types are equal, if their properties are equal.
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
public boolean equals(Object obj) {
- // Check that the object are of the same class
+ // Checks that the object are of the same class
if (!(obj.getClass().equals(this.getClass())))
return false;
- // Check that the properties of the types are equal
+ // Checks that the properties of the types are equal
return this.toString().equals(obj.toString());
}
- /** Textual representation of the UIDLTransformer type */
+ /**
+ * Textual representation of the UIDLTransformer type.
+ * @see java.lang.Object#toString()
+ */
public String toString() {
return " theme='"
+ theme.getName()
diff --git a/src/com/itmill/toolkit/terminal/web/WebApplicationContext.java b/src/com/itmill/toolkit/terminal/web/WebApplicationContext.java
index 7a68acde20..0537cedcdb 100644
--- a/src/com/itmill/toolkit/terminal/web/WebApplicationContext.java
+++ b/src/com/itmill/toolkit/terminal/web/WebApplicationContext.java
@@ -61,22 +61,25 @@ public class WebApplicationContext implements ApplicationContext {
private WeakHashMap formActions = new WeakHashMap();
- /** Create a new Web Application Context. */
+ /**
+ * Creates a new Web Application Context.
+ * @param session the HTTP session.
+ */
WebApplicationContext(HttpSession session) {
this.session = session;
}
/**
- * Get the form action for given window.
- *
+ * Gets the form action for given window.
+ * <p>
* By default, this action is "", which preserves the current url. Commonly
- * this is wanted to be set to <code>application.getUrl().toString()</code>
- * or <code>window.getUrl().toString()</code> in order to clean any local
+ * this is wanted to be set to <code>application.getUrl.toString</code>
+ * or <code>window.getUrl.toString</code> in order to clean any local
* links or parameters set from the action.
- *
+ * </p>
* @param window
- * Window for which the action is queried
- * @return Action to be set into Form action attribute
+ * the Window for which the action is queried.
+ * @return the Action to be set into Form action attribute.
*/
public String getWindowFormAction(Window window) {
String action = (String) formActions.get(window);
@@ -84,17 +87,17 @@ public class WebApplicationContext implements ApplicationContext {
}
/**
- * Set the form action for given window.
- *
+ * Sets the form action for given window.
+ * <p>
* By default, this action is "", which preserves the current url. Commonly
- * this is wanted to be set to <code>application.getUrl().toString()</code>
- * or <code>window.getUrl().toString()</code> in order to clean any local
+ * this is wanted to be set to <code>application.getUrl.toString</code>
+ * or <code>window.getUrl.toString</code> in order to clean any local
* links or parameters set from the action.
- *
+ * </p>
* @param window
- * Window for which the action is set
+ * the Window for which the action is set.
* @param action
- * New action for the window.
+ * the New action for the window.
*/
public void setWindowFormAction(Window window, String action) {
if (action == null || action == "")
@@ -103,9 +106,8 @@ public class WebApplicationContext implements ApplicationContext {
formActions.put(window, action);
}
- /*
- * (non-Javadoc)
- *
+ /**
+ * Gets the application context base directory.
* @see com.itmill.toolkit.service.ApplicationContext#getBaseDirectory()
*/
public File getBaseDirectory() {
@@ -117,17 +119,16 @@ public class WebApplicationContext implements ApplicationContext {
}
/**
- * Get the http-session application is running in.
+ * Gets the http-session application is running in.
*
- * @return HttpSession this application context resides in
+ * @return HttpSession this application context resides in.
*/
public HttpSession getHttpSession() {
return session;
}
- /*
- * (non-Javadoc)
- *
+ /**
+ * Gets the applications in this context.
* @see com.itmill.toolkit.service.ApplicationContext#getApplications()
*/
public Collection getApplications() {
@@ -140,36 +141,35 @@ public class WebApplicationContext implements ApplicationContext {
}
/**
- * Get application context for HttpSession.
- *
- * @return application context for HttpSession.
+ * Gets the application context for HttpSession.
+ * @param session the HTTP session.
+ * @return the application context for HttpSession.
*/
static public WebApplicationContext getApplicationContext(
HttpSession session) {
return new WebApplicationContext(session);
}
- /*
- * (non-Javadoc)
- *
+ /**
+ * Returns <code>true</code> if and only if the argument is not <code>null</code> and is a
+ * Boolean object that represents the same boolean value as this object.
+ * @param obj the object to compare with.
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
return session.equals(obj);
}
- /*
- * (non-Javadoc)
- *
+ /**
+ * Returns the hash code value .
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return session.hashCode();
}
- /*
- * (non-Javadoc)
- *
+ /**
+ * Adds the transaction listener to this context.
* @see com.itmill.toolkit.service.ApplicationContext#addTransactionListener(com.itmill.toolkit.service.ApplicationContext.TransactionListener)
*/
public void addTransactionListener(TransactionListener listener) {
@@ -178,9 +178,8 @@ public class WebApplicationContext implements ApplicationContext {
this.listeners.add(listener);
}
- /*
- * (non-Javadoc)
- *
+ /**
+ * Removes the transaction listener from this context.
* @see com.itmill.toolkit.service.ApplicationContext#removeTransactionListener(com.itmill.toolkit.service.ApplicationContext.TransactionListener)
*/
public void removeTransactionListener(TransactionListener listener) {
@@ -189,7 +188,11 @@ public class WebApplicationContext implements ApplicationContext {
}
- /** Notify transaction start */
+ /**
+ * Notifies the transaction start.
+ * @param application
+ * @param request the HTTP request.
+ */
protected void startTransaction(Application application,
HttpServletRequest request) {
if (this.listeners == null)
@@ -200,7 +203,11 @@ public class WebApplicationContext implements ApplicationContext {
}
}
- /** Notify transaction end */
+ /**
+ * Notifies the transaction end.
+ * @param application
+ * @param request the HTTP request.
+ */
protected void endTransaction(Application application,
HttpServletRequest request) {
if (this.listeners == null)
diff --git a/src/com/itmill/toolkit/terminal/web/WebBrowser.java b/src/com/itmill/toolkit/terminal/web/WebBrowser.java
index 0ad6ce949e..5f808b7eea 100644
--- a/src/com/itmill/toolkit/terminal/web/WebBrowser.java
+++ b/src/com/itmill/toolkit/terminal/web/WebBrowser.java
@@ -35,7 +35,8 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;
-/** Web browser terminal type.
+/**
+ * Web browser terminal type.
*
* This class implements web browser properties, which declare the features of
* the web browser.
@@ -48,46 +49,69 @@ public class WebBrowser implements Terminal {
private static WebBrowser DEFAULT = new WebBrowser();
- /** Content type */
+ /**
+ * Content type.
+ */
private String contentType = "text/html; charset=utf-8";
- /** Holds the collection of accepted locales */
+ /**
+ * Holds the collection of accepted locales.
+ */
private Collection locales = new ArrayList();
- /** Holds value of property browserApplication. */
+ /**
+ * Holds value of property browserApplication.
+ */
private String browserApplication = null;
- /** Should the client side checkking be done. */
+ /**
+ * Should the client side checkking be done.
+ */
private boolean performClientCheck = true;
- /** Holds value for property isClientSideChecked. */
+ /**
+ * Holds value for property isClientSideChecked.
+ */
private boolean clientSideChecked = false;
- /** Holds value of property javaScriptVersion. */
+ /**
+ * Holds value of property javaScriptVersion.
+ */
private JavaScriptVersion javaScriptVersion = JAVASCRIPT_UNCHECKED;
- /** Holds value of property javaEnabled. */
+ /**
+ * Holds value of property javaEnabled.
+ */
private boolean javaEnabled = false;
- /** Holds value of property frameSupport. */
+ /**
+ * Holds value of property frameSupport.
+ */
private boolean frameSupport = false;
- /** Holds value of property markup version. */
+ /**
+ * Holds value of property markup version.
+ */
private MarkupVersion markupVersion = MARKUP_HTML_3_2;
- /** Pixel width of the terminal screen */
+ /**
+ * Pixel width of the terminal screen.
+ */
private int screenWidth = -1;
- /** Pixel height of the terminal screen */
+ /**
+ * Pixel height of the terminal screen.
+ */
private int screenHeight = -1;
private RenderingMode renderingMode = RENDERING_MODE_UNDEFINED;
- /** Constuctor with some autorecognition capabilities
- * Retrieves all capability information reported in http request headers:
+ /**
+ * Constuctor with some autorecognition capabilities
+ * Retrieves all capability information reported in http request headers:
* <ul>
- * <li>User web browser (User-Agent)</li>
- * <li>Supported locale(s)</li>
+ * <li>User web browser (User-Agent)</li>
+ * <li>Supported locale(s)</li>
* </ul>
*/
@@ -98,69 +122,78 @@ public class WebBrowser implements Terminal {
public WebBrowser() {
}
- /** Get name of the default theme
- * @return Name of the terminal window
+ /**
+ * Gets the name of the default theme.
+ * @return the Name of the terminal window.
*/
public String getDefaultTheme() {
return ApplicationServlet.DEFAULT_THEME;
}
- /** Get the name and version of the web browser application.
- *
+ /**
+ * Gets the name and version of the web browser application.
* This is the version string reported by the web-browser in http headers.
- * @return Web browser application.
+ *
+ * @return the Web browser application.
*/
public String getBrowserApplication() {
return this.browserApplication;
}
- /** Get the version of the supported Java Script by the browser.
+ /**
+ * Gets the version of the supported Java Script by the browser.
*
- * Null if the Java Script is not supported.
- * @return Version of the supported Java Script
+ * <code>Null</code> if the Java Script is not supported.
+ * @return the Version of the supported Java Script.
*/
public JavaScriptVersion getJavaScriptVersion() {
return this.javaScriptVersion;
}
- /** Does the browser support frames ?
- * @return True if the browser supports frames, False if not
+ /**
+ * Does the browser support frames ?
+ * @return <code>true</code> if the browser supports frames, otherwise <code>false</code>.
*/
public boolean isFrameSupport() {
return this.frameSupport;
}
- /** Set the browser frame support
- * @param frameSupport True if the browser supports frames, False if not
+ /**
+ * Sets the browser frame support.
+ * @param frameSupport True if the browser supports frames, False if not.
*/
public void setFrameSupport(boolean frameSupport) {
this.frameSupport = frameSupport;
}
- /** Get the supported markup language.
+ /**
+ * Gets the supported markup language.
*
- * @return Supported markup language
+ * @return the Supported markup language
*/
public MarkupVersion getMarkupVersion() {
return this.markupVersion;
}
- /** Get height of the terminal window in pixels
- * @return Height of the terminal window
+ /**
+ * Gets the height of the terminal window in pixels.
+ * @return the Height of the terminal window.
*/
public int getScreenHeight() {
return this.screenHeight;
}
- /** Get width of the terminal window in pixels
- * @return Width of the terminal window
+ /**
+ * Gets the width of the terminal window in pixels.
+ * @return the Width of the terminal window.
*/
public int getScreenWidth() {
return this.screenWidth;
}
- /** Get the default locale requested by the browser.
- * @return Default locale
+ /**
+ * Gets the default locale requested by the browser.
+ * @return the Default locale.
*/
public Locale getDefaultLocale() {
if (this.locales.isEmpty())
@@ -168,12 +201,18 @@ public class WebBrowser implements Terminal {
return (Locale) this.locales.iterator().next();
}
- /** Hash code composed of the properties of the web browser type */
+ /**
+ * Hash code composed of the properties of the web browser type.
+ * @see java.lang.Object#hashCode()
+ */
public int hashCode() {
return toString().hashCode();
}
- /** Test the equality of the properties for two web browser types */
+ /**
+ * Tests the equality of the properties for two web browser types.
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
public boolean equals(Object obj) {
if (obj != null && obj instanceof WebBrowser) {
return toString().equals(obj.toString());
@@ -181,7 +220,9 @@ public class WebBrowser implements Terminal {
return false;
}
- /** Repsent the type of the web browser as string */
+ /**
+ * @see java.lang.Object#toString()
+ */
public String toString() {
String localeString = "[";
@@ -192,7 +233,7 @@ public class WebBrowser implements Terminal {
}
localeString += "]";
- // Return catenation of the properties
+ // Returns catenation of the properties
return "Browser:"
+ this.browserApplication
+ ", "
@@ -222,34 +263,44 @@ public class WebBrowser implements Terminal {
+ this.clientSideChecked;
}
- /** Get preferred content type */
+ /**
+ * Gets the preferred content type.
+ * @return the content type.
+ */
public String getContentType() {
return contentType;
}
- /** Check if this type supports also given browser.
- * @return true if this type matches the given browser.
+ /**
+ * Checks if this type supports also given browser.
+ * @param browser the browser type.
+ * @return true if this type matches the given browser.
*/
public boolean supports(String browser) {
return this.getBrowserApplication().indexOf(browser) >= 0;
}
- /** Check if this type supports given markup language version.
- * @return true if this type supports the given markup version.
+ /**
+ * Checks if this type supports given markup language version.
+ * @param html the markup language version.
+ * @return <code>true</ocde> if this type supports the given markup version,otherwise <code>false</code>.
*/
public boolean supports(MarkupVersion html) {
return this.getMarkupVersion().supports(html);
}
- /** Check if this type supports given javascript version.
- * @param js The javascript version to check for.
- * @return true if this type supports the given javascript version.
+ /**
+ * Checks if this type supports given javascript version.
+ * @param js the javascript version to check for.
+ * @return true if this type supports the given javascript version.
*/
public boolean supports(JavaScriptVersion js) {
return this.getJavaScriptVersion().supports(js);
}
- /** Parse HTML version from string.
+ /**
+ * Parses HTML version from string.
+ * @param html
* @return HTMLVersion instance.
*/
private MarkupVersion doParseHTMLVersion(String html) {
@@ -260,8 +311,10 @@ public class WebBrowser implements Terminal {
return MARKUP_UNKNOWN;
}
- /** Parse JavaScript version from string.
- * @return HTMLVersion instance.
+ /**
+ * Parses JavaScript version from string.
+ * @param js the javascript version to check for.
+ * @return HTMLVersion instance.
*/
private JavaScriptVersion doParseJavaScriptVersion(String js) {
for (int i = 0; i < JAVASCRIPT_VERSIONS.length; i++) {
@@ -274,116 +327,135 @@ public class WebBrowser implements Terminal {
return JAVASCRIPT_NONE;
}
- /** Parse HTML version from string.
- * @return HTMLVersion instance.
+ /**
+ * Parses HTML version from string.
+ * @param html
+ * @return the HTMLVersion instance.
*/
public static MarkupVersion parseHTMLVersion(String html) {
return DEFAULT.doParseHTMLVersion(html);
}
- /** Parse JavaScript version from string.
- * @return HTMLVersion instance.
+ /**
+ * Parse JavaScript version from string.
+ * @param js the javascript version to check for.
+ * @return the HTMLVersion instance.
*/
public static JavaScriptVersion parseJavaScriptVersion(String js) {
return DEFAULT.doParseJavaScriptVersion(js);
}
- /** Get the client side cheked property.
- * Certain terminal features can only be detected at client side. This
- * property indicates if the client side detections have been performed
- * for this type.
- * @return true if client has sent information about its properties. Default false
+ /**
+ * Gets the client side cheked property.
+ * Certain terminal features can only be detected at client side. This
+ * property indicates if the client side detections have been performed
+ * for this type.
+ * @return <code>true</code> if client has sent information about its properties. Default is <code>false</code>.
*/
public boolean isClientSideChecked() {
return this.clientSideChecked;
}
- /** Set the client side checked property.
- * Certain terminal features can only be detected at client side. This
- * property indicates if the client side detections have been performed
- * for this type.
- * @param true if client has sent information about its properties, false otherweise.
+ /**
+ * Sets the client side checked property.
+ * Certain terminal features can only be detected at client side. This
+ * property indicates if the client side detections have been performed
+ * for this type.
+ * @param value true if client has sent information about its properties, false otherweise.
*/
public void setClientSideChecked(boolean value) {
this.clientSideChecked = value;
}
- /** Should the client features be checked using remote scripts.
- * Should the client side terminal feature check be performed.
- * @return true if client side checking should be performed for this terminal type. Default false.
+ /**
+ * Should the client features be checked using remote scripts.
+ * Should the client side terminal feature check be performed.
+ * @return <code>true</code> if client side checking should be performed
+ * for this terminal type. Default is <code>false</code>.
*/
public boolean performClientCheck() {
return this.performClientCheck;
}
- /** Should the client features be checked using remote scripts.
- *
- * @return true if client side checking should be performed for this terminal type. Default false.
+ /**
+ * Should the client features be checked using remote scripts.
+ * @param value
+ * @return <code>true</code> if client side checking should be performed
+ * for this terminal type. Default <code>false</code>.
*/
public void performClientCheck(boolean value) {
this.performClientCheck = value;
}
- /** Check if web browser supports Java.
- * @return boolean
+ /**
+ * Checks if web browser supports Java.
+ * @return <code>true<code> if the browser supports java otherwise <code>false</code>.
*/
public boolean isJavaEnabled() {
return javaEnabled;
}
- /** Returns the locales supported by the web browser.
- * @return Collection
+ /**
+ * Returns the locales supported by the web browser.
+ * @return the Collection.
*/
public Collection getLocales() {
return locales;
}
- /** Sets the browser application.
- * This corresponds to User-Agent HTTP header.
- * @param browserApplication The browserApplication to set
+ /**
+ * Sets the browser application.
+ * This corresponds to User-Agent HTTP header.
+ * @param browserApplication the browserApplication to set.
*/
public void setBrowserApplication(String browserApplication) {
this.browserApplication = browserApplication;
}
- /** Sets the default content type.
- * Default is <code>text/html</code>
- * @param contentType The contentType to set
+ /**
+ * Sets the default content type.
+ * Default is <code>text/html</code>
+ * @param contentType the contentType to set.
*/
public void setContentType(String contentType) {
this.contentType = contentType;
}
- /** Sets the java enabled property.
- * @param javaEnabled The javaEnabled to set
+ /**
+ * Sets the java enabled property.
+ * @param javaEnabled the javaEnabled to set.
*/
public void setJavaEnabled(boolean javaEnabled) {
this.javaEnabled = javaEnabled;
}
- /**Sets the JavaScript version.
- * @param javaScriptVersion The JavaScript version to set
+ /**
+ * Sets the JavaScript version.
+ * @param javaScriptVersion the JavaScript version to set.
*/
public void setJavaScriptVersion(JavaScriptVersion javaScriptVersion) {
this.javaScriptVersion = javaScriptVersion;
}
- /** Sets the markup language version.
- * @param markupVersion ersion The markup language version to set
+ /**
+ * Sets the markup language version.
+ * @param markupVersion the markup language version to set.
*/
public void setMarkupVersion(MarkupVersion markupVersion) {
this.markupVersion = markupVersion;
}
- /** Sets the screen height.
- * @param screenHeight The screen height to set in pixels.
+ /**
+ * Sets the screen height.
+ * @param screenHeight the screen height to set in pixels.
*/
public void setScreenHeight(int screenHeight) {
this.screenHeight = screenHeight;
}
- /** Sets the screen width.
- * @param screenWidth The screenWidth to set in pixels.
+ /**
+ * Sets the screen width.
+ * @param screenWidth the screenWidth to set in pixels.
*/
public void setScreenWidth(int screenWidth) {
this.screenWidth = screenWidth;
@@ -400,6 +472,9 @@ public class WebBrowser implements Terminal {
private int order;
/**
+ * Returns <code>true</code> if and only if the argument is not <code>null</code> and is a
+ * Boolean object that represents the same boolean value as this object.
+ * @param obj the object to compare with.
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object obj) {
@@ -414,14 +489,21 @@ public class WebBrowser implements Terminal {
public String toString() {
return name;
}
-
+
+/**
+ *
+ * @param name
+ * @param order
+ */
private MarkupVersion(String name, int order) {
this.name = name;
this.order = order;
}
- /** Check compability with other HTML version.
- * @return true if this is compatible with the other, false otherwise
+ /**
+ * Checks the compability with other HTML version.
+ * @param other the HTML version.
+ * @return <code>true</code> if this is compatible with the other, otherwise <code>false</code>.
*/
public boolean supports(MarkupVersion other) {
return (this.order >= other.order);
@@ -484,16 +566,23 @@ public class WebBrowser implements Terminal {
public String toString() {
return name;
}
-
+
+/**
+ *
+ * @param name
+ * @param order
+ */
private JavaScriptVersion(String name, int order) {
this.name = name;
this.order = order;
}
- /** Check compability with other JavaScript version.
- * Use this like:
- * <code>boolean isEcma = someVersion.supports(ECMA_262);</code>
- * @return true if this supports the other, false otherwise
+ /**
+ * Checks the compability with other JavaScript version.
+ * Use this like:
+ * <code>boolean isEcma = someVersion.supports(ECMA_262);</code>
+ * @param other the java script version.
+ * @return <code>true</code> if this supports the other, otherwise <code>false</code>.
*/
public boolean supports(JavaScriptVersion other) {
@@ -594,16 +683,16 @@ public class WebBrowser implements Terminal {
public static final RenderingMode RENDERING_MODE_AJAX = DEFAULT.new RenderingMode();
/**
- * Gets current rendering mode
- * @return current rendering mode
+ * Gets the current rendering mode.
+ * @return the current rendering mode.
*/
public RenderingMode getRenderingMode() {
return renderingMode;
}
/**
- * Sets current rendering mode
- * @param renderingMode
+ * Sets the current rendering mode.
+ * @param renderingMode the rendering mode.
*/
public void setRenderingMode(RenderingMode renderingMode) {
this.renderingMode = renderingMode;
diff --git a/src/com/itmill/toolkit/terminal/web/WebBrowserProbe.java b/src/com/itmill/toolkit/terminal/web/WebBrowserProbe.java
index cbe61d0474..835705082c 100644
--- a/src/com/itmill/toolkit/terminal/web/WebBrowserProbe.java
+++ b/src/com/itmill/toolkit/terminal/web/WebBrowserProbe.java
@@ -37,7 +37,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/**
- * The WebBrowserProbe uses JavaScript to determine the capabilities of the
+ * The <code>WebBrowserProbe</code> uses JavaScript to determine the capabilities of the
* client browser.
*
* @author IT Mill Ltd.
@@ -52,8 +52,8 @@ public class WebBrowserProbe {
private static final String CLIENT_TYPE = "wa_browser";
/**
- * Return the terminal type from the given session.
- *
+ * Returns the terminal type from the given session.
+ * @param session the HTTP session.
* @return WebBrowser instance for the given session.
*/
public static WebBrowser getTerminalType(HttpSession session) {
@@ -63,8 +63,9 @@ public class WebBrowserProbe {
}
/**
- * Set the terminal type for the given session.
- *
+ * Sets the terminal type for the given session.
+ * @param session the HTTP session.
+ * @param terminal the web browser.
* @return WebBrowser instance for the given session.
*/
public static void setTerminalType(HttpSession session, WebBrowser terminal) {
@@ -73,13 +74,15 @@ public class WebBrowserProbe {
}
/**
- * Handle client checking.
+ * Handles the client checking.
*
* @param request
- * The HTTP request to process.
- * @param response
- * HTTP response to write to.
- * @return true if response should include a probe script
+ * the HTTP request to process.
+ * @param parameters
+ * the Parameters to be used as defaults.
+ * @return <code>true</code> if response should include a probe script,otherwise <code>false</code>.
+ * @throws ServletException if an exception has occurred that interferes with the
+ * servlet's normal operation.
*/
public static boolean handleProbeRequest(HttpServletRequest request,
Map parameters) throws ServletException {
@@ -106,11 +109,11 @@ public class WebBrowserProbe {
}
- // Create new type based on client parameters
+ // Creates new type based on client parameters
browser = probe(browser, request, parameters);
setTerminalType(s, browser);
- // Set client as checked if parameters were found
+ // Sets client as checked if parameters were found
if (parameters.containsKey("wa_clientprobe")) {
String val = ((String[]) parameters.get("wa_clientprobe"))[0];
browser.setClientSideChecked(val != null && "1".equals(val));
@@ -122,10 +125,10 @@ public class WebBrowserProbe {
}
/**
- * Determine versions based on user agent string.
+ * Determines versions based on user agent string.
*
* @param agent
- * HTTP User-Agent request header.
+ * the HTTP User-Agent request header.
* @return new WebBrowser instance initialized based on agent features.
*/
public static WebBrowser probe(String agent) {
@@ -268,15 +271,15 @@ public class WebBrowserProbe {
}
/**
- * Create new instance of WebBrowser by initializing the values based on
+ * Creates new instance of WebBrowser by initializing the values based on
* user request.
*
* @param browser
- * The browser to be updated. If null a new instance is created.
+ * the browser to be updated. If null a new instance is created.
* @param request
- * Request to be used as defaults.
+ * the Request to be used as defaults.
* @param params
- * Parameters to be used as defaults.
+ * the Parameters to be used as defaults.
* @return new WebBrowser instance initialized based on request parameters.
*/
public static WebBrowser probe(WebBrowser browser,
diff --git a/src/com/itmill/toolkit/terminal/web/WebPaintTarget.java b/src/com/itmill/toolkit/terminal/web/WebPaintTarget.java
index 7c4d58652b..27b5c7e93d 100644
--- a/src/com/itmill/toolkit/terminal/web/WebPaintTarget.java
+++ b/src/com/itmill/toolkit/terminal/web/WebPaintTarget.java
@@ -41,7 +41,8 @@ import com.itmill.toolkit.terminal.VariableOwner;
import java.util.Stack;
-/** User Interface Description Language Target.
+/**
+ * User Interface Description Language Target.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -67,9 +68,8 @@ public class WebPaintTarget implements PaintTarget {
private boolean mSuppressOutput = false;
- /** Create a new XMLPrintWriter, without automatic line flushing.
- *
- *
+ /**
+ * Creates a new XMLPrintWriter, without automatic line flushing.
* @param out A character-output stream.
*/
public WebPaintTarget(
@@ -85,23 +85,23 @@ public class WebPaintTarget implements PaintTarget {
// Target theme
this.theme = theme;
- // Set the variable map
+ // Sets the variable map
this.variableMap = variableMap;
- // Set the target for UIDL writing
+ // Sets the target for UIDL writing
this.uidlBuffer = new StringBuffer();
- // Set the target for TAG data
+ // Sets the target for TAG data
this.tagBuffer = new StringBuffer();
// Initialize tag-writing
mOpenTags = new Stack();
mTagArgumentListOpen = false;
- //Add document declaration
+ //Adds document declaration
this.print(UIDL_XML_DECL + "\n\n");
- // Add UIDL start tag and its attributes
+ // Adds UIDL start tag and its attributes
this.startTag("uidl");
// Name of the active theme
@@ -109,7 +109,8 @@ public class WebPaintTarget implements PaintTarget {
}
- /** Ensures that the currently open element tag is closed.
+ /**
+ * Ensures that the currently open element tag is closed.
*/
private void ensureClosedTag() {
if (mTagArgumentListOpen) {
@@ -118,13 +119,15 @@ public class WebPaintTarget implements PaintTarget {
append(tagBuffer);
}
}
- /** Print element start tag.
+ /**
+ * Prints element start tag.
*
* <pre>Todo:
* Checking of input values
* </pre>
*
- * @param tagName The name of the start tag
+ * @param tagName the name of the start tag.
+ * @throws PaintException if the paint operation failed.
*
*/
public void startTag(String tagName) throws PaintException {
@@ -150,19 +153,21 @@ public class WebPaintTarget implements PaintTarget {
mTagArgumentListOpen = true;
}
- /** Print element end tag.
+ /**
+ * Prints element end tag.
*
* If the parent tag is closed before
* every child tag is closed a PaintException is raised.
*
- * @param tag The name of the end tag
+ * @param tagName the name of the end tag.
+ * @throws PaintException if the paint operation failed.
*/
public void endTag(String tagName) throws PaintException {
// In case of null data output nothing:
if (tagName == null)
throw new NullPointerException();
- //Ensure that the target is open
+ //Ensures that the target is open
if (this.closed)
throw new PaintException("Attempted to write to a closed PaintTarget.");
@@ -177,11 +182,11 @@ public class WebPaintTarget implements PaintTarget {
+ lastTag
+ "'.");
- // Make sure that the open start tag is closed before
+ // Makes sure that the open start tag is closed before
// anything is written.
ensureClosedTag();
- //Write the end (closing) tag
+ //Writes the end (closing) tag
append("</" + lastTag + "\n>");
// NOTE: We re-enable the output (if it has been disabled)
@@ -190,9 +195,10 @@ public class WebPaintTarget implements PaintTarget {
mSuppressOutput = false;
}
- /** Append data into UIDL output buffer.
+ /**
+ * Appends data into UIDL output buffer.
*
- * @param data String to be appended.
+ * @param data the String to be appended.
*/
private void append(String data) {
if (!mSuppressOutput) {
@@ -200,9 +206,10 @@ public class WebPaintTarget implements PaintTarget {
}
}
- /** Append data into UIDL output buffer.
+ /**
+ * Appends data into UIDL output buffer.
*
- * @param data StringBuffer to be appended.
+ * @param data the StringBuffer to be appended.
*/
private void append(StringBuffer data) {
if (!mSuppressOutput) {
@@ -210,8 +217,9 @@ public class WebPaintTarget implements PaintTarget {
}
}
- /** Substitute the XML sensitive characters with predefined XML entities.
- *
+ /**
+ * Substitutes the XML sensitive characters with predefined XML entities.
+ * @param xml
* @return A new string instance where all occurrences of XML sensitive
* characters are substituted with entities.
*/
@@ -221,8 +229,9 @@ public class WebPaintTarget implements PaintTarget {
return escapeXML(new StringBuffer(xml)).toString();
}
- /** Substitute the XML sensitive characters with predefined XML entities.
- * @param xml the String to be substituted
+ /**
+ * Substitutes the XML sensitive characters with predefined XML entities.
+ * @param xml the String to be substituted.
* @return A new StringBuffer instance where all occurrences of XML
* sensitive characters are substituted with entities.
*
@@ -245,8 +254,9 @@ public class WebPaintTarget implements PaintTarget {
return result;
}
- /** Substitute a XML sensitive character with predefined XML entity.
- * @param c Character to be replaced with an entity.
+ /**
+ * Substitutes a XML sensitive character with predefined XML entity.
+ * @param c 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.
*/
@@ -267,12 +277,14 @@ public class WebPaintTarget implements PaintTarget {
}
}
- /** Print XML.
+ /**
+ * Prints XML.
*
* Writes pre-formatted XML to stream. Well-formness of XML is checked.
* <pre>
* TODO: XML checking should be made
* </pre>
+ * @param str
*/
private void print(String str) {
// In case of null data output nothing:
@@ -287,18 +299,23 @@ public class WebPaintTarget implements PaintTarget {
append(str);
}
- /** Print XML-escaped text.
+ /**
+ * Prints XML-escaped text.
+ * @param str
+ * @throws PaintException if the paint operation failed.
*
*/
public void addText(String str) throws PaintException {
addUIDL(escapeXML(str));
}
- /** Adds a boolean attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a boolean attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Attribute name
- * @param value Attribute value
+ * @param name the Attribute name.
+ * @param value the Attribute value.
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, boolean value)
throws PaintException {
@@ -312,11 +329,13 @@ public class WebPaintTarget implements PaintTarget {
}
}
- /** Adds a resource attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a resource attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Attribute name
- * @param value Attribute value
+ * @param name the Attribute name.
+ * @param value the Attribute value.
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, Resource value)
throws PaintException {
@@ -351,34 +370,37 @@ public class WebPaintTarget implements PaintTarget {
}
- /** Adds a integer attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a integer attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Attribute name
- * @param value Attribute value
- * @return this object
+ * @param name the Attribute name.
+ * @param value the Attribute value.
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, int value) throws PaintException {
addAttribute(name, String.valueOf(value));
}
- /** Adds a long attribute to component.
+ /**
+ * Adds a long attribute to component.
* Atributes must be added before any content is written.
*
- * @param name Attribute name
- * @param value Attribute value
- * @return this object
+ * @param name the Attribute name.
+ * @param value the Attribute value.
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, long value) throws PaintException {
addAttribute(name, String.valueOf(value));
}
- /** Adds a string attribute to component.
- * Atributes must be added before any content is written.
+ /**
+ * Adds a string attribute to component.
+ * Atributes must be added before any content is written.
*
- * @param name Boolean attribute name
- * @param value Boolean attribute value
- * @return this object
+ * @param name the Boolean attribute name.
+ * @param value the Boolean attribute value.
+ * @throws PaintException if the paint operation failed.
*/
public void addAttribute(String name, String value) throws PaintException {
// In case of null data output nothing:
@@ -396,11 +418,12 @@ public class WebPaintTarget implements PaintTarget {
tagBuffer.append(" " + name + "=\"" + escapeXML(value) + "\"");
}
- /** Add a string type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a string type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ * @param value the Variable initial value.
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String value)
throws PaintException {
@@ -412,11 +435,12 @@ public class WebPaintTarget implements PaintTarget {
endTag("string");
}
- /** Add a int type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a int type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ * @param value the Variable initial value.
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, int value)
throws PaintException {
@@ -428,11 +452,12 @@ public class WebPaintTarget implements PaintTarget {
endTag("integer");
}
- /** Add a boolean type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a boolean type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ * @param value the Variable initial value.
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, boolean value)
throws PaintException {
@@ -444,11 +469,12 @@ public class WebPaintTarget implements PaintTarget {
endTag("boolean");
}
- /** Add a string array type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a string array type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ * @param value the Variable initial value.
+ * @throws PaintException if the paint operation failed.
*/
public void addVariable(VariableOwner owner, String name, String[] value)
throws PaintException {
@@ -461,11 +487,12 @@ public class WebPaintTarget implements PaintTarget {
endTag("array");
}
- /** Add a upload stream type variable.
- * @param owner Listener for variable changes
- * @param name Variable name
- * @param value Variable initial value
- * @return Reference to this.
+ /**
+ * Adds a upload stream type variable.
+ * @param owner the Listener for variable changes.
+ * @param name the Variable name.
+ *
+ * @throws PaintException if the paint operation failed.
*/
public void addUploadStreamVariable(VariableOwner owner, String name)
throws PaintException {
@@ -477,10 +504,15 @@ public class WebPaintTarget implements PaintTarget {
endTag("uploadstream");
}
- /** Print single text section.
- *
+ /**
+ * Prints the single text section.
+ * <p>
* Prints full text section. The section data is escaped from XML tags and
* surrounded by XML start and end-tags.
+ * </p>
+ * @param sectionTagName the name of the tag.
+ * @param sectionData the section data.
+ * @throws PaintException if the paint operation failed.
*/
public void addSection(String sectionTagName, String sectionData)
throws PaintException {
@@ -489,7 +521,11 @@ public class WebPaintTarget implements PaintTarget {
endTag(sectionTagName);
}
- /** Add XML dirctly to UIDL */
+ /**
+ * Adds XML directly to UIDL.
+ * @param xml the XML to be added.
+ * @throws PaintException if the paint operation failed.
+ */
public void addUIDL(String xml) throws PaintException {
//Ensure that the target is open
@@ -505,7 +541,9 @@ public class WebPaintTarget implements PaintTarget {
append(xml);
}
- /** Add XML section with namespace
+ /**
+ * Adds XML section with namespace.
+ *
* @see com.itmill.toolkit.terminal.PaintTarget#addXMLSection(String, String, String)
*/
public void addXMLSection(
@@ -514,7 +552,7 @@ public class WebPaintTarget implements PaintTarget {
String namespace)
throws PaintException {
- //Ensure that the target is open
+ //Ensures that the target is open
if (this.closed)
throw new PaintException("Attempted to write to a closed PaintTarget.");
@@ -522,7 +560,7 @@ public class WebPaintTarget implements PaintTarget {
if (namespace != null)
addAttribute("xmlns", namespace);
- // Close that starting tag
+ // Closes that starting tag
ensureClosedTag();
if (sectionData != null)
@@ -530,9 +568,11 @@ public class WebPaintTarget implements PaintTarget {
endTag(sectionTagName);
}
- /** Get the UIDL already printed to stream.
- * Paint target must be closed before the getUIDL()
- * cn be called.
+ /**
+ * Gets the UIDL already printed to stream.
+ * Paint target must be closed before the <code>getUIDL</code>
+ * can be called.
+ * @return the UIDL.
*/
public String getUIDL() {
if (this.closed) {
@@ -541,13 +581,15 @@ public class WebPaintTarget implements PaintTarget {
throw new IllegalStateException("Tried to read UIDL from open PaintTarget");
}
- /** Close the paint target.
- * Paint target must be closed before the getUIDL()
- * cn be called.
+ /**
+ * 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 ignored.
* will generate an exception.
+ * @throws PaintException if the paint operation failed.
*/
public void close() throws PaintException {
if (!this.closed) {
@@ -556,18 +598,23 @@ public class WebPaintTarget implements PaintTarget {
}
}
- /** Print element start tag of a paintable section.
+ /**
+ * Prints element start tag of a paintable section.
* Starts a paintable section using the given tag. The PaintTarget may
* implement a caching scheme, that checks the paintable has actually
* changed or can a cached version be used instead. This method should call
- * the startTag method. <p> If the Paintable is found in cache and this
+ * the startTag method.
+ * <p>
+ * If the Paintable is found in cache and this
* function returns true it may omit the content and close the tag, in which
* case cached content should be used.
- * </p><b>Note:</b> Web adapter does not currently implement caching and
+ * </p>
+ * <b>Note:</b> Web adapter does not currently implement caching and
* this function always returns false.
- * @param paintable The paintable to start
- * @param tagName The name of the start tag
+ * @param paintable the paintable to start.
+ * @param tag the name of the start tag.
* @return false
+ * @throws PaintException if the paint operation failed.
* @see com.itmill.toolkit.terminal.PaintTarget#startTag(Paintable, String),
* #startTag(String)
* @since 3.1
@@ -578,8 +625,10 @@ public class WebPaintTarget implements PaintTarget {
return false;
}
- /** Add CDATA node to target UIDL-tree.
- * @param text Character data to add
+ /**
+ * Adds CDATA node to target UIDL-tree.
+ * @param text the Character data to add.
+ * @throws PaintException if the paint operation failed.
* @since 3.1
*/
public void addCharacterData(String text) throws PaintException {
diff --git a/src/com/itmill/toolkit/terminal/web/XSLReader.java b/src/com/itmill/toolkit/terminal/web/XSLReader.java
index 436886a095..cf0c94fe22 100644
--- a/src/com/itmill/toolkit/terminal/web/XSLReader.java
+++ b/src/com/itmill/toolkit/terminal/web/XSLReader.java
@@ -46,7 +46,8 @@ import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
-/** Class implementing XMLReader for the UIDLTransformer.
+/**
+ * Class implementing XMLReader for the UIDLTransformer.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -118,8 +119,9 @@ public class XSLReader implements XMLReader, ContentHandler {
this.streams = streams;
}
- /** Parse all streams given for constructor parameter.
- * The input parameter is ignored.
+ /**
+ * Parses all streams given for constructor parameter.
+ * The input parameter is ignored.
* @see org.xml.sax.XMLReader#parse(InputSource)
*/
public synchronized void parse(InputSource input)
@@ -140,6 +142,7 @@ public class XSLReader implements XMLReader, ContentHandler {
handler.endElement(xslNamespace, "stylesheet", "xsl:stylesheet");
handler.endDocument();
}
+
/**
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
@@ -257,19 +260,22 @@ public class XSLReader implements XMLReader, ContentHandler {
handler.startPrefixMapping(prefix, uri);
}
- /** Override the default content handler.
+ /**
+ * Overrides the default content handler.
* @see org.xml.sax.XMLReader#getContentHandler()
*/
public ContentHandler getContentHandler() {
return this.handler;
}
- /** Override the default content handler.
+ /**
+ * Overrides the default content handler.
* @see org.xml.sax.XMLReader#setContentHandler(ContentHandler)
*/
public void setContentHandler(ContentHandler handler) {
this.handler = handler;
}
+
/**
* @see org.xml.sax.XMLReader#getDTDHandler()
*/
@@ -307,7 +313,8 @@ public class XSLReader implements XMLReader, ContentHandler {
return reader.getProperty(name);
}
- /** Override the parse.
+ /**
+ * Overrides the parse.
* @see org.xml.sax.XMLReader#parse(String)
*/
public void parse(String systemId) throws IOException, SAXException {
@@ -354,7 +361,11 @@ public class XSLReader implements XMLReader, ContentHandler {
public class AttributeMapper implements Attributes {
private Attributes original;
-
+
+ /**
+ *
+ * @param originalAttributes
+ */
public AttributeMapper(Attributes originalAttributes) {
original = originalAttributes;
}
@@ -478,31 +489,53 @@ public class XSLReader implements XMLReader, ContentHandler {
public class XSLStreamLocator implements Locator {
private String id;
-
+
+/**
+ *
+ * @param id
+ */
public XSLStreamLocator(String id) {
this.id = id;
}
-
+
+ /**
+ *
+ * @see org.xml.sax.Locator#getPublicId()
+ */
public String getPublicId() {
return streamLocator.getPublicId();
}
-
+
+ /**
+ *
+ * @see org.xml.sax.Locator#getSystemId()
+ */
public String getSystemId() {
return streamLocator.getSystemId()+""+id;
}
-
+ /**
+ *
+ * @see org.xml.sax.Locator#getLineNumber()
+ */
public int getLineNumber() {
return streamLocator.getLineNumber();
}
-
+
public int getCombinedLineNumber() {
return streamLocator.getLineNumber()+streamStartLineNumber;
- }
-
+ }
+
+ /**
+ * @see org.xml.sax.Locator#getColumnNumber()
+ */
public int getColumnNumber() {
return streamLocator.getColumnNumber();
}
-
+
+ /**
+ * Gets the id.
+ * @return the id .
+ */
public String getId() {
return id;
}
@@ -511,11 +544,18 @@ public class XSLReader implements XMLReader, ContentHandler {
public class SAXStreamErrorHandler implements ErrorHandler {
private ErrorHandler handler;
-
+
+/**
+ *
+ * @param origHandler
+ */
SAXStreamErrorHandler(ErrorHandler origHandler) {
this.handler = origHandler;
}
-
+
+ /**
+ * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
+ */
public void warning(SAXParseException exception) throws SAXException {
handler.warning(
new SAXParseException(
@@ -523,7 +563,10 @@ public class XSLReader implements XMLReader, ContentHandler {
locator,
exception));
}
-
+
+ /**
+ * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
+ */
public void error(SAXParseException exception) throws SAXException {
handler.error(
new SAXParseException(
@@ -531,7 +574,10 @@ public class XSLReader implements XMLReader, ContentHandler {
locator,
exception));
}
-
+
+ /**
+ * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
+ */
public void fatalError(SAXParseException exception)
throws SAXException {
handler.fatalError(
diff --git a/src/com/itmill/toolkit/ui/AbstractComponent.java b/src/com/itmill/toolkit/ui/AbstractComponent.java
index 311f7a66eb..a3a7390fca 100644
--- a/src/com/itmill/toolkit/ui/AbstractComponent.java
+++ b/src/com/itmill/toolkit/ui/AbstractComponent.java
@@ -41,7 +41,8 @@ import java.util.Set;
import java.util.HashSet;
import java.lang.reflect.Method;
-/** An abstract class that defines default implementation for the
+/**
+ * An abstract class that defines default implementation for the
* {@link Component} interface. Basic UI components that are not derived
* from an external component can inherit this class to easily qualify as a
* IT Mill Toolkit component. Most components in the toolkit do
@@ -56,67 +57,101 @@ public abstract class AbstractComponent
/* Private members ************************************************* */
- /** Look-and-feel style of the component. */
+ /**
+ * Look-and-feel style of the component.
+ */
private String style;
- /** Caption text. */
+ /**
+ * Caption text.
+ */
private String caption;
- /** Application specific data object. */
+ /**
+ * Application specific data object.
+ */
private Object applicationData;
- /** Icon to be shown together with caption. */
+ /**
+ * Icon to be shown together with caption.
+ */
private Resource icon;
- /** Is the component enable (its normal usage is allowed). */
+ /**
+ * Is the component enable (its normal usage is allowed).
+ */
private boolean enabled = true;
- /** Is the component visible (it is rendered). */
+ /**
+ * Is the component visible (it is rendered).
+ */
private boolean visible = true;
- /** Is the component read-only ? */
+ /**
+ * Is the component read-only ?
+ */
private boolean readOnly = false;
- /** Description of the usage (XML). */
+ /**
+ * Description of the usage (XML).
+ */
private String description = null;
- /** The container this component resides in. */
+ /**
+ * The container this component resides in.
+ */
private Component parent = null;
- /** The EventRouter used for the event model. */
+ /**
+ * The EventRouter used for the event model.
+ */
private EventRouter eventRouter = null;
- /** The internal error message of the component. */
+ /**
+ * The internal error message of the component.
+ */
private ErrorMessage componentError = null;
- /** List of event variable change event handling dependencies */
+ /**
+ * List of event variable change event handling dependencies.
+ */
private Set dependencies = null;
- /** Immediate mode: if true, all variable changes are required to be sent
- * from the terminal immediately
+ /**
+ * Immediate mode: if true, all variable changes are required to be sent
+ * from the terminal immediately.
*/
private boolean immediate = false;
- /** Locale of this component. */
+ /**
+ * Locale of this component.
+ */
private Locale locale;
- /** List of repaint request listeners or null if not listened at all */
+ /**
+ * List of repaint request listeners or null if not listened at all.
+ */
private LinkedList repaintRequestListeners = null;
- /** Are all the repaint listeners notified about recent changes ? */
+ /**
+ * Are all the repaint listeners notified about recent changes ?
+ */
private boolean repaintRequestListenersNotified = false;
/* Constructor ***************************************************** */
- /** Constructs a new Component */
+ /**
+ * Constructs a new Component.
+ */
public AbstractComponent() {
}
/* Get/Set component properties ************************************ */
- /** Gets the UIDL tag corresponding to the component.
+ /**
+ * Gets the UIDL tag corresponding to the component.
*
- * @return component's UIDL tag as <code>String</code>
+ * @return the component's UIDL tag as <code>String</code>
*/
public abstract String getTag();
@@ -145,11 +180,12 @@ public abstract class AbstractComponent
return this.caption;
}
- /** Sets the component's caption <code>String</code>. Caption is the
+ /**
+ * 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 new caption <code>String</code> for the component
+ * @param caption the new caption <code>String</code> for the component.
*/
public void setCaption(String caption) {
this.caption = caption;
@@ -170,8 +206,9 @@ public abstract class AbstractComponent
return null;
}
- /** Sets the locale of this component.
- * @param locale The locale to become this component's locale.
+ /**
+ * Sets the locale of this component.
+ * @param locale the locale to become this component's locale.
*/
public void setLocale(Locale locale) {
this.locale = locale;
@@ -185,11 +222,12 @@ public abstract class AbstractComponent
return this.icon;
}
- /** Sets the component's icon. This method will trigger a
- * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
- *
- * @param icon the icon to be shown with the component's caption
- */
+ /**
+ * Sets the component's icon. This method will trigger a
+ *{@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
+ *
+ * @param icon the icon to be shown with the component's caption.
+ */
public void setIcon(Resource icon) {
this.icon = icon;
requestRepaint();
@@ -222,11 +260,12 @@ public abstract class AbstractComponent
return immediate;
}
- /** Sets the component's immediate mode to the specified status. This
+ /**
+ * Sets the component's immediate mode to the specified status. This
* method will trigger a
* {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
*
- * @param immediate boolean value specifying if the component should
+ * @param immediate the boolean value specifying if the component should
* be in the immediate mode after the call.
* @see Component#isImmediate()
*/
@@ -259,9 +298,12 @@ public abstract class AbstractComponent
}
}
- /** <p>Gets the component's description. The description can be used to
+ /**
+ * <p>
+ * Gets the component's description. The description can be used to
* briefly describe the state of the component to the user. The
- * description string may contain certain XML tags:</p>
+ * description string may contain certain XML tags:
+ * </p>
*
* <p><table border=1>
* <tr><td width=120><b>Tag</b></td>
@@ -298,11 +340,12 @@ public abstract class AbstractComponent
return this.description;
}
- /** Sets the component's description. See {@link #getDescription()} for
+ /**
+ * Sets the component's description. See {@link #getDescription()} for
* more information on what the description is. This method will trigger
* a {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
*
- * @param description new description string for the component
+ * @param description the new description string for the component.
*/
public void setDescription(String description) {
this.description = description;
@@ -317,7 +360,7 @@ public abstract class AbstractComponent
return this.parent;
}
- /* Set the parent component.
+ /* Sets the parent component.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -341,7 +384,8 @@ public abstract class AbstractComponent
attach();
}
- /** Get the error message for this component.
+ /**
+ * Gets the error message for this component.
*
* @return ErrorMessage containing the description of the error state
* of the component or null, if the component contains no errors. Extending
@@ -353,20 +397,22 @@ public abstract class AbstractComponent
return this.componentError;
}
- /** Gets the component's error message.
+ /**
+ * Gets the component's error message.
* @link Terminal.ErrorMessage#ErrorMessage(String, int)
*
- * @return component's error message
+ * @return the component's error message.
*/
public ErrorMessage getComponentError() {
return this.componentError;
}
- /** Sets the component's error message. The message may contain certain
+ /**
+ * Sets the component's error message. The message may contain certain
* XML tags, for more information see
* @link Component.ErrorMessage#ErrorMessage(String, int)
*
- * @param errorMessage new <code>ErrorMessage</code> of the component
+ * @param componentError the new <code>ErrorMessage</code> of the component.
*/
public void setComponentError(ErrorMessage componentError) {
this.componentError = componentError;
@@ -382,7 +428,7 @@ public abstract class AbstractComponent
return readOnly;
}
- /* Set the component's read-only mode.
+ /* Sets the component's read-only mode.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -391,7 +437,7 @@ public abstract class AbstractComponent
requestRepaint();
}
- /* Get the parent window of the component.
+ /* Gets the parent window of the component.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -416,7 +462,7 @@ public abstract class AbstractComponent
public void detach() {
}
- /* Get the parent application of the component.
+ /* Gets the parent application of the component.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
@@ -477,14 +523,15 @@ public abstract class AbstractComponent
repaintRequestListenersNotified = false;
}
- /** Paints any needed component-specific things to the given UIDL
+ /**
+ * Paints any needed component-specific things to the given UIDL
* stream. The more general {@link #paint(PaintTarget)} method handles
* all general attributes common to all components, and it calls this
* method to paint any component-specific attributes to the UIDL stream.
*
- * @param target target UIDL stream where the component should paint
+ * @param target the target UIDL stream where the component should paint
* itself to
- * @throws PaintException if the operation failed
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
@@ -508,7 +555,10 @@ public abstract class AbstractComponent
fireRequestRepaintEvent(alreadyNotified);
}
- /** Fire repaint request event */
+ /**
+ * Fires the repaint request event.
+ * @param alreadyNotified
+ */
private void fireRequestRepaintEvent(Collection alreadyNotified) {
// Notify listeners only once
@@ -590,7 +640,7 @@ public abstract class AbstractComponent
*/
public void removeDirectDependency(VariableOwner depended) {
- // Remove the listener if necessary
+ // Removes the listener if necessary
if (dependencies != null && depended != null)
dependencies.remove(depended);
}
@@ -620,21 +670,24 @@ public abstract class AbstractComponent
}
}
- /** <p>Registers a new listener with the specified activation method to
+ /**
+ * <p>
+ * Registers a new listener with the specified activation method to
* listen events generated by this component. If the activation method
* does not have any arguments the event object will not be passed to it
- * when it's called.</p>
+ * when it's called.
+ * </p>
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType type of the listened event. Events of this type or
+ * @param eventType 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
- * @param method the activation method
- * @throws java.lang.IllegalArgumentException unless <code>method</code>
- * has exactly one match in <code>object</code>
+ * @param object the object instance who owns the activation method.
+ * @param method the activation method.
*/
public void addListener(Class eventType, Object object, Method method) {
if (eventRouter == null)
@@ -642,26 +695,31 @@ public abstract class AbstractComponent
eventRouter.addListener(eventType, object, method);
}
- /** <p>Registers a new listener with the specified activation method to
+ /**
+ * <p>
+ * Registers a new listener with the specified activation method to
* listen events generated by this component. If the activation method
* does not have any arguments the event object will not be passed to it
- * when it's called.</p>
+ * when it's called.
+ * </p>
*
- * <p>This version of <code>addListener</code> gets the name of the
+ * <p>
+ * 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>
+ * <code>java.lang.IllegalArgumentException</code> is thrown.
+ * </p>
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType type of the listened event. Events of this type or
+ * @param eventType 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
- * @param methodName the name of the activation method
- * @throws java.lang.IllegalArgumentException unless <code>method</code>
- * has exactly one match in <code>object</code>
+ * @param object the object instance who owns the activation method.
+ * @param methodName the name of the activation method.
*/
public void addListener(
Class eventType,
@@ -672,26 +730,30 @@ public abstract class AbstractComponent
eventRouter.addListener(eventType, object, methodName);
}
- /** Removes all registered listeners matching the given parameters.
+ /**
+ * 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.
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType exact event type the <code>object</code> listens to
- * @param target target object that has registered to listen to events
- * of type <code>eventType</code> with one or more methods
+ * @param eventType 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.
*/
public void removeListener(Class eventType, Object target) {
if (eventRouter != null)
eventRouter.removeListener(eventType, target);
}
- /** Removes one registered listener method. The given method owned by
+ /**
+ * Removes one registered listener method. The given method owned by
* the given object will no longer be called when the specified events
* are generated by this component.
*
@@ -699,35 +761,42 @@ public abstract class AbstractComponent
* see the
* {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
*
- * @param eventType exact event type the <code>object</code> listens to
+ * @param eventType the exact event type the <code>object</code> listens to.
* @param target target object that has registered to listen to events
- * of type <code>eventType</code> with one or more methods
+ * of type <code>eventType</code> with one or more methods.
* @param method the method owned by <code>target</code> that's
- * registered to listen to events of type <code>eventType</code>
+ * registered to listen to events of type <code>eventType</code>.
*/
public void removeListener(Class eventType, Object target, Method method) {
if (eventRouter != null)
eventRouter.removeListener(eventType, target, method);
}
- /** <p>Removes one registered listener method. The given method owned by
+ /**
+ * <p>
+ * Removes one registered listener method. The given method owned by
* the given object will no longer be called when the specified events
- * are generated by this component.</p>
+ * are generated by this component.
+ * </p>
*
- * <p>This version of <code>removeListener</code> gets the name of the
+ * <p>
+ * This version of <code>removeListener</code> gets the name of the
* activation method as a parameter. The actual method is reflected from
* <code>target</code>, and unless exactly one match is found,
- * <code>java.lang.IllegalArgumentException</code> is thrown.</p>
+ * <code>java.lang.IllegalArgumentException</code> is thrown.
+ * </p>
*
- * <p>For more information on the inheritable event mechanism
+ * <p>
+ * For more information on the inheritable event mechanism
* see the
- * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
+ * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
+ * </p>
*
- * @param eventType exact event type the <code>object</code> listens to
- * @param target target object that has registered to listen to events
- * of type <code>eventType</code> with one or more methods
- * @param methodName name of the method owned by <code>target</code>
- * that's registered to listen to events of type <code>eventType</code>
+ * @param eventType 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.
+ * @param methodName 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,
@@ -737,8 +806,9 @@ public abstract class AbstractComponent
eventRouter.removeListener(eventType, target, methodName);
}
- /** Send event to all listeners
- * @param event Event to be sent to all listeners
+ /**
+ * Sends the event to all listeners.
+ * @param event the Event to be sent to all listeners.
*/
protected void fireEvent(Component.Event event) {
@@ -779,32 +849,36 @@ public abstract class AbstractComponent
}
}
- /** Emits a component event. It is transmitted to all registered
+ /**
+ * Emits the component event. It is transmitted to all registered
* listeners interested in such events.
*/
protected void fireComponentEvent() {
fireEvent(new Component.Event(this));
}
- /** Emits a component error event. It is transmitted to all registered
+ /**
+ * Emits the component error event. It is transmitted to all registered
* listeners interested in such events.
*/
protected void fireComponentErrorEvent() {
fireEvent(new Component.ErrorEvent(this.getComponentError(),this));
}
- /** Sets application specific data object.
+ /**
+ * Sets the application specific data object.
*
- * @param data Application specific data.
+ * @param data the Application specific data.
* @since 3.1
*/
public void setData(Object data) {
this.applicationData = data;
}
- /** Gets application specific data.
+ /**
+ * Gets the application specific data.
*
- * @return Application specific data set with setData function.
+ * @return the Application specific data set with setData function.
* @since 3.1
*/
public Object getData() {
diff --git a/src/com/itmill/toolkit/ui/AbstractComponentContainer.java b/src/com/itmill/toolkit/ui/AbstractComponentContainer.java
index d8d86c1982..6bed25c26d 100644
--- a/src/com/itmill/toolkit/ui/AbstractComponentContainer.java
+++ b/src/com/itmill/toolkit/ui/AbstractComponentContainer.java
@@ -32,7 +32,8 @@ import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.Iterator;
-/** Extension to {@link AbstractComponent} that defines the default
+/**
+ * Extension to {@link AbstractComponent} that defines the default
* implementation for the methods in {@link ComponentContainer}. Basic UI
* components that need to contain other components inherit this class to
* easily qualify as a component container.
@@ -44,23 +45,26 @@ import java.util.Iterator;
public abstract class AbstractComponentContainer
extends AbstractComponent implements ComponentContainer {
- /** Constructs a new component container. */
+ /**
+ * Constructs a new component container.
+ */
public AbstractComponentContainer() {
super();
}
- /** Removes all components from the container. This should probably be
- * reimplemented in extending classes for a more powerfu
+ /**
+ * Removes all components from the container. This should probably be
+ * reimplemented in extending classes for a more powerfull
* implementation.
*/
public void removeAllComponents() {
LinkedList l = new LinkedList();
- // Add all components
+ // Adds all components
for (Iterator i = getComponentIterator(); i.hasNext();)
l.add(i.next());
- // Remove all component
+ // Removes all component
for (Iterator i = l.iterator(); i.hasNext();)
removeComponent((Component)i.next());
}
@@ -81,7 +85,8 @@ extends AbstractComponent implements ComponentContainer {
}
}
- /** Notifies all contained components that the container is attached to
+ /**
+ * Notifies all contained components that the container is attached to
* a window.
*
* @see com.itmill.toolkit.ui.Component#attach()
@@ -93,7 +98,8 @@ extends AbstractComponent implements ComponentContainer {
((Component)i.next()).attach();
}
- /** Notifies all contained components that the container is detached
+ /**
+ * Notifies all contained components that the container is detached
* from a window.
*
* @see com.itmill.toolkit.ui.Component#detach()
@@ -147,23 +153,26 @@ extends AbstractComponent implements ComponentContainer {
removeListener(ComponentContainer.ComponentDetachEvent.class, listener, COMPONENT_DETACHED_METHOD);
}
- /** Fire component attached event. This should be called by the addComponent
+ /**
+ * Fires the component attached event. This should be called by the addComponent
* methods after the component have been added to this container.
- * @param component The component that has been added to this container.
+ * @param component the component that has been added to this container.
*/
protected void fireComponentAttachEvent(Component component) {
fireEvent(new ComponentAttachEvent(this,component));
}
- /** Fire component detached event. This should be called by the removeComponent
+ /**
+ * Fires the component detached event. This should be called by the removeComponent
* methods after the component have been removed from this container.
- * @param component The component that has been removed from this container.
+ * @param component the component that has been removed from this container.
*/
protected void fireComponentDetachEvent(Component component) {
fireEvent(new ComponentAttachEvent(this,component));
}
- /** This only implements the events and component parent calls. The extending
+ /**
+ * This only implements the events and component parent calls. The extending
* classes must implement component list maintenance and call this method
* after component list maintenance.
* @see com.itmill.toolkit.ui.ComponentContainer#addComponent(Component)
@@ -173,7 +182,8 @@ extends AbstractComponent implements ComponentContainer {
fireComponentAttachEvent(c);
}
- /** This only implements the events and component parent calls. The extending
+ /**
+ * This only implements the events and component parent calls. The extending
* classes must implement component list maintenance and call this method
* before component list maintenance.
* @see com.itmill.toolkit.ui.ComponentContainer#removeComponent(Component)
diff --git a/src/com/itmill/toolkit/ui/AbstractField.java b/src/com/itmill/toolkit/ui/AbstractField.java
index 0f92adaf18..2e1f7983b6 100644
--- a/src/com/itmill/toolkit/ui/AbstractField.java
+++ b/src/com/itmill/toolkit/ui/AbstractField.java
@@ -76,40 +76,64 @@ public abstract class AbstractField extends AbstractComponent implements Field,
private boolean delayedFocus;
- /** Value of the datafield */
+ /**
+ * Value of the datafield.
+ */
private Object value;
- /** Connected data-source. */
+ /**
+ * Connected data-source.
+ */
private Property dataSource = null;
- /** The list of validators. */
+ /**
+ * The list of validators.
+ */
private LinkedList validators = null;
- /** Auto commit mode. */
+ /**
+ * Auto commit mode.
+ */
private boolean writeTroughMode = true;
- /** Read the value from data-source, when it is not modified. */
+ /**
+ * Reads the value from data-source, when it is not modified.
+ */
private boolean readTroughMode = true;
- /** Is the field modified but not committed. */
+ /**
+ * Is the field modified but not committed.
+ */
private boolean modified = false;
- /** Current source exception */
+ /**
+ * Current source exception.
+ */
private Buffered.SourceException currentBufferedSourceException = null;
- /** Are the invalid values alloved in fields ? */
+ /**
+ * Are the invalid values alloved in fields ?
+ */
private boolean invalidAllowed = true;
- /** Are the invalid values committed */
+ /**
+ * Are the invalid values committed ?
+ */
private boolean invalidCommitted = false;
- /** The tab order number of this field */
+ /**
+ * The tab order number of this field.
+ */
private int tabIndex = 0;
- /** Unique focusable id */
+ /**
+ * Unique focusable id.
+ */
private long focusableId = -1;
- /** Required field */
+ /**
+ * Required field.
+ */
private boolean required = false;
/* Component basics ************************************************ */
@@ -119,7 +143,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Paint the field. Don't add a JavaDoc comment here, we use the default
+ * Paints the field. Don't add a JavaDoc comment here, we use the default
* documentation from the implemented interface.
*/
public void paintContent(PaintTarget target) throws PaintException {
@@ -137,7 +161,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
if (isModified())
target.addAttribute("modified", true);
- // Add required attribute
+ // Adds the required attribute
if (isRequired())
target.addAttribute("required", true);
@@ -159,7 +183,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
- * Change the readonly state and throw read-only status change events.
+ * Changes the readonly state and throw read-only status change events.
*
* @see com.itmill.toolkit.ui.Component#setReadOnly(boolean)
*/
@@ -168,18 +192,24 @@ public abstract class AbstractField extends AbstractComponent implements Field,
fireReadOnlyStatusChange();
}
- /* Buffering ******************************************************* */
-
+ /**
+ * Tests if the invalid data is committed to datasource.
+ * @see com.itmill.toolkit.data.BufferedValidatable#isInvalidCommitted()
+ */
public boolean isInvalidCommitted() {
return invalidCommitted;
}
-
+
+ /**
+ * Sets if the invalid data should be committed to datasource.
+ * @see com.itmill.toolkit.data.BufferedValidatable#setInvalidCommitted(boolean)
+ */
public void setInvalidCommitted(boolean isCommitted) {
this.invalidCommitted = isCommitted;
}
/*
- * Save the current value to the data source Don't add a JavaDoc comment
+ * Saves the current value to the data source Don't add a JavaDoc comment
* here, we use the default documentation from the implemented interface.
*/
public void commit() throws Buffered.SourceException {
@@ -188,17 +218,17 @@ public abstract class AbstractField extends AbstractComponent implements Field,
Object newValue = getValue();
try {
- // Commit the value to datasource
+ // Commits the value to datasource.
dataSource.setValue(newValue);
} catch (Throwable e) {
- // Set the buffering state
+ // Sets the buffering state.
currentBufferedSourceException = new Buffered.SourceException(
this, e);
requestRepaint();
- // Throw the source exception
+ // Throws the source exception.
throw currentBufferedSourceException;
}
}
@@ -222,17 +252,17 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Update the value from the data source. Don't add a JavaDoc comment here,
+ * Updates the value from the data source. Don't add a JavaDoc comment here,
* we use the default documentation from the implemented interface.
*/
public void discard() throws Buffered.SourceException {
if (dataSource != null) {
- // Get the correct value from datasource
+ // Gets the correct value from datasource
Object newValue;
try {
- // Discard buffer by overwriting from datasource
+ // Discards buffer by overwriting from datasource
newValue = dataSource.getValue();
// If successful, remove set the buffering state to be ok
@@ -242,12 +272,12 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
} catch (Throwable e) {
- // Set the buffering state
+ // Sets the buffering state
currentBufferedSourceException = new Buffered.SourceException(
this, e);
requestRepaint();
- // Throw the source exception
+ // Throws the source exception
throw currentBufferedSourceException;
}
@@ -278,7 +308,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Test if the field is in write-through mode. Don't add a JavaDoc comment
+ * Tests if the field is in write-through mode. Don't add a JavaDoc comment
* here, we use the default documentation from the implemented interface.
*/
public boolean isWriteThrough() {
@@ -286,7 +316,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Set the field's write-through mode to the specified status Don't add a
+ * Sets the field's write-through mode to the specified status Don't add a
* JavaDoc comment here, we use the default documentation from the
* implemented interface.
*/
@@ -300,7 +330,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Test if the field is in read-through mode. Don't add a JavaDoc comment
+ * Tests if the field is in read-through mode. Don't add a JavaDoc comment
* here, we use the default documentation from the implemented interface.
*/
public boolean isReadThrough() {
@@ -308,7 +338,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Set the field's read-through mode to the specified status Don't add a
+ * Sets the field's read-through mode to the specified status Don't add a
* JavaDoc comment here, we use the default documentation from the
* implemented interface.
*/
@@ -324,13 +354,11 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/* Property interface implementation ******************************* */
-
- /**
- * Returns the value of the Property in human readable textual format.
- *
- * @return <code>String</code> representation of the value stored in the
- * Property
- */
+
+ /**
+ * Returns the value of the Property in human readable textual format.
+ * @see java.lang.Object#toString()
+ */
public String toString() {
Object value = getValue();
if (value == null)
@@ -344,7 +372,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
* read-through mode, the abstract buffer is also updated and validation is
* performed.
*
- * @return the current value of the field
+ * @return the current value of the field.
*/
public Object getValue() {
@@ -363,10 +391,12 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
- * Set the value of the field.
+ * Sets the value of the field.
*
* @param newValue
- * New value of the field.
+ * the New value of the field.
+ * @throws Property.ReadOnlyException
+ * @throws Property.ConversionException
*/
public void setValue(Object newValue) throws Property.ReadOnlyException,
Property.ConversionException {
@@ -386,7 +416,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
((Validator) i.next()).validate(newValue);
}
- // Change the value
+ // Changes the value
setInternalValue(newValue);
modified = dataSource != null;
@@ -395,7 +425,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
&& (isInvalidCommitted() || isValid())) {
try {
- // Commit the value to datasource
+ // Commits the value to datasource
dataSource.setValue(newValue);
// The buffer is now unmodified
@@ -403,12 +433,12 @@ public abstract class AbstractField extends AbstractComponent implements Field,
} catch (Throwable e) {
- // Set the buffering state
+ // Sets the buffering state
currentBufferedSourceException = new Buffered.SourceException(
this, e);
requestRepaint();
- // Throw the source exception
+ // Throws the source exception
throw currentBufferedSourceException;
}
}
@@ -419,7 +449,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
requestRepaint();
}
- // Fire value change
+ // Fires the value change
fireValueChange();
}
}
@@ -429,7 +459,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
/**
* Gets the current data source of the field, if any.
*
- * @return The current data source as a Property, or <code>null</code> if
+ * @return the current data source as a Property, or <code>null</code> if
* none defined.
*/
public Property getPropertyDataSource() {
@@ -453,29 +483,29 @@ public abstract class AbstractField extends AbstractComponent implements Field,
* </p>
*
* @param newDataSource
- * the new data source Property
+ * the new data source Property.
*/
public void setPropertyDataSource(Property newDataSource) {
- // Save the old value
+ // Saves the old value
Object oldValue = value;
- // Discard all changes to old datasource
+ // Discards all changes to old datasource
try {
discard();
} catch (Buffered.SourceException ignored) {
}
- // Stop listening the old data source changes
+ // Stops listening the old data source changes
if (dataSource != null
&& Property.ValueChangeNotifier.class
.isAssignableFrom(dataSource.getClass()))
((Property.ValueChangeNotifier) dataSource).removeListener(this);
- // Set the new data source
+ // Sets the new data source
dataSource = newDataSource;
- // Get the value from source
+ // Gets the value from source
try {
if (dataSource != null)
setInternalValue(dataSource.getValue());
@@ -486,7 +516,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
modified = true;
}
- // Listen the new data source if possible
+ // Listens the new data source if possible
if (dataSource instanceof Property.ValueChangeNotifier)
((Property.ValueChangeNotifier) dataSource).addListener(this);
@@ -498,7 +528,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
addValidator((Validator) i.next());
}
- // Fire value change if the value has changed
+ // Fires value change if the value has changed
if ((value != oldValue)
&& ((value != null && !value.equals(oldValue)) || value == null))
fireValueChange();
@@ -511,7 +541,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
* field are checked each time the its value changes.
*
* @param validator
- * the new validator to be added
+ * the new validator to be added.
*/
public void addValidator(Validator validator) {
if (validators == null)
@@ -522,7 +552,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
/**
* Gets the validators of the field.
*
- * @return Unmodifiable collection that holds all validators for the field.
+ * @return the Unmodifiable collection that holds all validators for the field.
*/
public Collection getValidators() {
if (validators == null || validators.isEmpty())
@@ -531,10 +561,10 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
- * Removes a validator from the field.
+ * Removes the validator from the field.
*
* @param validator
- * the validator to remove
+ * the validator to remove.
*/
public void removeValidator(Validator validator) {
if (validators != null)
@@ -545,7 +575,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
* Tests the current value against all registered validators.
*
* @return <code>true</code> if all registered validators claim that the
- * current value is valid, <code>false</code> otherwise
+ * current value is valid, <code>false</code> otherwise.
*/
public boolean isValid() {
@@ -559,7 +589,11 @@ public abstract class AbstractField extends AbstractComponent implements Field,
return true;
}
-
+
+ /**
+ * Checks the validity of the validatable
+ * @see com.itmill.toolkit.data.Validatable#validate()
+ */
public void validate() throws Validator.InvalidValueException {
// If there is no validator, there can not be any errors
@@ -571,7 +605,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
LinkedList errors = null;
Object value = getValue();
- // Get all the validation errors
+ // Gets all the validation errors
for (Iterator i = validators.iterator(); i.hasNext();)
try {
((Validator) i.next()).validate(value);
@@ -595,7 +629,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
if (errors == null)
throw firstError;
- // Create composite validator
+ // Creates composite validator
Validator.InvalidValueException[] exceptions = new Validator.InvalidValueException[errors
.size()];
int index = 0;
@@ -608,10 +642,8 @@ public abstract class AbstractField extends AbstractComponent implements Field,
/**
* Fields allow invalid values by default. In most cases this is wanted,
* because the field otherwise visually forget the user input immediately.
- *
- * @see com.itmill.toolkit.data.Validatable#isInvalidAllowed()
- *
* @return true iff the invalid values are allowed.
+ * @see com.itmill.toolkit.data.Validatable#isInvalidAllowed()
*/
public boolean isInvalidAllowed() {
return invalidAllowed;
@@ -620,12 +652,13 @@ public abstract class AbstractField extends AbstractComponent implements Field,
/**
* Fields allow invalid values by default. In most cases this is wanted,
* because the field otherwise visually forget the user input immediately.
+ * <p>
* In common setting where the user wants to assure the correctness of the
* datasource, but allow temporarily invalid contents in the field, the user
* should add the validators to datasource, that should not allow invalid
* values. The validators are automatically copied to the field when the
* datasource is set.
- *
+ * </p>
* @see com.itmill.toolkit.data.Validatable#setInvalidAllowed(boolean)
*/
public void setInvalidAllowed(boolean invalidAllowed)
@@ -673,7 +706,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Add a value change listener for the field. Don't add a JavaDoc comment
+ * Adds a value change listener for the field. Don't add a JavaDoc comment
* here, we use the default documentation from the implemented interface.
*/
public void addListener(Property.ValueChangeListener listener) {
@@ -682,7 +715,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Remove a value change listener from the field. Don't add a JavaDoc
+ * Removes a value change listener from the field. Don't add a JavaDoc
* comment here, we use the default documentation from the implemented
* interface.
*/
@@ -692,7 +725,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
- * Emit a value change event. The value contained in the field is validated
+ * Emits the value change event. The value contained in the field is validated
* before the event is created.
*/
protected void fireValueChange() {
@@ -734,19 +767,19 @@ public abstract class AbstractField extends AbstractComponent implements Field,
private static final long serialVersionUID = 3258688823264161846L;
/**
- * New instance of text change event
+ * New instance of text change event.
*
* @param source
- * Source of the event.
+ * the Source of the event.
*/
public ReadOnlyStatusChangeEvent(AbstractField source) {
super(source);
}
/**
- * Property where the event occurred
+ * Property where the event occurred.
*
- * @return Source of the event.
+ * @return the Source of the event.
*/
public Property getProperty() {
return (Property) getSource();
@@ -754,7 +787,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/*
- * Add a read-only status change listener for the field. Don't add a JavaDoc
+ * Adds a read-only status change listener for the field. Don't add a JavaDoc
* comment here, we use the default documentation from the implemented
* interface.
*/
@@ -774,7 +807,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
- * Emit a read-only status change event. The value contained in the field is
+ * Emits the read-only status change event. The value contained in the field is
* validated before the event is created.
*/
protected void fireReadOnlyStatusChange() {
@@ -787,14 +820,16 @@ public abstract class AbstractField extends AbstractComponent implements Field,
*
* @param event
* the value change event telling the data source contents have
- * changed
+ * changed.
*/
public void valueChange(Property.ValueChangeEvent event) {
if (isReadThrough() || !isModified())
fireValueChange();
}
- /** Ask the terminal to place the cursor to this field. */
+ /**
+ * Asks the terminal to place the cursor to this field.
+ */
public void focus() {
Window w = getWindow();
if (w != null) {
@@ -805,14 +840,14 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
- * Create abstract field by the type of the property.
+ * Creates abstract field by the type of the property.
*
* <p>
- * This returns most suitable field type for editing property of given type
+ * This returns most suitable field type for editing property of given type.
* </p>
*
* @param propertyType
- * Type of the property, that needs to be edited.
+ * the Type of the property, that needs to be edited.
*/
public static AbstractField constructField(Class propertyType) {
@@ -838,21 +873,21 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
- * Get the tab index of this field. The tab index property is used to
+ * Gets the tab index of this field. The tab index property is used to
* specify the natural tab ordering of fields.
*
- * @return Tab index of this field. Negative value means unspecified.
+ * @return the Tab index of this field. Negative value means unspecified.
*/
public int getTabIndex() {
return tabIndex;
}
/**
- * Get the tab index of this field. The tab index property is used to
+ * Gets the tab index of this field. The tab index property is used to
* specify the natural tab ordering of fields.
*
* @param tabIndex
- * The tab order of this component. Negative value means
+ * the tab order of this component. Negative value means
* unspecified.
*/
public void setTabIndex(int tabIndex) {
@@ -860,18 +895,19 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
- * Set the internal field value. This is purely used by AbstractField to
+ * Sets the internal field value. This is purely used by AbstractField to
* change the internal Field value. It does not trigger any events. It can
* be overriden by the inheriting classes to update all dependent variables.
*
* @param newValue
- * The new value to be set.
+ * the new value to be set.
*/
protected void setInternalValue(Object newValue) {
this.value = newValue;
}
/**
+ * Gets the unique ID of focusable
* @see com.itmill.toolkit.ui.Component.Focusable#getFocusableId()
*/
public long getFocusableId() {
@@ -879,6 +915,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
/**
+ * Notifies the component that it is connected to an application.
* @see com.itmill.toolkit.ui.Component#attach()
*/
public void attach() {
@@ -891,20 +928,19 @@ public abstract class AbstractField extends AbstractComponent implements Field,
/**
* Is this field required.
- *
* Required fields must filled by the user.
*
- * @return true if the
+ * @return <code>true</code> if the field is required .otherwise <code>false</code>.
*/
public boolean isRequired() {
return required;
}
/**
- * Set the field required. Required fields must filled by the user.
+ * Sets the field required. Required fields must filled by the user.
*
* @param required
- * Is the field required
+ * Is the field required.
*/
public void setRequired(boolean required) {
this.required = required;
@@ -912,6 +948,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
/**
* Free used resources.
+ * @see java.lang.Object#finalize()
*/
public void finalize() throws Throwable {
if (focusableId > -1) {
diff --git a/src/com/itmill/toolkit/ui/BaseFieldFactory.java b/src/com/itmill/toolkit/ui/BaseFieldFactory.java
index 4a4224da3e..dba1c5cec2 100644
--- a/src/com/itmill/toolkit/ui/BaseFieldFactory.java
+++ b/src/com/itmill/toolkit/ui/BaseFieldFactory.java
@@ -34,16 +34,14 @@ import com.itmill.toolkit.data.Container;
import com.itmill.toolkit.data.Item;
import com.itmill.toolkit.data.Property;
-/** Default implementation of the
-
- *
- *
- * The following Field types are used by default:
+/**
+ * Default implementation of the
+ * the following Field types are used by default:
* <p>
- * <b>Boolean</b>: Button(switchMode:true)<br/>
- * <b>Date</b>: DateField(resolution: day)
- * <b>Item</b>: Form<br/>
- * <b>default field type</b>: TextField
+ * <b>Boolean</b>: Button(switchMode:true).<br/>
+ * <b>Date</b>: DateField(resolution: day).<br/>
+ * <b>Item</b>: Form. <br/>
+ * <b>default field type</b>: TextField.
* <p>
* @author IT Mill Ltd.
* @version @VERSION@
@@ -52,11 +50,12 @@ import com.itmill.toolkit.data.Property;
public class BaseFieldFactory implements FieldFactory {
- /** Creates field based on type of data.
+ /**
+ * Creates the field based on type of data.
*
*
- * @param type The type of data presented in field
- * @param uiContext The context where the Field is presented.
+ * @param type the type of data presented in field.
+ * @param uiContext the context where the Field is presented.
*
* @see com.itmill.toolkit.ui.FieldFactory#createField(Class, Component)
*/
@@ -90,7 +89,8 @@ public class BaseFieldFactory implements FieldFactory {
return new TextField();
}
- /** Create field based on the datasource property.
+ /**
+ * Creates the field based on the datasource property.
*
* @see com.itmill.toolkit.ui.FieldFactory#createField(Property, Component)
*/
@@ -101,7 +101,8 @@ public class BaseFieldFactory implements FieldFactory {
return null;
}
- /** Creates field based on the item and property id.
+ /**
+ * Creates the field based on the item and property id.
*
* @see com.itmill.toolkit.ui.FieldFactory#createField(Item, Object, Component)
*/
diff --git a/src/com/itmill/toolkit/ui/Button.java b/src/com/itmill/toolkit/ui/Button.java
index b357971b0d..c9cba2e706 100644
--- a/src/com/itmill/toolkit/ui/Button.java
+++ b/src/com/itmill/toolkit/ui/Button.java
@@ -44,8 +44,8 @@ import com.itmill.toolkit.terminal.KeyMapper;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
-
-/** A generic button component.
+/**
+ * A generic button component.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -63,9 +63,8 @@ public class Button extends AbstractField implements Action.Container {
/** Action mapper */
private KeyMapper actionMapper = null;
-
- /** Creates a new push button.
- *
+ /**
+ * Creates the new push button.
* The value of the push button is allways false and they are
* immediate by default.
*
@@ -74,42 +73,47 @@ public class Button extends AbstractField implements Action.Container {
setSwitchMode(false);
}
- /** Creates a new push button.
+ /**
+ * Creates the new push button.
*
* The value of the push button is allways false and they are
* immediate by default.
*
- * @param caption Button caption
+ * @param caption the Button caption.
*/
public Button(String caption) {
setCaption(caption);
setSwitchMode(false);
}
- /** Creates a new push button with click listener.
- * @param caption Button caption
- * @param listener Button click listener
+ /**
+ * Creates the new push button with click listener.
+ * @param caption the Button caption.
+ * @param listener the Button click listener.
*/
public Button(String caption, ClickListener listener) {
this(caption);
addListener(listener);
}
- /** Creates a new push button with a method listening button clicks.
+ /**
+ * Creates the new push button with a method listening button clicks.
* The method must have either no parameters, or only one parameter of
* Button.ClickEvent type.
- * @param caption Button caption
- * @param target Object having the method for listening button clicks
- * @param methodName The name of the method in target object, that
- * receives button click events.
+ * @param caption the Button caption.
+ * @param target the Object having the method for listening button clicks.
+ * @param methodName the name of the method in target object, that
+ * receives button click events.
*/
public Button(String caption, Object target, String methodName) {
this(caption);
addListener(ClickEvent.class, target, methodName);
}
- /** Creates new switch button with initial value.
- * @param state Initial state of the switch-button.
+ /**
+ * Creates the new switch button with initial value.
+ * @param state the Initial state of the switch-button.
+ * @param initialState
*/
public Button(String caption, boolean initialState) {
setCaption(caption);
@@ -117,8 +121,10 @@ public class Button extends AbstractField implements Action.Container {
setSwitchMode(true);
}
- /** Creates new switch button that is connected to a boolean property.
- * @param state Initial state of the switch-button.
+ /**
+ * Creates the new switch button that is connected to a boolean property.
+ * @param state the Initial state of the switch-button.
+ * @param dataSource
*/
public Button(String caption, Property dataSource) {
setCaption(caption);
@@ -126,17 +132,19 @@ public class Button extends AbstractField implements Action.Container {
setPropertyDataSource(dataSource);
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Gets component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "button";
}
- /** Paint the content of this component.
- * @param event PaintEvent.
- * @throws IOException Passed from the UIDLStream.
- * @throws PaintException The paint operation failed.
+ /**
+ * Paints the content of this component.
+ * @param event the PaintEvent.
+ * @throws IOException if the writing failed due to input/output error.
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
@@ -195,13 +203,15 @@ public class Button extends AbstractField implements Action.Container {
}
}
- /** Invoked when the value of a variable has changed. Button
+ /**
+ * Invoked when the value of a variable has changed. Button
* listeners are notified if the button is clicked.
- * @param event Variable change event.
+ * @param source
+ * @param variables
*/
public void changeVariables(Object source, Map variables) {
if (variables.containsKey("state")) {
- // Get the new and old button states
+ // Gets the new and old button states
Boolean newValue = (Boolean) variables.get("state");
Boolean oldValue = (Boolean) getValue();
@@ -249,8 +259,8 @@ public class Button extends AbstractField implements Action.Container {
}
/**
- * Returns the switchMode.
- * @return boolean
+ * Checks if it is switchMode.
+ * @return <code>true</code> if it is in Switch Mode, otherwise <code>false</code>.
*/
public boolean isSwitchMode() {
return switchMode;
@@ -258,7 +268,7 @@ public class Button extends AbstractField implements Action.Container {
/**
* Sets the switchMode.
- * @param switchMode The switchMode to set
+ * @param switchMode The switchMode to set.
*/
public void setSwitchMode(boolean switchMode) {
this.switchMode = switchMode;
@@ -268,19 +278,20 @@ public class Button extends AbstractField implements Action.Container {
}
}
- /** Set immediate mode.
- * @see com.itmill.toolkit.ui.AbstractComponent#setImmediate(boolean)
- *
- * Push buttons can not be set in non-immediate mode.
- */
+ /**
+ * Sets immediate mode.
+ * Push buttons can not be set in non-immediate mode.
+ * @see com.itmill.toolkit.ui.AbstractComponent#setImmediate(boolean)
+ */
public void setImmediate(boolean immediate) {
// Push buttons are allways immediate
super.setImmediate(!isSwitchMode() || immediate);
}
- /** The type of the button as a property.
- * @see com.itmill.toolkit.data.Property#getType()
- */
+ /**
+ * The type of the button as a property.
+ * @see com.itmill.toolkit.data.Property#getType()
+ */
public Class getType() {
return Boolean.class;
}
@@ -300,10 +311,11 @@ public class Button extends AbstractField implements Action.Container {
}
}
- /** Click event. This event is thrown, when the button is clicked.
+ /**
+ * Click event. This event is thrown, when the button is clicked.
* @author IT Mill Ltd.
- * @version @VERSION@
- * @since 3.0
+ * @version @VERSION@
+ * @since 3.0
*/
public class ClickEvent extends Component.Event {
@@ -312,49 +324,57 @@ public class Button extends AbstractField implements Action.Container {
*/
private static final long serialVersionUID = 3546647602931118393L;
- /** New instance of text change event
- * @param source Source of the event.
- */
+ /**
+ * New instance of text change event.
+ * @param source the Source of the event.
+ */
public ClickEvent(Component source) {
super(source);
}
- /** Button where the event occurred
- * @return Source of the event.
+ /**
+ * Gets the Button where the event occurred.
+ * @return the Source of the event.
*/
public Button getButton() {
return (Button) getSource();
}
}
- /** Button click listener
+ /**
+ * Button click listener
* @author IT Mill Ltd.
- * @version @VERSION@
- * @since 3.0
+ * @version @VERSION@
+ * @since 3.0
*/
public interface ClickListener {
- /** Button has been pressed.
+ /**
+ * Button has been pressed.
* @param event Button click event.
*/
public void buttonClick(ClickEvent event);
}
- /** Add button click listener
- * @param listener Listener to be added.
- */
+ /**
+ * Adds the button click listener.
+ * @param listener the Listener to be added.
+ */
public void addListener(ClickListener listener) {
addListener(ClickEvent.class, listener, BUTTON_CLICK_METHOD);
}
- /** Remove button click listener
- * @param listener Listener to be removed.
- */
+ /**
+ * Removes the button click listener.
+ * @param listener the Listener to be removed.
+ */
public void removeListener(ClickListener listener) {
removeListener(ClickEvent.class, listener, BUTTON_CLICK_METHOD);
}
- /** Emit options change event. */
+ /**
+ * Emits the options change event.
+ */
protected void fireClick() {
fireEvent(new Button.ClickEvent(this));
}
diff --git a/src/com/itmill/toolkit/ui/Component.java b/src/com/itmill/toolkit/ui/Component.java
index 7626ef3566..d0dba99e37 100644
--- a/src/com/itmill/toolkit/ui/Component.java
+++ b/src/com/itmill/toolkit/ui/Component.java
@@ -39,8 +39,9 @@ import java.util.EventListener;
import java.util.EventObject;
import java.util.Locale;
-/** The top-level component interface which must be implemented by all
- * UI components that use IT Mill Toolkit
+/**
+ * The top-level component interface which must be implemented by all
+ * UI components that use IT Mill Toolkit.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -48,43 +49,50 @@ import java.util.Locale;
*/
public interface Component extends Paintable, VariableOwner {
- /** Gets the look-and-feel style of the component.
+ /**
+ * Gets the look-and-feel style of the component.
*
- * @return component's styleValue of property style.
+ * @return the component's styleValue of property style.
*/
public String getStyle();
- /** Sets the look-and-feel style of the component. This method will
+ /**
+ * Sets the look-and-feel style of the component. This method will
* trigger a {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
- * .
- * @param style new style of the component
+ *
+ * @param style the new style of the component.
*/
public void setStyle(String style);
- /** <p>Tests if the component is enabled or not. All the variable
+ /**
+ * <p>
+ * Tests if the component is enabled or not. All the variable
* change events are blocked from disabled components. Also the
* component should visually indicate that it is disabled (by shading
* the component for example).
- * All hidden (isVisible() == false) components must return false.</p>
+ * All hidden (isVisible() == false) components must return false.
+ * </p>
*
* <p>Components should be enabled by default.</p>
*
* @return <code>true</code> if the component is enabled,
- * <code>false</code> if not
+ * <code>false</code> if not.
* @see VariableOwner#isEnabled()
*/
public boolean isEnabled();
- /** Enable or disable the component. Being enabled means that the
+ /**
+ * 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}.
*
- * @param enabled boolean value specifying if the component should be
+ * @param enabled the boolean value specifying if the component should be
* enabled after the call or not
*/
public void setEnabled(boolean enabled);
- /** Tests if the component is visible or not. Visibility defines if the
+ /**
+ * Tests if the component is visible or not. Visibility defines if the
* component is shown in the UI or not. Default is <code>true</code>.
*
* @return <code>true</code> if the component is visible in the UI,
@@ -92,22 +100,25 @@ public interface Component extends Paintable, VariableOwner {
*/
public boolean isVisible();
- /** Sets the components visibility status. Visibility defines if the
+ /**
+ * Sets the components visibility status. Visibility defines if the
* component is shown in the UI or not.
*
- * @param visible Boolean value specifying if the component should be
- * visible after the call or not
+ * @param visible the Boolean value specifying if the component should be
+ * visible after the call or not.
*/
public void setVisible(boolean visible);
- /** Gets the visual parent of the component. The components can be
+ /**
+ * Gets the visual parent of the component. The components can be
* nested but one component can have only one parent.
*
- * @return the parent component
+ * @return the parent component.
*/
public Component getParent();
- /** Sets the component's parent component.
+ /**
+ * Sets the component's parent component.
*
* <p>This method calls
* automatically {@link #attach()} if the parent is attached to a
@@ -119,58 +130,66 @@ public interface Component extends Paintable, VariableOwner {
* {@link ComponentContainer#addComponent(Component)} method is used
* to add components to container, which call this method implicitly.
*
- * @param parent the new parent component
+ * @param parent the new parent component.
*/
public void setParent(Component parent);
- /** Tests if the component is in read-only mode.
+ /**
+ * Tests if the component is in read-only mode.
*
* @return <code>true</code> if the component is in read-only mode,
- * <code>false</code> if not
+ * <code>false</code> if not.
*/
public boolean isReadOnly();
- /** Sets the component's to read-only mode to the specified state. This
+ /**
+ * 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}.
*
- * @param readOnly boolean value specifying if the component should be
- * in read-only mode after the call or not
+ * @param readOnly the boolean value specifying if the component should be
+ * in read-only mode after the call or not.
*/
public void setReadOnly(boolean readOnly);
- /** Gets the caption of the component. Caption is the visible name of
+ /**
+ * Gets the caption of the component. Caption is the visible name of
* the component.
*
- * @return component's caption <code>String</code>
+ * @return the component's caption <code>String</code>.
*/
public String getCaption();
- /** Gets the component's icon. A component may have a graphical icon
+ /**
+ * Gets the component's icon. A component may have a graphical icon
* associated with it, this method retrieves it if it is defined.
*
* @return the component's icon or <code>null</code> if it not defined.
*/
public Resource getIcon();
- /** Gets the component's parent window. If the component does not yet
+ /**
+ * Gets the component's parent window. If the component does not yet
* belong to a window <code>null</code> is returned.
*
- * @return parent window of the component or <code>null</code>
+ * @return the parent window of the component or <code>null</code>.
*/
public Window getWindow();
- /** Gets the component's parent application. If the component does not
+ /**
+ * Gets the component's parent application. If the component does not
* yet belong to a application <code>null</code> is returned.
*
- * @return parent application of the component or <code>null</code>
+ * @return the parent application of the component or <code>null</code>.
*/
public Application getApplication();
- /** Notifies the component that it is connected to an application. This
+ /**
+ * <p>
+ * 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> functions might return <code>null</code>
+ * 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.</p>
*
* <p>The caller of this method is {@link #setParent(Component)} if the
@@ -180,7 +199,8 @@ public interface Component extends Paintable, VariableOwner {
*/
public void attach();
- /** Notifies the component that it is detached from the application.
+ /**
+ * Notifies the component that it is detached from the application.
* <p>The {@link #getApplication()} and {@link #getWindow()}
* methods might return <code>null</code> after this method is
* called.</p>
@@ -192,31 +212,35 @@ public interface Component extends Paintable, VariableOwner {
*/
public void detach();
- /** Gets the locale of this component.
+ /**
+ * Gets the locale of this component.
*
* @return This component's locale. If this component does not have a
* locale, the locale of its parent is returned. Eventually locale
* of application is returned. If application does not have its own
- * locale the locale is determined by Locale.getDefautl(). Returns
+ * locale the locale is determined by <code>Locale.getDefautlt</code>. Returns
* null if the component does not have its own locale and has not
* yet been added to a containment hierarchy such that the locale
* can be determined from the containing parent.
*/
public Locale getLocale();
- /** The children must call this method when they need repainting. The call must be
+ /**
+ * The children must call this method when they need repainting. The call must be
* made event in the case the children sent the repaint request themselves.
- * @param alreadyNotified A 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.
+ * @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.
*/
public void childRequestedRepaint(Collection alreadyNotified);
/* Component event framework *************************************** */
- /** Superclass of all component originated <code>Event</code>s. */
+ /**
+ * Superclass of all component originated <code>Event</code>s.
+ */
public class Event extends EventObject {
/**
@@ -224,39 +248,47 @@ public interface Component extends Paintable, VariableOwner {
*/
private static final long serialVersionUID = 4048791277653274933L;
- /** Constructs a new event with a specified source component.
+ /**
+ * Constructs a new event with a specified source component.
*
- * @param source source component of the event
+ * @param source the source component of the event.
*/
public Event(Component source) {
super(source);
}
}
- /** Listener interface for receiving <code>Component.Event</code>s */
+ /**
+ * Listener interface for receiving <code>Component.Event</code>s.
+ */
public interface Listener extends EventListener {
- /** Notifies the listener of a component event.
+ /**
+ * Notifies the listener of a component event.
*
- * @param event the event that has occured
+ * @param event the event that has occured.
*/
public void componentEvent(Component.Event event);
}
- /** Registers a new component event listener for this component.
+ /**
+ * Registers a new component event listener for this component.
*
- * @param listener the new Listener to be registered
+ * @param listener the new Listener to be registered.
*/
public void addListener(Component.Listener listener);
- /** Removes a previously registered component event listener from this
+ /**
+ * Removes a previously registered component event listener from this
* component.
*
- * @param listener the listener to be removed
+ * @param listener the listener to be removed.
*/
public void removeListener(Component.Listener listener);
- /** Class of all component originated <code>ErrorEvent</code>s. */
+ /**
+ * Class of all component originated <code>ErrorEvent</code>s.
+ */
public class ErrorEvent extends Event {
/**
@@ -266,10 +298,11 @@ public interface Component extends Paintable, VariableOwner {
private ErrorMessage message;
- /** Constructs a new event with a specified source component.
- *
- * @param source source component of the event
- */
+ /**
+ * Constructs a new event with a specified source component.
+ * @param message the error message.
+ * @param component the source component.
+ */
public ErrorEvent(
ErrorMessage message,
Component component) {
@@ -277,44 +310,56 @@ public interface Component extends Paintable, VariableOwner {
this.message = message;
}
- /** Return the error message */
+ /**
+ * Gets the error message.
+ * @return the error message.
+ */
public ErrorMessage getErrorMessage() {
return this.message;
}
}
- /** Listener interface for receiving <code>Component.Errors</code>s */
+ /**
+ * Listener interface for receiving <code>Component.Errors</code>s.
+ */
public interface ErrorListener extends EventListener {
- /** Notifies the listener of a component error.
- *
- * @param event the event that has occured
- */
+ /**
+ * Notifies the listener of a component error.
+ * @param event the event that has occured.
+ */
public void componentError(Component.ErrorEvent event);
}
- /** Interface implemented by components which can obtain input focus. */
+ /**
+ * Interface implemented by components which can obtain input focus.
+ */
public interface Focusable {
- /** Set focus to this component.*/
+ /**
+ * Sets the focus to this component.
+ */
public void focus();
- /** Get Tabulator index of this Focusable component.
- * @return Positive tab order of this focusable. Negative of zero means
+ /**
+ * Gets the Tabulator index of this Focusable component.
+ * @return the Positive tab order of this focusable. Negative of zero means
* unspecified tab order.
*/
public int getTabIndex();
- /** Set Tabulator index of this Focusable component.
- * @param tabIndex Positive tab order of this focusable. Negative of
+ /**
+ * Sets the Tabulator index of this Focusable component.
+ * @param tabIndex the Positive tab order of this focusable. Negative of
* zero means unspecified tab order.
*/
public void setTabIndex(int tabIndex);
- /** Get unique ID of focusable.
- * This will be used to move input focus directly to this
- * component.
- * @return Unique id of focusable.
+ /**
+ * Gets the unique ID of focusable.
+ * This will be used to move input focus directly to this
+ * component.
+ * @return the Unique id of focusable.
*/
public long getFocusableId();
diff --git a/src/com/itmill/toolkit/ui/ComponentContainer.java b/src/com/itmill/toolkit/ui/ComponentContainer.java
index d6d44049f4..bd8c5d1c7f 100644
--- a/src/com/itmill/toolkit/ui/ComponentContainer.java
+++ b/src/com/itmill/toolkit/ui/ComponentContainer.java
@@ -30,7 +30,8 @@ package com.itmill.toolkit.ui;
import java.util.Iterator;
-/** Extension to the {@link Component} interface which adds to it the capacity
+/**
+ * Extension to the {@link Component} interface which adds to it the capacity
* to contain other components. All UI elements that can have child elements
* implement this interface.
*
@@ -40,22 +41,27 @@ import java.util.Iterator;
*/
public interface ComponentContainer extends Component {
- /** Adds a component into this container.
+ /**
+ * Adds the component into this container.
*
- * @param c the component to be added
+ * @param c the component to be added.
*/
public void addComponent(Component c);
- /** Removes a component from this container.
+ /**
+ * Removes the component from this container.
*
- * @param c the component to be added
+ * @param c the component to be added.
*/
public void removeComponent(Component c);
- /** Removes all components from this container. */
+ /**
+ * Removes all components from this container.
+ */
public void removeAllComponents();
- /** Replace a component in the container with another one without changing position.
+ /**
+ * Replaces the component in the container with another one without changing position.
*
* <p>This method replaces component with another one is such way that the new component
* overtakes the position of the old component. If the old component is not in the
@@ -63,54 +69,78 @@ public interface ComponentContainer extends Component {
* already in the container, their positions are swapped.
* Component attach and detach events should be taken care as with add and remove.</p>
*
- * @param oldComponent The old component that will be replaced.
- * @param newComponent The new component to be replaced
+ * @param oldComponent the old component that will be replaced.
+ * @param newComponent the new component to be replaced.
*/
public void replaceComponent(Component oldComponent, Component newComponent);
- /** Gets an iterator to the collection of contained components. Using
+ /**
+ * Gets an iterator to the collection of contained components. Using
* this iterator it is possible to step through all components contained
* in this container.
*
- * @return component iterator
+ * @return the component iterator.
*/
public Iterator getComponentIterator();
- /** Moves all components from an another container into this container.
+ /**
+ * Moves all components from an another container into this container.
* The components are removed from <code>source</code>.
*
* @param source the container which contains the components that are to
- * be moved to this container
+ * be moved to this container.
*/
public void moveComponentsFrom(ComponentContainer source);
- /** Listen component attach events */
+ /**
+ * Listens the component attach events.
+ * @param listener the listener to add.
+ */
public void addListener(ComponentAttachListener listener);
- /** Stop listening component attach events */
+ /**
+ * Stops the listening component attach events.
+ * @param listener the listener to removed.
+ */
public void removeListener(ComponentAttachListener listener);
- /** Listen component detach events */
+ /**
+ * Listens the component detach events.
+ */
public void addListener(ComponentDetachListener listener);
- /** Stop listening component detach events */
+ /**
+ * Stops the listening component detach events.
+ */
public void removeListener(ComponentDetachListener listener);
- /** Component attach listener interface. */
+ /**
+ * Component attach listener interface.
+ */
public interface ComponentAttachListener {
- /** A new component is attached to container */
+ /**
+ * A new component is attached to container.
+ * @param event the component attach event.
+ */
public void componentAttachedToContainer(ComponentAttachEvent event);
}
- /** Component detach listener interface. */
+ /**
+ * Component detach listener interface.
+ */
public interface ComponentDetachListener {
- /** A component has been detached from container */
+ /**
+ * A component has been detached from container.
+ * @param event the component detach event.
+ */
public void componentDetachedFromContainer(ComponentDetachEvent event);
}
- /** Component attach event sent when a component is attached to container */
+ /**
+ * Component attach event sent when a component is attached to container.
+ */
public class ComponentAttachEvent extends Component.Event {
/**
@@ -120,27 +150,36 @@ public interface ComponentContainer extends Component {
private Component component;
- /** Create new attach event.
- * @param container The component container the component has been detached to.
- * @param attachedComponent The component that has been attached
+ /**
+ * Creates the new attach event.
+ * @param container the component container the component has been detached to.
+ * @param attachedComponent the component that has been attached.
*/
public ComponentAttachEvent(ComponentContainer container, Component attachedComponent) {
super(container);
this.component = attachedComponent;
}
- /** Get the component container */
+ /**
+ * Gets the component container.
+ * @param the component container.
+ */
public ComponentContainer getContainer() {
return (ComponentContainer) getSource();
}
- /** Get the attached component */
+ /**
+ * Gets the attached component.
+ * @param the attach component.
+ */
public Component getAttachedComponent() {
return component;
}
}
- /** Component detach event sent when a component is detached from container */
+ /**
+ * Component detach event sent when a component is detached from container.
+ */
public class ComponentDetachEvent extends Component.Event {
/**
@@ -150,21 +189,28 @@ public interface ComponentContainer extends Component {
private Component component;
- /** Create new detach event.
- * @param container The component container the component has been detached from.
- * @param detachedComponent The component that has been detached
+ /**
+ * Creates the new detach event.
+ * @param container the component container the component has been detached from.
+ * @param detachedComponent the component that has been detached.
*/
public ComponentDetachEvent(ComponentContainer container, Component detachedComponent) {
super(container);
this.component = detachedComponent;
}
- /** Get the component container */
+ /**
+ * Gets the component container.
+ * @param the component container.
+ */
public ComponentContainer getContainer() {
return (ComponentContainer) getSource();
}
- /** Get the detached component */
+ /**
+ * Gets the detached component.
+ * @return the detached component.
+ */
public Component getDetachedComponent() {
return component;
}
diff --git a/src/com/itmill/toolkit/ui/CustomComponent.java b/src/com/itmill/toolkit/ui/CustomComponent.java
index ca106e6602..3a253bec80 100644
--- a/src/com/itmill/toolkit/ui/CustomComponent.java
+++ b/src/com/itmill/toolkit/ui/CustomComponent.java
@@ -41,12 +41,15 @@ import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.Resource;
import com.itmill.toolkit.terminal.VariableOwner;
-/** Custom component provides simple implementation of Component interface for
+/**
+ * Custom component provides simple implementation of Component interface for
* creation of new UI components by composition of existing components.
- * <p>The component is used by inheriting the CustomComponent class and setting
+ * <p>
+ * The component is used by inheriting the CustomComponent class and setting
* composite root inside the Custom component. The composite root itself
* can contain more components, but their interfaces are hidden from the
- * users.</p>
+ * users.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -54,59 +57,83 @@ import com.itmill.toolkit.terminal.VariableOwner;
*/
public class CustomComponent implements Component {
- /** The root component implementing the custom component */
+ /**
+ * The root component implementing the custom component.
+ */
private Component root = null;
- /** The visibility of the component */
+ /**
+ * The visibility of the component.
+ */
private boolean visible = true;
- /** The parent of the component */
+ /**
+ * The parent of the component.
+ */
private Component parent = null;
- /** Dependencies of the component, or null */
+ /**
+ * Dependencies of the component, or null.
+ */
private HashSet dependencies = null;
- /** Type of the component */
+ /**
+ * Type of the component.
+ */
private String componentType = null;
- /** List of repaint request listeners or null if not listened at all */
+ /**
+ * List of repaint request listeners or null if not listened at all.
+ */
private LinkedList repaintRequestListeners = null;
- /** Are all the repaint listeners notified about recent changes ? */
+ /**
+ * Are all the repaint listeners notified about recent changes ?
+ */
private boolean repaintRequestListenersNotified = false;
- /** Construct new custom component.
+ /**
+ * Constructs new custom component.
*
- * <p>The component is implemented by wrapping the methods of the
+ * <p>
+ * The component is implemented by wrapping the methods of the
* composition root component given as parameter. The composition
- * root must be set before the component can be used.</p>
+ * root must be set before the component can be used.
+ * </p>
*/
public CustomComponent() {
}
- /** Construct new custom component.
+ /**
+ * Constructs the new custom component.
*
- * <p>The component is implemented by wrapping the methods of the
+ * <p>
+ * The component is implemented by wrapping the methods of the
* composition root component given as parameter. The composition
- * root must not be null and can not be changed after the composition.</p>
+ * root must not be null and can not be changed after the composition.
+ * </p>
*
- * @param compositionRoot The root of the composition component tree.
+ * @param compositionRoot the root of the composition component tree.
*/
public CustomComponent(Component compositionRoot) {
setCompositionRoot(compositionRoot);
}
- /** Returns the composition root.
- * @return Component Composition root
+ /**
+ * Returns the composition root.
+ * @return the Component Composition root.
*/
protected final Component getCompositionRoot() {
return root;
}
- /** Sets the compositions root.
- * <p>The composition root must be set to non-null value before the
- * component can be used. The composition root can only be set once.</p>
- * @param compositionRoot The root of the composition component tree.
+ /**
+ * Sets the compositions root.
+ * <p>
+ * The composition root must be set to non-null value before the
+ * component can be used. The composition root can only be set once.
+ * </p>
+ * @param compositionRoot the root of the composition component tree.
*/
protected final void setCompositionRoot(Component compositionRoot) {
if (compositionRoot != root && root != null)
@@ -117,25 +144,39 @@ public class CustomComponent implements Component {
}
/* Basic component features ------------------------------------------ */
-
+
+ /**
+ * Notifies the component that it is connected to an application.
+ * @see com.itmill.toolkit.ui.Component#attach()
+ */
public void attach() {
if (root != null)
root.attach();
}
-
+
+ /**
+ * Notifies the component that it is detached from the application.
+ * @see com.itmill.toolkit.ui.Component#detach()
+ */
public void detach() {
if (root != null)
root.detach();
}
-
+
+ /**
+ * Gets the component's parent application
+ * @see com.itmill.toolkit.ui.Component#getApplication()
+ */
public Application getApplication() {
if (parent == null)
return null;
return parent.getApplication();
}
- /** The caption of the custom component is by default the the
- * caption of the root component, or null if the root is not set
+ /**
+ * The caption of the custom component is by default the
+ * caption of the root component, or null if the root is not set.
+ * @see com.itmill.toolkit.ui.Component#getCaption()
*/
public String getCaption() {
if (root == null)
@@ -143,8 +184,10 @@ public class CustomComponent implements Component {
return root.getCaption();
}
- /** The icon of the custom component is by default the the
- * icon of the root component, or null if the root is not set
+ /**
+ * The icon of the custom component is by default the
+ * icon of the root component, or null if the root is not set.
+ * @see com.itmill.toolkit.ui.Component#getIcon()
*/
public Resource getIcon() {
if (root == null)
@@ -152,49 +195,73 @@ public class CustomComponent implements Component {
return root.getIcon();
}
- /** The icon of the custom component is by default the the
+ /**
+ * The icon of the custom component is by default the
* locale of the parent or null if the parent is not set.
+ * @see com.itmill.toolkit.ui.Component#getLocale()
*/
public Locale getLocale() {
if (parent == null)
return null;
return parent.getLocale();
}
-
+
+ /**
+ * Gets the visual parent of the component.
+ * @see com.itmill.toolkit.ui.Component#getParent()
+ */
public Component getParent() {
return parent;
}
- /** Custom component does not implement custom styles by default and
+ /**
+ * Custom component does not implement custom styles by default and
* this function returns null.
+ * @see com.itmill.toolkit.ui.Component#getStyle()
*/
public String getStyle() {
return null;
}
-
+
+ /**
+ * Gets the component's parent window.
+ * @see com.itmill.toolkit.ui.Component#getWindow()
+ */
public Window getWindow() {
if (parent == null)
return null;
return parent.getWindow();
}
- /** Custom component is allways enabled by default */
+ /**
+ * Custom component is allways enabled by default.
+ * @see com.itmill.toolkit.ui.Component#isEnabled()
+ */
public boolean isEnabled() {
return true;
}
- /** Custom component is by default in the non-immediate mode. The immediateness
- * of the custom component is defined by the components it is composed of.
+ /**
+ * Custom component is by default in the non-immediate mode. The immediateness
+ * of the custom component is defined by the components it is composed of.
+ * @see com.itmill.toolkit.terminal.VariableOwner#isImmediate()
*/
public boolean isImmediate() {
return false;
}
- /** The custom components are not readonly by default. */
+ /**
+ * The custom components are not readonly by default.
+ * @see com.itmill.toolkit.ui.Component#isReadOnly()
+ */
public boolean isReadOnly() {
return false;
}
-
+
+ /**
+ * Tests if the component is visible or not.
+ * @see com.itmill.toolkit.ui.Component#isVisible()
+ */
public boolean isVisible() {
return visible;
}
@@ -260,40 +327,54 @@ public class CustomComponent implements Component {
}
}
- /** The custom component is allways enabled by default. */
+ /**
+ * The custom component is allways enabled by default.
+ */
public void setEnabled(boolean enabled) {
}
-
+
+ /**
+ * Sets the component's parent component.
+ * @see com.itmill.toolkit.ui.Component#setParent(com.itmill.toolkit.ui.Component)
+ */
public void setParent(Component parent) {
// If the parent is not changed, dont do nothing
if (parent == this.parent)
return;
- // Send detach event if the component have been connected to a window
+ // Sends the detach event if the component have been connected to a window
if (getApplication() != null) {
detach();
this.parent = null;
}
- // Connect to new parent
+ // Connects to new parent
this.parent = parent;
- // Send attach event if connected to a window
+ // Sends the attach event if connected to a window
if (getApplication() != null)
attach();
}
- /** Changing the read-only mode of the component is not supported by default.
+ /**
+ * Sets the component's to read-only mode to the specified state.
+ * @see com.itmill.toolkit.ui.Component#setReadOnly(boolean)
*/
public void setReadOnly(boolean readOnly) {
}
- /** Changing the style of the component is not supported by default.
+ /**
+ * Sets the look-and-feel style of the component.
+ * @see com.itmill.toolkit.ui.Component#setStyle(java.lang.String)
*/
public void setStyle(String style) {
}
-
+
+ /**
+ * Sets the components visibility status.
+ * @see com.itmill.toolkit.ui.Component#setVisible(boolean)
+ */
public void setVisible(boolean visible) {
this.visible = visible;
}
@@ -324,10 +405,18 @@ public class CustomComponent implements Component {
repaintRequestListenersNotified = false;
}
- /** The custom component does not have any variables by default */
+ /**
+ * Called when one or more variables handled by the implementing class
+ * are changed.
+ * @see com.itmill.toolkit.terminal.VariableOwner#changeVariables(java.lang.Object, java.util.Map)
+ */
public void changeVariables(Object source, Map variables) {
}
-
+
+ /**
+ * Makes this <code>VariableOwner</code> depend on the given <code>VariableOwner</code>.
+ * @see com.itmill.toolkit.terminal.VariableOwner#dependsOn(com.itmill.toolkit.terminal.VariableOwner)
+ */
public void dependsOn(VariableOwner depended) {
if (depended == null)
return;
@@ -335,11 +424,20 @@ public class CustomComponent implements Component {
dependencies = new HashSet();
dependencies.add(depended);
}
-
+
+ /**
+ * Gets the variable change listeners this <code>VariableOwner</code>
+ * directly depends on.
+ * @see com.itmill.toolkit.terminal.VariableOwner#getDirectDependencies()
+ */
public Set getDirectDependencies() {
return dependencies;
}
-
+
+ /**
+ * Removes the given component from this component's dependency list.
+ * @see com.itmill.toolkit.terminal.VariableOwner#removeDirectDependency(com.itmill.toolkit.terminal.VariableOwner)
+ */
public void removeDirectDependency(VariableOwner depended) {
if (dependencies == null)
return;
@@ -350,22 +448,27 @@ public class CustomComponent implements Component {
/* Event functions are not implemented by default -------------------- */
- /** Custom component does not implement any component events by default */
+ /**
+ * Custom component does not implement any component events by default.
+ * @param listener the listener to add.
+ */
public void addListener(Component.Listener listener) {
}
- /** Custom component does not implement any component events by default */
+ /**
+ * Custom component does not implement any component events by default.
+ * @param listener the listener to remove.
+ */
public void removeListener(Component.Listener listener) {
}
- /** Gets the component type.
+ /**
+ * Gets the component type.
*
* The component type is textual type of the component. This is included
* in the UIDL as component tag attribute. If the component type is null
* (default), the component tag is not included in the UIDL at all.
- *
- * Returns the componentType.
- * @return String
+ * @return the component type.
*/
public String getComponentType() {
return componentType;
@@ -378,7 +481,7 @@ public class CustomComponent implements Component {
* in the UIDL as component tag attribute. If the component type is null
* (default), the component tag is not included in the UIDL at all.
*
- * @param componentType The componentType to set
+ * @param componentType the componentType to set.
*/
public void setComponentType(String componentType) {
this.componentType = componentType;
diff --git a/src/com/itmill/toolkit/ui/CustomLayout.java b/src/com/itmill/toolkit/ui/CustomLayout.java
index 2e42335782..7302f20b71 100644
--- a/src/com/itmill/toolkit/ui/CustomLayout.java
+++ b/src/com/itmill/toolkit/ui/CustomLayout.java
@@ -34,21 +34,28 @@ import com.itmill.toolkit.terminal.PaintTarget;
import java.util.Iterator;
import java.util.HashMap;
-/** <p>A container component with freely designed layout and style. The
+/**
+ * <p>
+ * A container component with freely designed layout and style. The
* container consists of items with textually represented locations. Each
* item contains one sub-component. The adapter and theme are resposible for
* rendering the layout with given style by placing the items on the screen
- * in defined locations.</p>
+ * in defined locations.
+ * </p>
*
- * <p>The definition of locations is not fixed - the each style can define
+ * <p>
+ * The definition of locations is not fixed - the each style can define
* its locations in a way that is suitable for it. One typical example would
* be to create visual design for a website as a custom layout: the visual
* design could define locations for "menu", "body" and "title" for example.
* The layout would then be implemented as XLS-template with for given
- * style.</p>
+ * style.
+ * </p>
*
- * <p>The default theme handles the styles that are not defined by just
- * drawing the subcomponents with flowlayout.</p>
+ * <p>
+ * The default theme handles the styles that are not defined by just
+ * drawing the subcomponents with flowlayout.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -56,24 +63,30 @@ import java.util.HashMap;
*/
public class CustomLayout extends AbstractComponentContainer implements Layout {
- /** Custom layout slots containing the components */
+ /**
+ * Custom layout slots containing the components.
+ */
private HashMap slots = new HashMap();
- /** Constructor for custom layout with given style */
+ /**
+ * Constructor for custom layout with given style.
+ */
public CustomLayout(String style) {
setStyle(style);
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Gets the component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "customlayout";
}
- /** Add a component into this container to given location.
- * @param c The component to be added.
- * @param location The location of the component
+ /**
+ * Adds the component into this container to given location.
+ * @param c the component to be added.
+ * @param location the location of the component.
*/
public void addComponent(Component c, String location) {
Component old = (Component)slots.get(location);
@@ -86,18 +99,20 @@ public class CustomLayout extends AbstractComponentContainer implements Layout {
requestRepaint();
}
- /** Add a component into this container. The component is added without
+ /**
+ * Adds the component into this container. The component is added without
* specifying the location (empty string is then used as location). Only
* one component can be added to the default "" location and adding
* more components into that location overwrites the old components.
- * @param c The component to be added.
+ * @param c the component to be added.
*/
public void addComponent(Component c) {
this.addComponent(c, "");
}
- /** Remove a component from this container.
- * @param c The component to be removed.
+ /**
+ * Removes the component from this container.
+ * @param c the component to be removed.
*/
public void removeComponent(Component c) {
if (c == null) return;
@@ -107,45 +122,49 @@ public class CustomLayout extends AbstractComponentContainer implements Layout {
requestRepaint();
}
- /** Remove a component from this container from given location.
- * @param location Location identifier of the component
+ /**
+ * Removes the component from this container from given location.
+ * @param location the Location identifier of the component.
*/
public void removeComponent(String location) {
this.removeComponent((Component) slots.get(location));
}
- /** Get component container iterator for going trough all the components in
+ /**
+ * Gets the component container iterator for going trough all the components in
* the container.
- * @return Iterator of the components inside the container.
+ * @return the Iterator of the components inside the container.
*/
public Iterator getComponentIterator() {
return slots.values().iterator();
}
- /** Get child-component by its location.
+ /**
+ * Gets the child-component by its location.
*
- * @param location The name of the location where the requested
- * component resides
- * @return Component in the given location or null if not found.
+ * @param location the name of the location where the requested
+ * component resides.
+ * @return the Component in the given location or null if not found.
*/
public Component getComponent(String location) {
return (Component) slots.get(location);
}
- /** Paint the content of this component.
- * @param event PaintEvent.
- * @throws PaintException The paint operation failed.
+ /**
+ * Paints the content of this component.
+ * @param target
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
- // Add all items in all the locations
+ // Adds all items in all the locations
for (Iterator i = slots.keySet().iterator(); i.hasNext();) {
- // Get the (location,component)
+ // Gets the (location,component)
String location = (String) i.next();
Component c = (Component) slots.get(location);
- // Write the item
+ // Writes the item
target.startTag("location");
target.addAttribute("name", location);
c.paint(target);
@@ -158,7 +177,7 @@ public class CustomLayout extends AbstractComponentContainer implements Layout {
Component oldComponent,
Component newComponent) {
- // Get the locations
+ // Gets the locations
String oldLocation = null;
String newLocation = null;
for (Iterator i=slots.keySet().iterator(); i.hasNext();) {
diff --git a/src/com/itmill/toolkit/ui/DateField.java b/src/com/itmill/toolkit/ui/DateField.java
index f5b1949bd5..a8eefe4c86 100644
--- a/src/com/itmill/toolkit/ui/DateField.java
+++ b/src/com/itmill/toolkit/ui/DateField.java
@@ -42,8 +42,8 @@ import com.itmill.toolkit.terminal.PaintTarget;
/**
* <p>
* A date editor component that can be bound to any bindable Property. that is
- * compatible with java.util.Date.
- *
+ * 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
@@ -61,39 +61,61 @@ public class DateField extends AbstractField {
/* Private members ************************************************* */
- /** Resolution identifier: milliseconds */
+ /**
+ * Resolution identifier: milliseconds.
+ */
public static final int RESOLUTION_MSEC = 0;
- /** Resolution identifier: seconds. */
+ /**
+ * Resolution identifier: seconds.
+ */
public static final int RESOLUTION_SEC = 1;
- /** Resolution identifier: minutes. */
+ /**
+ * Resolution identifier: minutes.
+ */
public static final int RESOLUTION_MIN = 2;
- /** Resolution identifier: hours. */
+ /**
+ * Resolution identifier: hours.
+ */
public static final int RESOLUTION_HOUR = 3;
- /** Resolution identifier: days. */
+ /**
+ * Resolution identifier: days.
+ */
public static final int RESOLUTION_DAY = 4;
- /** Resolution identifier: months. */
+ /**
+ * Resolution identifier: months.
+ */
public static final int RESOLUTION_MONTH = 5;
- /** Resolution identifier: years. */
+ /**
+ * Resolution identifier: years.
+ */
public static final int RESOLUTION_YEAR = 6;
- /** Specified smallest modifiable unit */
+ /**
+ * Specified smallest modifiable unit.
+ */
private int resolution = RESOLUTION_MSEC;
- /** Specified largest modifiable unit */
+ /**
+ * Specified largest modifiable unit.
+ */
private static final int largestModifiable = RESOLUTION_YEAR;
- /** The internal calendar to be used in java.utl.Date conversions */
+ /**
+ * The internal calendar to be used in java.utl.Date conversions.
+ */
private Calendar calendar;
/* Constructors **************************************************** */
- /** Constructs an empty <code>DateField</code> with no caption. */
+ /**
+ * Constructs an empty <code>DateField</code> with no caption.
+ */
public DateField() {
}
@@ -101,7 +123,7 @@ public class DateField extends AbstractField {
* 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);
@@ -112,9 +134,9 @@ public class DateField extends AbstractField {
* <code>Property</code> and has the given caption <code>String</code>.
*
* @param caption
- * 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);
@@ -126,7 +148,7 @@ public class DateField extends AbstractField {
* <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()))
@@ -145,9 +167,9 @@ public class DateField extends AbstractField {
* is called to bind it.
*
* @param caption
- * caption <code>String</code> for the editor
- * @param text
- * initial text content of the editor
+ * the caption <code>String</code> for the editor.
+ * @param value
+ * the Date value.
*/
public DateField(String caption, Date value) {
setValue(value);
@@ -157,19 +179,19 @@ public class DateField extends AbstractField {
/* Component basic features ********************************************* */
/*
- * Paint this component. Don't add a JavaDoc comment here, we use the
+ * Paints this component. Don't add a JavaDoc comment here, we use the
* default documentation from implemented interface.
*/
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
- // Add locale as attribute
+ // Adds the locale as attribute
Locale l = getLocale();
if (l != null) {
target.addAttribute("locale",l.toString());
}
- // Get the calendar
+ // Gets the calendar
Calendar calendar = getCalendar();
Date currentDate = (Date) getValue();
@@ -235,7 +257,7 @@ public class DateField extends AbstractField {
Date oldDate = (Date) getValue();
Date newDate = null;
- // Get the new date in parts
+ // Gets the new date in parts
// Null values are converted to negative values.
int year = variables.containsKey("year") ? (variables.get("year") == null ? -1
: ((Integer) variables.get("year")).intValue())
@@ -279,7 +301,7 @@ public class DateField extends AbstractField {
sec = sec < 0 ? cal.get(Calendar.SECOND) : sec;
msec = msec < 0 ? cal.get(Calendar.MILLISECOND) : msec;
- // Set the calendar fields
+ // Sets the calendar fields
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month);
cal.set(Calendar.DAY_OF_MONTH, day);
@@ -288,7 +310,7 @@ public class DateField extends AbstractField {
cal.set(Calendar.SECOND, sec);
cal.set(Calendar.MILLISECOND, msec);
- // Assign the date
+ // Assigns the date
newDate = cal.getTime();
}
@@ -309,7 +331,7 @@ public class DateField extends AbstractField {
}
/*
- * Return the value of the property in human readable textual format. Don't
+ * Returns the value of the property in human readable textual format. Don't
* add a JavaDoc comment here, we use the default documentation from
* implemented interface.
*/
@@ -321,13 +343,13 @@ public class DateField extends AbstractField {
}
/*
- * Set the value of the property. Don't add a JavaDoc comment here, we use
+ * Sets the value of the property. Don't add a JavaDoc comment here, we use
* the default documentation from implemented interface.
*/
public void setValue(Object newValue) throws Property.ReadOnlyException,
Property.ConversionException {
- // Allow setting dates directly
+ // Allows setting dates directly
if (newValue == null || newValue instanceof Date)
super.setValue(newValue);
else {
@@ -344,7 +366,7 @@ public class DateField extends AbstractField {
}
/**
- * Set DateField datasource. Datasource type must assignable to Date.
+ * Sets the DateField datasource. Datasource type must assignable to Date.
*
* @see com.itmill.toolkit.data.Property.Viewer#setPropertyDataSource(Property)
*/
@@ -358,7 +380,7 @@ public class DateField extends AbstractField {
}
/**
- * Returns the resolution.
+ * Gets the resolution.
*
* @return int
*/
@@ -367,10 +389,10 @@ public class DateField extends AbstractField {
}
/**
- * Sets the resolution of the DateField
+ * Sets the resolution of the DateField.
*
* @param resolution
- * The resolution to set
+ * the resolution to set.
*/
public void setResolution(int resolution) {
this.resolution = resolution;
@@ -382,14 +404,13 @@ public class DateField extends AbstractField {
* Returns new clone of the calendar object initialized using the the
* current date (if available)
*
- * If this is no calendar is assigned the Calendar.getInstance() is used.
- *
+ * If this is no calendar is assigned the <code>Calendar.getInstance</code> is used.
+ * @return the Calendar.
* @see #setCalendar(Calendar)
- * @return Calendar
*/
private Calendar getCalendar() {
- // Make sure we have an calendar instance
+ // Makes sure we have an calendar instance
if (this.calendar == null) {
this.calendar = Calendar.getInstance();
}
@@ -397,7 +418,7 @@ public class DateField extends AbstractField {
// Clone the instance
Calendar newCal = (Calendar) this.calendar.clone();
- // Assign the current time tom calendar.
+ // Assigns the current time tom calendar.
Date currentDate = (Date) getValue();
if (currentDate != null)
newCal.setTime(currentDate);
diff --git a/src/com/itmill/toolkit/ui/Embedded.java b/src/com/itmill/toolkit/ui/Embedded.java
index aad3046220..18120e5e24 100644
--- a/src/com/itmill/toolkit/ui/Embedded.java
+++ b/src/com/itmill/toolkit/ui/Embedded.java
@@ -36,7 +36,8 @@ import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.Resource;
import com.itmill.toolkit.terminal.Sizeable;
-/** Component for embedding external objects.
+/**
+ * Component for embedding external objects.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -44,64 +45,89 @@ import com.itmill.toolkit.terminal.Sizeable;
*/
public class Embedded extends AbstractComponent implements Sizeable {
- /** General object type */
+ /**
+ * General object type.
+ */
public static final int TYPE_OBJECT = 0;
- /** Image types */
+ /**
+ * Image types.
+ */
public static final int TYPE_IMAGE = 1;
- /** Type of the object */
+ /**
+ * Type of the object.
+ */
private int type = TYPE_OBJECT;
- /** Source of the embedded object */
+ /**
+ * Source of the embedded object.
+ */
private Resource source = null;
- /** Dimensions of the object. */
+ /**
+ * Dimensions of the object.
+ */
private int width = -1;
private int height = -1;
private int widthUnits = Sizeable.UNITS_PIXELS;
private int heightUnits = Sizeable.UNITS_PIXELS;
- /** Generic object attributes */
+ /**
+ * Generic object attributes.
+ */
private String mimeType = null;
private String standby = null;
- /** Hash of object parameteres. */
+ /**
+ * Hash of object parameteres.
+ */
private Hashtable parameters = new Hashtable();
- /** Applet or other client side runnable properties. */
+ /**
+ * Applet or other client side runnable properties.
+ */
private String codebase = null;
private String codetype = null;
private String classId = null;
private String archive = null;
- /** Creates a new empty Embedded object.
+ /**
+ * Creates a new empty Embedded object.
*/
public Embedded() {
}
- /** Creates a new empty Embedded object with caption.
+ /**
+ * Creates a new empty Embedded object with caption.
+ * @param caption
*/
public Embedded(String caption) {
setCaption(caption);
}
- /** Creates a new Embedded object whose contents is loaded from given resource.
+ /**
+ * Creates a new Embedded object whose contents is loaded from given resource.
* The dimensions are assumed if possible. The type is guessed from resource.
+ * @param caption
+ * @param source the Source of the embedded object.
*/
public Embedded(String caption, Resource source) {
setCaption(caption);
setSource(source);
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Gets the component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "embedded";
}
- /** Invoked when the component state should be painted */
+ /**
+ * Invoked when the component state should be painted.
+ */
public void paintContent(PaintTarget target) throws PaintException {
if (type == TYPE_IMAGE) {
@@ -143,70 +169,74 @@ public class Embedded extends AbstractComponent implements Sizeable {
}
}
- /** Set an object parameter.
- * Parameters are optional information, and they are passed to the
- * instantiated object. Parameters are are stored as name value pairs.
- * This overrides the previous value assigned to this parameter.
- * @param name - The name of the parameter.
- * @param value - The value of the parameter.
+ /**
+ * Sets an object parameter.
+ * Parameters are optional information, and they are passed to the
+ * instantiated object. Parameters are are stored as name value pairs.
+ * This overrides the previous value assigned to this parameter.
+ * @param name the name of the parameter.
+ * @param value the value of the parameter.
*/
public void setParameter(String name, String value) {
parameters.put(name, value);
requestRepaint();
}
- /** Get the value of an object parameter.
- * Parameters are optional information, and they are passed to the
- * instantiated object. Parameters are are stored as name value pairs.
- * @return Value of parameter or null if not found.
+ /**
+ * Gets the value of an object parameter.
+ * Parameters are optional information, and they are passed to the
+ * instantiated object. Parameters are are stored as name value pairs.
+ * @return the Value of parameter or null if not found.
*/
public String getParameter(String name) {
return (String) parameters.get(name);
}
- /** Remove an object parameter from the list.
- * @param name - The name of the parameter to remove.
+ /**
+ * Removes an object parameter from the list.
+ * @param name the name of the parameter to remove.
*/
public void removeParameter(String name) {
parameters.remove(name);
requestRepaint();
}
- /** Get embedded object parameter names.
- * @return Iterator of parameters names.
+ /**
+ * Gets the embedded object parameter names.
+ * @return the Iterator of parameters names.
*/
public Iterator getParameterNames() {
return parameters.keySet().iterator();
}
/**
- * Returns the codebase, the root-path used to access resources with relative paths.
- * @return String
+ * Gets the codebase, the root-path used to access resources with relative paths.
+ * @return the code base.
*/
public String getCodebase() {
return codebase;
}
/**
- * Returns the MIME-Type of the code.
- * @return String
+ * Gets the MIME-Type of the code.
+ * @return the MIME-Type of the code.
*/
public String getCodetype() {
return codetype;
}
/**
- * Returns the MIME-Type of the object
- * @return String
+ * Gets the MIME-Type of the object.
+ * @return the MIME-Type of the object.
*/
public String getMimeType() {
return mimeType;
}
/**
- * Returns the standby text displayed when
+ * Gets the standby text displayed when
* the object is loading.
- * @return String
+ * @return the standby text.
*/
public String getStandby() {
return standby;
@@ -214,7 +244,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
/**
* Sets the codebase, the root-path used to access resources with relative paths.
- * @param codebase The codebase to set
+ * @param codebase the codebase to set.
*/
public void setCodebase(String codebase) {
if (codebase != this.codebase
@@ -226,7 +256,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
/**
* Sets the codetype, the MIME-Type of the code.
- * @param codetype The codetype to set
+ * @param codetype the codetype to set.
*/
public void setCodetype(String codetype) {
if (codetype != this.codetype
@@ -238,7 +268,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
/**
* Sets the mimeType, the MIME-Type of the object.
- * @param mimeType The mimeType to set
+ * @param mimeType the mimeType to set.
*/
public void setMimeType(String mimeType) {
if (mimeType != this.mimeType
@@ -250,7 +280,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
/**
* Sets the standby, the text to display while loading the object.
- * @param standby The standby to set
+ * @param standby the standby to set.
*/
public void setStandby(String standby) {
if (standby != this.standby
@@ -263,7 +293,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
/**
* Returns the visual height of the object.
* Default height is -1, which is interpreted as "unspecified".
- * @return The height in units specified by heightUnits property.
+ * @return the height in units specified by heightUnits property.
*/
public int getHeight() {
return height;
@@ -272,15 +302,16 @@ public class Embedded extends AbstractComponent implements Sizeable {
/**
* Returns the visual width of the object.
* Default width is -1, which is interpreted as "unspecified".
- * @return The width in units specified by widthUnits property.
+ * @return the width in units specified by widthUnits property.
*/
public int getWidth() {
return width;
}
- /** Sets the visual height of the object.
- * Default height is -1, which is interpreted as "unspecified".
- * @param height The height in units specified by heightUnits property.
+ /**
+ * Sets the visual height of the object.
+ * Default height is -1, which is interpreted as "unspecified".
+ * @param height the height in units specified by heightUnits property.
*/
public void setHeight(int height) {
if (this.height != height) {
@@ -289,9 +320,10 @@ public class Embedded extends AbstractComponent implements Sizeable {
}
}
- /** Sets the visual width of the object.
- * Default width is -1, which is interpreted as "unspecified".
- * @param width The width in units specified by widthUnits property.
+ /**
+ * Sets the visual width of the object.
+ * Default width is -1, which is interpreted as "unspecified".
+ * @param width the width in units specified by widthUnits property.
*/
public void setWidth(int width) {
if (this.width != width) {
@@ -301,8 +333,8 @@ public class Embedded extends AbstractComponent implements Sizeable {
}
/**
- * Returns the classId attribute.
- * @return String
+ * Gets the classId attribute.
+ * @return the class id.
*/
public String getClassId() {
return classId;
@@ -310,7 +342,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
/**
* Sets the classId attribute.
- * @param classId The classId to set
+ * @param classId the classId to set.
*/
public void setClassId(String classId) {
if (classId != this.classId
@@ -320,29 +352,32 @@ public class Embedded extends AbstractComponent implements Sizeable {
}
}
- /** Get the resource contained in the embedded object.
- * @return Resource
+ /**
+ * Gets the resource contained in the embedded object.
+ * @return the Resource
*/
public Resource getSource() {
return source;
}
- /** Get the type of the embedded object.
+ /**
+ * Gets the type of the embedded object.
* <p>This can be one of the following:<ul>
* <li>TYPE_OBJECT <i>(This is the default)</i>
* <li>TYPE_IMAGE
* </ul>
* </p>
- * @return int
+ * @return the type.
*/
public int getType() {
return type;
}
- /** Set the object source resource.
+ /**
+ * Sets the object source resource.
* The dimensions are assumed if possible.
* The type is guessed from resource.
- * @param source The source to set
+ * @param source the source to set.
*/
public void setSource(Resource source) {
if (source != null && !source.equals(this.source)) {
@@ -357,13 +392,14 @@ public class Embedded extends AbstractComponent implements Sizeable {
}
}
- /** Sets the object type.
+ /**
+ * Sets the object type.
* <p>This can be one of the following:<ul>
* <li>TYPE_OBJECT <i>(This is the default)</i>
* <li>TYPE_IMAGE
* </ul>
* </p>
- * @param type The type to set
+ * @param type the type to set.
*/
public void setType(int type) {
if (type != TYPE_OBJECT && type != TYPE_IMAGE)
@@ -375,8 +411,8 @@ public class Embedded extends AbstractComponent implements Sizeable {
}
/**
- * Returns the archive attribute.
- * @return String
+ * Gets the archive attribute.
+ * @return the archive attribute.
*/
public String getArchive() {
return archive;
@@ -384,7 +420,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
/**
* Sets the archive attribute.
- * @param archive The archive string to set
+ * @param archive the archive string to set.
*/
public void setArchive(String archive) {
if (archive != this.archive
@@ -394,7 +430,8 @@ public class Embedded extends AbstractComponent implements Sizeable {
}
}
- /**Get height property units.
+ /**
+ * Gets the height property units.
* Default units are <code>Sizeable.UNITS_PIXELS</code>.
* @see com.itmill.toolkit.terminal.Sizeable#getHeightUnits()
*/
@@ -402,7 +439,8 @@ public class Embedded extends AbstractComponent implements Sizeable {
return this.heightUnits;
}
- /**Get width property units.
+ /**
+ * Gets the width property units.
* Default units are <code>Sizeable.UNITS_PIXELS</code>.
* @see com.itmill.toolkit.terminal.Sizeable#getWidthUnits()
*/
@@ -410,7 +448,8 @@ public class Embedded extends AbstractComponent implements Sizeable {
return this.widthUnits;
}
- /**Set height property units.
+ /**
+ * Sets the height property units.
* @see com.itmill.toolkit.terminal.Sizeable#setHeightUnits(int)
*/
public void setHeightUnits(int units) {
@@ -420,7 +459,8 @@ public class Embedded extends AbstractComponent implements Sizeable {
}
}
- /**Set width property units.
+ /**
+ * Sets the width property units.
* @see com.itmill.toolkit.terminal.Sizeable#setWidthUnits(int)
*/
public void setWidthUnits(int units) {
diff --git a/src/com/itmill/toolkit/ui/Field.java b/src/com/itmill/toolkit/ui/Field.java
index d0b9cfc803..edbcedf55e 100644
--- a/src/com/itmill/toolkit/ui/Field.java
+++ b/src/com/itmill/toolkit/ui/Field.java
@@ -45,35 +45,47 @@ public interface Field
Property.ValueChangeListener,
Property.Editor,
Focusable {
-
+
+ /**
+ * Sets the Caption.
+ * @param caption
+ */
void setCaption(String caption);
String getDescription();
+ /**
+ * Sets the Description.
+ * @param caption
+ */
void setDescription(String caption);
- /** Is this field required.
+ /**
+ * Is this field required.
*
* Required fields must filled by the user.
*
- * @return true if the
+ * @return <code>true</code> if the field is required,otherwise <code>false</code>.
* @since 3.1
*/
public boolean isRequired();
- /** Set the field required.
+ /**
+ * Sets the field required.
* Required fields must filled by the user.
*
- * @param required Is the field required
+ * @param required Is the field required.
* @since 3.1
*/
public void setRequired(boolean required);
- /** An <code>Event</code> object specifying the Field whose value
+ /**
+ * An <code>Event</code> object specifying the Field whose value
* has been changed.
+ *
* @author IT Mill Ltd.
- * @version @VERSION@
- * @since 3.0
+ * @version @VERSION@
+ * @since 3.0
*/
public class ValueChangeEvent
extends Component.Event
@@ -84,18 +96,20 @@ public interface Field
*/
private static final long serialVersionUID = 3545803169444672816L;
- /** Constructs a new event object with the specified source
+ /**
+ * Constructs a new event object with the specified source
* field object.
*
- * @param source the field that caused the event
+ * @param source the field that caused the event.
*/
public ValueChangeEvent(Field source) {
super(source);
}
- /** Gets the Property which triggered the event.
+ /**
+ * Gets the Property which triggered the event.
*
- * @return Source Property of the event.
+ * @return the Source Property of the event.
*/
public Property getProperty() {
return (Property) getSource();
diff --git a/src/com/itmill/toolkit/ui/FieldFactory.java b/src/com/itmill/toolkit/ui/FieldFactory.java
index 4d2905f86f..255411ebd1 100644
--- a/src/com/itmill/toolkit/ui/FieldFactory.java
+++ b/src/com/itmill/toolkit/ui/FieldFactory.java
@@ -32,8 +32,9 @@ import com.itmill.toolkit.data.Container;
import com.itmill.toolkit.data.Item;
import com.itmill.toolkit.data.Property;
-/** Factory for creating new Field-instances based on type,
- * datasource and/or context.
+/**
+ * Factory for creating new Field-instances based on type,
+ * datasource and/or context.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -42,40 +43,43 @@ import com.itmill.toolkit.data.Property;
public interface FieldFactory {
- /** Creates field based on type of data.
+ /**
+ * Creates the field based on type of data.
*
- *
- * @param type The type of data presented in field
- * @param uiContext The component where the field is presented.
- * @return Field The field suitable for editing the specified data.
+ * @param type the type of data presented in field.
+ * @param uiContext the component where the field is presented.
+ * @return Field the field suitable for editing the specified data.
*
*/
Field createField(Class type, Component uiContext);
- /** Creates field based on the property datasource.
+ /**
+ * Creates the field based on the property datasource.
*
- * @param property The property datasource.
- * @param uiContext The component where the field is presented.
- * @return Field The field suitable for editing the specified data.
+ * @param property the property datasource.
+ * @param uiContext the component where the field is presented.
+ * @return Field the field suitable for editing the specified data.
*/
Field createField(Property property, Component uiContext);
- /** Creates field based on the item and property id.
+ /**
+ * Creates the field based on the item and property id.
*
- * @param item The item where the property belongs to.
- * @param propertyId Id of the property.
- * @param uiContext The component where the field is presented.
- * @return Field The field suitable for editing the specified data.
+ * @param item the item where the property belongs to.
+ * @param propertyId the Id of the property.
+ * @param uiContext 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 field based on the container item id and property id.
+ /**
+ * Creates the field based on the container item id and property id.
*
- * @param container Container where the property belongs to.
- * @param itemId The item Id.
- * @param propertyId Id of the property.
- * @param uiContext The component where the field is presented.
- * @return Field The field suitable for editing the specified data.
+ * @param container the Container where the property belongs to.
+ * @param itemId the item Id.
+ * @param propertyId the Id of the property.
+ * @param uiContext 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, Component uiContext);
diff --git a/src/com/itmill/toolkit/ui/Form.java b/src/com/itmill/toolkit/ui/Form.java
index e1fe2b1f9c..f3d6c1b2b8 100644
--- a/src/com/itmill/toolkit/ui/Form.java
+++ b/src/com/itmill/toolkit/ui/Form.java
@@ -40,17 +40,20 @@ import com.itmill.toolkit.data.util.BeanItem;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
-/** Form component provides easy way of creating and managing sets fields.
+/**
+ * Form component provides easy way of creating and managing sets fields.
*
- * <p>Form is a container for fields implementing {@link Field} interface. It
+ * <p>
+ * <code>Form</code> is a container for fields implementing {@link Field} interface. It
* provides support for any layouts and provides buffering interface for easy
- * connection of commit- and discard buttons. All the form fields can be
+ * connection of commit and discard buttons. All the form fields can be
* customized by adding validators, setting captions and icons, setting
* immediateness, etc. Also direct mechanism for replacing existing fields with
* selections is given.
* </p>
*
- * <p>Form provides customizable editor for classes implementing
+ * <p>
+ * <code>Form</code> provides customizable editor for classes implementing
* {@link com.itmill.toolkit.data.Item} interface. Also the form itself
* implements this interface for easier connectivity to other items.
* To use the form as editor for an item, just connect the item to
@@ -61,7 +64,8 @@ import com.itmill.toolkit.terminal.PaintTarget;
* be added. If you need to connect a class that does not implement
* {@link com.itmill.toolkit.data.Item} interface, most properties of any
* class following bean pattern, can be accessed trough
- * {@link com.itmill.toolkit.data.util.BeanItem}.</p>
+ * {@link com.itmill.toolkit.data.util.BeanItem}.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -73,59 +77,83 @@ public class Form
private Object propertyValue;
- /** Layout of the form */
+ /**
+ * Layout of the form.
+ */
private Layout layout;
- /** Item connected to this form as datasource */
+ /**
+ * Item connected to this form as datasource.
+ */
private Item itemDatasource;
- /** Ordered list of property ids in this editor */
+ /**
+ * Ordered list of property ids in this editor.
+ */
private LinkedList propertyIds = new LinkedList();
- /** Current buffered source exception */
+ /**
+ * Current buffered source exception.
+ */
private Buffered.SourceException currentBufferedSourceException = null;
- /** Is the form in write trough mode */
+ /**
+ * Is the form in write trough mode.
+ */
private boolean writeThrough = true;
- /** Is the form in read trough mode */
+ /**
+ * Is the form in read trough mode.
+ */
private boolean readThrough = true;
- /** Mapping from propertyName to corresponding field */
+ /**
+ * Mapping from propertyName to corresponding field.
+ */
private HashMap fields = new HashMap();
- /** Field factory for this form */
+ /**
+ * Field factory for this form.
+ */
private FieldFactory fieldFactory;
- /** Registered Validators */
+ /**
+ * Registered Validators.
+ */
private LinkedList validators;
- /** Visible item properties */
+ /**
+ * Visible item properties.
+ */
private Collection visibleItemProperties;
- /** Contruct a new form with default layout.
+ /**
+ * Contructs a new form with default layout.
*
- * <p>By default the form uses <code>OrderedLayout</code>
+ * <p>
+ * By default the form uses <code>OrderedLayout</code>
* with <code>form</code>-style.
- *
- * @param formLayout The layout of the form.
+ * </p>
+ * @param formLayout the layout of the form.
*/
public Form() {
this(null);
}
- /** Contruct a new form with given layout.
+ /**
+ * Contructs a new form with given layout.
*
- * @param formLayout The layout of the form.
+ * @param formLayout the layout of the form.
*/
public Form(Layout formLayout) {
this(formLayout, new BaseFieldFactory());
}
- /** Contruct a new form with given layout and FieldFactory.
+ /**
+ * Contructs a new form with given layout and FieldFactory.
*
- * @param formLayout The layout of the form.
- * @param fieldFactory FieldFactory of the form
+ * @param formLayout the layout of the form.
+ * @param fieldFactory the FieldFactory of the form.
*/
public Form(Layout formLayout, FieldFactory fieldFactory) {
super();
@@ -187,7 +215,7 @@ public class Form
throw e;
}
- /* Discard local changes and refresh values from the data source
+ /* Discards local changes and refresh values from the data source
* Don't add a JavaDoc comment here, we use the default one from the
* interface.
*/
@@ -214,7 +242,7 @@ public class Form
return;
}
- // Discard problems occurred
+ // Discards problems occurred
Throwable[] causes = new Throwable[problems.size()];
int index = 0;
for (Iterator i = problems.iterator(); i.hasNext();)
@@ -279,26 +307,27 @@ public class Form
}
}
- /** Add a new property to form and create corresponding field.
+ /**
+ * Adds a new property to form and create corresponding field.
*
* @see com.itmill.toolkit.data.Item#addItemProperty(Object, Property)
*/
public boolean addItemProperty(Object id, Property property) {
- // Check inputs
+ // Checks inputs
if (id == null || property == null)
throw new NullPointerException("Id and property must be non-null");
- // Check that the property id is not reserved
+ // Checks that the property id is not reserved
if (propertyIds.contains(id))
return false;
- // Get suitable field
+ // Gets suitable field
Field field = this.fieldFactory.createField(property, this);
if (field == null)
return false;
- // Configure the field
+ // Configures the field
try {
field.setPropertyDataSource(property);
String caption = id.toString();
@@ -319,9 +348,11 @@ public class Form
return true;
}
- /** Add field to form.
+ /**
+ * Adds the field to form.
*
- * <p>The property id must not be already used in the form.
+ * <p>
+ * The property id must not be already used in the form.
* </p>
*
* <p>This field is added to the form layout in the default position
@@ -330,8 +361,8 @@ public class Form
* string representation of the property id is used instead of the
* default location.</p>
*
- * @param propertyId Property id the the field.
- * @param field New field added to the form.
+ * @param propertyId the Property id the the field.
+ * @param field the New field added to the form.
*/
public void addField(Object propertyId, Field field) {
@@ -354,12 +385,15 @@ public class Form
}
}
- /** The property identified by the property id.
+ /**
+ * The property identified by the property id.
*
- * <p>The property data source of the field specified with
+ * <p>
+ * The property data source of the field specified with
* property id is returned. If there is a (with specified property id)
* having no data source,
- * the field is returned instead of the data source.</p>
+ * the field is returned instead of the data source.
+ * </p>
*
* @see com.itmill.toolkit.data.Item#getItemProperty(Object)
*/
@@ -375,7 +409,10 @@ public class Form
return field;
}
- /** Get the field identified by the propertyid */
+ /**
+ * Gets the field identified by the propertyid.
+ * @param propertyId the id of the property.
+ */
public Field getField(Object propertyId) {
return (Field) fields.get(propertyId);
}
@@ -385,7 +422,8 @@ public class Form
return Collections.unmodifiableCollection(propertyIds);
}
- /** Removes the property and corresponding field from the form.
+ /**
+ * Removes the property and corresponding field from the form.
*
* @see com.itmill.toolkit.data.Item#removeItemProperty(Object)
*/
@@ -405,10 +443,11 @@ public class Form
return false;
}
- /** Removes all properties and fields from the form.
+ /**
+ * Removes all properties and fields from the form.
*
- * @return Success of the operation. Removal of all fields succeeded
- * if (and only if) the return value is true.
+ * @return the Success of the operation. Removal of all fields succeeded
+ * if (and only if) the return value is <code>true</code>.
*/
public boolean removeAllProperties() {
Object[] properties = propertyIds.toArray();
@@ -426,10 +465,13 @@ public class Form
return itemDatasource;
}
- /** Set the item datasource for the form.
+ /**
+ * Sets the item datasource for the form.
*
- * <p>Setting item datasource clears any fields, the form might contain
- * and adds all the properties as fields to the form.</p>
+ * <p>
+ * Setting item datasource clears any fields, the form might contain
+ * and adds all the properties as fields to the form.
+ * </p>
*
* @see com.itmill.toolkit.data.Item.Viewer#setItemDataSource(Item)
*/
@@ -439,28 +481,31 @@ public class Form
newDataSource != null ? newDataSource.getItemPropertyIds() : null);
}
- /** Set the item datasource for the form, but limit the form contents
+ /**
+ * Set the item datasource for the form, but limit the form contents
* to specified properties of the item.
*
- * <p>Setting item datasource clears any fields, the form might contain
+ * <p>
+ * Setting item datasource clears any fields, the form might contain
* and adds the specified the properties as fields to the form, in the
- * specified order.</p>
+ * specified order.
+ * </p>
*
* @see com.itmill.toolkit.data.Item.Viewer#setItemDataSource(Item)
*/
public void setItemDataSource(Item newDataSource, Collection propertyIds) {
- // Remove all fields first from the form
+ // Removes all fields first from the form
removeAllProperties();
- // Set the datasource
+ // Sets the datasource
itemDatasource = newDataSource;
//If the new datasource is null, just set null datasource
if (itemDatasource == null)
return;
- // Add all the properties to this form
+ // Adds all the properties to this form
for (Iterator i = propertyIds.iterator(); i.hasNext();) {
Object id = i.next();
Property property = itemDatasource.getItemProperty(id);
@@ -475,21 +520,27 @@ public class Form
}
}
- /** Get the layout of the form.
+ /**
+ * Gets the layout of the form.
*
- * <p>By default form uses <code>OrderedLayout</code> with <code>form</code>-style.</p>
+ * <p>
+ * By default form uses <code>OrderedLayout</code> with <code>form</code>-style.
+ * </p>
*
- * @return Layout of the form.
+ * @return the Layout of the form.
*/
public Layout getLayout() {
return layout;
}
- /** Set the layout of the form.
+ /**
+ * Sets the layout of the form.
*
- * <p>By default form uses <code>OrderedLayout</code> with <code>form</code>-style.</p>
+ * <p>
+ * By default form uses <code>OrderedLayout</code> with <code>form</code>-style.
+ * </p>
*
- * @param layout Layout of the form.
+ * @param newLayout the Layout of the form.
*/
public void setLayout(Layout newLayout) {
@@ -510,26 +561,31 @@ public class Form
this.layout = newLayout;
}
- /** Set a form field to be selectable from static list of changes.
+ /**
+ * Sets the form field to be selectable from static list of changes.
*
- * <p>The list values and descriptions are given as array. The value-array must contain the
+ * <p>
+ * The list values and descriptions are given as array. The value-array must contain the
* current value of the field and the lengths of the arrays must match. Null values are not
- * supported.</p>
- *
- * @return The select property generated
+ * supported.
+ * </p>
+ * @param propertyId the id of the property.
+ * @param values
+ * @param descriptions
+ * @return the select property generated
*/
public Select replaceWithSelect(
Object propertyId,
Object[] values,
Object[] descriptions) {
- // Check the parameters
+ // Checks the parameters
if (propertyId == null || values == null || descriptions == null)
throw new NullPointerException("All parameters must be non-null");
if (values.length != descriptions.length)
throw new IllegalArgumentException("Value and description list are of different size");
- // Get the old field
+ // Gets the old field
Field oldField = (Field) fields.get(propertyId);
if (oldField == null)
throw new IllegalArgumentException(
@@ -538,7 +594,7 @@ public class Form
+ "' can not be found.");
Object value = oldField.getValue();
- // Check that the value exists and check if the select should
+ // Checks that the value exists and check if the select should
// be forced in multiselect mode
boolean found = false;
boolean isMultiselect = false;
@@ -575,7 +631,7 @@ public class Form
+ "' was not found");
}
- // Create new field matching to old field parameters
+ // Creates the new field matching to old field parameters
Select newField = new Select();
if (isMultiselect) newField.setMultiSelect(true);
newField.setCaption(oldField.getCaption());
@@ -583,7 +639,7 @@ public class Form
newField.setReadThrough(oldField.isReadThrough());
newField.setWriteThrough(oldField.isWriteThrough());
- // Create options list
+ // Creates the options list
newField.addContainerProperty("desc", String.class, "");
newField.setItemCaptionPropertyId("desc");
for (int i = 0; i < values.length; i++) {
@@ -598,12 +654,12 @@ public class Form
descriptions[i].toString());
}
- // Set the property data source
+ // Sets the property data source
Property property = oldField.getPropertyDataSource();
oldField.setPropertyDataSource(null);
newField.setPropertyDataSource(property);
- // Replace the old field with new one
+ // Replaces the old field with new one
layout.replaceComponent(oldField, newField);
fields.put(propertyId, newField);
this.removeDirectDependency(oldField);
@@ -615,6 +671,7 @@ public class Form
}
/**
+ * Notifies the component that it is connected to an application
* @see com.itmill.toolkit.ui.Component#attach()
*/
public void attach() {
@@ -623,6 +680,7 @@ public class Form
}
/**
+ * Notifies the component that it is detached from the application.
* @see com.itmill.toolkit.ui.Component#detach()
*/
public void detach() {
@@ -631,6 +689,7 @@ public class Form
}
/**
+ * Adds a new validator for this object.
* @see com.itmill.toolkit.data.Validatable#addValidator(com.itmill.toolkit.data.Validator)
*/
public void addValidator(Validator validator) {
@@ -640,7 +699,9 @@ public class Form
}
this.validators.add(validator);
}
+
/**
+ * Removes a previously registered validator from the object.
* @see com.itmill.toolkit.data.Validatable#removeValidator(com.itmill.toolkit.data.Validator)
*/
public void removeValidator(Validator validator) {
@@ -648,7 +709,9 @@ public class Form
this.validators.remove(validator);
}
}
+
/**
+ * Gets the Lists all validators currently registered for the object.
* @see com.itmill.toolkit.data.Validatable#getValidators()
*/
public Collection getValidators() {
@@ -657,7 +720,10 @@ public class Form
}
return null;
}
+
/**
+ * Tests the current value of the object against all registered
+ * validators
* @see com.itmill.toolkit.data.Validatable#isValid()
*/
public boolean isValid() {
@@ -666,7 +732,9 @@ public class Form
valid &= ((Field) fields.get(i.next())).isValid();
return valid;
}
+
/**
+ * Checks the validity of the validatable.
* @see com.itmill.toolkit.data.Validatable#validate()
*/
public void validate() throws InvalidValueException {
@@ -675,19 +743,24 @@ public class Form
}
/**
+ * Checks the validabtable object accept invalid values.
* @see com.itmill.toolkit.data.Validatable#isInvalidAllowed()
*/
public boolean isInvalidAllowed() {
return true;
}
+
/**
+ * Should the validabtable object accept invalid values.
* @see com.itmill.toolkit.data.Validatable#setInvalidAllowed(boolean)
*/
public void setInvalidAllowed(boolean invalidValueAllowed)
throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+
/**
+ * Sets the component's to read-only mode to the specified state.
* @see com.itmill.toolkit.ui.Component#setReadOnly(boolean)
*/
public void setReadOnly(boolean readOnly) {
@@ -696,12 +769,13 @@ public class Form
((Field) fields.get(i.next())).setReadOnly(readOnly);
}
- /** Set the field factory of Form.
+ /**
+ * Sets the field factory of Form.
*
- * FieldFacroty is used to create fields for form properties.
+ * <code>FieldFactory</code> is used to create fields for form properties.
* By default the form uses BaseFieldFactory to create Field instances.
*
- * @param fieldFactory New factory used to create the fields
+ * @param fieldFactory the New factory used to create the fields.
* @see Field
* @see FieldFactory
*/
@@ -709,15 +783,17 @@ public class Form
this.fieldFactory = fieldFactory;
}
- /** Get the field factory of the form.
+ /**
+ * Get the field factory of the form.
*
- * @return FieldFactory Factory used to create the fields
+ * @return the FieldFactory Factory used to create the fields.
*/
public FieldFactory getFieldFactory() {
return this.fieldFactory;
}
/**
+ * Gets the field type.
* @see com.itmill.toolkit.ui.AbstractField#getType()
*/
public Class getType() {
@@ -726,27 +802,29 @@ public class Form
return Object.class;
}
- /** Set the internal value.
+ /**
+ * Sets the internal value.
*
* This is relevant when the Form is used as Field.
* @see com.itmill.toolkit.ui.AbstractField#setInternalValue(java.lang.Object)
*/
protected void setInternalValue(Object newValue) {
- // Store old value
+ // Stores the old value
Object oldValue = this.propertyValue;
- // Set the current Value
+ // Sets the current Value
super.setInternalValue(newValue);
this.propertyValue = newValue;
- // Ignore form updating if data object has not changed.
+ // Ignores form updating if data object has not changed.
if (oldValue != newValue) {
setFormDataSource(newValue, getVisibleItemProperties());
}
}
- /**Get first field in form.
- * @return Field
+ /**
+ * Gets the first field in form.
+ * @return the Field.
*/
private Field getFirstField() {
Object id = null;
@@ -758,10 +836,12 @@ public class Form
return null;
}
- /** Update the internal form datasource.
+ /**
+ * Updates the internal form datasource.
*
* Method setFormDataSource.
- * @param value
+ * @param data
+ * @param properties
*/
protected void setFormDataSource(Object data, Collection properties) {
@@ -773,19 +853,19 @@ public class Form
item = new BeanItem(data);
}
- // Set the datasource to form
+ // Sets the datasource to form
if (item != null && properties != null) {
- // Show only given properties
+ // Shows only given properties
this.setItemDataSource(item, properties);
} else {
- // Show all properties
+ // Shows all properties
this.setItemDataSource(item);
}
}
/**
* Returns the visibleProperties.
- * @return Collection
+ * @return the Collection of visible Item properites.
*/
public Collection getVisibleItemProperties() {
return visibleItemProperties;
@@ -793,7 +873,7 @@ public class Form
/**
* Sets the visibleProperties.
- * @param visibleProperties The visibleProperties to set
+ * @param visibleProperties the visibleProperties to set.
*/
public void setVisibleItemProperties(Collection visibleProperties) {
this.visibleItemProperties = visibleProperties;
@@ -801,7 +881,8 @@ public class Form
setFormDataSource(value, getVisibleItemProperties());
}
- /** Focuses the first field in the form.
+ /**
+ * Focuses the first field in the form.
* @see com.itmill.toolkit.ui.Component.Focusable#focus()
*/
public void focus() {
@@ -812,6 +893,7 @@ public class Form
}
/**
+ * Sets the Tabulator index of this Focusable component.
* @see com.itmill.toolkit.ui.Component.Focusable#setTabIndex(int)
*/
public void setTabIndex(int tabIndex) {
diff --git a/src/com/itmill/toolkit/ui/FrameWindow.java b/src/com/itmill/toolkit/ui/FrameWindow.java
index 83b1fdb4c9..6717fad004 100644
--- a/src/com/itmill/toolkit/ui/FrameWindow.java
+++ b/src/com/itmill/toolkit/ui/FrameWindow.java
@@ -39,14 +39,19 @@ import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.Resource;
-/** <p>An application frame window component. This component implements a
+/**
+ * <p>
+ * An application frame window component. This component implements a
* window that contains a hierarchical set of frames. Each frame can contain
* a web-page, window or a set of frames that divides the space horizontally
- * or vertically.</p>
+ * or vertically.
+ * </p>
*
- * <p>A <code>FrameWindow</code> can't contain any components directly (as
+ * <p>
+ * A <code>FrameWindow</code> can't contain any components directly (as
* it contains only a set of frames) and thus the container interface
- * methods do nothing.</p>
+ * methods do nothing.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -56,43 +61,46 @@ public class FrameWindow extends Window {
private Frameset frameset = new Frameset();
- /** <p>Constructs a new frame window.
- *
+ /**
+ * Constructs a new frame window.
*/
public FrameWindow() {
}
- /** <p>Constructs a new frame window.
- *
- * @param caption title of the window
+ /**
+ * Constructs a new frame window.
+ * @param caption th etitle of the window.
*/
public FrameWindow(String caption) {
super(caption);
}
- /** Gets the window's UIDL tag.
+ /**
+ * Gets the window's UIDL tag.
*
- * @return window's UIDL tag as <code>String</code>
+ * @return the window's UIDL tag as <code>String</code>.
*/
public String getTag() {
return "framewindow";
}
- /** Gets the main frameset of the window. This set contains all the
+ /**
+ * Gets the main frameset of the window. This set contains all the
* top-level frames of the window. New contents are added by adding
* frames to this frameset.
*
- * @return top-level frame set of this frame window
+ * @return the top-level frame set of this frame window.
*/
public Frameset getFrameset() {
return frameset;
}
- /** Paints the window contents.
+ /**
+ * Paints the window contents.
*
- * @param target A paint target event
- * @throws PaintException if the paint operation fails
+ * @param target the paint target event.
+ * @throws PaintException if the paint operation fails.
*
* @see com.itmill.toolkit.ui.AbstractComponent#paintContent(PaintTarget)
*/
@@ -104,71 +112,109 @@ public class FrameWindow extends Window {
getFrameset().paint(target);
}
- /** An individual frame that contains either a window or the contents of the
+ /**
+ * An individual frame that contains either a window or the contents of the
* url set to frame.
*
- * <p>The frames can be only created to framesets using the
- * <code>newFrame()</code> functions of the frameset.</p>
+ * <p>
+ * The frames can be only created to framesets using the
+ * <code>newFrame</code> method of the frameset.
+ * </p>
*/
public class Frame {
- /** URL of the frame contents */
+ /**
+ * URL of the frame contents.
+ */
private URL url;
- /** Name of the frame */
+ /**
+ * Name of the frame.
+ */
private String name;
- /** Window connected to frame or null */
+ /**
+ * Window connected to frame or null.
+ */
private Window window;
- /** Window connected to frame or null */
+ /**
+ * Window connected to frame or null.
+ */
private Resource resource;
- /** String representation of the width */
+ /**
+ * String representation of the width.
+ */
private String width = "*";
- /** Parent frameset */
+ /**
+ * Parent frameset.
+ */
protected Frameset parentFrameset;
- /** URL of the frame */
+ /**
+ * Gets the URL of the frame.
+ * @return the URl.
+ */
public URL getURL() {
return window == null ? url : window.getURL();
}
- /** Get the parent frameset */
+ /**
+ * Gets the parent frameset.
+ * @return the parent frameset.
+ */
public Frameset getParentFrameset() {
return parentFrameset;
}
- /** Name of the freame */
+ /**
+ * Gets the Name of the frame.
+ * @return the Name.
+ */
public String getName() {
return window == null ? name : window.getName();
}
- /** Window connected to frame */
+ /**
+ * Gets the Window connected to frame.
+ * @return the window.
+ */
public Window getWindow() {
return window;
}
- /** Resource connected to frame */
+ /**
+ * Gets the Resource connected to frame.
+ * @return the resource.
+ */
public Resource getResource() {
return resource;
}
- /** Absolute width/height of the frame in pixels */
+ /**
+ * Sets the Absolute width/height of the frame in pixels.
+ * @param widthInPixel the width in Pixel.
+ */
public void setAbsoluteSize(int widthInPixels) {
width = String.valueOf(widthInPixels);
requestRepaint();
}
- /** Set the frame size to be freely specified by the terminal */
+ /**
+ * Sets the frame size to be freely specified by the terminal.
+ */
public void setFreeSize() {
width = "*";
requestRepaint();
}
- /** Set the frame width/height as a percentage of the containing
- * frameset size */
+ /**
+ * Sets the frame width/height as a percentage of the containing
+ * frameset size.
+ * @param widthInPercents the frame width in percent.
+ */
public void setRelativeSize(int widthInPercents) {
if (widthInPercents < 0 || widthInPercents > 100)
throw new IllegalArgumentException(
@@ -177,7 +223,11 @@ public class FrameWindow extends Window {
requestRepaint();
}
- /** Paint the frame */
+ /**
+ * Paints the frame.
+ * @param target the paint target.
+ * @throws PaintException if the paint operation fails.
+ */
private void paint(PaintTarget target) throws PaintException {
target.startTag("frame");
if (getResource() != null)
@@ -189,39 +239,55 @@ public class FrameWindow extends Window {
}
}
- /** Vertical or horizontal set of frames */
+ /**
+ * Vertical or horizontal set of frames.
+ */
public class Frameset extends Frame {
- /** List of frames ordered from left to right or from top to bottom */
+ /**
+ * List of frames ordered from left to right or from top to bottom.
+ */
private LinkedList frames = new LinkedList();
- /** True iff the frames are on top of each other. If false the frames
+ /**
+ * <code>true</code> if the frames are on top of each other. If <code>false</code> the frames
* are side by side.
*/
private boolean vertical = false;
- /** Get a list of frames.
+ /**
+ * Gets the list of frames.
*
- * @return unmodifiable list of frames.
+ * @return the unmodifiable list of frames.
*/
public List getFrames() {
return Collections.unmodifiableList(frames);
}
- /** Create new frame containing a window.
+ /**
+ * Creates the new frame containing a window.
*
- * <p>The new frame will be in the end of the frames list.</p>
+ * <p>
+ * The new frame will be in the end of the frames list.
+ * </p>
+ * @param window the window connected to the frame.
+ * @return the new Frame.
*/
public Frame newFrame(Window window) {
return newFrame(window, size());
}
- /** Create new frame containing a window.
+ /**
+ * Creates the new frame containing a window.
*
- * <p>The new frame will be put before the frame identified
+ * <p>
+ * The new frame will be put before the frame identified
* by the given index. The indexes of the frame previously in the
* given position and all the positions after it are incremented
- * by one.</p>
+ * by one.
+ * </p>
+ * @param window the window connected to the frame.
+ * @param index the given index.
*/
public Frame newFrame(Window window, int index) {
Frame f = new Frame();
@@ -234,28 +300,47 @@ public class FrameWindow extends Window {
return f;
}
- /** Create new frame containing a url.
+ /**
+ * Creates the new frame containing a url.
*
- * <p>The new frame will be put in the end of the frames list..</p>
+ * <p>
+ * The new frame will be put in the end of the frames list.
+ * </p>
+ * @param url the URL of the frame contents.
+ * @param name the Name of the frame.
+ * @return the new frame.
*/
public Frame newFrame(URL url, String name) {
return newFrame(url, name, size());
}
- /** Create new frame containing a resource.
+ /**
+ * Creates the new frame containing a resource.
*
- * <p>The new frame will be put in the end of the frames list..</p>
+ * <p>
+ * The new frame will be put in the end of the frames list.
+ * </p>
+ * @param resource the resource.
+ * @param name the Name of the frame.
+ * @return the new frame.
*/
public Frame newFrame(Resource resource, String name) {
return newFrame(resource, name, size());
}
- /** Create new frame containing a url.
+ /**
+ * Creates the new frame containing a url.
*
- * <p>The new frame will be put before the frame identified
+ * <p>
+ * The new frame will be put before the frame identified
* by the given index. The indexes of the frame previously in the
* given position and all the positions after it are incremented
- * by one.</p>
+ * by one.
+ * </p>
+ * @param url the URL of the frame contents.
+ * @param name the Name of the frame.
+ * @param index the given index.
+ * @return the new frame.
*/
public Frame newFrame(URL url, String name, int index) {
Frame f = new Frame();
@@ -267,12 +352,19 @@ public class FrameWindow extends Window {
return f;
}
- /** Create new frame containing a resource.
+ /**
+ * Creates the new frame containing a resource.
*
- * <p>The new frame will be put before the frame identified
+ * <p>
+ * The new frame will be put before the frame identified
* by the given index. The indexes of the frame previously in the
* given position and all the positions after it are incremented
- * by one.</p>
+ * by one.
+ * </p>
+ * @param resource the resource.
+ * @param name the Name of the frame.
+ * @param index the given index.
+ * @return the new frame.
*/
public Frame newFrame(Resource resource, String name, int index) {
Frame f = new Frame();
@@ -284,12 +376,18 @@ public class FrameWindow extends Window {
return f;
}
- /** Create new frameset.
+ /**
+ * Creates the new frameset.
*
- * <p>The new frame will be put before the frame identified
+ * <p>
+ * The new frame will be put before the frame identified
* by the given index. The indexes of the frame previously in the
* given position and all the positions after it are incremented
- * by one.</p>
+ * by one.
+ * </p>
+ * @param isVertical is the frames are on top of each other.
+ * @param index the given index.
+ * @return the new frameset.
*/
public Frameset newFrameset(boolean isVertical, int index) {
Frameset f = new Frameset();
@@ -300,14 +398,19 @@ public class FrameWindow extends Window {
return f;
}
- /** Remove a frame from this frameset */
+ /**
+ * Removes the frame from this frameset.
+ * @param frame the frame to remove.
+ */
public void removeFrame(Frame frame) {
frames.remove(frame);
frame.parentFrameset = null;
requestRepaint();
}
- /** Remove all frames from this frameset */
+ /**
+ * Removes all frames from this frameset.
+ */
public void removeAllFrames() {
for (Iterator i = frames.iterator(); i.hasNext();)
((Frame) i.next()).parentFrameset = null;
@@ -315,35 +418,48 @@ public class FrameWindow extends Window {
requestRepaint();
}
- /** Number of frames in this frameset */
+ /**
+ * Number of frames in this frameset.
+ * @return the size.
+ */
public int size() {
return frames.size();
}
- /** Set the framaset to be vertical.
+ /**
+ * Sets the framaset to be vertical.
*
- * <p>By setting this true, the frames will be ordered on top
+ * <p>
+ * By setting this true, the frames will be ordered on top
* of each other from top to bottom. Setting this false, the
- * frames will be ordered side by side from left to right.</p>
+ * frames will be ordered side by side from left to right.
+ * </p>
+ * @param isVertical is the frames are on top of each other.
*/
public void setVertical(boolean isVertical) {
this.vertical = isVertical;
requestRepaint();
}
- /** Check if the frameset is vertical.
+ /**
+ * Checks if the frameset is vertical.
*
- * <p>If this is true, the frames will be ordered on top
+ * <p>
+ * If this is true, the frames will be ordered on top
* of each other from top to bottom, otherwise the
- * frames will be ordered side by side from left to right.</p>
+ * frames will be ordered side by side from left to right.
+ * </p>
+ * @return <code>true</code> if the frameset is Vertical, otherwise <code>false</code>.
*/
public boolean isVertical() {
return vertical;
}
- /** Get frame by name.
- * @return Frame having the given name or null if the frame is
- * not found
+ /**
+ * Gets the frame by name.
+ * @param name the Name of the frame.
+ * @return the Frame having the given name or null if the frame is
+ * not found.
*/
public Frame getFrame(String name) {
if (name == null)
@@ -356,8 +472,10 @@ public class FrameWindow extends Window {
return null;
}
- /** Get frame by index.
- * @return Frame having the given index or null if the frame is
+ /**
+ * Gets the frame by index.
+ * @param index the given index.
+ * @return the Frame having the given index or null if the frame is
* not found
*/
public Frame getFrame(int index) {
@@ -366,7 +484,11 @@ public class FrameWindow extends Window {
return null;
}
- /** Paint the frameset */
+ /**
+ * Paints the frameset.
+ * @param target the Paint Target.
+ * @throws PaintException if the Paint operation fails.
+ */
private void paint(PaintTarget target) throws PaintException {
target.startTag("frameset");
if (!frames.isEmpty()) {
@@ -394,7 +516,11 @@ public class FrameWindow extends Window {
target.endTag("frameset");
}
- /** Set the application for all the frames in this frameset */
+ /**
+ * Sets the application for all the frames in this frameset.
+ * @param fromApplication
+ * @param toApplication
+ */
private void setApplication(
Application fromApplication,
Application toApplication) {
@@ -414,7 +540,8 @@ public class FrameWindow extends Window {
}
}
- /** Setting the application for frame window also sets the application
+ /**
+ * Setting the application for frame window also sets the application
* for all the frames.
* @see com.itmill.toolkit.ui.Window#setApplication(Application)
*/
@@ -426,40 +553,48 @@ public class FrameWindow extends Window {
fs.setApplication(fromApplication, application);
}
- /** Frame windows does not support scrolling.
+ /**
+ * Frame windows does not support scrolling.
+ * @return <code>true</code> if it is scrollable,otherwise <code>false</code>.
*/
public boolean isScrollable() {
return false;
}
- /** Frame windows does not support scrolling.
+ /**
+ * Enables or disables scrolling.
*
* @see com.itmill.toolkit.terminal.Scrollable#setScrollable(boolean)
*/
public void setScrollable(boolean isScrollingEnabled) {
}
- /** Frame windows does not support scrolling.
+ /**
+ * Sets the scroll X offset.
*
* @see com.itmill.toolkit.terminal.Scrollable#setScrollOffsetX(int)
*/
public void setScrollOffsetX(int pixelsScrolledLeft) {
}
- /** Frame windows does not support scrolling.
+ /**
+ * Gets the scroll Y offset.
*
* @see com.itmill.toolkit.terminal.Scrollable#setScrollOffsetY(int)
*/
public void setScrollOffsetY(int pixelsScrolledDown) {
}
- /** Frame window does not support adding components directly.
- *
- * <p>To add component to frame window, normal window must be
- * first created and then attached to frame window as a frame.</p>
+ /**
+ * Frame window does not support adding components directly.
*
+ * <p>
+ * To add component to frame window, normal window must be
+ * first created and then attached to frame window as a frame.
+ * </p>
+ * @param c the component to be added.
* @see com.itmill.toolkit.ui.ComponentContainer#addComponent(Component)
- * @throws UnsupportedOperationException if invoked.
+ *
*/
public void addComponent(Component c)
throws UnsupportedOperationException {
diff --git a/src/com/itmill/toolkit/ui/GridLayout.java b/src/com/itmill/toolkit/ui/GridLayout.java
index 3324db74a8..3e2b7521ec 100644
--- a/src/com/itmill/toolkit/ui/GridLayout.java
+++ b/src/com/itmill/toolkit/ui/GridLayout.java
@@ -36,15 +36,20 @@ import java.util.LinkedList;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
-/** <p>A container that consists of components with certain coordinates on a
+/**
+ * <p>
+ * A container that consists of components with certain coordinates on a
* grid. It also maintains cursor for adding component in left to right,
- * top to bottom order.</p>
+ * top to bottom order.
+ * </p>
*
- * <p>Each component in a <code>GridLayout</code> uses a certain
+ * <p>
+ * Each component in a <code>GridLayout</code> uses a certain
* {@link GridLayout.Area area} (x1,y1,x2,y2) from the grid. One should not
* add components that would overlap with the existing components because in
* such case an {@link OverlapsException} is thrown. Adding component with
- * cursor automatically extends the grid by increasing the grid height.</p>
+ * cursor automatically extends the grid by increasing the grid height.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -52,65 +57,82 @@ import com.itmill.toolkit.terminal.PaintTarget;
*/
public class GridLayout extends AbstractComponentContainer implements Layout {
- /** Initial grid x size */
+ /**
+ * Initial grid x size.
+ */
private int width = 0;
- /** Initial grid y size */
+ /**
+ * Initial grid y size.
+ */
private int height = 0;
- /** Cursor X position: this is where the next component with
+ /**
+ * Cursor X position: this is where the next component with
* unspecified x,y is inserted
*/
private int cursorX = 0;
- /** Cursor Y position: this is where the next component with
+ /**
+ * Cursor Y position: this is where the next component with
* unspecified x,y is inserted
*/
private int cursorY = 0;
- /** Contains all items that are placed on the grid.
+ /**
+ * Contains all items that are placed on the grid.
* These are components with grid area definition.
*/
private LinkedList areas = new LinkedList();
- /** Mapping from components to threir respective areas. */
+ /**
+ * Mapping from components to threir respective areas.
+ */
private LinkedList components = new LinkedList();
- /** Constructor for grid of given size.
+ /**
+ * Constructor for grid of given size.
* Note that grid's final size depends on the items that are added into the grid.
* Grid grows if you add components outside the grid's area.
- * @param width Width of the grid.
- * @param height Height of the grid.
+ * @param width the Width of the grid.
+ * @param height the Height of the grid.
*/
public GridLayout(int width, int height) {
setWidth(width);
setHeight(height);
}
- /** Constructs an empty grid layout that is extended as needed. */
+ /**
+ * Constructs an empty grid layout that is extended as needed.
+ */
public GridLayout() {
this(1, 1);
}
- /** <p>Adds a component with a specified area to the grid. The area the
+ /**
+ * <p>
+ * Adds a component with a specified area to the grid. The area the
* new component should take is defined by specifying the upper left
- * corner (x1, y1) and the lower right corner (x2, y2) of the area.</p>
+ * corner (x1, y1) and the lower right corner (x2, y2) of the area.
+ * </p>
*
- * <p>If the new component overlaps with any of the existing components
+ * <p>
+ * If the new component overlaps with any of the existing components
* already present in the grid the operation will fail and an
- * {@link OverlapsException} is thrown.</p>
+ * {@link OverlapsException} is thrown.
+ * </p>
*
- * @param c The component to be added.
- * @param x1 The X-coordinate of the upper left corner of the area
- * <code>c</code> is supposed to occupy
- * @param y1 The Y-coordinate of the upper left corner of the area
- * <code>c</code> is supposed to occupy
- * @param x2 The X-coordinate of the lower right corner of the area
- * <code>c</code> is supposed to occupy
- * @param y2 The Y-coordinate of the lower right corner of the area
- * <code>c</code> is supposed to occupy
+ * @param c the component to be added.
+ * @param x1 the X-coordinate of the upper left corner of the area
+ * <code>c</code> is supposed to occupy.
+ * @param y1 the Y-coordinate of the upper left corner of the area
+ * <code>c</code> is supposed to occupy.
+ * @param x2 the X-coordinate of the lower right corner of the area
+ * <code>c</code> is supposed to occupy.
+ * @param y2 the Y-coordinate of the lower right corner of the area
+ * <code>c</code> is supposed to occupy.
* @throws OverlapsException if the new component overlaps with any
- * of the components already in the grid
+ * of the components already in the grid.
* @throws OutOfBoundsException if the coordinates are outside of the
* grid area.
*/
@@ -125,23 +147,23 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
if (component == null)
throw new NullPointerException("Component must not be null");
- // Check that the component does not already exist in the container
+ // Checks that the component does not already exist in the container
if (components.contains(component))
throw new IllegalArgumentException("Component is already in the container");
- // Create area
+ // Creates the area
Area area = new Area(component, x1, y1, x2, y2);
- // Check the validity of the coordinates
+ // Checks the validity of the coordinates
if (x2 < x1 || y2 < y2)
throw new IllegalArgumentException("Illegal coordinates for the component");
if (x1 < 0 || y1 < 0 || x2 >= width || y2 >= height)
throw new OutOfBoundsException(area);
- // Check that newItem does not overlap with existing items
+ // Checks that newItem does not overlap with existing items
checkExistingOverlaps(area);
- // Insert the component to right place at the list
+ // Inserts the component to right place at the list
// Respect top-down, left-right ordering
component.setParent(this);
Iterator i = areas.iterator();
@@ -166,12 +188,13 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
requestRepaint();
}
- /** Tests if the given area overlaps with any of the items already on
+ /**
+ * Tests if the given area overlaps with any of the items already on
* the grid.
*
- * @param area Area to be checked for overlapping
+ * @param area the Area to be checked for overlapping.
* @throws OverlapsException if <code>area</code> overlaps with
- * any existing area
+ * any existing area.
*/
private void checkExistingOverlaps(Area area) throws OverlapsException {
for (Iterator i = areas.iterator(); i.hasNext();) {
@@ -183,20 +206,22 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
}
- /** Add component into this container to coordinates x1,y1 (NortWest corner of the area.)
+ /**
+ * Adds the component into this container to coordinates x1,y1 (NortWest corner of the area.)
* End coordinates (SouthEast corner of the area) are the same as x1,y1. Component width
* and height is 1.
- * @param c The component to be added.
- * @param x X-coordinate
- * @param y Y-coordinate
+ * @param c the component to be added.
+ * @param x the X-coordinate.
+ * @param y the Y-coordinate.
*/
public void addComponent(Component c, int x, int y) {
this.addComponent(c, x, y, x, y);
}
- /** Force the next component to be added to the beginning of the next line.
- * By calling this function user can ensure that no more components are
- * added to the right of the previous component.
+ /**
+ * Force the next component to be added to the beginning of the next line.
+ * By calling this function user can ensure that no more components are
+ * added to the right of the previous component.
*
* @see #space()
*/
@@ -205,7 +230,8 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
cursorY++;
}
- /** Move cursor forwards by one. If the cursor goes out of the right grid border,
+ /**
+ * Moves the cursor forwards by one. If the cursor goes out of the right grid border,
* move it to next line.
*
* @see #newLine()
@@ -218,15 +244,16 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
}
- /** Add a component into this container to the cursor position.
+ /**
+ * Adds the component into this container to the cursor position.
* If the cursor position is already occupied, the cursor is
* moved forwards to find free position. If the cursor goes out
* from the bottom of the grid, the grid is automaticly extended.
- * @param c The component to be added.
+ * @param c the component to be added.
*/
public void addComponent(Component component) {
- // Find first available place from the grid
+ // Finds first available place from the grid
Area area;
boolean done = false;
while (!done)
@@ -238,17 +265,18 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
space();
}
- // Extend the grid if needed
+ // Extends the grid if needed
width = cursorX >= width ? cursorX + 1 : width;
height = cursorY >= height ? cursorY + 1 : height;
addComponent(component, cursorX, cursorY);
}
- /** Removes the given component from this
+ /**
+ * Removes the given component from this
* container.
*
- * @param c The component to be removed.
+ * @param c the component to be removed.
*/
public void removeComponent(Component component) {
@@ -272,15 +300,16 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
requestRepaint();
}
- /** Removes a component specified with it's top-left corner coordinates
+ /**
+ * Removes the component specified with it's top-left corner coordinates
* from this grid.
*
- * @param x Component's top-left corner's X-coordinate
- * @param y Component's top-left corner's Y-coordinate
+ * @param x the Component's top-left corner's X-coordinate.
+ * @param y the Component's top-left corner's Y-coordinate.
*/
public void removeComponent(int x, int y) {
- // Find area
+ // Finds the area
for (Iterator i = areas.iterator(); i.hasNext();) {
Area area = (Area) i.next();
if (area.getX1() == x && area.getY1() == y) {
@@ -290,19 +319,21 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
}
- /** Gets an Iterator to the component container contents. Using the
+ /**
+ * Gets an Iterator to the component container contents. Using the
* Iterator it's possible to step through the contents of the container.
*
- * @return Iterator of the components inside the container.
+ * @return the Iterator of the components inside the container.
*/
public Iterator getComponentIterator() {
return Collections.unmodifiableCollection(components).iterator();
}
- /** Paints the contents of this component.
+ /**
+ * Paints the contents of this component.
*
- * @param event PaintEvent.
- * @throws PaintException The paint operation failed.
+ * @param target the Paint Event.
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
@@ -315,20 +346,20 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
// Current item to be processed (fetch first item)
Area area = areaiterator.hasNext() ? (Area) areaiterator.next() : null;
- // Collect rowspan related information here
+ // Collects rowspan related information here
HashMap cellUsed = new HashMap();
// Empty cell collector
int emptyCells = 0;
- // Iterate every applicable row
+ // Iterates every applicable row
for (int cury = 0; cury < height; cury++) {
target.startTag("gr");
- // Iterate every applicable column
+ // Iterates every applicable column
for (int curx = 0; curx < width; curx++) {
- // Check if current item is located at curx,cury
+ // Checks if current item is located at curx,cury
if (area != null && (area.y1 == cury) && (area.x1 == curx)) {
// First check if empty cell needs to be rendered
@@ -368,7 +399,7 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
area = null;
}
- // Update cellUsed if rowspan needed
+ // Updates the cellUsed if rowspan needed
if (rows > 1) {
int spannedx = curx;
for (int j = 1; j <= cols; j++) {
@@ -379,14 +410,14 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
}
- // Skip current item's spanned columns
+ // Skips the current item's spanned columns
if (cols > 1) {
curx += cols - 1;
}
} else {
- // Check against cellUsed, render space or ignore cell
+ // Checks against cellUsed, render space or ignore cell
if (cellUsed.containsKey(new Integer(curx))) {
// Current column contains already an item,
@@ -415,7 +446,7 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
// empty cell is needed
emptyCells++;
- // Remove cellUsed key as it has become obsolete
+ // Removes the cellUsed key as it has become obsolete
cellUsed.remove(new Integer(curx));
}
} else {
@@ -425,11 +456,11 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
}
- } // iterate every column
+ } // iterates every column
// Last column handled of current row
- // Check if empty cell needs to be rendered
+ // Checks if empty cell needs to be rendered
if (emptyCells > 0) {
target.startTag("gc");
target.addAttribute("x", width - emptyCells);
@@ -443,54 +474,70 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
target.endTag("gr");
- } // iterate every row
+ } // iterates every row
// Last row handled
}
- /** Gets the components UIDL tag.
+ /**
+ * Gets the components UIDL tag.
*
- * @return Component UIDL tag as string.
+ * @return the Component UIDL tag as string.
* @see com.itmill.toolkit.ui.AbstractComponent#getTag()
*/
public String getTag() {
return "gridlayout";
}
- /** This class defines an area on a grid. An Area is defined by the
+ /**
+ * This class defines an area on a grid. An Area is defined by the
* coordinates of its upper left corner (x1,y1) and lower right corner
- * (x2,y2)
+ * (x2,y2).
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public class Area {
- /** X-coordinate of the upper left corner of the area */
+ /**
+ * X-coordinate of the upper left corner of the area.
+ */
private int x1;
- /** Y-coordinate of the upper left corner of the area */
+ /**
+ * Y-coordinate of the upper left corner of the area.
+ */
private int y1;
- /** X-coordinate of the lower right corner of the area */
+ /**
+ * X-coordinate of the lower right corner of the area.
+ */
private int x2;
- /** Y-coordinate of the lower right corner of the area */
+ /**
+ * Y-coordinate of the lower right corner of the area.
+ */
private int y2;
- /** Component painted on the area */
+ /**
+ * Component painted on the area.
+ */
private Component component;
- /** <p>Construct a new area on a grid.
- *
- * @param x1 The X-coordinate of the upper left corner of the area
- * <code>c</code> is supposed to occupy
- * @param y1 The Y-coordinate of the upper left corner of the area
- * <code>c</code> is supposed to occupy
- * @param x2 The X-coordinate of the lower right corner of the area
- * <code>c</code> is supposed to occupy
- * @param y2 The Y-coordinate of the lower right corner of the area
- * <code>c</code> is supposed to occupy
+ /**
+ * <p>
+ * Construct a new area on a grid.
+ * </p>
+ * @param component the component connected to the area.
+ * @param x1 the X-coordinate of the upper left corner of the area
+ * <code>c</code> is supposed to occupy.
+ * @param y1 the Y-coordinate of the upper left corner of the area
+ * <code>c</code> is supposed to occupy.
+ * @param x2 the X-coordinate of the lower right corner of the area
+ * <code>c</code> is supposed to occupy.
+ * @param y2 the Y-coordinate of the lower right corner of the area
+ * <code>c</code> is supposed to occupy.
* @throws OverlapsException if the new component overlaps with any
* of the components already in the grid
*/
@@ -502,12 +549,13 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
this.component = component;
}
- /** Tests if the given Area overlaps with an another Area.
+ /**
+ * Tests if the given Area overlaps with an another Area.
*
- * @param other Another Area that's to be tested for overlap with
- * this area
+ * @param other the Another Area that's to be tested for overlap with
+ * this area.
* @return <code>true</code> if <code>other</code> overlaps with
- * this area, <code>false</code> if it doesn't
+ * this area, <code>false</code> if it doesn't.
*/
public boolean overlaps(Area other) {
return x1 <= other.getX2()
@@ -517,42 +565,45 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
- /** Returns the component connected to the area.
- * @return Component
+ /**
+ * Gets the component connected to the area.
+ * @return the Component.
*/
public Component getComponent() {
return component;
}
- /** Sets the component connected to the area.
+ /**
+ * Sets the component connected to the area.
*
* <p>This function only sets the value in the datastructure and does not
- * send any events or set parents</p>
+ * send any events or set parents.</p>
*
- * @param newComponent The new connected overriding the existing one
+ * @param newComponent the new connected overriding the existing one.
*/
protected void setComponent(Component newComponent) {
component= newComponent;
}
- /** Returns the top-left corner x-coordinate.
- * @return int
+ /**
+ * Gets the top-left corner x-coordinate.
+ * @return the top-left corner of x-coordinate.
*/
public int getX1() {
return x1;
}
/**
- * Returns the bottom-right corner x-coordinate.
- * @return int
+ * Gets the bottom-right corner x-coordinate.
+ * @return the x-coordinate.
*/
public int getX2() {
return x2;
}
/**
- * Returns the top-left corner y-coordinate.
- * @return int
+ * Gets the top-left corner y-coordinate.
+ * @return the y-coordinate.
*/
public int getY1() {
return y1;
@@ -560,7 +611,7 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
/**
* Returns the bottom-right corner y-coordinate.
- * @return int
+ * @return the y-coordinate.
*/
public int getY2() {
return y2;
@@ -568,8 +619,10 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
- /** An <code>Exception</code> object which is thrown when two Items
+ /**
+ * An <code>Exception</code> object which is thrown when two Items
* occupy the same space on a grid.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -583,21 +636,27 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
private Area existingArea;
- /** Constructs an <code>OverlapsException</code>.
- * @param msg the detail message.
+ /**
+ * Constructs an <code>OverlapsException</code>.
+ * @param existingArea
*/
public OverlapsException(Area existingArea) {
this.existingArea = existingArea;
}
- /** Get the area */
+ /**
+ * Gets the area .
+ * @return the existing area.
+ */
public Area getArea() {
return existingArea;
}
}
- /** An <code>Exception</code> object which is thrown when an area exceeds the
+ /**
+ * An <code>Exception</code> object which is thrown when an area exceeds the
* bounds of the grid.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -611,26 +670,29 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
private Area areaOutOfBounds;
- /** Constructs an <code>OoutOfBoundsException</code> with the specified
+ /**
+ * Constructs an <code>OoutOfBoundsException</code> with the specified
* detail message.
*
- * @param msg the detail message.
+ * @param areaOutOfBounds
*/
public OutOfBoundsException(Area areaOutOfBounds) {
this.areaOutOfBounds = areaOutOfBounds;
}
- /** Get the area that is out of bounds */
+ /**
+ * Gets the area that is out of bounds.
+ * @return the area out of Bound.
+ */
public Area getArea() {
return areaOutOfBounds;
}
}
- /** Set the width of the grid. The width can not be reduced if there are
+ /**
+ * Sets the width of the grid. The width can not be reduced if there are
* any areas that would be outside of the shrunk grid.
- * @param width New width of the grid.
- * @throws OutOfBoundsException if the one of the areas would exceed the
- * bounds of the grid after the modification of the grid size.
+ * @param width the New width of the grid.
*/
public void setWidth(int width) {
@@ -642,7 +704,7 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
if (this.width == width)
return;
- // Check for overlaps
+ // Checks for overlaps
if (this.width > width)
for (Iterator i = areas.iterator(); i.hasNext();) {
Area area = (Area) i.next();
@@ -655,16 +717,18 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
requestRepaint();
}
- /** Get the width of the grids.
- * @return The width of the grid
+ /**
+ * Get the width of the grids.
+ * @return the width of the grid.
*/
public final int getWidth() {
return this.width;
}
- /** Set the height of the grid. The width can not be reduced if there are
+ /**
+ * Sets the height of the grid. The width can not be reduced if there are
* any areas that would be outside of the shrunk grid.
- * @param Height of the grid
+ * @param height the height of the grid.
*/
public void setHeight(int height) {
@@ -676,7 +740,7 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
if (this.height == height)
return;
- // Check for overlaps
+ // Checks for overlaps
if (this.height > height)
for (Iterator i = areas.iterator(); i.hasNext();) {
Area area = (Area) i.next();
@@ -689,30 +753,33 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
requestRepaint();
}
- /** Get the height of the grid.
- * @return int - how many cells high the grid is
+ /**
+ * Gets the height of the grid.
+ * @return int - how many cells high the grid is.
*/
public final int getHeight() {
return this.height;
}
- /** Get the current cursor x-position.
+ /**
+ * Gets the current cursor x-position.
* The cursor position points the position for the next component
* that is added without specifying its coordinates. When the
* cursor position is occupied, the next component will be added
* to first free position after the cursor.
- * @return Cursor x-coordinate.
+ * @return the Cursor x-coordinate.
*/
public int getCursorX() {
return cursorX;
}
- /** Get the current cursor y-position.
+ /**
+ * Gets the current cursor y-position.
* The cursor position points the position for the next component
* that is added without specifying its coordinates. When the
* cursor position is occupied, the next component will be added
* to first free position after the cursor.
- * @return Cursor y-coordinate.
+ * @return the Cursor y-coordinate.
*/
public int getCursorY() {
return cursorY;
@@ -723,7 +790,7 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
Component oldComponent,
Component newComponent) {
- // Get the locations
+ // Gets the locations
Area oldLocation = null;
Area newLocation = null;
for (Iterator i=areas.iterator(); i.hasNext();) {
@@ -746,6 +813,7 @@ public class GridLayout extends AbstractComponentContainer implements Layout {
}
/*
+ * Removes all components from this container.
* @see com.itmill.toolkit.ui.ComponentContainer#removeAllComponents()
*/
public void removeAllComponents() {
diff --git a/src/com/itmill/toolkit/ui/Label.java b/src/com/itmill/toolkit/ui/Label.java
index df447c0e14..9126beb31b 100644
--- a/src/com/itmill/toolkit/ui/Label.java
+++ b/src/com/itmill/toolkit/ui/Label.java
@@ -35,7 +35,8 @@ import com.itmill.toolkit.data.util.ObjectProperty;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
-/** Label component for showing non-editable short texts.
+/**
+ * Label component for showing non-editable short texts.
*
* The label content can be set to the modes specified by the final members
* CONTENT_*
@@ -65,31 +66,37 @@ public class Label
Property.ValueChangeListener,
Property.ValueChangeNotifier, Comparable {
- /** Content mode, where the label contains only plain text. The getValue()
+ /**
+ * Content mode, where the label contains only plain text. The getValue()
* result is coded to XML when painting.
*/
public static final int CONTENT_TEXT = 0;
- /** Content mode, where the label contains preformatted text.
+ /**
+ * Content mode, where the label contains preformatted text.
*/
public static final int CONTENT_PREFORMATTED = 1;
- /** Formatted content mode, where the contents is XML restricted to the
+ /**
+ * Formatted content mode, where the contents is XML restricted to the
* UIDL 1.0 formatting markups.
*/
public static final int CONTENT_UIDL = 2;
- /** Content mode, where the label contains XHTML. Contents is then enclosed in
+ /**
+ * Content mode, where the label contains XHTML. Contents is then enclosed in
* DIV elements having namespace of "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
*/
public static final int CONTENT_XHTML = 3;
- /** Content mode, where the label contains well-formed or well-balanced XML.
+ /**
+ * Content mode, where the label contains well-formed or well-balanced XML.
* Each of the root elements must have their default namespace specified.
*/
public static final int CONTENT_XML = 4;
- /** Content mode, where the label contains RAW output. Output is not
+ /**
+ * Content mode, where the label contains RAW output. Output is not
* required to comply to with XML. In Web Adapter output is inserted inside
* the resulting HTML document as-is. This is useful for some specific
* purposes where possibly broken HTML content needs to be shown, but in
@@ -97,49 +104,69 @@ public class Label
*/
public static final int CONTENT_RAW = 5;
- /** The default content mode is plain text */
+ /**
+ * The default content mode is plain text.
+ */
public static final int CONTENT_DEFAULT = CONTENT_TEXT;
private Property dataSource;
private int contentMode = CONTENT_DEFAULT;
- /** Creates an empty Label. */
+ /**
+ * Creates an empty Label.
+ */
public Label() {
setPropertyDataSource(new ObjectProperty("", String.class));
}
- /** Creates a new instance of Label with text-contents. */
+ /**
+ * Creates a new instance of Label with text-contents.
+ * @param content
+ */
public Label(String content) {
setPropertyDataSource(new ObjectProperty(content, String.class));
}
- /** Creates a new instance of Label with text-contents read from given datasource. */
+ /**
+ * Creates a new instance of Label with text-contents read from given datasource.
+ * @param contentSource
+ */
public Label(Property contentSource) {
setPropertyDataSource(contentSource);
}
- /** Creates a new instance of Label with text-contents. */
+ /**
+ * Creates a new instance of Label with text-contents.
+ * @param content
+ * @param contentMode
+ */
public Label(String content, int contentMode) {
setPropertyDataSource(new ObjectProperty(content, String.class));
setContentMode(contentMode);
}
- /** Creates a new instance of Label with text-contents read from given datasource. */
+ /**
+ * Creates a new instance of Label with text-contents read from given datasource.
+ * @param contentSource
+ * @param contentMode
+ */
public Label(Property contentSource, int contentMode) {
setPropertyDataSource(contentSource);
setContentMode(contentMode);
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Get the component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "label";
}
- /** Set the component to read-only.
+ /**
+ * Set the component to read-only.
* Readonly is not used in label.
- * @param readOnly True to enable read-only mode, False to disable it
+ * @param readOnly True to enable read-only mode, False to disable it.
*/
public void setReadOnly(boolean readOnly) {
if (dataSource == null)
@@ -147,9 +174,10 @@ public class Label
dataSource.setReadOnly(readOnly);
}
- /** Is the component read-only ?
+ /**
+ * Is the component read-only ?
* Readonly is not used in label - this returns allways false.
- * @return True iff the component is in read only mode
+ * @return <code>true</code> if the component is in read only mode.
*/
public boolean isReadOnly() {
if (dataSource == null)
@@ -157,8 +185,10 @@ public class Label
return dataSource.isReadOnly();
}
- /** Paint the content of this component.
- * @param event PaintEvent.
+ /**
+ * Paints the content of this component.
+ * @param target the Paint Event.
+ * @throws PaintException if the Paint Operation fails.
*/
public void paintContent(PaintTarget target) throws PaintException {
if (contentMode == CONTENT_TEXT)
@@ -187,9 +217,10 @@ public class Label
}
- /** Get the value of the label.
+ /**
+ * Gets the value of the label.
* Value of the label is the XML contents of the label.
- * @return Value of the label
+ * @return the Value of the label.
*/
public Object getValue() {
if (dataSource == null)
@@ -197,52 +228,69 @@ public class Label
return dataSource.getValue();
}
- /** Set the value of the label.
+ /**
+ * Set the value of the label.
* Value of the label is the XML contents of the label.
- * @param newValue New value of the label
+ * @param newValue the New value of the label.
*/
public void setValue(Object newValue) {
if (dataSource == null)
throw new IllegalStateException("Datasource must be se");
this.dataSource.setValue(newValue);
}
-
+
+ /**
+ * @see java.lang.Object#toString()
+ */
public String toString() {
if (dataSource == null)
throw new IllegalStateException("Datasource must be se");
return dataSource.toString();
}
-
+
+ /**
+ * Gets the type of the Property.
+ * @see com.itmill.toolkit.data.Property#getType()
+ */
public Class getType() {
if (dataSource == null)
throw new IllegalStateException("Datasource must be se");
return dataSource.getType();
}
- /** Get viewing data-source property. */
+ /**
+ * Gets the viewing data-source property.
+ * @return the data source property.
+ * @see com.itmill.toolkit.data.Property.Viewer#getPropertyDataSource()
+ */
public Property getPropertyDataSource() {
return dataSource;
}
- /** Set the property as data-source for viewing. */
+ /**
+ * Sets the property as data-source for viewing.
+ * @param newDataSource the new data source Property
+ * @see com.itmill.toolkit.data.Property.Viewer#setPropertyDataSource(com.itmill.toolkit.data.Property)
+ */
public void setPropertyDataSource(Property newDataSource) {
- // Stop listening the old data source changes
+ // Stops listening the old data source changes
if (dataSource != null
&& Property.ValueChangeNotifier.class.isAssignableFrom(
dataSource.getClass()))
((Property.ValueChangeNotifier) dataSource).removeListener(this);
- // Set the new data source
+ // Sets the new data source
dataSource = newDataSource;
- // Listen the new data source if possible
+ // Listens the new data source if possible
if (dataSource != null
&& Property.ValueChangeNotifier.class.isAssignableFrom(
dataSource.getClass()))
((Property.ValueChangeNotifier) dataSource).addListener(this);
}
- /** Get the content mode of the Label.
+ /**
+ * Gets the content mode of the Label.
*
* <p>Possible content modes include:
* <ul>
@@ -271,13 +319,14 @@ public class Label
* be preferred.</li>
* </ul></p>
*
- * @return Content mode of the label.
+ * @return the Content mode of the label.
*/
public int getContentMode() {
return contentMode;
}
- /** Set the content mode of the Label.
+ /**
+ * Sets the content mode of the Label.
*
* <p>Possible content modes include:
* <ul>
@@ -306,7 +355,7 @@ public class Label
* be preferred.</li>
* </ul></p>
*
- * @param contentMode New content mode of the label.
+ * @param contentMode the New content mode of the label.
*/
public void setContentMode(int contentMode) {
if (contentMode >= CONTENT_TEXT && contentMode <= CONTENT_RAW)
@@ -329,7 +378,8 @@ public class Label
}
}
- /** Value change event
+ /**
+ * Value change event
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -343,23 +393,27 @@ public class Label
*/
private static final long serialVersionUID = 3906084563938586935L;
- /** New instance of text change event
- * @param source Source of the event.
+ /**
+ * New instance of text change event
+ * @param source the Source of the event.
*/
public ValueChangeEvent(Label source) {
super(source);
}
- /** Value where the event occurred
- * @return Source of the event.
+ /**
+ * Gets the Property that has been modified.
+ * @see com.itmill.toolkit.data.Property.ValueChangeEvent#getProperty()
*/
public Property getProperty() {
return (Property) getSource();
}
}
- /** Add value change listener
- * @param listener Listener to be added.
+ /**
+ * Adds the value change listener.
+ * @param listener the Listener to be added.
+ * @see com.itmill.toolkit.data.Property.ValueChangeNotifier#addListener(com.itmill.toolkit.data.Property.ValueChangeListener)
*/
public void addListener(Property.ValueChangeListener listener) {
addListener(
@@ -368,8 +422,10 @@ public class Label
VALUE_CHANGE_METHOD);
}
- /** Remove value change listener
- * @param listener Listener to be removed.
+ /**
+ * Removes the value change listener.
+ * @param listener the Listener to be removed.
+ * @see com.itmill.toolkit.data.Property.ValueChangeNotifier#removeListener(com.itmill.toolkit.data.Property.ValueChangeListener)
*/
public void removeListener(Property.ValueChangeListener listener) {
removeListener(
@@ -378,21 +434,25 @@ public class Label
VALUE_CHANGE_METHOD);
}
- /** Emit options change event. */
+ /**
+ * Emits the options change event.
+ */
protected void fireValueChange() {
// Set the error message
fireEvent(new Label.ValueChangeEvent(this));
requestRepaint();
}
- /** Listen value change events from data source.
+ /**
+ * Listens the value change events from data source.
* @see com.itmill.toolkit.data.Property.ValueChangeListener#valueChange(Property.ValueChangeEvent)
*/
public void valueChange(Property.ValueChangeEvent event) {
fireValueChange();
}
- /** Compare Label to other objects.
+ /**
+ * Compares the Label to other objects.
*
* <p>Labels can be compared to other labels for sorting label contents.
* This is especially handy for sorting table columns.</p>
@@ -401,10 +461,10 @@ public class Label
* compared as is. In XML, UIDL and XHTML modes, only CDATA is compared and
* tags ignored. If the other object is not a Label, its toString() return
* value is used in comparison.</p>
- *
+ * @param other the Other object to compare to.
+ * @return a negative integer, zero, or a positive integer as this object
+ * is less than, equal to, or greater than the specified object.
* @see java.lang.Comparable#compareTo(java.lang.Object)
- * @param other Other object to compare to
- * @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
*/
public int compareTo(Object other) {
@@ -426,10 +486,11 @@ public class Label
return thisValue.compareTo(otherValue);
}
- /** Strip tags from the XML.
+ /**
+ * Strips the tags from the XML.
*
- * @param xml String containing a XML snippet
- * @return The original XML without tags
+ * @param xml the String containing a XML snippet.
+ * @return the original XML without tags.
*/
private String stripTags(String xml) {
diff --git a/src/com/itmill/toolkit/ui/Layout.java b/src/com/itmill/toolkit/ui/Layout.java
index 91fbbbb0dc..a92185bf52 100644
--- a/src/com/itmill/toolkit/ui/Layout.java
+++ b/src/com/itmill/toolkit/ui/Layout.java
@@ -28,7 +28,8 @@
package com.itmill.toolkit.ui;
-/** Extension to the {@link ComponentContainer} interface which adds the
+/**
+ * Extension to the {@link ComponentContainer} interface which adds the
* layouting control to the elements in the container. This is
* required by the various layout components to enable them to place other
* components in specific locations in the UI.
diff --git a/src/com/itmill/toolkit/ui/Link.java b/src/com/itmill/toolkit/ui/Link.java
index 01a529d5bb..962cf9a55e 100644
--- a/src/com/itmill/toolkit/ui/Link.java
+++ b/src/com/itmill/toolkit/ui/Link.java
@@ -32,12 +32,12 @@ import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.Resource;
-/** Link component.
- * Link is used to create external or internal URL links.
+/**
+ * Link is used to create external or internal URL links.
*
- * Internal links can be used to create action items, which
- * change the state to application to one of the predefined states.
- * For example, a link can be created for existing MenuTree items.
+ * Internal links can be used to create action items, which
+ * change the state to application to one of the predefined states.
+ * For example, a link can be created for existing MenuTree items.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -59,17 +59,22 @@ public class Link extends AbstractComponent {
private int targetWidth = -1;
private int targetHeight = -1;
- /** Creates a new link. */
+ /**
+ * Creates a new link.
+ */
public Link() {
}
- /** Creates a new link to a window. */
+
+ /**
+ * Creates a new link to a window.
+ */
public Link(Window window) {
- // Set the link caption to match window caption
+ // Sets the link caption to match window caption
setCaption(window.getCaption());
- // Set the target
+ // Sets the target
setTargetName(window.getName());
setTargetName(window.getName());
@@ -78,22 +83,27 @@ public class Link extends AbstractComponent {
setTargetBorder(window.getBorder());
}
- /** Creates a new instance of Link */
+ /**
+ * Creates a new instance of Link.
+ * @param caption
+ * @param resource
+ */
public Link(String caption, Resource resource) {
setCaption(caption);
this.resource = resource;
}
- /** Creates a new instance of Link that opens a new window.
+ /**
+ * Creates a new instance of Link that opens a new window.
*
*
- * @param caption Link text.
- * @param targetName The name of the target window where the link
+ * @param caption 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.
- * @param width Width of the target window.
- * @param height Height of the target window.
- * @param border Borget style of the target window.
+ * @param width the Width of the target window.
+ * @param height the Height of the target window.
+ * @param border the Border style of the target window.
*
*/
public Link(
@@ -111,16 +121,18 @@ public class Link extends AbstractComponent {
setTargetBorder(border);
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Gets the component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "link";
}
- /** Paint the content of this component.
- * @param event PaintEvent.
- * @throws PaintException The paint operation failed.
+ /**
+ * Paints the content of this component.
+ * @param target the Paint Event.
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
@@ -153,37 +165,42 @@ public class Link extends AbstractComponent {
}
}
- /** Returns the target window border.
- * @return int
+ /**
+ * Returns the target window border.
+ * @return the target window border.
*/
public int getTargetBorder() {
return targetBorder;
}
- /** Returns the target window height or -1 if not set.
- * @return int
+ /**
+ * Returns the target window height or -1 if not set.
+ * @return the target window height.
*/
public int getTargetHeight() {
return targetHeight < 0 ? -1 : targetHeight;
}
- /** Returns the target window name. Empty name of null implies that
+ /**
+ * Returns the target window name. Empty name of null implies that
* the target is opened to the window containing the link.
- * @return String
+ * @return the target window name.
*/
public String getTargetName() {
return targetName;
}
- /** Returns the target window width or -1 if not set.
- * @return int
+ /**
+ * Returns the target window width or -1 if not set.
+ * @return the target window width.
*/
public int getTargetWidth() {
return targetWidth < 0 ? -1 : targetWidth;
}
- /** Sets the border of the target window.
- * @param targetBorder The targetBorder to set
+ /**
+ * Sets the border of the target window.
+ * @param targetBorder the targetBorder to set.
*/
public void setTargetBorder(int targetBorder) {
if (targetBorder == TARGET_BORDER_DEFAULT
@@ -194,45 +211,51 @@ public class Link extends AbstractComponent {
}
}
- /** Sets the target window height.
- * @param targetHeight The targetHeight to set
+ /**
+ * Sets the target window height.
+ * @param targetHeight the targetHeight to set.
*/
public void setTargetHeight(int targetHeight) {
this.targetHeight = targetHeight;
requestRepaint();
}
- /** Sets the target window name.
- * @param targetName The targetName to set
+ /**
+ * Sets the target window name.
+ * @param targetName the targetName to set.
*/
public void setTargetName(String targetName) {
this.targetName = targetName;
requestRepaint();
}
- /** Sets the target window width.
- * @param targetWidth The targetWidth to set
+ /**
+ * Sets the target window width.
+ * @param targetWidth the targetWidth to set.
*/
public void setTargetWidth(int targetWidth) {
this.targetWidth = targetWidth;
requestRepaint();
}
- /** Returns the resource this link opens.
- * @return Resource
+ /**
+ * Returns the resource this link opens.
+ * @return the Resource.
*/
public Resource getResource() {
return resource;
}
- /** Returns the window this link opens.
- * @return Window
+ /**
+ * Returns the window this link opens.
+ * @return the Window.
*/
public Window getWindow() {
return window;
}
- /** Sets the resource this link opens.
- * @param resource The resource to set
+ /**
+ * Sets the resource this link opens.
+ * @param resource the resource to set.
*/
public void setResource(Resource resource) {
this.resource = resource;
@@ -242,8 +265,9 @@ public class Link extends AbstractComponent {
requestRepaint();
}
- /** Sets the window this link opens.
- * @param window The window to set
+ /**
+ * Sets the window this link opens.
+ * @param window the window to set.
*/
public void setWindow(Window window) {
this.window = window;
diff --git a/src/com/itmill/toolkit/ui/OrderedLayout.java b/src/com/itmill/toolkit/ui/OrderedLayout.java
index 876a643679..959dfd8762 100644
--- a/src/com/itmill/toolkit/ui/OrderedLayout.java
+++ b/src/com/itmill/toolkit/ui/OrderedLayout.java
@@ -36,7 +36,7 @@ import java.util.LinkedList;
/** Ordered layout.
*
- * Ordered layout is a component container, which shows the subcomponents in the
+ * <code>OrderedLayout</code> is a component container, which shows the subcomponents in the
* order of their addition in specified orientation.
*
* @author IT Mill Ltd.
@@ -49,43 +49,55 @@ public class OrderedLayout
/* Predefined orientations ***************************************** */
- /** Components are to be layed out vertically. */
+ /**
+ * Components are to be layed out vertically.
+ */
public static int ORIENTATION_VERTICAL = 0;
- /** Components are to be layed out horizontally. */
+ /**
+ * Components are to be layed out horizontally.
+ */
public static int ORIENTATION_HORIZONTAL = 1;
- /** Custom layout slots containing the components */
+ /**
+ * Custom layout slots containing the components.
+ */
private LinkedList components = new LinkedList();
- /** Orientation of the layout. */
+ /**
+ * Orientation of the layout.
+ */
private int orientation;
- /** Create a new ordered layout.
- * The order of the layout is ORIENTATION_VERTICAL.
+ /**
+ * Creates a new ordered layout.
+ * The order of the layout is <code>ORIENTATION_VERTICAL</code>.
*/
public OrderedLayout() {
orientation = ORIENTATION_VERTICAL;
}
- /** Create a new ordered layout.
+ /**
+ * Create a new ordered layout.
* The orientation of the layout is given as parameters.
*
- * @param orientation Orientation of the layout.
+ * @param orientation the Orientation of the layout.
*/
public OrderedLayout(int orientation) {
this.orientation = orientation;
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Gets the component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "orderedlayout";
}
- /** Add a component into this container. The component is added to the
+ /**
+ * Add a component into this container. The component is added to the
* right or under the previous component.
- * @param c The component to be added.
+ * @param c the component to be added.
*/
public void addComponent(Component c) {
components.add(c);
@@ -93,9 +105,10 @@ public class OrderedLayout
requestRepaint();
}
- /** Add a component into this container. The component is added to the
+ /**
+ * Adds a component into this container. The component is added to the
* left or on top of the other components.
- * @param c The component to be added.
+ * @param c the component to be added.
*/
public void addComponentAsFirst(Component c) {
components.addFirst(c);
@@ -103,9 +116,10 @@ public class OrderedLayout
requestRepaint();
}
- /** Add a component into indexed position in this container.
- * @param c The component to be added.
- * @param index Index of the component position.
+ /**
+ * Adds a component into indexed position in this container.
+ * @param c the component to be added.
+ * @param index the Index of the component position.
* The components currently in and after the position are shifted forwards.
*/
public void addComponent(Component c, int index) {
@@ -114,8 +128,9 @@ public class OrderedLayout
requestRepaint();
}
- /** Remove a component from this container.
- * @param c The component to be removed.
+ /**
+ * Removes the component from this container.
+ * @param c the component to be removed.
*/
public void removeComponent(Component c) {
super.removeComponent(c);
@@ -123,26 +138,28 @@ public class OrderedLayout
requestRepaint();
}
- /** Get component container iterator for going trough all the components in
+ /**
+ * Gets the component container iterator for going trough all the components in
* the container.
- * @return Iterator of the components inside the container.
+ * @return the Iterator of the components inside the container.
*/
public Iterator getComponentIterator() {
return components.iterator();
}
- /** Paint the content of this component.
- * @param event PaintEvent.
- * @throws PaintException The paint operation failed.
+ /**
+ * Paints the content of this component.
+ * @param target the Paint Event.
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
- // Add the attributes: orientation
+ // Adds the attributes: orientation
// note that the default values (b/vertival) are omitted
if (orientation == ORIENTATION_HORIZONTAL)
target.addAttribute("orientation", "horizontal");
- // Add all items in all the locations
+ // Adds all items in all the locations
for (Iterator i = components.iterator(); i.hasNext();) {
Component c = (Component) i.next();
if (c != null) {
@@ -151,19 +168,21 @@ public class OrderedLayout
}
}
- /** Get the orientation of the container.
- * @return Value of property orientation.
+ /**
+ * Gets the orientation of the container.
+ * @return the Value of property orientation.
*/
public int getOrientation() {
return this.orientation;
}
- /** Set the orientation of the container.
- * @param orientation New value of property orientation.
+ /**
+ * Set the orientation of the container.
+ * @param orientation the New value of property orientation.
*/
public void setOrientation(int orientation) {
- // Check the validity of the argument
+ // Checks the validity of the argument
if (orientation < ORIENTATION_VERTICAL
|| orientation > ORIENTATION_HORIZONTAL)
throw new IllegalArgumentException();
@@ -176,7 +195,7 @@ public class OrderedLayout
Component oldComponent,
Component newComponent) {
- // Get the locations
+ // Gets the locations
int oldLocation = -1;
int newLocation = -1;
int location = 0;
diff --git a/src/com/itmill/toolkit/ui/Panel.java b/src/com/itmill/toolkit/ui/Panel.java
index 0c72bc9d16..5991d752c6 100644
--- a/src/com/itmill/toolkit/ui/Panel.java
+++ b/src/com/itmill/toolkit/ui/Panel.java
@@ -36,7 +36,8 @@ import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.Scrollable;
import com.itmill.toolkit.terminal.Sizeable;
-/** Panel - a simple single component container.
+/**
+ * Panel - a simple single component container.
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -49,76 +50,98 @@ public class Panel
ComponentContainer.ComponentAttachListener,
ComponentContainer.ComponentDetachListener {
- /** Layout of the panel */
+ /**
+ * Layout of the panel.
+ */
private Layout layout;
- /** Width of the panel or -1 if unspecified */
+ /**
+ * Width of the panel or -1 if unspecified.
+ */
private int width = -1;
- /** Height of the panel or -1 if unspecified */
+ /**
+ * Height of the panel or -1 if unspecified.
+ */
private int height = -1;
- /** Width unit */
+ /**
+ * Width unit.
+ */
private int widthUnit = Sizeable.UNITS_PIXELS;
- /** Height unit */
+ /**
+ * Height unit.
+ */
private int heightUnit = Sizeable.UNITS_PIXELS;
- /** Scroll X position */
+ /**
+ * Scroll X position.
+ */
private int scrollOffsetX = 0;
- /** Scroll Y position */
+ /**
+ * Scroll Y position.
+ */
private int scrollOffsetY = 0;
- /** Scrolling mode */
+ /**
+ * Scrolling mode.
+ */
private boolean scrollable = false;
- /** Create new empty panel.
- * Ordered layout is used.
+ /**
+ * Creates the new empty panel.
+ * Ordered layout is used.
*/
public Panel() {
this(new OrderedLayout());
}
- /** Create new empty panel with given layout.
+ /**
+ * Creates the new empty panel with given layout.
* Layout must be non-null.
*
- * @param layout The layout used in the panel.
+ * @param layout the layout used in the panel.
*/
public Panel(Layout layout) {
setLayout(layout);
}
- /** Create new empty panel with caption.
+ /**
+ * Creates the new empty panel with caption.
* Ordered layout is used.
*
- * @param caption The caption used in the panel.
+ * @param caption the caption used in the panel.
*/
public Panel(String caption) {
this(caption, new OrderedLayout());
}
- /** Create new empty panel with caption.
+ /**
+ * Creates the new empty panel with caption.
*
- * @param caption The caption of the panel.
- * @param layout The layout used in the panel.
+ * @param caption the caption of the panel.
+ * @param layout the layout used in the panel.
*/
public Panel(String caption, Layout layout) {
this(layout);
setCaption(caption);
}
- /** Get the current layout of the panel.
- * @return Current layout of the panel.
+ /**
+ * Gets the current layout of the panel.
+ * @return the Current layout of the panel.
*/
public Layout getLayout() {
return this.layout;
}
- /** Set the layout of the panel.
+ /**
+ * Sets the layout of the panel.
* All the components are moved to new layout.
*
- * @param layout New layout of the panel.
+ * @param layout the New layout of the panel.
*/
public void setLayout(Layout layout) {
@@ -126,7 +149,7 @@ public class Panel
if (layout == null)
layout = new OrderedLayout();
- // Set the panel to be parent for the layout
+ // Sets the panel to be parent for the layout
layout.setParent(this);
dependsOn(layout);
@@ -138,23 +161,24 @@ public class Panel
this.layout.setParent(null);
}
- // Remove the event listeners from the old layout
+ // Removes the event listeners from the old layout
if (this.layout != null) {
this.layout.removeListener((ComponentContainer.ComponentAttachListener) this);
this.layout.removeListener((ComponentContainer.ComponentDetachListener) this);
}
- // Set the new layout
+ // Sets the new layout
this.layout = layout;
- // Add event listeners for new layout
+ // Adds the event listeners for new layout
layout.addListener((ComponentContainer.ComponentAttachListener) this);
layout.addListener((ComponentContainer.ComponentDetachListener) this);
}
- /** Paint the content of this component.
- * @param event PaintEvent.
- * @throws PaintException The paint operation failed.
+ /**
+ * Paints the content of this component.
+ * @param target the Paint Event.
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
layout.paint(target);
@@ -166,15 +190,18 @@ public class Panel
}
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Gets the component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "panel";
}
- /** Add a component into this container.
- * @param c The component to be added.
+ /**
+ * Adds the component into this container.
+ * @param c the component to be added.
+ * @see com.itmill.toolkit.ui.AbstractComponentContainer#addComponent(com.itmill.toolkit.ui.Component)
*/
public void addComponent(Component c) {
layout.addComponent(c);
@@ -182,8 +209,10 @@ public class Panel
// request repaints
}
- /** Remove a component from this container.
+ /**
+ * Removes the component from this container.
* @param c The component to be added.
+ * @see com.itmill.toolkit.ui.AbstractComponentContainer#removeComponent(com.itmill.toolkit.ui.Component)
*/
public void removeComponent(Component c) {
layout.removeComponent(c);
@@ -191,39 +220,49 @@ public class Panel
// request repaints
}
- /** Get component container iterator for going trough all the components in the container.
- * @return Iterator of the components inside the container.
+ /**
+ * Gets the component container iterator for going trough all the components in the container.
+ * @return the Iterator of the components inside the container.
+ * @see com.itmill.toolkit.ui.ComponentContainer#getComponentIterator()
*/
public Iterator getComponentIterator() {
return layout.getComponentIterator();
}
/**
+ * Gets the height in pixels.
* @return The height in pixels or negative value if not assigned.
+ * @see com.itmill.toolkit.terminal.Sizeable#getHeight()
*/
public int getHeight() {
return height;
}
/**
+ * Gets the Width in pixel.
* @return The width in pixels or negative value if not assigned.
+ * @see com.itmill.toolkit.terminal.Sizeable#getWidth()
*/
public int getWidth() {
return width;
}
- /** Sets the height in pixels.
+ /**
+ * Sets the height in pixels.
* Use negative value to let the client decide the height.
- * @param height The height to set
+ * @param height the height to set.
+ * @see com.itmill.toolkit.terminal.Sizeable#setHeight(int)
*/
public void setHeight(int height) {
this.height = height;
requestRepaint();
}
- /** Sets the width in pixels.
+ /**
+ * Sets the width in pixels.
* Use negative value to allow the client decide the width.
- * @param width The width to set
+ * @param width the width to set.
+ * @see com.itmill.toolkit.terminal.Sizeable#setWidth(int)
*/
public void setWidth(int width) {
this.width = width;
@@ -231,6 +270,8 @@ public class Panel
}
/**
+ * Called when one or more variables handled by the implementing class
+ * are changed.
* @see com.itmill.toolkit.terminal.VariableOwner#changeVariables(Object, Map)
*/
public void changeVariables(Object source, Map variables) {
@@ -254,6 +295,7 @@ public class Panel
}
/**
+ * Gets the height property units.
* @see com.itmill.toolkit.terminal.Sizeable#getHeightUnits()
*/
public int getHeightUnits() {
@@ -261,13 +303,15 @@ public class Panel
}
/**
+ * Gets the width property units.
* @see com.itmill.toolkit.terminal.Sizeable#getWidthUnits()
*/
public int getWidthUnits() {
return widthUnit;
}
- /** Set height units.
+ /**
+ * Sets the height units.
* Panel supports only Sizeable.UNITS_PIXELS and this is ignored.
* @see com.itmill.toolkit.terminal.Sizeable#setHeightUnits(int)
*/
@@ -275,8 +319,9 @@ public class Panel
// Ignored
}
- /** Set width units.
- * Panel supports only Sizeable.UNITS_PIXELS, and this is ignored.
+ /**
+ * Sets the width units.
+ * Panel supports only Sizeable.UNITS_PIXELS, and this is ignored.
* @see com.itmill.toolkit.terminal.Sizeable#setWidthUnits(int)
*/
public void setWidthUnits(int units) {
@@ -336,7 +381,8 @@ public class Panel
layout.replaceComponent(oldComponent, newComponent);
}
- /** Pass the events from underlying layout forwards.
+ /**
+ * A new component is attached to container.
* @see com.itmill.toolkit.ui.ComponentContainer.ComponentAttachListener#componentAttachedToContainer(com.itmill.toolkit.ui.ComponentContainer.ComponentAttachEvent)
*/
public void componentAttachedToContainer(ComponentAttachEvent event) {
@@ -344,7 +390,8 @@ public class Panel
fireComponentAttachEvent(event.getAttachedComponent());
}
- /** Pass the events from underlying layout forwards.
+ /**
+ * A component has been detached from container.
* @see com.itmill.toolkit.ui.ComponentContainer.ComponentDetachListener#componentDetachedFromContainer(com.itmill.toolkit.ui.ComponentContainer.ComponentDetachEvent)
*/
public void componentDetachedFromContainer(ComponentDetachEvent event) {
@@ -352,20 +399,24 @@ public class Panel
fireComponentDetachEvent(event.getDetachedComponent());
}
- /*
+ /**
+ * Notifies the component that it is connected to an application.
* @see com.itmill.toolkit.ui.Component#attach()
*/
public void attach() {
if (layout != null) layout.attach();
}
- /*
+ /**
+ * Notifies the component that it is detached from the application.
* @see com.itmill.toolkit.ui.Component#detach()
*/
public void detach() {
if (layout != null) layout.detach();
- }
- /*
+ }
+
+ /**
+ * Removes all components from this container.
* @see com.itmill.toolkit.ui.ComponentContainer#removeAllComponents()
*/
public void removeAllComponents() {
diff --git a/src/com/itmill/toolkit/ui/ProgressIndicator.java b/src/com/itmill/toolkit/ui/ProgressIndicator.java
index f2bc16098c..de0e54c94b 100644
--- a/src/com/itmill/toolkit/ui/ProgressIndicator.java
+++ b/src/com/itmill/toolkit/ui/ProgressIndicator.java
@@ -34,10 +34,10 @@ import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
/**
- * ProgressIndicator is component that shows user state of a process
+ * <code>ProgressIndicator</code> is component that shows user state of a process
* (like long computing or file upload)
*
- * ProgressIndicator has two mainmodes. One for indeterminate processes and
+ * <code>ProgressIndicator</code> has two mainmodes. One for indeterminate processes and
* other (default) for processes which progress can be measured
*
* May view an other property that indicates progress 0...1
@@ -53,12 +53,14 @@ public class ProgressIndicator
Property.Viewer,
Property.ValueChangeListener {
- /** Content mode, where the label contains only plain text. The getValue()
+ /**
+ * Content mode, where the label contains only plain text. The getValue()
* result is coded to XML when painting.
*/
public static final int CONTENT_TEXT = 0;
- /** Content mode, where the label contains preformatted text.
+ /**
+ * Content mode, where the label contains preformatted text.
*/
public static final int CONTENT_PREFORMATTED = 1;
@@ -68,31 +70,41 @@ public class ProgressIndicator
private int pollingInterval = 1000;
- /** Creates an a new ProgressIndicator. */
+ /**
+ * Creates an a new ProgressIndicator.
+ */
public ProgressIndicator() {
setPropertyDataSource(new ObjectProperty(new Float(0), Float.class));
}
- /** Creates a new instance of ProgressIndicator with given state. */
+ /**
+ * Creates a new instance of ProgressIndicator with given state.
+ * @param value
+ */
public ProgressIndicator(Float value) {
setPropertyDataSource(new ObjectProperty(value, Float.class));
}
- /** Creates a new instance of ProgressIndicator with stae read from given datasource. */
+ /**
+ * Creates a new instance of ProgressIndicator with stae read from given datasource.
+ * @param contentSource
+ */
public ProgressIndicator(Property contentSource) {
setPropertyDataSource(contentSource);
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Gets the component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "progressindicator";
}
- /** Set the component to read-only.
+ /**
+ * Sets the component to read-only.
* Readonly is not used in ProgressIndicator.
- * @param readOnly True to enable read-only mode, False to disable it
+ * @param readOnly True to enable read-only mode, False to disable it.
*/
public void setReadOnly(boolean readOnly) {
if (dataSource == null)
@@ -100,9 +112,10 @@ public class ProgressIndicator
dataSource.setReadOnly(readOnly);
}
- /** Is the component read-only ?
+ /**
+ * Is the component read-only ?
* Readonly is not used in ProgressIndicator - this returns allways false.
- * @return True iff the component is in read only mode
+ * @return True if the component is in read only mode.
*/
public boolean isReadOnly() {
if (dataSource == null)
@@ -110,8 +123,10 @@ public class ProgressIndicator
return dataSource.isReadOnly();
}
- /** Paint the content of this component.
- * @param event PaintEvent.
+ /**
+ * Paints the content of this component.
+ * @param target the Paint Event.
+ * @throws PaintException if the Paint Operation fails.
*/
public void paintContent(PaintTarget target) throws PaintException {
target.addAttribute("indeterminate", indeterminate);
@@ -119,9 +134,11 @@ public class ProgressIndicator
target.addAttribute("state", this.getValue().toString());
}
- /** Get the value of the ProgressIndicator.
- * Value of the ProgressIndicator is Float between 0 and 1
- * @return Value of the ProgressIndicator
+ /**
+ * Gets the value of the ProgressIndicator.
+ * Value of the ProgressIndicator is Float between 0 and 1.
+ * @return the Value of the ProgressIndicator.
+ * @see com.itmill.toolkit.ui.AbstractField#getValue()
*/
public Object getValue() {
if (dataSource == null)
@@ -129,79 +146,96 @@ public class ProgressIndicator
return dataSource.getValue();
}
- /** Set the value of the ProgressIndicator.
- * Value of the ProgressIndicator is the Float between 0 and 1
- * @param newValue New value of the ProgressIndicator
+ /**
+ * Sets the value of the ProgressIndicator.
+ * Value of the ProgressIndicator is the Float between 0 and 1.
+ * @param newValue the New value of the ProgressIndicator.
+ * @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object)
*/
public void setValue(Object newValue) {
if (dataSource == null)
throw new IllegalStateException("Datasource must be se");
this.dataSource.setValue(newValue);
}
-
+
+ /**
+ * @see com.itmill.toolkit.ui.AbstractField#toString()
+ */
public String toString() {
if (dataSource == null)
throw new IllegalStateException("Datasource must be se");
return dataSource.toString();
}
-
+
+ /**
+ * @see com.itmill.toolkit.ui.AbstractField#getType()
+ */
public Class getType() {
if (dataSource == null)
throw new IllegalStateException("Datasource must be se");
return dataSource.getType();
}
- /** Get viewing data-source property. */
+ /**
+ * Gets the viewing data-source property.
+ * @return the datasource.
+ * @see com.itmill.toolkit.ui.AbstractField#getPropertyDataSource()
+ */
public Property getPropertyDataSource() {
return dataSource;
}
- /** Set the property as data-source for viewing. */
+ /**
+ * Sets the property as data-source for viewing.
+ * @param newDataSource the new data source.
+ * @see com.itmill.toolkit.ui.AbstractField#setPropertyDataSource(com.itmill.toolkit.data.Property)
+ */
public void setPropertyDataSource(Property newDataSource) {
- // Stop listening the old data source changes
+ // Stops listening the old data source changes
if (dataSource != null
&& Property.ValueChangeNotifier.class.isAssignableFrom(
dataSource.getClass()))
((Property.ValueChangeNotifier) dataSource).removeListener(this);
- // Set the new data source
+ // Sets the new data source
dataSource = newDataSource;
- // Listen the new data source if possible
+ // Listens the new data source if possible
if (dataSource != null
&& Property.ValueChangeNotifier.class.isAssignableFrom(
dataSource.getClass()))
((Property.ValueChangeNotifier) dataSource).addListener(this);
}
- /** Get the mode of ProgressIndicator.
+ /**
+ * Gets the mode of ProgressIndicator.
*
- * @return true if in indeterminate mode
+ * @return true if in indeterminate mode.
*/
public boolean getContentMode() {
return indeterminate;
}
/**
- * Set ProgressIndicator to indeterminate mode
+ * Sets the ProgressIndicator to indeterminate mode.
*
- * @param newValue true to set to indeterminate mode
+ * @param newValue true to set to indeterminate mode.
*/
public void setIndeterminate(boolean newValue) {
indeterminate = newValue;
}
/**
- * Set interval that compnent checks for progress
- * @param newValue interval in milliseconds
+ * Sets the interval that component checks for progress.
+ * @param newValue the interval in milliseconds.
*/
public void setPollingInterval(int newValue) {
pollingInterval = newValue;
}
/**
- * Get interval that component checks for progress
- * @return interval in milliseconds
+ * Gets the interval that component checks for progress.
+ * @return the interval in milliseconds.
*/
public int getPollingInterval() {
return pollingInterval;
diff --git a/src/com/itmill/toolkit/ui/Select.java b/src/com/itmill/toolkit/ui/Select.java
index 2c490bb229..5c66e1463a 100644
--- a/src/com/itmill/toolkit/ui/Select.java
+++ b/src/com/itmill/toolkit/ui/Select.java
@@ -122,37 +122,59 @@ public class Select extends AbstractField implements Container,
*/
public static final int ITEM_CAPTION_MODE_PROPERTY = 6;
- /** Is the select in multiselect mode? */
+ /**
+ * Is the select in multiselect mode?
+ */
private boolean multiSelect = false;
- /** Select options */
+ /**
+ * Select options.
+ */
protected Container items;
- /** Is the user allowed to add new options? */
+ /**
+ * Is the user allowed to add new options?
+ */
private boolean allowNewOptions;
- /** Keymapper used to map key values */
+ /**
+ * Keymapper used to map key values.
+ */
protected KeyMapper itemIdMapper = new KeyMapper();
- /** Item icons */
+ /**
+ * Item icons.
+ */
private HashMap itemIcons = new HashMap();
- /** Item captions */
+ /**
+ * Item captions.
+ */
private HashMap itemCaptions = new HashMap();
- /** Item caption mode */
+ /**
+ * Item caption mode.
+ */
private int itemCaptionMode = ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID;
- /** Item caption source property id */
+ /**
+ * Item caption source property id.
+ */
private Object itemCaptionPropertyId = null;
- /** Item icon source property id */
+ /**
+ * Item icon source property id.
+ */
private Object itemIconPropertyId = null;
- /** List of property set change event listeners */
+ /**
+ * List of property set change event listeners.
+ */
private LinkedList propertySetEventListeners = null;
- /** List of item set change event listeners */
+ /**
+ * List of item set change event listeners.
+ */
private LinkedList itemSetEventListeners = null;
/**
@@ -166,7 +188,8 @@ public class Select extends AbstractField implements Container,
*/
private Object nullSelectionItemId = null;
- /** Mechanism for streaming select options outside of the UIDL.
+ /**
+ * Mechanism for streaming select options outside of the UIDL.
*
* By default streaming is not enabled and this is null. Streaming can
* be enabled with setOptionsLoadingLazy(true).
@@ -193,13 +216,10 @@ public class Select extends AbstractField implements Container,
/**
* Creates a new select wthat is connected to a data-source.
- *
- * @param dataSource
- * Container datasource to be selected from by this select.
* @param caption
- * Caption of the component.
- * @param selected
- * Selected item id or null, if none selected.
+ * the Caption of the component.
+ * @param dataSource
+ * the Container datasource to be selected from by this select.
*/
public Select(String caption, Container dataSource) {
setCaption(caption);
@@ -210,15 +230,13 @@ public class Select extends AbstractField implements Container,
* Creates a new select that is filled from a collection of option values.
*
* @param caption
- * Caption of this field.
+ * the Caption of this field.
* @param options
- * Collection containing the options.
- * @param selected
- * Selected option or null, if none selected.
+ * the Collection containing the options.
*/
public Select(String caption, Collection options) {
- // Create options container and add given options to it
+ // Creates the options container and add given options to it
Container c = new IndexedContainer();
if (options != null)
for (Iterator i = options.iterator(); i.hasNext();)
@@ -231,25 +249,25 @@ public class Select extends AbstractField implements Container,
/* Component methods **************************************************** */
/**
- * Paint the content of this component.
+ * Paints the content of this component.
*
- * @param event
- * PaintEvent.
+ * @param target
+ * the Paint Event.
* @throws PaintException
- * The paint operation failed.
+ * if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
- // Paint field properties
+ // Paints field properties
super.paintContent(target);
- // Paint select attributes
+ // Paints select attributes
if (isMultiSelect())
target.addAttribute("selectmode", "multi");
if (isNewItemsAllowed())
target.addAttribute("allownewitem", true);
- // Construct selected keys array
+ // Constructs selected keys array
String[] selectedKeys;
if (isMultiSelect())
selectedKeys = new String[((Set) getValue()).size()];
@@ -257,7 +275,7 @@ public class Select extends AbstractField implements Container,
selectedKeys = new String[(getValue() == null
&& getNullSelectionItemId() == null ? 0 : 1)];
- // Paint options and create array of selected id keys
+ // Paints the options and create array of selected id keys
target.startTag("options");
// TODO Also use conventional rendering if lazy loading is not supported by terminal
if (!isLazyLoading()) {
@@ -268,13 +286,13 @@ public class Select extends AbstractField implements Container,
if (getNullSelectionItemId() != null
&& (!ids.contains(getNullSelectionItemId()))) {
- // Get the option attribute values
+ // Gets the option attribute values
Object id = getNullSelectionItemId();
String key = itemIdMapper.key(id);
String caption = getItemCaption(id);
Resource icon = getItemIcon(id);
- // Paint option
+ // Paints option
target.startTag("so");
if (icon != null)
target.addAttribute("icon", icon);
@@ -288,16 +306,16 @@ public class Select extends AbstractField implements Container,
target.endTag("so");
}
- // Paint available selection options from data source
+ // Paints the available selection options from data source
for (Iterator i = getItemIds().iterator(); i.hasNext();) {
- // Get the option attribute values
+ // Gets the option attribute values
Object id = i.next();
String key = itemIdMapper.key(id);
String caption = getItemCaption(id);
Resource icon = getItemIcon(id);
- // Paint option
+ // Paints the option
target.startTag("so");
if (icon != null)
target.addAttribute("icon", icon);
@@ -331,10 +349,7 @@ public class Select extends AbstractField implements Container,
/**
* Invoked when the value of a variable has changed.
- *
- * @param event
- * Variable change event containing the information about the
- * changed variable.
+ * @see com.itmill.toolkit.ui.AbstractComponent#changeVariables(java.lang.Object, java.util.Map)
*/
public void changeVariables(Object source, Map variables) {
@@ -344,14 +359,14 @@ public class Select extends AbstractField implements Container,
String newitem = (String) variables.get("newitem");
if (newitem != null && newitem.length() > 0) {
- // Check for readonly
+ // Checks for readonly
if (isReadOnly())
throw new Property.ReadOnlyException();
- // Add new option
+ // Adds new option
if (addItem(newitem) != null) {
- // Set the caption property, if used
+ // Sets the caption property, if used
if (getItemCaptionPropertyId() != null)
try {
getContainerProperty(newitem,
@@ -371,7 +386,7 @@ public class Select extends AbstractField implements Container,
// Multiselect mode
if (isMultiSelect()) {
- // Convert the key-array to id-set
+ // Converts the key-array to id-set
LinkedList s = new LinkedList();
for (int i = 0; i < ka.length; i++) {
Object id = itemIdMapper.get(ka[i]);
@@ -382,7 +397,7 @@ public class Select extends AbstractField implements Container,
s.add(newitem);
}
- // Limit the deselection to the set of visible items
+ // Limits the deselection to the set of visible items
// (non-visible items can not be deselected)
Collection visible = getVisibleItemIds();
if (visible != null) {
@@ -401,7 +416,7 @@ public class Select extends AbstractField implements Container,
else {
if (ka.length == 0) {
- // Allow deselection only if the deselected item is visible
+ // Allows deselection only if the deselected item is visible
Object current = getValue();
Collection visible = getVisibleItemIds();
if (visible != null && visible.contains(current))
@@ -420,16 +435,16 @@ public class Select extends AbstractField implements Container,
}
/**
- * Get component UIDL tag.
+ * Gets the component UIDL tag.
*
- * @return Component UIDL tag as string.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "select";
}
/**
- * Get the visible item ids. In Select, this returns list of all item ids,
+ * Gets the visible item ids. In Select, this returns list of all item ids,
* but can be overriden in subclasses if they paint only part of the items
* to the terminal or null if no items is visible.
*/
@@ -442,12 +457,12 @@ public class Select extends AbstractField implements Container,
/* Property methods ***************************************************** */
/**
- * Return the type of the property. getValue and setValue functions must be
- * compatible with this type: one can safely cast getValue() to given type
+ * 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
- * setValue().
+ * <code>setValue</code>.
*
- * @return type Type of the property.
+ * @return the Type of the property.
*/
public Class getType() {
if (isMultiSelect())
@@ -455,9 +470,10 @@ public class Select extends AbstractField implements Container,
else
return Object.class;
}
-
+
/**
- * Get the selected item id or in multiselect mode a set of selected ids.
+ * Gets the selected item id or in multiselect mode a set of selected ids.
+ * @see com.itmill.toolkit.ui.AbstractField#getValue()
*/
public Object getValue() {
Object retValue = super.getValue();
@@ -483,7 +499,7 @@ public class Select extends AbstractField implements Container,
}
/**
- * Set the visible value of the property.
+ * Sets the visible value of the property.
*
* <p>
* The value of the select is the selected item id. If the select is in
@@ -492,7 +508,8 @@ public class Select extends AbstractField implements Container,
* </p>
*
* @param newValue
- * 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,
Property.ConversionException {
@@ -509,55 +526,59 @@ public class Select extends AbstractField implements Container,
/* Container methods **************************************************** */
/**
- * Get the item from the container with given id. If the container does not
+ * Gets the item from the container with given id. If the container does not
* contain the requested item, null is returned.
+ * @param itemId the item id.
+ * @return the item from the container.
*/
public Item getItem(Object itemId) {
return items.getItem(itemId);
}
/**
- * Get item Id collection from the container.
+ * Gets the item Id collection from the container.
*
- * @return Collection of item ids.
+ * @return the Collection of item ids.
*/
public Collection getItemIds() {
return items.getItemIds();
}
/**
- * Get property Id collection from the container.
+ * Gets the property Id collection from the container.
*
- * @return Collection of property ids.
+ * @return the Collection of property ids.
*/
public Collection getContainerPropertyIds() {
return items.getContainerPropertyIds();
}
/**
- * Get property type.
+ * Gets the property type.
*
- * @param id
- * Id identifying the of the property.
+ * @param propertyId
+ * the Id identifying the property.
+ * @see com.itmill.toolkit.data.Container#getType(java.lang.Object)
*/
public Class getType(Object propertyId) {
return items.getType(propertyId);
}
- /**
- * Get the number of items in the container.
+ /*
+ * Gets the number of items in the container.
*
- * @return Number of items in the container.
+ * @return the Number of items in the container.
+ * @see com.itmill.toolkit.data.Container#size()
*/
public int size() {
return items.size();
}
/**
- * Test, if the collection contains an item with given id.
+ * Tests, if the collection contains an item with given id.
*
* @param itemId
- * Id the of item to be tested.
+ * the Id the of item to be tested.
*/
public boolean containsId(Object itemId) {
if (itemId != null)
@@ -567,6 +588,8 @@ public class Select extends AbstractField implements Container,
}
/**
+ * Gets the Property identified by the given itemId and propertyId from the
+ * Container
* @see com.itmill.toolkit.data.Container#getContainerProperty(Object,
* Object)
*/
@@ -574,16 +597,17 @@ public class Select extends AbstractField implements Container,
return items.getContainerProperty(itemId, propertyId);
}
- /* Container.Managed methods ******************************************** */
+ /* Container.Managed methods ******************************************** */
/**
- * Add new property to all items. Adds a property with given id, type and
+ * Adds the new property to all items. Adds a property with given id, type and
* default value to all items in the container.
*
* This functionality is optional. If the function is unsupported, it always
* returns false.
*
- * @return True iff the operation succeeded.
+ * @return True if the operation succeeded.
+ * @see com.itmill.toolkit.data.Container#addContainerProperty(java.lang.Object, java.lang.Class, java.lang.Object)
*/
public boolean addContainerProperty(Object propertyId, Class type,
Object defaultValue) throws UnsupportedOperationException {
@@ -597,12 +621,13 @@ public class Select extends AbstractField implements Container,
}
/**
- * Remove all items from the container.
+ * Removes all items from the container.
*
* This functionality is optional. If the function is unsupported, it always
* returns false.
*
- * @return True iff the operation succeeded.
+ * @return True if the operation succeeded.
+ * @see com.itmill.toolkit.data.Container#removeAllItems()
*/
public boolean removeAllItems() throws UnsupportedOperationException {
@@ -617,11 +642,12 @@ public class Select extends AbstractField implements Container,
}
/**
- * Create a new item into container with container managed id. The id of the
+ * Creates a new item into container with container managed id. The id of the
* created new item is returned. The item can be fetched with getItem()
* method. if the creation fails, null is returned.
*
- * @return Id of the created item or null in case of failure.
+ * @return the Id of the created item or null in case of failure.
+ * @see com.itmill.toolkit.data.Container#addItem()
*/
public Object addItem() throws UnsupportedOperationException {
@@ -642,8 +668,9 @@ public class Select extends AbstractField implements Container,
* returns null.
*
* @param itemId
- * Identification of the item to be created.
- * @return Created item with the given id, or null in case of failure.
+ * 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)
*/
public Item addItem(Object itemId) throws UnsupportedOperationException {
@@ -655,11 +682,12 @@ public class Select extends AbstractField implements Container,
}
/**
- * Remove item identified by Id from the container. This functionality is
+ * Removes the item identified by Id from the container. This functionality is
* optional. If the function is not implemented, the functions allways
* returns false.
*
- * @return True iff the operation succeeded.
+ * @return True if the operation succeeded.
+ * @see com.itmill.toolkit.data.Container#removeItem(java.lang.Object)
*/
public boolean removeItem(Object itemId)
throws UnsupportedOperationException {
@@ -673,13 +701,14 @@ public class Select extends AbstractField implements Container,
}
/**
- * Remove property from all items. Removes a property with given id from all
+ * Removes the property from all items. Removes a property with given id from all
* the items in the container.
*
* This functionality is optional. If the function is unsupported, it always
* returns false.
*
- * @return True iff the operation succeeded.
+ * @return True if the operation succeeded.
+ * @see com.itmill.toolkit.data.Container#removeContainerProperty(java.lang.Object)
*/
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException {
@@ -692,14 +721,17 @@ public class Select extends AbstractField implements Container,
/* Container.Viewer methods ********************************************* */
- /** Set the container as data-source for viewing. */
+ /**
+ * Sets the container as data-source for viewing.
+ * @param newDataSource the new data source.
+ */
public void setContainerDataSource(Container newDataSource) {
if (newDataSource == null)
newDataSource = new IndexedContainer();
if (items != newDataSource) {
- // Remove listeners from the old datasource
+ // Removes listeners from the old datasource
if (items != null) {
try {
((Container.ItemSetChangeNotifier) items)
@@ -715,13 +747,13 @@ public class Select extends AbstractField implements Container,
}
}
- // Assign new data source
+ // Assigns new data source
items = newDataSource;
- // Clear itemIdMapper also
+ // Clears itemIdMapper also
this.itemIdMapper.removeAll();
- // Add listeners
+ // Adds listeners
if (items != null) {
try {
((Container.ItemSetChangeNotifier) items)
@@ -741,7 +773,10 @@ public class Select extends AbstractField implements Container,
}
}
- /** Get viewing data-source container. */
+ /**
+ * Gets the viewing data-source container.
+ * @see com.itmill.toolkit.data.Container.Viewer#getContainerDataSource()
+ */
public Container getContainerDataSource() {
return items;
}
@@ -751,19 +786,19 @@ public class Select extends AbstractField implements Container,
/**
* Is the select in multiselect mode? In multiselect mode
*
- * @return Value of property multiSelect.
+ * @return the Value of property multiSelect.
*/
public boolean isMultiSelect() {
return this.multiSelect;
}
/**
- * Set the multiselect mode. Setting multiselect mode false may loose
+ * Sets the multiselect mode. Setting multiselect mode false may loose
* selection information: if selected items set contains one or more
* selected items, only one of the selected items is kept as selected.
*
* @param multiSelect
- * New value of property multiSelect.
+ * the New value of property multiSelect.
*/
public void setMultiSelect(boolean multiSelect) {
@@ -801,7 +836,7 @@ public class Select extends AbstractField implements Container,
* used as id. No that data-source must allow adding new items (it must
* implement Container.Managed).
*
- * @return True iff additions are allowed.
+ * @return True if additions are allowed.
*/
public boolean isNewItemsAllowed() {
@@ -809,10 +844,10 @@ public class Select extends AbstractField implements Container,
}
/**
- * Enable or disable possibility to add new options by the user.
+ * Enables or disables possibility to add new options by the user.
*
* @param allowNewOptions
- * New value of property allowNewOptions.
+ * the New value of property allowNewOptions.
*/
public void setNewItemsAllowed(boolean allowNewOptions) {
@@ -830,9 +865,9 @@ public class Select extends AbstractField implements Container,
* item and index captions.
*
* @param itemId
- * The id of the item to be recaptioned.
+ * the id of the item to be recaptioned.
* @param caption
- * New caption.
+ * the New caption.
*/
public void setItemCaption(Object itemId, String caption) {
if (itemId != null) {
@@ -842,13 +877,13 @@ public class Select extends AbstractField implements Container,
}
/**
- * Get the caption of an item. The caption is generated as specified by the
+ * Gets the caption of an item. The caption is generated as specified by the
* item caption mode. See <code>setItemCaptionMode()</code> for more
* details.
*
* @param itemId
- * The id of the item to be queried.
- * @return caption for specified item.
+ * the id of the item to be queried.
+ * @return the caption for specified item.
*/
public String getItemCaption(Object itemId) {
@@ -901,12 +936,12 @@ public class Select extends AbstractField implements Container,
}
/**
- * Set icon for an item.
+ * 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
- * New icon.
+ * the New icon.
*/
public void setItemIcon(Object itemId, Resource icon) {
if (itemId != null) {
@@ -919,11 +954,11 @@ public class Select extends AbstractField implements Container,
}
/**
- * Get the item icon.
+ * Gets the item icon.
*
* @param itemId
- * The id of the item to be assigned an icon.
- * @return Icon for the item or null, if not specified.
+ * 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) {
Resource explicit = (Resource) itemIcons.get(itemId);
@@ -944,18 +979,18 @@ public class Select extends AbstractField implements Container,
}
/**
- * Set the item caption mode.
+ * Sets the item caption mode.
*
* <p>
* The mode can be one of the following ones:
* <ul>
* <li><code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> : Items
- * Id-objects <code>toString()</code> is used as item caption. If caption
+ * Id-objects <code>toString</code> is used as item caption. If caption
* is explicitly specified, it overrides the id-caption.
* <li><code>ITEM_CAPTION_MODE_ID</code> : Items Id-objects
- * <code>toString()</code> is used as item caption.</li>
+ * <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>
+ * <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
* implementing <code>Container.Indexed</code> interface.</li>
@@ -963,14 +998,14 @@ public class Select extends AbstractField implements Container,
* 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>
+ * <code>setItemCaptionPropertyId</code>.</li>
* </ul>
* The <code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> is the default
* mode.
* </p>
*
* @param mode
- * 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) {
@@ -980,18 +1015,18 @@ public class Select extends AbstractField implements Container,
}
/**
- * Get the item caption mode.
+ * Gets the item caption mode.
*
* <p>
* The mode can be one of the following ones:
* <ul>
* <li><code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> : Items
- * Id-objects <code>toString()</code> is used as item caption. If caption
+ * Id-objects <code>toString</code> is used as item caption. If caption
* is explicitly specified, it overrides the id-caption.
* <li><code>ITEM_CAPTION_MODE_ID</code> : Items Id-objects
- * <code>toString()</code> is used as item caption.</li>
+ * <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>
+ * <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
* implementing <code>Container.Indexed</code> interface.</li>
@@ -999,20 +1034,20 @@ public class Select extends AbstractField implements Container,
* 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>
+ * <code>setItemCaptionPropertyId</code>.</li>
* </ul>
* The <code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> is the default
* mode.
* </p>
*
- * @return One of the modes listed above.
+ * @return the One of the modes listed above.
*/
public int getItemCaptionMode() {
return itemCaptionMode;
}
/**
- * Set the item caption property.
+ * Sets the item caption property.
*
* <p>
* Setting the id to a existing property implicitly sets the item caption
@@ -1026,6 +1061,7 @@ public class Select extends AbstractField implements Container,
* Setting the property id to null disables this feature. The id is null by
* default
* </p>.
+ * @param propertyId the id of the property.
*
*/
public void setItemCaptionPropertyId(Object propertyId) {
@@ -1042,16 +1078,16 @@ public class Select extends AbstractField implements Container,
}
/**
- * Get the item caption property.
+ * Gets the item caption property.
*
- * @return Id of the property used as item caption source.
+ * @return the Id of the property used as item caption source.
*/
public Object getItemCaptionPropertyId() {
return itemCaptionPropertyId;
}
/**
- * Set the item icon property.
+ * Sets the item icon property.
*
* <p>
* If the property id is set to a valid value, each item is given an icon
@@ -1060,7 +1096,7 @@ public class Select extends AbstractField implements Container,
* </p>
*
* <p>
- * Note that the icons set with <code>setItemIcon</code> function override
+ * Note : The icons set with <code>setItemIcon</code> function override
* the icons from the property.
* </p>
*
@@ -1070,7 +1106,7 @@ public class Select extends AbstractField implements Container,
* </p>.
*
* @param propertyId
- * 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)
@@ -1082,7 +1118,7 @@ public class Select extends AbstractField implements Container,
}
/**
- * Get the item icon property.
+ * Gets the item icon property.
*
* <p>
* If the property id is set to a valid value, each item is given an icon
@@ -1091,7 +1127,7 @@ public class Select extends AbstractField implements Container,
* </p>
*
* <p>
- * Note that the icons set with <code>setItemIcon</code> function override
+ * Note : The icons set with <code>setItemIcon</code> function override
* the icons from the property.
* </p>
*
@@ -1100,25 +1136,25 @@ public class Select extends AbstractField implements Container,
* default
* </p>.
*
- * @return Id of the property containing the item icons.
+ * @return the Id of the property containing the item icons.
*/
public Object getItemIconPropertyId() {
return itemIconPropertyId;
}
/**
- * Test if an item is selected
+ * Tests if an item is selected.
*
* <p>
* In single select mode testing selection status of the item identified by
* {@link #getNullSelectionItemId()} returns true if the value of the
* property is null.
* </p>
- *
+ * @param itemId
+ * the Id the of the item to be tested.
* @see #getNullSelectionItemId()
* @see #setNullSelectionItemId(Object)
- * @param itemId
- * Id the of the item to be tested
+ *
*/
public boolean isSelected(Object itemId) {
if (itemId == null)
@@ -1133,17 +1169,17 @@ public class Select extends AbstractField implements Container,
}
/**
- * Select an item.
+ * Selects an item.
*
* <p>
* In single select mode selecting item identified by
* {@link #getNullSelectionItemId()} sets the value of the property to null.
* </p>
- *
+ * @param itemId
+ * the tem to be selected.
* @see #getNullSelectionItemId()
* @see #setNullSelectionItemId(Object)
- * @param itemId
- * Item to be selected.
+ *
*/
public void select(Object itemId) {
if (!isSelected(itemId) && items.containsId(itemId)) {
@@ -1159,12 +1195,12 @@ public class Select extends AbstractField implements Container,
}
/**
- * Unselect an item.
- *
+ * Unselects an item.
+ * @param itemId
+ * the Item to be unselected.
* @see #getNullSelectionItemId()
* @see #setNullSelectionItemId(Object)
- * @param itemId
- * Item to be unselected.
+ *
*/
public void unselect(Object itemId) {
if (isSelected(itemId)) {
@@ -1178,6 +1214,7 @@ public class Select extends AbstractField implements Container,
}
/**
+ * Notifies this listener that the Containers contents has changed.
* @see com.itmill.toolkit.data.Container.PropertySetChangeListener#containerPropertySetChange(com.itmill.toolkit.data.Container.PropertySetChangeEvent)
*/
public void containerPropertySetChange(
@@ -1186,6 +1223,7 @@ public class Select extends AbstractField implements Container,
}
/**
+ * Adds a new Property set change listener for this Container.
* @see com.itmill.toolkit.data.Container.PropertySetChangeNotifier#addListener(com.itmill.toolkit.data.Container.PropertySetChangeListener)
*/
public void addListener(Container.PropertySetChangeListener listener) {
@@ -1195,6 +1233,7 @@ public class Select extends AbstractField implements Container,
}
/**
+ * Removes a previously registered Property set change listener.
* @see com.itmill.toolkit.data.Container.PropertySetChangeNotifier#removeListener(com.itmill.toolkit.data.Container.PropertySetChangeListener)
*/
public void removeListener(Container.PropertySetChangeListener listener) {
@@ -1206,6 +1245,7 @@ public class Select extends AbstractField implements Container,
}
/**
+ * Adds an Item set change listener for the object.
* @see com.itmill.toolkit.data.Container.ItemSetChangeNotifier#addListener(com.itmill.toolkit.data.Container.ItemSetChangeListener)
*/
public void addListener(Container.ItemSetChangeListener listener) {
@@ -1215,6 +1255,7 @@ public class Select extends AbstractField implements Container,
}
/**
+ * Removes the Item set change listener from the object.
* @see com.itmill.toolkit.data.Container.ItemSetChangeNotifier#removeListener(com.itmill.toolkit.data.Container.ItemSetChangeListener)
*/
public void removeListener(Container.ItemSetChangeListener listener) {
@@ -1226,17 +1267,20 @@ public class Select extends AbstractField implements Container,
}
/**
+ * Lets the listener know a Containers Item set has changed.
* @see com.itmill.toolkit.data.Container.ItemSetChangeListener#containerItemSetChange(com.itmill.toolkit.data.Container.ItemSetChangeEvent)
*/
public void containerItemSetChange(Container.ItemSetChangeEvent event) {
- // Clear item id mapping table
+ // Clears the item id mapping table
this.itemIdMapper.removeAll();
// Notify all listeners
fireItemSetChange();
}
- /** Fire property set change event */
+ /**
+ * Fires the property set change event.
+ */
protected void firePropertySetChange() {
if (propertySetEventListeners != null
&& !propertySetEventListeners.isEmpty()) {
@@ -1249,7 +1293,9 @@ public class Select extends AbstractField implements Container,
requestRepaint();
}
- /** Fire item set change event */
+ /**
+ * Fires the item set change event.
+ */
protected void fireItemSetChange() {
if (itemSetEventListeners != null && !itemSetEventListeners.isEmpty()) {
Container.ItemSetChangeEvent event = new ItemSetChangeEvent();
@@ -1261,10 +1307,13 @@ public class Select extends AbstractField implements Container,
requestRepaint();
}
- /** Implementation of item set change event */
+ /**
+ * Implementation of item set change event.
+ */
private class ItemSetChangeEvent implements Container.ItemSetChangeEvent {
/**
+ * Gets the Property where the event occurred.
* @see com.itmill.toolkit.data.Container.ItemSetChangeEvent#getContainer()
*/
public Container getContainer() {
@@ -1273,11 +1322,14 @@ public class Select extends AbstractField implements Container,
}
- /** Implementation of property set change event */
+ /**
+ * Implementation of property set change event.
+ */
private class PropertySetChangeEvent implements
Container.PropertySetChangeEvent {
/**
+ * Retrieves the Container whose contents have been modified.
* @see com.itmill.toolkit.data.Container.PropertySetChangeEvent#getContainer()
*/
public Container getContainer() {
@@ -1296,7 +1348,7 @@ public class Select extends AbstractField implements Container,
* setting only affects the single select mode.
* </p>
*
- * @return Object Null value item id.
+ * @return the Object Null value item id.
* @see #setNullSelectionItemId(Object)
* @see #isSelected(Object)
* @see #select(Object)
@@ -1314,8 +1366,8 @@ public class Select extends AbstractField implements Container,
* setting only affects the single select mode.
* </p>
*
- * @param nullPropertyValueContainerItemId
- * The nullPropertyValueContainerItemId to set
+ * @param nullSelectionItemId
+ * the nullSelectionItemId to set.
* @see #getNullSelectionItemId()
* @see #isSelected(Object)
* @see #select(Object)
@@ -1348,7 +1400,8 @@ public class Select extends AbstractField implements Container,
}
/**
- * @see org.millstone.base.ui.Component#attach()
+ * Notifies the component that it is connected to an application.
+ * @see com.itmill.toolkit.ui.AbstractField#attach()
*/
public void attach() {
super.attach();
@@ -1357,7 +1410,8 @@ public class Select extends AbstractField implements Container,
}
/**
- * @see org.millstone.base.ui.Component#detach()
+ * Detaches the component from application.
+ * @see com.itmill.toolkit.ui.AbstractComponent#detach()
*/
public void detach() {
if (optionsStream != null)
@@ -1373,7 +1427,11 @@ public class Select extends AbstractField implements Container,
private String uri = "selectOptionsStream"
+ (long) (Math.random() * 1000000000000000000L);
-
+
+ /**
+ * Handles the given relative URI.
+ * @see com.itmill.toolkit.terminal.URIHandler#handleURI(java.net.URL, java.lang.String)
+ */
public DownloadStream handleURI(URL context, String relativeUri) {
if (!"".equals(uri)) {
@@ -1408,11 +1466,13 @@ public class Select extends AbstractField implements Container,
}
/**
- * Creates DownloadStream for response
+ * Creates the DownloadStream for response.
*
- * @param visibleitems
- * Items to be return
- * @return new DownloadStream
+ * @param size
+ * the Items to be return.
+ * @param first
+ * @param filter
+ * @return the new DownloadStream.
*/
public DownloadStream createDownloadStream(int size, int first, String filter) {
@@ -1435,10 +1495,10 @@ public class Select extends AbstractField implements Container,
}
/**
- * Update visible items by given prefix.
+ * Updates the visible items by given prefix.
*
* @param prefix
- * Filter prefix
+ * the Filter prefix
* @return All item ids filtered by given prefix.
*/
public ArrayList filterContent(String prefix) {
@@ -1487,7 +1547,7 @@ public class Select extends AbstractField implements Container,
currentFilter = filter;
}
- // Create list of shown options
+ // Creates list of shown options
ArrayList keys = new ArrayList();
ArrayList values = new ArrayList();
@@ -1507,7 +1567,7 @@ public class Select extends AbstractField implements Container,
values.add(String.valueOf(id));
}
- // Construct JSON format for response
+ // Constructs JSON format for response
StringBuffer json = new StringBuffer();
json.append("{\"keys\":[");
addToJSONArray(json, keys);
diff --git a/src/com/itmill/toolkit/ui/TabSheet.java b/src/com/itmill/toolkit/ui/TabSheet.java
index b96788caa8..80e0c1189f 100644
--- a/src/com/itmill/toolkit/ui/TabSheet.java
+++ b/src/com/itmill/toolkit/ui/TabSheet.java
@@ -36,7 +36,8 @@ import java.util.Map;
import com.itmill.toolkit.terminal.*;
-/** Tabsheet component.
+/**
+ * Tabsheet component.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -44,39 +45,52 @@ import com.itmill.toolkit.terminal.*;
*/
public class TabSheet extends AbstractComponentContainer {
- /** Linked list of component tabs */
+ /**
+ * Linked list of component tabs.
+ */
private LinkedList tabs = new LinkedList();
- /** Tab -> caption mapping */
+ /**
+ * Tab -> caption mapping.
+ */
private Hashtable tabCaptions = new Hashtable();
- /** Tab -> icon mapping */
+ /**
+ * Tab -> icon mapping .
+ */
private Hashtable tabIcons = new Hashtable();
- /** Selected tab */
+ /**
+ * Selected tab.
+ */
private Component selected = null;
private KeyMapper keyMapper = new KeyMapper();
- /** Holds value of property tabsHIdden. */
+ /**
+ * Holds the value of property tabsHIdden.
+ */
private boolean tabsHidden;
- /** Construct new Tabsheet.
- * Tabsheet is immediate by default.
+ /**
+ * Constructs the new Tabsheet.
+ * Tabsheet is immediate by default.
*/
public TabSheet() {
super();
setImmediate(true);
}
- /** Get component container iterator for going trough all the components in the container.
- * @return Iterator of the components inside the container.
+ /**
+ * Gets the component container iterator for going trough all the components in the container.
+ * @return the Iterator of the components inside the container.
*/
public Iterator getComponentIterator() {
return java.util.Collections.unmodifiableList(tabs).iterator();
}
- /** Remove a component from this container.
- * @param c The component to be removed.
+ /**
+ * Removes the component from this container.
+ * @param c the component to be removed.
*/
public void removeComponent(Component c) {
if (c != null && tabs.contains(c)) {
@@ -96,19 +110,21 @@ public class TabSheet extends AbstractComponentContainer {
}
}
- /** Add a component into this container.
+ /**
+ * Adds the component into this container.
* The component is added as a tab where its default tab-caption is
* the caption of the component.
- * @param c The component to be added.
+ * @param c the component to be added.
*/
public void addComponent(Component c) {
addTab(c, c.getCaption(), getIcon());
}
- /** Add a new tab into TabSheet.
- * @param c The component to be added onto tab.
- * @param caption The caption of the tab.
- * @param icon Set the icon of the tab.
+ /**
+ * Adds the new tab into TabSheet.
+ * @param c the component to be added onto tab.
+ * @param caption the caption of the tab.
+ * @param icon the Set the icon of the tab.
*/
public void addTab(Component c, String caption, Resource icon) {
if (c != null) {
@@ -125,16 +141,18 @@ public class TabSheet extends AbstractComponentContainer {
}
}
- /** Get component UIDL tag.
- * @return Component UIDL tag as string.
+ /**
+ * Gets the component UIDL tag.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "tabsheet";
}
- /** Move all components from another container to this container.
+ /**
+ * Moves all components from another container to this container.
* The components are removed from the other container.
- * @param source The container components are removed from.
+ * @param source the container components are removed from.
*/
public void moveComponentsFrom(ComponentContainer source) {
for (Iterator i = source.getComponentIterator(); i.hasNext();) {
@@ -151,9 +169,10 @@ public class TabSheet extends AbstractComponentContainer {
}
}
- /** Paint the content of this component.
- * @param event PaintEvent.
- * @throws PaintException The paint operation failed.
+ /**
+ * Paints the content of this component.
+ * @param event the Paint Event.
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
@@ -191,14 +210,16 @@ public class TabSheet extends AbstractComponentContainer {
target.addVariable(this, "selected", keyMapper.key(selected));
}
- /** Are tabs hidden.
- * @return Property visibility
+ /**
+ * Are tabs hidden.
+ * @return the Property visibility.
*/
public boolean areTabsHidden() {
return this.tabsHidden;
}
- /** Setter for property tabsHidden.
+ /**
+ * Setter for property tabsHidden.
* @param tabsHidden True if the tabs should be hidden.
*/
public void hideTabs(boolean tabsHidden) {
@@ -206,7 +227,10 @@ public class TabSheet extends AbstractComponentContainer {
requestRepaint();
}
- /** Get the caption for a component */
+ /**
+ * Gets the caption for a component.
+ * @param c the component.
+ */
public String getTabCaption(Component c) {
String caption = (String) tabCaptions.get(c);
if (caption == null)
@@ -214,18 +238,29 @@ public class TabSheet extends AbstractComponentContainer {
return caption;
}
- /** Set the caption for a component */
+ /**
+ * Sets the caption for a component.
+ * @param c the component.
+ * @param caption the caption to set.
+ */
public void setTabCaption(Component c, String caption) {
tabCaptions.put(c, caption);
requestRepaint();
}
- /** Get the icon for a component */
+ /**
+ * Gets the icon for a component.
+ * @param c the component.
+ */
public Resource getTabIcon(Component c) {
return (Resource) tabIcons.get(c);
}
- /** Set the icon for a component */
+ /** ]
+ * Sets the icon for a component.
+ * @param c
+ * @param icon
+ */
public void setTabIcon(Component c, Resource icon) {
if (icon == null)
tabIcons.remove(c);
@@ -234,7 +269,10 @@ public class TabSheet extends AbstractComponentContainer {
requestRepaint();
}
- /** Set the selected tab */
+ /**
+ * Sets the selected tab.
+ * @param c
+ */
public void setSelectedTab(Component c) {
if (c != null && tabs.contains(c) && !selected.equals(c)) {
selected = c;
@@ -243,14 +281,17 @@ public class TabSheet extends AbstractComponentContainer {
}
}
- /** Get the selected tab */
+ /**
+ * Gets the selected tab.
+ * @return the selected tab.
+ */
public Component getSelectedTab() {
return selected;
}
- /** Invoked when the value of a variable has changed.
- * @param event Variable change event containing the information about
- * the changed variable.
+ /**
+ * Invoked when the value of a variable has changed.
+ * @see com.itmill.toolkit.ui.AbstractComponent#changeVariables(java.lang.Object, java.util.Map)
*/
public void changeVariables(Object source, Map variables) {
if (variables.containsKey("selected"))
@@ -263,13 +304,13 @@ public class TabSheet extends AbstractComponentContainer {
Component oldComponent,
Component newComponent) {
- // Get the captions
+ // Gets the captions
String oldCaption = getTabCaption(oldComponent);
Resource oldIcon = getTabIcon(oldComponent);
String newCaption = getTabCaption(newComponent);
Resource newIcon = getTabIcon(newComponent);
- // Get the locations
+ // Gets the locations
int oldLocation = -1;
int newLocation = -1;
int location = 0;
@@ -330,11 +371,13 @@ public class TabSheet extends AbstractComponentContainer {
}
}
- /** Selected Tab Change event. This event is thrown, when the selected tab
+ /**
+ * Selected Tab Change event. This event is thrown, when the selected tab
* in the tab sheet is changed.
+ *
* @author IT Mill Ltd.
- * @version @VERSION@
- * @since 3.0
+ * @version @VERSION@
+ * @since 3.0
*/
public class SelectedTabChangeEvent extends Component.Event {
@@ -343,37 +386,43 @@ public class TabSheet extends AbstractComponentContainer {
*/
private static final long serialVersionUID = 3258129141914940469L;
- /** New instance of selected tab change event
- * @param source Source of the event.
+ /**
+ * New instance of selected tab change event
+ * @param source the Source of the event.
*/
public SelectedTabChangeEvent(Component source) {
super(source);
}
- /** Select where the event occurred
- * @return Source of the event.
+ /**
+ * Select where the event occurred
+ * @return the Source of the event.
*/
public Select getSelect() {
return (Select) getSource();
}
}
- /** Selected Tab Change Event listener
+ /**
+ * Selected Tab Change Event listener
* @author IT Mill Ltd.
- * @version @VERSION@
- * @since 3.0
+ *
+ * @version @VERSION@
+ * @since 3.0
*/
public interface SelectedTabChangeListener {
- /** Visible tab in tab sheet has has been changed.
- * @param event Selected tab change event.
+ /**
+ * Visible tab in tab sheet has has been changed.
+ * @param event the Selected tab change event.
*/
public void selectedTabChange(SelectedTabChangeEvent event);
}
- /** Add selected tab change listener
- * @param listener Listener to be added.
- */
+ /**
+ * Adds the selected tab change listener
+ * @param listener the Listener to be added.
+ */
public void addListener(SelectedTabChangeListener listener) {
addListener(
SelectedTabChangeEvent.class,
@@ -381,9 +430,10 @@ public class TabSheet extends AbstractComponentContainer {
SELECTED_TAB_CHANGE_METHOD);
}
- /** Remove selected tab change listener
- * @param listener Listener to be removed.
- */
+ /**
+ * Removes the selected tab change listener
+ * @param listener the Listener to be removed.
+ */
public void removeListener(SelectedTabChangeListener listener) {
removeListener(
SelectedTabChangeEvent.class,
@@ -391,7 +441,9 @@ public class TabSheet extends AbstractComponentContainer {
SELECTED_TAB_CHANGE_METHOD);
}
- /** Emit options change event. */
+ /**
+ * Emits the options change event.
+ */
protected void fireSelectedTabChange() {
fireEvent(new SelectedTabChangeEvent(this));
}
diff --git a/src/com/itmill/toolkit/ui/Table.java b/src/com/itmill/toolkit/ui/Table.java
index 2f63d85726..e51c4b44a6 100644
--- a/src/com/itmill/toolkit/ui/Table.java
+++ b/src/com/itmill/toolkit/ui/Table.java
@@ -51,7 +51,7 @@ import com.itmill.toolkit.terminal.Resource;
import com.itmill.toolkit.terminal.Sizeable;
/**
- * Table component is used for representing data or components in pageable and
+ * <code>TableComponent</code> is used for representing data or components in pageable and
* selectable table.
*
* @author IT Mill Ltd.
@@ -71,16 +71,24 @@ public class Table extends Select implements Action.Container,
private static final int CELL_FIRSTCOL = 4;
- /** Width of the table or -1 if unspecified */
+ /**
+ * Width of the table or -1 if unspecified.
+ */
private int width = -1;
- /** Height of the table or -1 if unspecified */
+ /**
+ * Height of the table or -1 if unspecified.
+ */
private int height = -1;
- /** Width unit */
+ /**
+ * Width unit.
+ */
private int widthUnit = Sizeable.UNITS_PIXELS;
- /** Height unit */
+ /**
+ * Height unit.
+ */
private int heightUnit = Sizeable.UNITS_PIXELS;
/**
@@ -88,10 +96,14 @@ public class Table extends Select implements Action.Container,
*/
public static final String ALIGN_LEFT = "b";
- /** Center column alignment. */
+ /**
+ * Center column alignment.
+ */
public static final String ALIGN_CENTER = "c";
- /** Right column alignment. */
+ /**
+ * Right column alignment.
+ */
public static final String ALIGN_RIGHT = "e";
/**
@@ -107,13 +119,13 @@ public class Table extends Select implements Action.Container,
/**
* Column header mode: Column headers are explicitly specified with
- * <code>setColumnHeaders()</code>
+ * <code>setColumnHeaders</code>.
*/
public static final int COLUMN_HEADER_MODE_EXPLICIT = 1;
/**
* Column header mode: Column headers are explicitly specified with
- * <code>setColumnHeaders()</code>
+ * <code>setColumnHeaders</code>
*/
public static final int COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID = 2;
@@ -124,19 +136,19 @@ public class Table extends Select implements Action.Container,
public static final int ROW_HEADER_MODE_HIDDEN = -1;
/**
- * Row caption mode: Items Id-objects toString() is used as row caption.
+ * Row caption mode: Items Id-objects toString is used as row caption.
*/
public static final int ROW_HEADER_MODE_ID = Select.ITEM_CAPTION_MODE_ID;
/**
- * Row caption mode: Item-objects toString() is used as row caption.
+ * Row caption mode: Item-objects toString is used as row caption.
*/
public static final int ROW_HEADER_MODE_ITEM = Select.ITEM_CAPTION_MODE_ITEM;
/**
- * Row caption mode: Index of the item is used as item caption. * The index
- * mode can only be used with the containers implementing Container.Indexed
- * interface.
+ * Row caption mode: Index of the item is used as item caption.
+ * The index mode can only be used with the containers implementing
+ * Container.Indexed interface.
*/
public static final int ROW_HEADER_MODE_INDEX = Select.ITEM_CAPTION_MODE_INDEX;
@@ -165,52 +177,84 @@ public class Table extends Select implements Action.Container,
/* Private table extensions to Select *********************************** */
- /** True if column collapsing is allowed */
+ /**
+ * True if column collapsing is allowed.
+ */
private boolean columnCollapsingAllowed = false;
- /** True if reordering of columns is allowed on the client side */
+ /**
+ * True if reordering of columns is allowed on the client side.
+ */
private boolean columnReorderingAllowed = false;
- /** Keymapper for column ids */
+ /**
+ * Keymapper for column ids.
+ */
private KeyMapper columnIdMap = new KeyMapper();
- /** Holds visible column propertyIds - in order */
+ /**
+ * Holds visible column propertyIds - in order.
+ */
private LinkedList visibleColumns = new LinkedList();
- /** Holds propertyIds of currently collapsed columns */
+ /**
+ * Holds propertyIds of currently collapsed columns.
+ */
private HashSet collapsedColumns = new HashSet();
- /** Holds headers for visible columns (by propertyId) */
+ /**
+ * Holds headers for visible columns (by propertyId).
+ */
private HashMap columnHeaders = new HashMap();
- /** Holds icons for visible columns (by propertyId) */
+ /**
+ * Holds icons for visible columns (by propertyId).
+ */
private HashMap columnIcons = new HashMap();
- /** Holds alignments for visible columns (by propertyId) */
+ /**
+ * Holds alignments for visible columns (by propertyId).
+ */
private HashMap columnAlignments = new HashMap();
- /** Holds value of property pageLength. 0 disables paging. */
+ /**
+ * Holds value of property pageLength. 0 disables paging.
+ */
private int pageLength = 15;
- /** Id the first item on the current page. */
+ /**
+ * Id the first item on the current page.
+ */
private Object currentPageFirstItemId = null;
- /** Index of the first item on the current page. */
+ /**
+ * Index of the first item on the current page.
+ */
private int currentPageFirstItemIndex = 0;
- /** Holds value of property pageBuffering. */
+ /**
+ * Holds value of property pageBuffering.
+ */
private boolean pageBuffering = false;
- /** Holds value of property selectable. */
+ /**
+ * Holds value of property selectable.
+ */
private boolean selectable = false;
- /** Holds value of property columnHeaderMode. */
+ /**
+ * Holds value of property columnHeaderMode.
+ */
private int columnHeaderMode = COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID;
- /** True iff the row captions are hidden. */
+ /**
+ * True iff the row captions are hidden.
+ */
private boolean rowCaptionsAreHidden = true;
- /** Page contents buffer used in buffered mode */
+ /**
+ * Page contents buffer used in buffered mode.
+ */
private Object[][] pageBuffer = null;
/**
@@ -219,38 +263,56 @@ public class Table extends Select implements Action.Container,
*/
private LinkedList listenedProperties = null;
- /** List of visible components - the is used for needsRepaint calculation. */
+ /**
+ * List of visible components - the is used for needsRepaint calculation.
+ */
private LinkedList visibleComponents = null;
- /** List of action handlers */
+ /**
+ * List of action handlers.
+ */
private LinkedList actionHandlers = null;
- /** Action mapper */
+ /**
+ * Action mapper.
+ */
private KeyMapper actionMapper = null;
- /** Table cell editor factory */
+ /**
+ * Table cell editor factory.
+ */
private FieldFactory fieldFactory = new BaseFieldFactory();
- /** Is table editable */
+ /**
+ * Is table editable.
+ */
private boolean editable = false;
- /** Current sorting direction */
+ /**
+ * Current sorting direction.
+ */
private boolean sortAscending = true;
- /** Currently table is sorted on this propertyId */
+ /**
+ * Currently table is sorted on this propertyId.
+ */
private Object sortContainerPropertyId = null;
- /** Is table sorting disabled alltogether; even if some of the properties would be
- * sortable. */
+ /**
+ * Is table sorting disabled alltogether; even if some of the properties would be
+ * sortable.
+ */
private boolean sortDisabled = false;
- /** Number of rows explicitly requested by the client to be painted on next paint.
+ /**
+ * Number of rows explicitly requested by the client to be painted on next paint.
* This is -1 if no request by the client is made. Painting the component will automatically
* reset this to -1.
*/
private int reqRowsToPaint = -1;
- /** Index of the first rows explicitly requested by the client to be painted.
+ /**
+ * Index of the first rows explicitly requested by the client to be painted.
* This is -1 if no request by the client is made. Painting the component will automatically
* reset this to -1.
*/
@@ -258,18 +320,27 @@ public class Table extends Select implements Action.Container,
/* Table constructors *************************************************** */
- /** Create new empty table */
+ /**
+ * Creates new empty table.
+ */
public Table() {
setRowHeaderMode(ROW_HEADER_MODE_HIDDEN);
}
- /** Create new empty table with caption. */
+ /**
+ * Creates the new empty table with caption.
+ * @param caption
+ */
public Table(String caption) {
this();
setCaption(caption);
}
- /** Create new table with caption and connect it to a Container. */
+ /**
+ * Creates the new table with caption and connect it to a Container.
+ * @param caption
+ * @param dataSource
+ */
public Table(String caption, Container dataSource) {
this();
setCaption(caption);
@@ -279,13 +350,13 @@ public class Table extends Select implements Action.Container,
/* Table functionality ************************************************** */
/**
- * Get the array of visible column property id:s.
+ * Gets the array of visible column property id:s.
*
* <p>
- * The columns are show in the order of their appearance in this array
+ * The columns are show in the order of their appearance in this array.
* </p>
*
- * @return Value of property availableColumns.
+ * @return the Value of property availableColumns.
*/
public Object[] getVisibleColumns() {
if (this.visibleColumns == null) {
@@ -295,14 +366,14 @@ public class Table extends Select implements Action.Container,
}
/**
- * Set the array of visible column property id:s.
+ * Sets the array of visible column property id:s.
*
* <p>
- * The columns are show in the order of their appearance in this array
+ * The columns are show in the order of their appearance in this array.
* </p>
*
- * @param availableColumns
- * Array of shown property id:s.
+ * @param visibleColumns
+ * the Array of shown property id:s.
*/
public void setVisibleColumns(Object[] visibleColumns) {
@@ -311,7 +382,7 @@ public class Table extends Select implements Action.Container,
throw new NullPointerException(
"Can not set visible columns to null value");
- // Check that the new visible columns contains no nulls and properties
+ // Checks that the new visible columns contains no nulls and properties
// exist
Collection properties = getContainerPropertyIds();
for (int i = 0; i < visibleColumns.length; i++) {
@@ -330,7 +401,7 @@ public class Table extends Select implements Action.Container,
newVC.add(visibleColumns[i]);
}
- // Remove alignments, icons and headers from hidden columns
+ // Removes alignments, icons and headers from hidden columns
if (this.visibleColumns != null)
for (Iterator i = this.visibleColumns.iterator(); i.hasNext();) {
Object col = i.next();
@@ -343,12 +414,12 @@ public class Table extends Select implements Action.Container,
this.visibleColumns = newVC;
- // Assure visual refresh
+ // Assures visual refresh
refreshCurrentPage();
}
/**
- * Get the headers of the columns.
+ * Gets the headers of the columns.
*
* <p>
* The headers match the property id:s given my the set visible column
@@ -359,7 +430,7 @@ public class Table extends Select implements Action.Container,
* with id.toString() outputs when rendering.
* </p>
*
- * @return Array of column headers.
+ * @return the Array of column headers.
*/
public String[] getColumnHeaders() {
if (this.columnHeaders == null) {
@@ -374,7 +445,7 @@ public class Table extends Select implements Action.Container,
}
/**
- * Set the headers of the columns.
+ * Sets the headers of the columns.
*
* <p>
* The headers match the property id:s given my the set visible column
@@ -386,8 +457,8 @@ public class Table extends Select implements Action.Container,
* </p>
*
* @param columnHeaders
- * Array of column headers that match the
- * <code>getVisibleColumns()</code>.
+ * the Array of column headers that match the
+ * <code>getVisibleColumns</code> method.
*/
public void setColumnHeaders(String[] columnHeaders) {
@@ -402,12 +473,12 @@ public class Table extends Select implements Action.Container,
this.columnHeaders.put(it.next(), columnHeaders[i]);
}
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
/**
- * Get the icons of the columns.
+ * Gets the icons of the columns.
*
* <p>
* The icons in headers match the property id:s given my the set visible
@@ -417,7 +488,7 @@ public class Table extends Select implements Action.Container,
* headers with icons.
* </p>
*
- * @return Array of icons that match the <code>getVisibleColumns()</code>.
+ * @return the Array of icons that match the <code>getVisibleColumns</code>.
*/
public Resource[] getColumnIcons() {
if (this.columnIcons == null) {
@@ -433,7 +504,7 @@ public class Table extends Select implements Action.Container,
}
/**
- * Set the icons of the columns.
+ * Sets the icons of the columns.
*
* <p>
* The icons in headers match the property id:s given my the set visible
@@ -444,7 +515,7 @@ public class Table extends Select implements Action.Container,
* </p>
*
* @param columnIcons
- * Array of icons that match the <code>getVisibleColumns()</code>.
+ * the Array of icons that match the <code>getVisibleColumns</code>.
*/
public void setColumnIcons(Resource[] columnIcons) {
@@ -464,7 +535,7 @@ public class Table extends Select implements Action.Container,
}
/**
- * Get array of column alignments.
+ * Gets the array of column alignments.
*
* <p>
* The items in the array must match the properties identified by
@@ -479,7 +550,7 @@ public class Table extends Select implements Action.Container,
* rendered as align lefts.
* </p>
*
- * @return Column alignments array.
+ * @return the Column alignments array.
*/
public String[] getColumnAlignments() {
if (this.columnAlignments == null) {
@@ -495,7 +566,7 @@ public class Table extends Select implements Action.Container,
}
/**
- * Set the column alignments.
+ * Sets the column alignments.
*
* <p>
* The items in the array must match the properties identified by
@@ -510,7 +581,7 @@ public class Table extends Select implements Action.Container,
* </p>
*
* @param columnAlignments
- * Column alignments array.
+ * the Column alignments array.
*/
public void setColumnAlignments(String[] columnAlignments) {
@@ -518,7 +589,7 @@ public class Table extends Select implements Action.Container,
throw new IllegalArgumentException(
"The length of the alignments array must match the number of visible columns");
- // Check all alignments
+ // Checks all alignments
for (int i = 0; i < columnAlignments.length; i++) {
String a = columnAlignments[i];
if (a != null && !a.equals(ALIGN_LEFT) && !a.equals(ALIGN_CENTER)
@@ -527,7 +598,7 @@ public class Table extends Select implements Action.Container,
+ " aligment '" + a + "' is invalid");
}
- // Reset alignments
+ // Resets the alignments
HashMap newCA = new HashMap();
int i = 0;
for (Iterator it = this.visibleColumns.iterator(); it.hasNext()
@@ -536,39 +607,38 @@ public class Table extends Select implements Action.Container,
}
this.columnAlignments = newCA;
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
/**
- * Get the page length.
+ * Gets the page length.
*
* <p>
* Setting page length 0 disables paging.
* </p>
*
- * @return Lenght of one page.
+ * @return the Length of one page.
*/
public int getPageLength() {
return this.pageLength;
}
/**
- * Set the page length.
+ * Sets the page length.
*
* <p>
* Setting page length 0 disables paging. The page length defaults to 15.
* </p>
*
- * @param Lenght
- * of one page.
+ * @param pageLength the Length of one page.
*/
public void setPageLength(int pageLength) {
if (pageLength >= 0 && this.pageLength != pageLength) {
this.pageLength = pageLength;
// "scroll" to first row
this.setCurrentPageFirstItemIndex(0);
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
}
@@ -576,7 +646,7 @@ public class Table extends Select implements Action.Container,
/**
* Getter for property currentPageFirstItem.
*
- * @return Value of property currentPageFirstItem.
+ * @return the Value of property currentPageFirstItem.
*/
public Object getCurrentPageFirstItemId() {
@@ -598,14 +668,14 @@ public class Table extends Select implements Action.Container,
}
/**
- * Setter for property currentPageFirstItem.
+ * Setter for property currentPageFirstItemId.
*
- * @param currentPageFirstItem
- * New value of property currentPageFirstItem.
+ * @param currentPageFirstItemId
+ * the New value of property currentPageFirstItemId.
*/
public void setCurrentPageFirstItemId(Object currentPageFirstItemId) {
- // Get the corresponding index
+ // Gets the corresponding index
int index = -1;
try {
index = ((Container.Indexed) items)
@@ -613,7 +683,7 @@ public class Table extends Select implements Action.Container,
} catch (ClassCastException e) {
// If the table item container does not have index, we have to
- // calculate the index by hand
+ // calculates the index by hand
Object id = ((Container.Ordered) items).firstItemId();
while (id != null && !id.equals(currentPageFirstItemId)) {
index++;
@@ -629,7 +699,7 @@ public class Table extends Select implements Action.Container,
this.currentPageFirstItemIndex = index;
}
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
@@ -664,7 +734,7 @@ public class Table extends Select implements Action.Container,
else
this.columnIcons.put(propertyId, icon);
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
@@ -689,7 +759,7 @@ public class Table extends Select implements Action.Container,
}
/**
- * Sets column header for the specified column;
+ * Sets the column header for the specified column;
*
* @param propertyId
* the propertyId indentifying the column.
@@ -704,7 +774,7 @@ public class Table extends Select implements Action.Container,
}
this.columnHeaders.put(propertyId, header);
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
@@ -735,7 +805,7 @@ public class Table extends Select implements Action.Container,
*/
public void setColumnAlignment(Object propertyId, String alignment) {
- // Check for valid alignments
+ // Checks for valid alignments
if (alignment != null && !alignment.equals(ALIGN_LEFT)
&& !alignment.equals(ALIGN_CENTER)
&& !alignment.equals(ALIGN_RIGHT))
@@ -749,7 +819,7 @@ public class Table extends Select implements Action.Container,
this.columnAlignments.put(propertyId, alignment);
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
@@ -773,6 +843,7 @@ public class Table extends Select implements Action.Container,
* the propertyID identifying the column.
* @param collapsed
* the desired collapsedness.
+ * @throws IllegalAccessException
*/
public void setColumnCollapsed(Object propertyId, boolean collapsed)
throws IllegalAccessException {
@@ -785,12 +856,12 @@ public class Table extends Select implements Action.Container,
else
this.collapsedColumns.remove(propertyId);
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
/**
- * Check if column collapsing is allowed.
+ * Checks if column collapsing is allowed.
*
* @return true if columns can be collapsed; false otherwise.
*/
@@ -810,12 +881,12 @@ public class Table extends Select implements Action.Container,
if (!collapsingAllowed)
collapsedColumns.clear();
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
/**
- * Check if column reordering is allowed.
+ * Checks if column reordering is allowed.
*
* @return true if columns can be reordered; false otherwise.
*/
@@ -832,7 +903,7 @@ public class Table extends Select implements Action.Container,
public void setColumnReorderingAllowed(boolean reorderingAllowed) {
this.columnReorderingAllowed = reorderingAllowed;
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
@@ -868,7 +939,7 @@ public class Table extends Select implements Action.Container,
/**
* Getter for property currentPageFirstItem.
*
- * @return Value of property currentPageFirstItem.
+ * @return the Value of property currentPageFirstItem.
*/
public int getCurrentPageFirstItemIndex() {
return this.currentPageFirstItemIndex;
@@ -878,11 +949,11 @@ public class Table extends Select implements Action.Container,
* Setter for property currentPageFirstItem.
*
* @param newIndex
- * New value of property currentPageFirstItem.
+ * the New value of property currentPageFirstItem.
*/
public void setCurrentPageFirstItemIndex(int newIndex) {
- // Ensure that the new value is valid
+ // Ensures that the new value is valid
if (newIndex < 0)
newIndex = 0;
if (newIndex >= size())
@@ -949,14 +1020,14 @@ public class Table extends Select implements Action.Container,
}
}
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
/**
* Getter for property pageBuffering.
*
- * @return Value of property pageBuffering.
+ * @return the Value of property pageBuffering.
*/
public boolean isPageBufferingEnabled() {
return this.pageBuffering;
@@ -966,7 +1037,7 @@ public class Table extends Select implements Action.Container,
* Setter for property pageBuffering.
*
* @param pageBuffering
- * New value of property pageBuffering.
+ * the New value of property pageBuffering.
*/
public void setPageBufferingEnabled(boolean pageBuffering) {
@@ -984,7 +1055,7 @@ public class Table extends Select implements Action.Container,
* The table is not selectable by default.
* </p>
*
- * @return Value of property selectable.
+ * @return the Value of property selectable.
*/
public boolean isSelectable() {
return this.selectable;
@@ -998,7 +1069,7 @@ public class Table extends Select implements Action.Container,
* </p>
*
* @param selectable
- * New value of property selectable.
+ * the New value of property selectable.
*/
public void setSelectable(boolean selectable) {
if (this.selectable != selectable) {
@@ -1010,7 +1081,7 @@ public class Table extends Select implements Action.Container,
/**
* Getter for property columnHeaderMode.
*
- * @return Value of property columnHeaderMode.
+ * @return the Value of property columnHeaderMode.
*/
public int getColumnHeaderMode() {
return this.columnHeaderMode;
@@ -1020,19 +1091,19 @@ public class Table extends Select implements Action.Container,
* Setter for property columnHeaderMode.
*
* @param columnHeaderMode
- * New value of property columnHeaderMode.
+ * the New value of property columnHeaderMode.
*/
public void setColumnHeaderMode(int columnHeaderMode) {
if (columnHeaderMode >= COLUMN_HEADER_MODE_HIDDEN
&& columnHeaderMode <= COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID)
this.columnHeaderMode = columnHeaderMode;
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
/**
- * Refresh the current page contents. If the page buffering is turned off,
+ * Refreshes the current page contents. If the page buffering is turned off,
* it is not necessary to call this explicitely.
*/
public void refreshCurrentPage() {
@@ -1043,7 +1114,7 @@ public class Table extends Select implements Action.Container,
}
/**
- * Set the row header mode.
+ * Sets the row header mode.
* <p>
* The mode can be one of the following ones:
* <ul>
@@ -1068,7 +1139,7 @@ public class Table extends Select implements Action.Container,
* </p>
*
* @param mode
- * One of the modes listed above.
+ * the One of the modes listed above.
*/
public void setRowHeaderMode(int mode) {
if (ROW_HEADER_MODE_HIDDEN == mode)
@@ -1083,9 +1154,9 @@ public class Table extends Select implements Action.Container,
}
/**
- * Get the row header mode.
+ * Gets the row header mode.
*
- * @return Row header mode.
+ * @return the Row header mode.
* @see #setRowHeaderMode(int)
*/
public int getRowHeaderMode() {
@@ -1094,14 +1165,14 @@ public class Table extends Select implements Action.Container,
}
/**
- * Add new row to table and fill the visible cells with given values.
+ * Adds the new row to table and fill the visible cells with given values.
*
* @param cells
- * Object array that is used for filling the visible cells new
+ * 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
- * Id the new row. If null, a new id is automatically assigned.
+ * 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.
*/
@@ -1110,11 +1181,11 @@ public class Table extends Select implements Action.Container,
Object[] cols = getVisibleColumns();
- // Check that a correct number of cells are given
+ // Checks that a correct number of cells are given
if (cells.length != cols.length)
return null;
- // Create new item
+ // Creates new item
Item item;
if (itemId == null) {
itemId = items.addItem();
@@ -1126,7 +1197,7 @@ public class Table extends Select implements Action.Container,
if (item == null)
return null;
- // Fill the item properties
+ // Fills the item properties
for (int i = 0; i < cols.length; i++)
item.getItemProperty(cols[i]).setValue(cells[i]);
@@ -1136,6 +1207,7 @@ public class Table extends Select implements Action.Container,
/* Overriding select behavior******************************************** */
/**
+ * Sets the Container that serves as the data source of the viewer.
* @see com.itmill.toolkit.data.Container.Viewer#setContainerDataSource(Container)
*/
public void setContainerDataSource(Container newDataSource) {
@@ -1143,7 +1215,7 @@ public class Table extends Select implements Action.Container,
if (newDataSource == null)
newDataSource = new IndexedContainer();
- // Assure that the data source is ordered by making unordered
+ // Assures that the data source is ordered by making unordered
// containers ordered by wrapping them
if (newDataSource instanceof Container.Ordered)
super.setContainerDataSource(newDataSource);
@@ -1151,11 +1223,11 @@ public class Table extends Select implements Action.Container,
super.setContainerDataSource(new ContainerOrderedWrapper(
newDataSource));
- // Reset page position
+ // Resets page position
currentPageFirstItemId = null;
currentPageFirstItemIndex = 0;
- // Reset column properties
+ // Resets column properties
if (this.collapsedColumns != null)
this.collapsedColumns.clear();
setVisibleColumns(getContainerPropertyIds().toArray());
@@ -1164,14 +1236,11 @@ public class Table extends Select implements Action.Container,
refreshCurrentPage();
}
- /* Component basics ***************************************************** */
+ /* Component basics ***************************************************** */
/**
* Invoked when the value of a variable has changed.
- *
- * @param event
- * Variable change event containing the information about the
- * changed variable.
+ * @see com.itmill.toolkit.ui.Select#changeVariables(java.lang.Object, java.util.Map)
*/
public void changeVariables(Object source, Map variables) {
@@ -1184,7 +1253,7 @@ public class Table extends Select implements Action.Container,
setCurrentPageFirstItemIndex(value.intValue() - 1);
}
- // Set requested firstrow and rows for the next paint
+ // Sets requested firstrow and rows for the next paint
if (variables.containsKey("reqfirstrow") || variables.containsKey("reqrows")) {
Integer value = (Integer) variables.get("reqfirstrow");
if (value != null)
@@ -1265,12 +1334,12 @@ public class Table extends Select implements Action.Container,
}
/**
- * Paint the content of this component.
+ * Paints the content of this component.
*
* @param target
- * Paint target.
+ * the Paint target.
* @throws PaintException
- * The paint operation failed.
+ * if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
@@ -1441,7 +1510,7 @@ public class Table extends Select implements Action.Container,
target.addVariable(this, "sortascending", this.sortAscending);
}
- // Reset and paint "to be painted next" variables. Also reset pageBuffer
+ // Resets and paints "to be painted next" variables. Also reset pageBuffer
reqFirstRowToPaint = -1;
reqRowsToPaint = -1;
pageBuffer = null;
@@ -1512,22 +1581,25 @@ public class Table extends Select implements Action.Container,
}
/**
- * Get UIDL tag corresponding to component.
+ * Gets the UIDL tag corresponding to component.
*
- * @return UIDL tag as string.
+ * @return the UIDL tag as string.
*/
public String getTag() {
return "table";
}
- /** Return cached visible table contents */
+ /**
+ * Gets the cached visible table contents.
+ * @return the cahced visible table conetents.
+ */
private Object[][] getVisibleCells() {
- // Return a buffered value if possible
+ // Returns a buffered value if possible
if (pageBuffer != null && isPageBufferingEnabled())
return pageBuffer;
- // Stop listening the old properties and initialise the list
+ // Stops listening the old properties and initialise the list
if (listenedProperties == null)
listenedProperties = new LinkedList();
else
@@ -1543,7 +1615,7 @@ public class Table extends Select implements Action.Container,
((Component) i.next()).setParent(null);
}
- // Collect basic facts about the table page
+ // Collects the basic facts about the table page
Object[] colids = getVisibleColumns();
int cols = colids.length;
int pagelen = getPageLength();
@@ -1569,7 +1641,7 @@ public class Table extends Select implements Action.Container,
if (rows == 0)
return cells;
- // Get first item id
+ // Gets the first item id
if (items instanceof Container.Indexed)
id = ((Container.Indexed) items).getIdByIndex(firstIndex);
else {
@@ -1583,7 +1655,7 @@ public class Table extends Select implements Action.Container,
iscomponent[i] = Component.class
.isAssignableFrom(getType(colids[i]));
- // Create page contents
+ // Creates the page contents
int filledRows = 0;
for (int i = 0; i < rows && id != null; i++) {
cells[CELL_ITEMID][i] = id;
@@ -1632,7 +1704,7 @@ public class Table extends Select implements Action.Container,
filledRows++;
}
- // Assure that all the rows of the cell-buffer are valid
+ // Assures that all the rows of the cell-buffer are valid
if (filledRows != cells[0].length) {
Object[][] temp = new Object[cells.length][filledRows];
for (int i = 0; i < cells.length; i++)
@@ -1641,7 +1713,7 @@ public class Table extends Select implements Action.Container,
cells = temp;
}
- // Save the results to internal buffer iff in buffering mode
+ // Saves the results to internal buffer iff in buffering mode
// to possible conserve memory from large non-buffered pages
if (isPageBufferingEnabled())
pageBuffer = cells;
@@ -1650,20 +1722,20 @@ public class Table extends Select implements Action.Container,
}
/**
- * Get value of property.
+ * Gets the value of property.
*
* By default if the table is editable the fieldFactory is used to create
* editors for table cells. Otherwise formatPropertyValue is used to format
* the value representation.
*
- * @see #setFieldFactory(FieldFactory)
* @param rowId
- * Id of the row (same as item Id)
+ * the Id of the row (same as item Id).
* @param colId
- * Id of the column
+ * the Id of the column.
* @param property
- * Property to be presented
+ * the Property to be presented.
* @return Object Either formatted value or Component for field.
+ * @see #setFieldFactory(FieldFactory)
*/
protected Object getPropertyValue(Object rowId, Object colId,
Property property) {
@@ -1683,10 +1755,11 @@ public class Table extends Select implements Action.Container,
* Formats table cell property values. By default the property.toString()
* and return a empty string for null properties.
*
- * @param itemId
+ * @param rowId the Id of the row (same as item Id).
+ * @param colId the Id of the column.
* @param property
- * Property to be formatted
- * @return String representation of property and its value.
+ * the Property to be formatted.
+ * @return the String representation of property and its value.
* @since 3.1
*/
protected String formatPropertyValue(Object rowId, Object colId,
@@ -1700,6 +1773,7 @@ public class Table extends Select implements Action.Container,
/* Action container *************************************************** */
/**
+ * Registers a new action handler for this container
* @see com.itmill.toolkit.event.Action.Container#addActionHandler(Action.Handler)
*/
public void addActionHandler(Action.Handler actionHandler) {
@@ -1720,6 +1794,8 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Removes a previously registered action handler for the contents
+ * of this container.
* @see com.itmill.toolkit.event.Action.Container#removeActionHandler(Action.Handler)
*/
public void removeActionHandler(Action.Handler actionHandler) {
@@ -1740,6 +1816,7 @@ public class Table extends Select implements Action.Container,
/* Property value change listening support **************************** */
/**
+ * Notifies this listener that the Property's value has changed.
* @see com.itmill.toolkit.data.Property.ValueChangeListener#valueChange(Property.ValueChangeEvent)
*/
public void valueChange(Property.ValueChangeEvent event) {
@@ -1748,6 +1825,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Notifies the component that it is connected to an application.
* @see com.itmill.toolkit.ui.Component#attach()
*/
public void attach() {
@@ -1759,7 +1837,8 @@ public class Table extends Select implements Action.Container,
}
/**
- * @see com.itmill.toolkit.ui.Component#attach()
+ * Notifies the component that it is detached from the application
+ * @see com.itmill.toolkit.ui.Component#detach()
*/
public void detach() {
super.detach();
@@ -1770,6 +1849,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Removes all Items from the Container.
* @see com.itmill.toolkit.data.Container#removeAllItems()
*/
public boolean removeAllItems() {
@@ -1779,6 +1859,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Removes the Item identified by <code>ItemId</code> from the Container.
* @see com.itmill.toolkit.data.Container#removeItem(Object)
*/
public boolean removeItem(Object itemId) {
@@ -1792,6 +1873,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Removes a Property specified by the given Property ID from the Container.
* @see com.itmill.toolkit.data.Container#removeContainerProperty(Object)
*/
public boolean removeContainerProperty(Object propertyId)
@@ -1808,16 +1890,14 @@ public class Table extends Select implements Action.Container,
/**
* Adds a new property to the table and show it as a visible column.
- *
- * @see com.itmill.toolkit.data.Container#addContainerProperty(Object,
- * Class, Object)
- *
* @param propertyId
- * 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)
*/
public boolean addContainerProperty(Object propertyId, Class type,
Object defaultValue) throws UnsupportedOperationException {
@@ -1831,23 +1911,23 @@ public class Table extends Select implements Action.Container,
/**
* Adds a new property to the table and show it as a visible column.
*
- * @see com.itmill.toolkit.data.Container#addContainerProperty(Object,
- * Class, Object)
- *
* @param propertyId
- * 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
- * Explicit header of the column. If explicit header is not
+ * the Explicit header of the column. If explicit header is not
* needed, this should be set null.
* @param columnIcon
- * Icon of the column. If icon is not needed, this should be set
+ * the Icon of the column. If icon is not needed, this should be set
* null.
* @param columnAlignment
- * 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.
+ * @see com.itmill.toolkit.data.Container#addContainerProperty(Object,
+ * Class, Object)
*/
public boolean addContainerProperty(Object propertyId, Class type,
Object defaultValue, String columnHeader, Resource columnIcon,
@@ -1861,7 +1941,7 @@ public class Table extends Select implements Action.Container,
}
/**
- * Return list of items on the current page
+ * Returns the list of items on the current page
*
* @see com.itmill.toolkit.ui.Select#getVisibleItemIds()
*/
@@ -1902,10 +1982,9 @@ public class Table extends Select implements Action.Container,
/**
* Adding new items is not supported.
- *
- * @see com.itmill.toolkit.ui.Select#setNewItemsAllowed(boolean)
* @throws UnsupportedOperationException
* if set to true.
+ * @see com.itmill.toolkit.ui.Select#setNewItemsAllowed(boolean)
*/
public void setNewItemsAllowed(boolean allowNewOptions)
throws UnsupportedOperationException {
@@ -1915,16 +1994,17 @@ public class Table extends Select implements Action.Container,
/**
* Focusing to this component is not supported.
- *
- * @see com.itmill.toolkit.ui.AbstractField#focus()
* @throws UnsupportedOperationException
* if invoked.
+ * @see com.itmill.toolkit.ui.AbstractField#focus()
*/
public void focus() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
+ * Gets the ID of the Item following the Item that corresponds to
+ * itemId.
* @see com.itmill.toolkit.data.Container.Ordered#nextItemId(java.lang.Object)
*/
public Object nextItemId(Object itemId) {
@@ -1932,6 +2012,8 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Gets the ID of the Item preceding the Item that corresponds to
+ * the itemId.
* @see com.itmill.toolkit.data.Container.Ordered#prevItemId(java.lang.Object)
*/
public Object prevItemId(Object itemId) {
@@ -1939,6 +2021,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Gets the ID of the first Item in the Container.
* @see com.itmill.toolkit.data.Container.Ordered#firstItemId()
*/
public Object firstItemId() {
@@ -1946,6 +2029,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Gets the ID of the last Item in the Container.
* @see com.itmill.toolkit.data.Container.Ordered#lastItemId()
*/
public Object lastItemId() {
@@ -1953,6 +2037,8 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Tests if the Item corresponding to the given Item ID is the first
+ * Item in the Container.
* @see com.itmill.toolkit.data.Container.Ordered#isFirstId(java.lang.Object)
*/
public boolean isFirstId(Object itemId) {
@@ -1960,6 +2046,8 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Tests if the Item corresponding to the given Item ID is the last Item
+ * in the Container.
* @see com.itmill.toolkit.data.Container.Ordered#isLastId(java.lang.Object)
*/
public boolean isLastId(Object itemId) {
@@ -1967,6 +2055,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Adds new item after the given item.
* @see com.itmill.toolkit.data.Container.Ordered#addItemAfter(java.lang.Object)
*/
public Object addItemAfter(Object previousItemId)
@@ -1975,6 +2064,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Adds new item after the given item.
* @see com.itmill.toolkit.data.Container.Ordered#addItemAfter(java.lang.Object,
* java.lang.Object)
*/
@@ -1985,27 +2075,26 @@ public class Table extends Select implements Action.Container,
}
/**
- * Get the FieldFactory that is used to create editor for table cells.
+ * Gets the FieldFactory that is used to create editor for table cells.
*
* The FieldFactory is only used if the Table is editable.
- *
- * @see #isEditable
* @return FieldFactory used to create the Field instances.
+ * @see #isEditable
*/
public FieldFactory getFieldFactory() {
return fieldFactory;
}
/**
- * Set the FieldFactory that is used to create editor for table cells.
+ * Sets the FieldFactory that is used to create editor for table cells.
*
* The FieldFactory is only used if the Table is editable. By default the
* BaseFieldFactory is used.
- *
+ * @param fieldFactory
+ * the field factory to set.
* @see #isEditable
* @see BaseFieldFactory
- * @param fieldFactory
- * The field factory to set
+
*/
public void setFieldFactory(FieldFactory fieldFactory) {
this.fieldFactory = fieldFactory;
@@ -2023,17 +2112,17 @@ public class Table extends Select implements Action.Container,
* To provide custom editors for table cells create a class implementins the
* FieldFactory interface, and assign it to table, and set the editable
* property to true.
- *
+ * @return true if table is editable, false oterwise.
* @see Field
* @see FieldFactory
- * @return true if table is editable, false oterwise.
+ *
*/
public boolean isEditable() {
return editable;
}
/**
- * Set the editable property.
+ * Sets the editable property.
*
* If table is editable a editor of type Field is created for each table
* cell. The assigned FieldFactory is used to create the instances.
@@ -2041,11 +2130,11 @@ public class Table extends Select implements Action.Container,
* To provide custom editors for table cells create a class implementins the
* FieldFactory interface, and assign it to table, and set the editable
* property to true.
- *
- * @see Field
- * @see FieldFactory
* @param editable
* true if table should be editable by user.
+ * @see Field
+ * @see FieldFactory
+ *
*/
public void setEditable(boolean editable) {
this.editable = editable;
@@ -2055,14 +2144,13 @@ public class Table extends Select implements Action.Container,
}
/**
- * Sort table.
- *
- * @see com.itmill.toolkit.data.Container.Sortable#sort(java.lang.Object[],
- * boolean[])
- *
+ * Sorts the table.
* @throws UnsupportedOperationException
* if the container data source does not implement
* Container.Sortable
+ * @see com.itmill.toolkit.data.Container.Sortable#sort(java.lang.Object[],
+ * boolean[])
+ *
*/
public void sort(Object[] propertyId, boolean[] ascending)
throws UnsupportedOperationException {
@@ -2078,7 +2166,7 @@ public class Table extends Select implements Action.Container,
}
/**
- * Sort table by currently selected sorting column.
+ * Sorts the table by currently selected sorting column.
*
* @throws UnsupportedOperationException
* if the container data source does not implement
@@ -2091,8 +2179,8 @@ public class Table extends Select implements Action.Container,
new boolean[] { this.sortAscending });
}
- /*
- * (non-Javadoc)
+ /**
+ * Gets the container property IDs, which can be used to sort the item.
*
* @see com.itmill.toolkit.data.Container.Sortable#getSortableContainerPropertyIds()
*/
@@ -2106,19 +2194,19 @@ public class Table extends Select implements Action.Container,
}
/**
- * Get the currently sorted column property ID.
+ * Gets the currently sorted column property ID.
*
- * @return Container property id of the currently sorted column.
+ * @return the Container property id of the currently sorted column.
*/
public Object getSortContainerPropertyId() {
return this.sortContainerPropertyId;
}
/**
- * Set the currently sorted column property id.
+ * Sets the currently sorted column property id.
*
* @param propertyId
- * Container property id of the currently sorted column.
+ * the Container property id of the currently sorted column.
*/
public void setSortContainerPropertyId(Object propertyId) {
if ((this.sortContainerPropertyId != null && !this.sortContainerPropertyId
@@ -2128,7 +2216,7 @@ public class Table extends Select implements Action.Container,
sort();
}
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
@@ -2136,18 +2224,18 @@ public class Table extends Select implements Action.Container,
* Is the table currently sorted in ascending order.
*
* @return <code>true</code> if ascending, <code>false</code> if
- * descending
+ * descending.
*/
public boolean isSortAscending() {
return this.sortAscending;
}
/**
- * Set the table in ascending order.
+ * Sets the table in ascending order.
*
* @param ascending
* <code>true</code> if ascending, <code>false</code> if
- * descending
+ * descending.
*/
public void setSortAscending(boolean ascending) {
if (this.sortAscending != ascending) {
@@ -2155,11 +2243,12 @@ public class Table extends Select implements Action.Container,
sort();
}
- // Assure visual refresh
+ // Assures the visual refresh
refreshCurrentPage();
}
- /** Is sorting disabled alltogether.
+ /**
+ * Is sorting disabled alltogether.
*
* True iff no sortable columns are given even in the case where datasource would support this.
*
@@ -2170,12 +2259,13 @@ public class Table extends Select implements Action.Container,
}
- /** Disable sorting alltogether.
+ /**
+ * Disables the sorting alltogether.
*
* To disable sorting alltogether, set to true. In this case no
* sortable columns are given even in the case where datasource would support this.
*
- * @param sortDisabled True iff sorting is disabled
+ * @param sortDisabled True iff sorting is disabled.
*/
public void setSortDisabled(boolean sortDisabled) {
if (this.sortDisabled != sortDisabled) {
@@ -2185,6 +2275,7 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Gets the height property units.
* @see com.itmill.toolkit.terminal.Sizeable#getHeightUnits()
*/
public int getHeightUnits() {
@@ -2192,13 +2283,15 @@ public class Table extends Select implements Action.Container,
}
/**
+ * Gets the width property units.
* @see com.itmill.toolkit.terminal.Sizeable#getWidthUnits()
*/
public int getWidthUnits() {
return widthUnit;
}
- /** Set height units.
+ /**
+ * Sets the height units.
* Table supports only Sizeable.UNITS_PIXELS. Setting to any other throws
* IllegalArgumentException.
* @see com.itmill.toolkit.terminal.Sizeable#setHeightUnits(int)
@@ -2209,8 +2302,9 @@ public class Table extends Select implements Action.Container,
this.heightUnit = units;
}
- /** Set width units.
- * Tabel supports only Sizeable.UNITS_PIXELS and Sizeable.UNITS_PERCENTAGE. Setting to any other throws
+ /**
+ * Sets the width units.
+ * Tabel supports only Sizeable.UNITS_PIXELS and Sizeable.UNITS_PERCENTAGE. Setting to any other throws
* IllegalArgumentException.
* @see com.itmill.toolkit.terminal.Sizeable#setWidthUnits(int)
*/
@@ -2221,39 +2315,47 @@ public class Table extends Select implements Action.Container,
}
/**
- * @return The height in pixels or negative value if not assigned.
+ * Gets the height in pixels.
+ * @return the height in pixels or negative value if not assigned.
+ * @see com.itmill.toolkit.terminal.Sizeable#getHeight()
*/
public int getHeight() {
return height;
}
/**
- * @return The width in pixels or negative value if not assigned.
+ * Gets the width in pixels.
+ * @return the width in pixels or negative value if not assigned.
+ * @see com.itmill.toolkit.terminal.Sizeable#getWidth()
*/
public int getWidth() {
return width;
}
- /** Sets the height in pixels.
+ /**
+ * Sets the height in pixels.
* Use negative value to let the client decide the height.
- * @param height The height to set
+ * @param height the height to set.
*/
public void setHeight(int height) {
this.height = height;
requestRepaint();
}
- /** Sets the width in pixels.
+ /**
+ * Sets the width in pixels.
* Use negative value to allow the client decide the width.
- * @param width The width to set
+ * @param width the width to set.
*/
public void setWidth(int width) {
this.width = width;
requestRepaint();
}
- /** Table does not support lazy options loading mode.
+ /**
+ * Table does not support lazy options loading mode.
* Setting this true will throw UnsupportedOperationException.
+ * @see com.itmill.toolkit.ui.Select#setLazyLoading(boolean)
*/
public void setLazyLoading(boolean useLazyLoading) {
if (useLazyLoading)
diff --git a/src/com/itmill/toolkit/ui/TextField.java b/src/com/itmill/toolkit/ui/TextField.java
index b963774d1a..b377c657ad 100644
--- a/src/com/itmill/toolkit/ui/TextField.java
+++ b/src/com/itmill/toolkit/ui/TextField.java
@@ -35,15 +35,20 @@ import com.itmill.toolkit.data.Property;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
-/** <p>A text editor component that can be bound to any bindable Property.
+/**
+ * <p>
+ * A text editor component that can be bound to any bindable Property.
* The text editor supports both multiline and single line modes, default
- * is one-line mode.</p>
+ * is one-line mode.
+ * </p>
*
- * <p>Since <code>TextField</code> extends <code>AbstractField</code> it
+ * <p>
+ * Since <code>TextField</code> extends <code>AbstractField</code> it
* implements the {@link com.itmill.toolkit.data.Buffered} interface. A
* <code>TextField</code> is in write-through mode by default, so
* {@link com.itmill.toolkit.ui.AbstractField#setWriteThrough(boolean)}
- * must be called to enable buffering.</p>
+ * must be called to enable buffering.
+ * </p>
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -53,74 +58,94 @@ public class TextField extends AbstractField {
/* Private members ************************************************* */
- /** Value formatter used to format the string contents*/
+ /**
+ * Value formatter used to format the string contents.
+ */
private Format format;
- /** Number of visible columns in the TextField. */
+ /**
+ * Number of visible columns in the TextField.
+ */
private int columns = 0;
- /** Number of visible rows in a multiline TextField. Value 0 implies a
+ /**
+ * Number of visible rows in a multiline TextField. Value 0 implies a
* single-line text-editor.
*/
private int rows = 0;
- /** Tells if word-wrapping should be used in multiline mode. */
+ /**
+ * Tells if word-wrapping should be used in multiline mode.
+ */
private boolean wordwrap = true;
- /** Tells if input is used to enter sensitive information that is
- * not echoed to display. Typically passwords.
+ /**
+ * Tells if input is used to enter sensitive information that is
+ * not echoed to display. Typically passwords.
*/
private boolean secret = false;
- /** Null representation. */
+ /**
+ * Null representation.
+ */
private String nullRepresentation = "null";
- /** Is setting to null from non-null value allowed by setting with
- * null representation */
+ /**
+ * Is setting to null from non-null value allowed by setting with
+ * null representation .
+ */
private boolean nullSettingAllowed = false;
/* Constructors **************************************************** */
- /** Constructs an empty <code>TextField</code> with no caption. */
+ /**
+ * Constructs an empty <code>TextField</code> with no caption.
+ */
public TextField() {
setValue("");
}
- /** Constructs an empty <code>TextField</code> with given caption. */
+ /**
+ * Constructs an empty <code>TextField</code> with given caption.
+ * @param caption the caption <code>String</code> for the editor.
+ */
public TextField(String caption) {
setValue("");
setCaption(caption);
}
- /** Constructs a new <code>TextField</code> that's bound to the
+ /**
+ * Constructs a new <code>TextField</code> that's bound to the
* specified <code>Property</code> and has no caption.
*
- * @param dataSource the Property to be edited with this editor
+ * @param dataSource the Property to be edited with this editor.
*/
public TextField(Property dataSource) {
setPropertyDataSource(dataSource);
}
- /** Constructs a new <code>TextField</code> that's bound to the
+ /**
+ * Constructs a new <code>TextField</code> that's bound to the
* specified <code>Property</code> and has the given caption
* <code>String</code>.
*
- * @param caption caption <code>String</code> for the editor
- * @param dataSource the Property to be edited with this editor
+ * @param caption the caption <code>String</code> for the editor.
+ * @param dataSource the Property to be edited with this editor.
*/
public TextField(String caption, Property dataSource) {
this(dataSource);
setCaption(caption);
}
- /** Constructs a new <code>TextField</code> with the given caption and
+ /**
+ * Constructs a new <code>TextField</code> with the given caption and
* initial text contents. The editor constructed this way will not be
* bound to a Property unless
* {@link com.itmill.toolkit.data.Property.Viewer#setPropertyDataSource(Property)}
* is called to bind it.
*
- * @param caption caption <code>String</code> for the editor
- * @param text initial text content of the editor
+ * @param caption the caption <code>String</code> for the editor.
+ * @param text the initial text content of the editor.
*/
public TextField(String caption, String value) {
setValue(value);
@@ -129,18 +154,18 @@ public class TextField extends AbstractField {
/* Component basic features ********************************************* */
- /* Paint this component.
+ /* Paints this component.
* Don't add a JavaDoc comment here, we use the default documentation
* from implemented interface.
*/
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
- // Set secret attribute
+ // Sets the secret attribute
if (this.isSecret())
target.addAttribute("secret", true);
- // Add the number of column and rows
+ // Adds the number of column and rows
int c = getColumns();
int r = getRows();
if (c != 0)
@@ -152,7 +177,7 @@ public class TextField extends AbstractField {
target.addAttribute("wordwrap", false);
}
- // Add content as variable
+ // Adds the content as variable
String value = getFormattedValue();
if (value == null)
value = getNullRepresentation();
@@ -161,10 +186,11 @@ public class TextField extends AbstractField {
target.addVariable(this, "text", value);
}
- /** Get the formatted dtring value.
- * Sets the field value by using the assigned Format.
- * @param value to be formatted
- * @return Formatted value
+ /**
+ * Gets the formatted dtring value.
+ * Sets the field value by using the assigned Format.
+ *
+ * @return the Formatted value.
* @see #setFormat(Format)
* @see Format
*/
@@ -195,7 +221,7 @@ public class TextField extends AbstractField {
*/
public void changeVariables(Object source, Map variables) {
- // Set the text
+ // Sets the text
if (variables.containsKey("text") && !isReadOnly()) {
// Only do the setting if the string representation of the value
@@ -215,21 +241,23 @@ public class TextField extends AbstractField {
/* Text field configuration ********************************************* */
- /** Gets the number of columns in the editor. If the number of columns
+ /**
+ * Gets the number of columns in the editor. If the number of columns
* is set 0, the actual number of displayed columns is determined
* implicitly by the adapter.
*
- * @param the number of columns for this editor
+ * @return the number of columns in the editor.
*/
public int getColumns() {
return this.columns;
}
- /** Sets the number of columns in the editor. If the number of columns
+ /**
+ * Sets the number of columns in the editor. If the number of columns
* is set 0, the actual number of displayed columns is determined
* implicitly by the adapter.
*
- * @return number of explicitly set columns
+ * @param columns the number of columns to set.
*/
public void setColumns(int columns) {
if (columns < 0)
@@ -238,21 +266,23 @@ public class TextField extends AbstractField {
requestRepaint();
}
- /** Gets the number of rows in the editor. If the number of rows is set
+ /**
+ * Gets the number of rows in the editor. If the number of rows is set
* to 0, the actual number of displayed rows is determined implicitly by
* the adapter.
*
- * @return number of explicitly set rows
+ * @return number of explicitly set rows.
*/
public int getRows() {
return this.rows;
}
- /** Sets the number of rows in the editor. If the number of rows is set
+ /**
+ * Sets the number of rows in the editor. If the number of rows is set
* to 0, the actual number of displayed rows is determined implicitly by
* the adapter.
*
- * @param the number of rows for this editor
+ * @param rows the number of rows for this editor.
*/
public void setRows(int rows) {
if (rows < 0)
@@ -261,18 +291,20 @@ public class TextField extends AbstractField {
requestRepaint();
}
- /** Tests if the editor is in word-wrap mode.
+ /**
+ * Tests if the editor is in word-wrap mode.
*
* @return <code>true</code> if the component is in the word-wrap mode,
- * <code>false</code> if not
+ * <code>false</code> if not.
*/
public boolean isWordwrap() {
return this.wordwrap;
}
- /** Sets the editor's word-wrap mode on or off.
+ /**
+ * Sets the editor's word-wrap mode on or off.
*
- * @param wordwrap boolean value specifying if the editor should be in
+ * @param wordwrap the boolean value specifying if the editor should be in
* word-wrap mode after the call or not.
*/
public void setWordwrap(boolean wordwrap) {
@@ -288,51 +320,56 @@ public class TextField extends AbstractField {
public Class getType() {
return String.class;
}
- /** Get the secret property on and off.
+ /**
+ * Gets the secret property on and off.
* If a field is used to enter secretinformation
* the information is not echoed to display.
- * @return true if the field is used to enter secret information, false otherwise.
+ * @return <code>true</code> if the field is used to enter secret information, <code>false</code> otherwise.
*/
public boolean isSecret() {
return secret;
}
- /** Set the secret property on and off.
+ /**
+ * Sets the secret property on and off.
* If a field is used to enter secretinformation
* the information is not echoed to display.
- * @param secret value specifying if the field is used to enter secret information.
+ * @param secret the value specifying if the field is used to enter secret information.
*/
public void setSecret(boolean secret) {
this.secret = secret;
}
- /** Get the null-string representation.
+ /**
+ * Gets the null-string representation.
*
* <p>The null-valued strings are represented on the user interface by replacing the
* null value with this string. If the null representation is set null (not 'null' string),
* painting null value throws exception.</p>
*
- * <p>The default value is string 'null'</p>
- *
+ * <p>The default value is string 'null'.</p>
+ * @return the String Textual representation for null strings.
* @see TextField#isNullSettingAllowed()
- * @return String Textual representation for null strings.
*/
public String getNullRepresentation() {
return nullRepresentation;
}
- /** Is setting nulls with null-string representation allowed.
+ /**
+ * Is setting nulls with null-string representation allowed.
*
- * <p>If this property is true, writing null-representation string to text
+ * <p>
+ * If this property is true, writing null-representation string to text
* field allways sets the field value to real null. If this property is
* false, null setting is not made, but the null values are maintained.
* Maintenance of null-values is made by only converting the textfield
* contents to real null, if the text field matches the null-string
- * representation and the current value of the field is null.</p>
+ * representation and the current value of the field is null.
+ * </p>
*
* <p>By default this setting is false</p>
*
- * @return boolean Should the null-string represenation be allways
+ * @return boolean Should the null-string represenation be allways
* converted to null-values.
* @see TextField#getNullRepresentation()
*/
@@ -340,22 +377,23 @@ public class TextField extends AbstractField {
return nullSettingAllowed;
}
- /** Sets the null-string representation.
+ /**
+ * Sets the null-string representation.
*
* <p>The null-valued strings are represented on the user interface by replacing the
* null value with this string. If the null representation is set null (not 'null' string),
* painting null value throws exception.</p>
*
* <p>The default value is string 'null'</p>
- *
- * @see TextField#setNullSettingAllowed(boolean)
* @param nullRepresentation Textual representation for null strings.
+ * @see TextField#setNullSettingAllowed(boolean)
*/
public void setNullRepresentation(String nullRepresentation) {
this.nullRepresentation = nullRepresentation;
}
- /** Set the null conversion mode.
+ /**
+ * Sets the null conversion mode.
*
* <p>If this property is true, writing null-representation string to text
* field allways sets the field value to real null. If this property is
@@ -364,7 +402,7 @@ public class TextField extends AbstractField {
* contents to real null, if the text field matches the null-string
* representation and the current value of the field is null.</p>
*
- * <p>By default this setting is false</p>
+ * <p>By default this setting is false.</p>
*
* @param nullSettingAllowed Should the null-string represenation be allways
* converted to null-values.
@@ -374,18 +412,19 @@ public class TextField extends AbstractField {
this.nullSettingAllowed = nullSettingAllowed;
}
- /** Get the value formatter of TextField.
- *
+ /**
+ * Gets the value formatter of TextField.
*
- * @return The Format used to format the value.
+ * @return the Format used to format the value.
*/
public Format getFormat() {
return format;
}
- /** Get the value formatter of TextField.
+ /**
+ * Gets the value formatter of TextField.
*
- * @param The Format used to format the value. Null disables the formatting.
+ * @param format the Format used to format the value. Null disables the formatting.
*/
public void setFormat(Format format) {
this.format = format;
diff --git a/src/com/itmill/toolkit/ui/Tree.java b/src/com/itmill/toolkit/ui/Tree.java
index cdb95d5ec2..191f5e2375 100644
--- a/src/com/itmill/toolkit/ui/Tree.java
+++ b/src/com/itmill/toolkit/ui/Tree.java
@@ -47,9 +47,10 @@ import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.Resource;
-/** MenuTree component.
- * MenuTree can be used to select an item (or multiple items)
- * from a hierarchical set of items.
+/**
+ * MenuTree component.
+ * MenuTree can be used to select an item (or multiple items)
+ * from a hierarchical set of items.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -82,30 +83,47 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
/* Private members **************************************************** */
- /** Set of expanded nodes */
+ /**
+ * Set of expanded nodes.
+ */
private HashSet expanded = new HashSet();
- /** List of action handlers */
+ /**
+ * List of action handlers.
+ */
private LinkedList actionHandlers = null;
- /** Action mapper */
+ /**
+ * Action mapper.
+ */
private KeyMapper actionMapper = null;
- /** Is the tree selectable */
+ /**
+ * Is the tree selectable .
+ */
private boolean selectable = true;
/* Tree constructors ************************************************** */
- /** Create new empty tree */
+ /**
+ * Creates the new empty tree.
+ */
public Tree() {
}
- /** Create new empty tree with caption. */
+ /**
+ * Creates the new empty tree with caption.
+ * @param caption
+ */
public Tree(String caption) {
setCaption(caption);
}
- /** Create new tree with caption and connect it to a Container. */
+ /**
+ * Creates the new tree with caption and connect it to a Container.
+ * @param caption
+ * @param dataSource
+ */
public Tree(String caption, Container dataSource) {
setCaption(caption);
setContainerDataSource(dataSource);
@@ -113,15 +131,18 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
/* Expanding and collapsing ******************************************* */
- /** Check is an item is expanded
- * @return true iff the item is expanded
+ /**
+ * Check is an item is expanded
+ * @param itemId the item id.
+ * @return true iff the item is expanded.
*/
public boolean isExpanded(Object itemId) {
return expanded.contains(itemId);
}
- /** Expand an item.
- *
+ /**
+ * Expands an item.
+ * @param itemId the item id.
* @return True iff the expand operation succeeded
*/
public boolean expandItem(Object itemId) {
@@ -134,7 +155,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
if (!areChildrenAllowed(itemId))
return false;
- // Expand
+ // Expands
expanded.add(itemId);
requestRepaint();
fireExpandEvent(itemId);
@@ -142,10 +163,12 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
return true;
}
- /** Expand items recursively
+ /**
+ * Expands the items recursively
*
* Expands all the children recursively starting from an item.
* Operation succeeds only if all expandable items are expanded.
+ * @param startItemId
* @return True iff the expand operation succeeded
*/
public boolean expandItemsRecursively(Object startItemId) {
@@ -156,7 +179,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
Stack todo = new Stack();
todo.add(startItemId);
- // Expand recursively
+ // Expands recursively
while (!todo.isEmpty()) {
Object id = todo.pop();
if (areChildrenAllowed(id) && !expandItem(id)) {
@@ -170,8 +193,9 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
return result;
}
- /** Collapse an item.
- *
+ /**
+ * Collapses an item.
+ * @param itemId the item id.
* @return True iff the collapse operation succeeded
*/
public boolean collapseItem(Object itemId) {
@@ -188,10 +212,12 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
return true;
}
- /** Collapse items recursively
+ /**
+ * Collapses the items recursively.
*
* Collapse all the children recursively starting from an item.
* Operation succeeds only if all expandable items are collapsed.
+ * @param startItemId
* @return True iff the collapse operation succeeded
*/
public boolean collapseItemsRecursively(Object startItemId) {
@@ -216,21 +242,23 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
return result;
}
- /** Getter for property selectable.
+ /**
+ * Getter for property selectable.
*
* <p>The tree is selectable by default.</p>
*
- * @return Value of property selectable.
+ * @return the Value of property selectable.
*/
public boolean isSelectable() {
return this.selectable;
}
- /** Setter for property selectable.
+ /**
+ * Setter for property selectable.
*
* <p>The tree is selectable by default.</p>
*
- * @param selectable New value of property selectable.
+ * @param selectable the New value of property selectable.
*/
public void setSelectable(boolean selectable) {
if (this.selectable != selectable) {
@@ -242,6 +270,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
/* Component API ****************************************************** */
/**
+ * Gets the UIDL tag corresponding to the component.
* @see com.itmill.toolkit.ui.AbstractComponent#getTag()
*/
public String getTag() {
@@ -249,11 +278,13 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Called when one or more variables handled by the implementing class
+ * are changed.
* @see com.itmill.toolkit.terminal.VariableOwner#changeVariables(Object source, Map variables)
*/
public void changeVariables(Object source, Map variables) {
- // Collapse nodes
+ // Collapses the nodes
if (variables.containsKey("collapse")) {
String[] keys = (String[]) variables.get("collapse");
for (int i = 0; i < keys.length; i++) {
@@ -263,7 +294,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
}
- // Expand nodes
+ // Expands the nodes
if (variables.containsKey("expand")) {
String[] keys = (String[]) variables.get("expand");
for (int i = 0; i < keys.length; i++) {
@@ -299,6 +330,8 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Paints any needed component-specific things to the given UIDL
+ * stream.
* @see com.itmill.toolkit.ui.AbstractComponent#paintContent(PaintTarget)
*/
public void paintContent(PaintTarget target) throws PaintException {
@@ -333,39 +366,39 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
int keyIndex = 0;
LinkedList expandedKeys = new LinkedList();
- // Iterate trough hierarchical tree using a stack of iterators
+ // Iterates through hierarchical tree using a stack of iterators
Stack iteratorStack = new Stack();
Collection ids = rootItemIds();
if (ids != null)
iteratorStack.push(ids.iterator());
while (!iteratorStack.isEmpty()) {
- // Get the iterator for current tree level
+ // Gets the iterator for current tree level
Iterator i = (Iterator) iteratorStack.peek();
// If the level is finished, back to previous tree level
if (!i.hasNext()) {
- // Remove used iterator from the stack
+ // Removes used iterator from the stack
iteratorStack.pop();
- // Close node
+ // Closes node
if (!iteratorStack.isEmpty())
target.endTag("node");
}
- // Add the item on current level
+ // Adds the item on current level
else {
Object itemId = i.next();
- // Start the item / node
+ // Starts the item / node
boolean isNode = areChildrenAllowed(itemId);
if (isNode)
target.startTag("node");
else
target.startTag("leaf");
- // Add attributes
+ // Adds the attributes
target.addAttribute("caption", getItemCaption(itemId));
Resource icon = getItemIcon(itemId);
if (icon != null)
@@ -401,7 +434,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
target.endTag("al");
}
- // Add children if expanded, or close the tag
+ // Adds the children if expanded, or close the tag
if (isExpanded(itemId) && hasChildren(itemId)
&& areChildrenAllowed(itemId)) {
iteratorStack.push(getChildren(itemId).iterator());
@@ -448,6 +481,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
/* Container.Hierarchical API ***************************************** */
/**
+ * Tests if the Item with given ID can have any children.
* @see com.itmill.toolkit.data.Container.Hierarchical#areChildrenAllowed(Object)
*/
public boolean areChildrenAllowed(Object itemId) {
@@ -455,6 +489,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Gets the IDs of all Items that are children of the specified Item.
* @see com.itmill.toolkit.data.Container.Hierarchical#getChildren(Object)
*/
public Collection getChildren(Object itemId) {
@@ -462,6 +497,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Gets the ID of the parent Item of the specified Item.
* @see com.itmill.toolkit.data.Container.Hierarchical#getParent(Object)
*/
public Object getParent(Object itemId) {
@@ -469,6 +505,8 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Tests if the Item specified with <code>itemId</code> has any child
+ * Items, that is, is it a leaf Item.
* @see com.itmill.toolkit.data.Container.Hierarchical#hasChildren(Object)
*/
public boolean hasChildren(Object itemId) {
@@ -476,6 +514,8 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Tests if the Item specified with <code>itemId</code> is a root
+ * Item.
* @see com.itmill.toolkit.data.Container.Hierarchical#isRoot(Object)
*/
public boolean isRoot(Object itemId) {
@@ -483,6 +523,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Gets the IDs of all Items in the container that don't have a parent.
* @see com.itmill.toolkit.data.Container.Hierarchical#rootItemIds()
*/
public Collection rootItemIds() {
@@ -490,6 +531,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Sets the given Item's capability to have children.
* @see com.itmill.toolkit.data.Container.Hierarchical#setChildrenAllowed(Object, boolean)
*/
public boolean setChildrenAllowed(
@@ -505,6 +547,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Sets the parent of an Item.
* @see com.itmill.toolkit.data.Container.Hierarchical#setParent(Object, Object)
*/
public boolean setParent(Object itemId, Object newParentId) {
@@ -518,6 +561,7 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
/* Overriding select behavior******************************************** */
/**
+ * Sets the Container that serves as the data source of the viewer.
* @see com.itmill.toolkit.data.Container.Viewer#setContainerDataSource(Container)
*/
public void setContainerDataSource(Container newDataSource) {
@@ -536,10 +580,12 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
/* Expand event and listener ****************************************** */
- /** Event to fired when a node is expanded.
- * ExapandEvent is fired when a node is to be expanded.
- * it can me used to dynamically fill the sub-nodes of the
- * node.
+ /**
+ * Event to fired when a node is expanded.
+ * ExapandEvent is fired when a node is to be expanded.
+ * it can me used to dynamically fill the sub-nodes of the
+ * node.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -551,61 +597,75 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
*/
private static final long serialVersionUID = 3832624001804481075L;
private Object expandedItemId;
- /** New instance of options change event
- * @param source Source of the event.
+
+ /**
+ * New instance of options change event
+ * @param source the Source of the event.
+ * @param expandedItemId
*/
public ExpandEvent(Component source, Object expandedItemId) {
super(source);
this.expandedItemId = expandedItemId;
}
- /** Node where the event occurred
- * @return Source of the event.
+ /**
+ * Node where the event occurred.
+ * @return the Source of the event.
*/
public Object getItemId() {
return this.expandedItemId;
}
}
- /** Expand event listener
+ /**
+ * Expand event listener.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface ExpandListener {
- /** A node has been expanded.
- * @param event Expand event.
+ /**
+ * A node has been expanded.
+ * @param event the Expand event.
*/
public void nodeExpand(ExpandEvent event);
}
- /** Add expand listener
- * @param listener Listener to be added.
+ /**
+ * Adds the expand listener.
+ * @param listener the Listener to be added.
*/
public void addListener(ExpandListener listener) {
addListener(ExpandEvent.class, listener, EXPAND_METHOD);
}
- /** Remove expand listener
- * @param listener Listener to be removed.
+ /**
+ * Removes the expand listener.
+ * @param listener the Listener to be removed.
*/
public void removeListener(ExpandListener listener) {
removeListener(ExpandEvent.class, listener, EXPAND_METHOD);
}
- /** Emit expand event. */
+ /**
+ * Emits the expand event.
+ * @param itemId the item id.
+ */
protected void fireExpandEvent(Object itemId) {
fireEvent(new ExpandEvent(this, itemId));
}
/* Collapse event ****************************************** */
- /** Collapse event
+ /**
+ * Collapse event
+ *
* @author IT Mill Ltd.
- * @version @VERSION@
- * @since 3.0
- */
+ * @version @VERSION@
+ * @since 3.0
+ */
public class CollapseEvent extends Component.Event {
/**
@@ -615,57 +675,69 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
private Object collapsedItemId;
- /** New instance of options change event
- * @param source Source of the event.
+ /**
+ * New instance of options change event.
+ * @param source the Source of the event.
+ * @param collapsedItemId
*/
public CollapseEvent(Component source, Object collapsedItemId) {
super(source);
this.collapsedItemId = collapsedItemId;
}
- /** Node where the event occurred
- * @return Source of the event.
+ /**
+ * Gets tge Collapsed Item id.
+ * @return the collapsed item id.
*/
public Object getItemId() {
return collapsedItemId;
}
}
- /** Collapse event listener
+ /**
+ * Collapse event listener.
+ *
* @author IT Mill Ltd.
- * @version @VERSION@
+ * @version @VERSION@
* @since 3.0
*/
public interface CollapseListener {
- /** A node has been collapsed.
- * @param event Collapse event.
+ /**
+ * A node has been collapsed.
+ * @param event the Collapse event.
*/
public void nodeCollapse(CollapseEvent event);
}
- /** Add collapse listener
- * @param listener Listener to be added.
+ /**
+ * Adds the collapse listener.
+ * @param listener the Listener to be added.
*/
public void addListener(CollapseListener listener) {
addListener(CollapseEvent.class, listener, COLLAPSE_METHOD);
}
- /** Remove collapse listener
- * @param listener Listener to be removed.
+ /**
+ * Removes the collapse listener.
+ * @param listener the Listener to be removed.
*/
public void removeListener(CollapseListener listener) {
removeListener(CollapseEvent.class, listener, COLLAPSE_METHOD);
}
- /** Emit collapse event. */
+ /**
+ * Emits collapse event.
+ * @param itemId the item id.
+ */
protected void fireCollapseEvent(Object itemId) {
fireEvent(new CollapseEvent(this, itemId));
}
/* Action container *************************************************** */
- /** Adds an action handler.
+ /**
+ * Adds an action handler.
* @see com.itmill.toolkit.event.Action.Container#addActionHandler(Action.Handler)
*/
public void addActionHandler(Action.Handler actionHandler) {
@@ -684,7 +756,8 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
}
- /** Removes an action handler.
+ /**
+ * Removes an action handler.
* @see com.itmill.toolkit.event.Action.Container#removeActionHandler(Action.Handler)
*/
public void removeActionHandler(Action.Handler actionHandler) {
@@ -703,36 +776,37 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
}
/**
+ * Gets the visible item ids.
* @see com.itmill.toolkit.ui.Select#getVisibleItemIds()
*/
public Collection getVisibleItemIds() {
LinkedList visible = new LinkedList();
- // Iterate trough hierarchical tree using a stack of iterators
+ // Iterates trough hierarchical tree using a stack of iterators
Stack iteratorStack = new Stack();
Collection ids = rootItemIds();
if (ids != null)
iteratorStack.push(ids.iterator());
while (!iteratorStack.isEmpty()) {
- // Get the iterator for current tree level
+ // Gets the iterator for current tree level
Iterator i = (Iterator) iteratorStack.peek();
// If the level is finished, back to previous tree level
if (!i.hasNext()) {
- // Remove used iterator from the stack
+ // Removes used iterator from the stack
iteratorStack.pop();
}
- // Add the item on current level
+ // Adds the item on current level
else {
Object itemId = i.next();
visible.add(itemId);
- // Add children if expanded, or close the tag
+ // Adds children if expanded, or close the tag
if (isExpanded(itemId) && hasChildren(itemId)) {
iteratorStack.push(getChildren(itemId).iterator());
}
@@ -742,9 +816,10 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
return visible;
}
- /** Adding new items is not supported.
- * @see com.itmill.toolkit.ui.Select#setNewItemsAllowed(boolean)
+ /**
+ * Adding new items is not supported.
* @throws UnsupportedOperationException if set to true.
+ * @see com.itmill.toolkit.ui.Select#setNewItemsAllowed(boolean)
*/
public void setNewItemsAllowed(boolean allowNewOptions)
throws UnsupportedOperationException {
@@ -752,16 +827,19 @@ public class Tree extends Select implements Container.Hierarchical, Action.Conta
throw new UnsupportedOperationException();
}
- /** Focusing to this component is not supported.
- * @see com.itmill.toolkit.ui.AbstractField#focus()
+ /**
+ * Focusing to this component is not supported.
* @throws UnsupportedOperationException if invoked.
+ * @see com.itmill.toolkit.ui.AbstractField#focus()
*/
public void focus() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
- /** Tree does not support lazy options loading mode.
+ /**
+ * Tree does not support lazy options loading mode.
* Setting this true will throw UnsupportedOperationException.
+ * @see com.itmill.toolkit.ui.Select#setLazyLoading(boolean)
*/
public void setLazyLoading(boolean useLazyLoading) {
if (useLazyLoading)
diff --git a/src/com/itmill/toolkit/ui/Upload.java b/src/com/itmill/toolkit/ui/Upload.java
index 98fbf31ad3..95da0bf7d1 100644
--- a/src/com/itmill/toolkit/ui/Upload.java
+++ b/src/com/itmill/toolkit/ui/Upload.java
@@ -39,7 +39,8 @@ import com.itmill.toolkit.terminal.UploadStream;
import java.io.IOException;
import java.io.OutputStream;
-/** Component for client file uploading.
+/**
+ * Component for client file uploading.
*
* @author IT Mill Ltd.
* @version @VERSION@
@@ -47,25 +48,35 @@ import java.io.OutputStream;
*/
public class Upload extends AbstractComponent implements Component.Focusable {
- /** Upload buffer size. */
+ /**
+ * Upload buffer size.
+ */
private static final int BUFFER_SIZE = 64 * 1024; // 64k
- /** Should the field be focused on next repaint */
+ /**
+ * Should the field be focused on next repaint?
+ */
private boolean focus = false;
- /** The tab order number of this field */
+ /**
+ * The tab order number of this field.
+ */
private int tabIndex = 0;
- /** The output of the upload is redirected to this receiver. */
+ /**
+ * The output of the upload is redirected to this receiver.
+ */
private Receiver receiver;
private long focusableId = -1;
/* TODO: Add a default constructor, receive to temp file. */
- /** Creates a new instance of Upload that redirects the
+ /**
+ * Creates a new instance of Upload that redirects the
* uploaded data to given stream.
- *
+ * @param caption
+ * @param uploadReceiver
*/
public Upload(String caption, Receiver uploadReceiver) {
this.focusableId = Window.getNewFocusableId(this);
@@ -73,28 +84,32 @@ public class Upload extends AbstractComponent implements Component.Focusable {
receiver = uploadReceiver;
}
- /** Get component type.
+ /**
+ * Gets the component type.
* @return Component type as string.
*/
public String getTag() {
return "upload";
}
- /** Invoked when the value of a variable has changed. */
+ /**
+ * Invoked when the value of a variable has changed.
+ * @see com.itmill.toolkit.ui.AbstractComponent#changeVariables(java.lang.Object, java.util.Map)
+ */
public void changeVariables(Object source, Map variables) {
- // Check the variable name
+ // Checks the variable name
if (!variables.containsKey("stream"))
return;
- // Get the upload stream
+ // Gets the upload stream
UploadStream upload = (UploadStream) variables.get("stream");
- // Get file properties
+ // Gets file properties
String filename = upload.getContentName();
String type = upload.getContentType();
- // Get the output target stream
+ // Gets the output target stream
OutputStream out = receiver.receiveUpload(filename, type);
if (out == null)
throw new RuntimeException("Error getting outputstream from upload receiver");
@@ -126,9 +141,10 @@ public class Upload extends AbstractComponent implements Component.Focusable {
}
}
- /** Paint the content of this component.
+ /**
+ * Paints the content of this component.
* @param target Target to paint the content on.
- * @throws PaintException The paint operation failed.
+ * @throws PaintException if the paint operation failed.
*/
public void paintContent(PaintTarget target) throws PaintException {
// The field should be focused
@@ -142,16 +158,19 @@ public class Upload extends AbstractComponent implements Component.Focusable {
target.addUploadStreamVariable(this, "stream");
}
- /** Interface that must be implemented by the upload receivers.
+ /**
+ * Interface that must be implemented by the upload receivers.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface Receiver {
- /** Invoked when a new upload arrives.
- * @param filename The desired filename of the upload, usually as specified by the client.
- * @param MIMEType The MIME type of the uploaded file.
+ /**
+ * Invoked when a new upload arrives.
+ * @param filename the desired filename of the upload, usually as specified by the client.
+ * @param MIMEType the MIME type of the uploaded file.
* @return Stream to which the uploaded file should be written.
*/
public OutputStream receiveUpload(String filename, String MIMEType);
@@ -183,8 +202,10 @@ public class Upload extends AbstractComponent implements Component.Focusable {
}
}
- /** Upload.Received event is sent when the upload receives a file,
+ /**
+ * Upload.Received event is sent when the upload receives a file,
* regardless if the receival was successfull.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -196,15 +217,28 @@ public class Upload extends AbstractComponent implements Component.Focusable {
*/
private static final long serialVersionUID = 3257288015385670969L;
- /** Length of the received file. */
+ /**
+ * Length of the received file.
+ */
private long length;
- /** MIME type of the received file. */
+ /**
+ * MIME type of the received file.
+ */
private String type;
- /** Received file name */
+ /**
+ * Received file name.
+ */
private String filename;
-
+
+ /**
+ *
+ * @param source the source of the file.
+ * @param filename the received file name.
+ * @param MIMEType the MIME type of the received file.
+ * @param length the length of the received file.
+ */
public FinishedEvent(
Upload source,
String filename,
@@ -216,28 +250,32 @@ public class Upload extends AbstractComponent implements Component.Focusable {
this.length = length;
}
- /** Upload where the event occurred
- * @return Source of the event.
+ /**
+ * Uploads where the event occurred.
+ * @return the Source of the event.
*/
public Upload getUpload() {
return (Upload) getSource();
}
/**
- * Returns the filename.
+ * Gets the file name.
+ * @return the filename.
*/
public String getFilename() {
return filename;
}
/**
- * Returns the length.
+ * Gets the length of the file.
+ * @return the length.
*/
public long getLength() {
return length;
}
/**
- * Returns the type.
+ * Gets the MIME Type of the file.
+ * @return the MIME type.
*/
public String getMIMEType() {
return type;
@@ -245,8 +283,10 @@ public class Upload extends AbstractComponent implements Component.Focusable {
}
- /** Upload.Interrupted event is sent when the upload is received, but the
+ /**
+ * Upload.Interrupted event is sent when the upload is received, but the
* reception is interrupted for some reason.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -257,7 +297,14 @@ public class Upload extends AbstractComponent implements Component.Focusable {
* Serial generated by eclipse.
*/
private static final long serialVersionUID = 3833746590157386293L;
-
+
+ /**
+ *
+ * @param source
+ * @param filename
+ * @param MIMEType
+ * @param length
+ */
public FailedEvent(
Upload source,
String filename,
@@ -268,7 +315,9 @@ public class Upload extends AbstractComponent implements Component.Focusable {
}
- /** Upload.Success event is sent when the upload is received successfully.
+ /**
+ * Upload.Success event is sent when the upload is received successfully.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
@@ -279,7 +328,14 @@ public class Upload extends AbstractComponent implements Component.Focusable {
* Serial generated by eclipse.
*/
private static final long serialVersionUID = 3256445798169524023L;
-
+
+ /**
+ *
+ * @param source
+ * @param filename
+ * @param MIMEType
+ * @param length
+ */
public SucceededEvent(
Upload source,
String filename,
@@ -290,88 +346,107 @@ public class Upload extends AbstractComponent implements Component.Focusable {
}
- /** Receives events when the uploads are ready.
+ /**
+ * Receives the events when the uploads are ready.
+ *
* @author IT Mill Ltd.
* @version @VERSION@
* @since 3.0
*/
public interface FinishedListener {
- /** Upload has finished.
- * @param event Upload finished event.
+ /**
+ * Upload has finished.
+ * @param event the Upload finished event.
*/
public void uploadFinished(FinishedEvent event);
}
- /** Receives events when the uploads are finished, but unsuccessful.
+ /**
+ * Receives events when the uploads are finished, but unsuccessful.
+ *
* @author IT Mill Ltd.
- * @version @VERSION@
+ * @version @VERSION@
* @since 3.0
*/
public interface FailedListener {
- /** Upload has finished unsuccessfully.
- * @param event Upload failed event.
+ /**
+ * Upload has finished unsuccessfully.
+ * @param event the Upload failed event.
*/
public void uploadFailed(FailedEvent event);
}
- /** Receives events when the uploads are successfully finished.
+ /**
+ * Receives events when the uploads are successfully finished.
* @author IT Mill Ltd.
- * @version @VERSION@
+ * @version @VERSION@
* @since 3.0
*/
public interface SucceededListener {
- /** Upload successfull..
- * @param event Upload successfull event.
+ /**
+ * Upload successfull..
+ * @param event the Upload successfull event.
*/
public void uploadSucceeded(SucceededEvent event);
}
- /** Add upload received event listener
- * @param listener Listener to be added.
+ /**
+ * Adds the upload received event listener.
+ * @param listener the Listener to be added.
*/
public void addListener(FinishedListener listener) {
addListener(FinishedEvent.class, listener, UPLOAD_FINISHED_METHOD);
}
- /** Remove upload received event listener
- * @param listener Listener to be removed.
+ /**
+ * Removes the upload received event listener.
+ * @param listener the Listener to be removed.
*/
public void removeListener(FinishedListener listener) {
removeListener(FinishedEvent.class, listener, UPLOAD_FINISHED_METHOD);
}
- /** Add upload interrupted event listener
- * @param listener Listener to be added.
+ /**
+ * Adds the upload interrupted event listener.
+ * @param listener the Listener to be added.
*/
public void addListener(FailedListener listener) {
addListener(FailedEvent.class, listener, UPLOAD_FAILED_METHOD);
}
- /** Remove upload interrupted event listener
- * @param listener Listener to be removed.
+ /**
+ * Removes the upload interrupted event listener.
+ * @param listener the Listener to be removed.
*/
public void removeListener(FailedListener listener) {
removeListener(FinishedEvent.class, listener, UPLOAD_FAILED_METHOD);
}
- /** Add upload success event listener
- * @param listener Listener to be added.
+ /**
+ * Adds the upload success event listener.
+ * @param listener the Listener to be added.
*/
public void addListener(SucceededListener listener) {
addListener(SucceededEvent.class, listener, UPLOAD_SUCCEEDED_METHOD);
}
- /** Remove upload success event listener
- * @param listener Listener to be removed.
+ /**
+ * Removes the upload success event listener.
+ * @param listener the Listener to be removed.
*/
public void removeListener(SucceededListener listener) {
removeListener(SucceededEvent.class, listener, UPLOAD_SUCCEEDED_METHOD);
}
- /** Emit upload received event. */
+ /**
+ * Emit upload received event.
+ * @param filename
+ * @param MIMEType
+ * @param length
+ */
protected void fireUploadReceived(
String filename,
String MIMEType,
@@ -379,7 +454,12 @@ public class Upload extends AbstractComponent implements Component.Focusable {
fireEvent(new Upload.FinishedEvent(this, filename, MIMEType, length));
}
- /** Emit upload interrupted event. */
+ /**
+ * Emits the upload interrupted event.
+ * @param filename
+ * @param MIMEType
+ * @param length
+ */
protected void fireUploadInterrupted(
String filename,
String MIMEType,
@@ -387,27 +467,37 @@ public class Upload extends AbstractComponent implements Component.Focusable {
fireEvent(new Upload.FailedEvent(this, filename, MIMEType, length));
}
- /** Emit upload success event. */
+ /**
+ * Emits the upload success event.
+ * @param filename
+ * @param MIMEType
+ * @param length
+ *
+ */
protected void fireUploadSuccess(
String filename,
String MIMEType,
long length) {
fireEvent(new Upload.SucceededEvent(this, filename, MIMEType, length));
}
- /** Returns the current receiver.
- * @return Receiver
+ /**
+ * Returns the current receiver.
+ * @return the Receiver.
*/
public Receiver getReceiver() {
return receiver;
}
- /** Sets the receiver.
- * @param receiver The receiver to set
+ /**
+ * Sets the receiver.
+ * @param receiver the receiver to set.
*/
public void setReceiver(Receiver receiver) {
this.receiver = receiver;
}
+
/**
+ * Sets the focus to this component.
* @see com.itmill.toolkit.ui.Component.Focusable#focus()
*/
public void focus() {
@@ -418,6 +508,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
}
/**
+ * Gets the Tabulator index of this Focusable component.
* @see com.itmill.toolkit.ui.Component.Focusable#getTabIndex()
*/
public int getTabIndex() {
@@ -425,6 +516,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
}
/**
+ * Sets the Tabulator index of this Focusable component.
* @see com.itmill.toolkit.ui.Component.Focusable#setTabIndex(int)
*/
public void setTabIndex(int tabIndex) {
@@ -432,6 +524,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
}
/**
+ * Gets the unique ID of focusable.
* @see com.itmill.toolkit.ui.Component.Focusable#getFocusableId()
*/
public long getFocusableId() {
diff --git a/src/com/itmill/toolkit/ui/Window.java b/src/com/itmill/toolkit/ui/Window.java
index 5da9560f42..29337e0ed3 100644
--- a/src/com/itmill/toolkit/ui/Window.java
+++ b/src/com/itmill/toolkit/ui/Window.java
@@ -57,56 +57,84 @@ import java.util.Iterator;
*/
public class Window extends Panel implements URIHandler, ParameterHandler {
- /** Window with no border */
+ /**
+ * Window with no border.
+ */
public static final int BORDER_NONE = 0;
- /** Window with only minimal border */
+ /**
+ * Window with only minimal border.
+ */
public static final int BORDER_MINIMAL = 1;
- /** Window with default borders */
+ /**
+ * Window with default borders.
+ */
public static final int BORDER_DEFAULT = 2;
- /** The terminal this window is attached to */
+ /**
+ * The terminal this window is attached to.
+ */
private Terminal terminal = null;
- /** The applicaiton this window is attached to */
+ /**
+ * The applicaiton this window is attached to.
+ */
private Application application = null;
- /** List of URI handlers for this window */
+ /**
+ * List of URI handlers for this window.
+ */
private LinkedList uriHandlerList = null;
- /** List of parameter handlers for this window */
+ /**
+ * List of parameter handlers for this window.
+ */
private LinkedList parameterHandlerList = null;
/**
* Explicitly specified theme of this window. If null, application theme is
- * used
+ * used.
*/
private String theme = null;
- /** Resources to be opened automatically on next repaint */
+ /**
+ * Resources to be opened automatically on next repaint.
+ */
private LinkedList openList = new LinkedList();
- /** The name of the window */
+ /**
+ * The name of the window.
+ */
private String name = null;
- /** Window border mode */
+ /**
+ * Window border mode.
+ */
private int border = BORDER_DEFAULT;
- /** Focused component */
+ /**
+ * Focused component.
+ */
private Focusable focusedComponent;
- /** Distance of Window top border in pixels from top border of the containing (main window) or -1 if unspecified */
+ /**
+ * Distance of Window top border in pixels from top border of the
+ * containing (main window) or -1 if unspecified.
+ */
private int positionY = -1;
- /** Distance of Window left border in pixels from left border of the containing (main window) or -1 if unspecified */
+ /**
+ * Distance of Window left border in pixels from left border of the
+ * containing (main window) or -1 if unspecified .
+ */
private int positionX = -1;
/* ********************************************************************* */
/**
- * Create new empty unnamed window with default layout.
+ * Creates the new empty unnamed window with default layout.
*
* <p>
* To show the window in application, it must be added to application with
@@ -118,14 +146,14 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* </p>
*
* @param caption
- * Title of the window
+ * the Title of the window.
*/
public Window() {
this("", null);
}
/**
- * Create new empty window with default layout.
+ * Creates the new empty window with default layout.
*
* <p>
* To show the window in application, it must be added to application with
@@ -137,14 +165,14 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* </p>
*
* @param caption
- * Title of the window
+ * the Title of the window.
*/
public Window(String caption) {
this(caption, null);
}
/**
- * Create new window.
+ * Creates the new window.
*
* <p>
* To show the window in application, it must be added to application with
@@ -156,9 +184,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* </p>
*
* @param caption
- * Title of the window
+ * the Title of the window.
* @param layout
- * Layout of the window
+ * the Layout of the window.
*/
public Window(String caption, Layout layout) {
super(caption, layout);
@@ -166,9 +194,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
/**
- * Get terminal type.
+ * Gets the terminal type.
*
- * @return Value of property terminal.
+ * @return the Value of property terminal.
*/
public Terminal getTerminal() {
return this.terminal;
@@ -177,22 +205,22 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/* ********************************************************************* */
/**
- * Get window of the component. Returns the window where this component
+ * Gets the window of the component. Returns the window where this component
* belongs to. If the component does not yet belong to a window the returns
* null.
*
- * @return parent window of the component.
+ * @return the parent window of the component.
*/
public final Window getWindow() {
return this;
}
/**
- * Get application instance of the component. Returns the application where
+ * Gets the application instance of the component. Returns the application where
* this component belongs to. If the component does not yet belong to a
* application the returns null.
*
- * @return parent application of the component.
+ * @return the parent application of the component.
*/
public final Application getApplication() {
return this.application;
@@ -202,7 +230,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* Getter for property parent. Parent is the visual parent of a component.
* Each component can belong to only one ComponentContainer at time.
*
- * @return Value of property parent.
+ * @return the Value of property parent.
*/
public final Component getParent() {
return null;
@@ -214,16 +242,16 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* allowed for the window, and thus this call should newer be called.
*
* @param parent
- * New value of property parent.
+ * the New value of property parent.
*/
public void setParent(Component parent) {
throw new RuntimeException("Setting parent for Window is not allowed");
}
/**
- * Get component UIDL tag.
+ * Gets the component UIDL tag.
*
- * @return Component UIDL tag as string.
+ * @return the Component UIDL tag as string.
*/
public String getTag() {
return "window";
@@ -231,7 +259,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/* ********************************************************************* */
- /** Add new URI handler to this window */
+ /**
+ * Adds the new URI handler to this window.
+ * @param handler the URI handler to add.
+ */
public void addURIHandler(URIHandler handler) {
if (uriHandlerList == null)
uriHandlerList = new LinkedList();
@@ -241,7 +272,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
}
- /** Remove given URI handler from this window */
+ /**
+ * Removes the given URI handler from this window.
+ * @param handler the URI handler to remove.
+ */
public void removeURIHandler(URIHandler handler) {
if (handler == null || uriHandlerList == null)
return;
@@ -253,7 +287,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
/**
- * Handle uri recursively.
+ * Handles uri recursively.
+ * @param context
+ * @param relativeUri
*/
public DownloadStream handleURI(URL context, String relativeUri) {
DownloadStream result = null;
@@ -279,7 +315,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/* ********************************************************************* */
- /** Add new parameter handler to this window. */
+ /**
+ * Adds the new parameter handler to this window.
+ * @param handler the parameter handler to add.
+ */
public void addParameterHandler(ParameterHandler handler) {
if (parameterHandlerList == null)
parameterHandlerList = new LinkedList();
@@ -289,7 +328,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
}
- /** Remove given URI handler from this window. */
+ /**
+ * Removes the given URI handler from this window.
+ * @param handler the parameter handler to remove.
+ */
public void removeParameterHandler(ParameterHandler handler) {
if (handler == null || parameterHandlerList == null)
return;
@@ -315,9 +357,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/* ********************************************************************* */
/**
- * Get theme for this window.
+ * Gets the theme for this window.
*
- * @return Name of the theme used in window. If the theme for this
+ * @return the Name of the theme used in window. If the theme for this
* individual window is not explicitly set, the application theme is
* used instead. If application is not assigned the
* terminal.getDefaultTheme is used. If terminal is not set, null is
@@ -334,10 +376,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
/**
- * Set theme for this window.
+ * Sets the theme for this window.
*
* @param theme
- * New theme for this window. Null implies the default theme.
+ * the New theme for this window. Null implies the default theme.
*/
public void setTheme(String theme) {
this.theme = theme;
@@ -345,23 +387,23 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
/**
- * Paint the content of this component.
+ * Paints the content of this component.
*
* @param event
- * PaintEvent.
+ * the Paint Event.
* @throws PaintException
- * The paint operation failed.
+ * if the paint operation failed.
*/
public synchronized void paintContent(PaintTarget target)
throws PaintException {
- // Set the window name
+ // Sets the window name
target.addAttribute("name", getName());
- // Set the window theme
+ // Sets the window theme
target.addAttribute("theme", getTheme());
- // Mark main window
+ // Marks the main window
if (getApplication() != null
&& this == getApplication().getMainWindow())
target.addAttribute("main", true);
@@ -385,7 +427,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
// Window closing
target.addVariable(this, "close", false);
- // Set focused component
+ // Sets the focused component
if (this.focusedComponent != null)
target.addVariable(this, "focused", ""
+ this.focusedComponent.getFocusableId());
@@ -397,7 +439,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/* ********************************************************************* */
/**
- * Open the given resource in this window.
+ * Opens the given resource in this window.
+ * @param resource
*/
public void open(Resource resource) {
synchronized (openList) {
@@ -411,9 +454,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/* ********************************************************************* */
/**
- * Open the given resource in named terminal window. Empty or
+ * Opens the given resource in named terminal window. Empty or
* <code>null</code> window name results the resource to be opened in this
* window.
+ * @param resouorce the resource.
+ * @param windowName the name of the window.
*/
public void open(Resource resource, String windowName) {
synchronized (openList) {
@@ -427,9 +472,14 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/* ********************************************************************* */
/**
- * Open the given resource in named terminal window with given size and
+ * Opens the given resource in named terminal window with given size and
* border properties. Empty or <code>null</code> window name results the
* resource to be opened in this window.
+ * @param resource
+ * @param windowName
+ * @param width
+ * @param height
+ * @param border
*/
public void open(Resource resource, String windowName, int width,
int height, int border) {
@@ -447,7 +497,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* Returns the full url of the window, this returns window specific url even
* for the main window.
*
- * @return String
+ * @return the URL of the window.
*/
public URL getURL() {
@@ -462,9 +512,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
/**
- * Get the unique name of the window that indentifies it on the terminal.
+ * Gets the unique name of the window that indentifies it on the terminal.
*
- * @return String
+ * @return the Name of the Window.
*/
public String getName() {
return name;
@@ -473,7 +523,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/**
* Returns the border.
*
- * @return int
+ * @return the border.
*/
public int getBorder() {
return border;
@@ -483,7 +533,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* Sets the border.
*
* @param border
- * The border to set
+ * the border to set.
*/
public void setBorder(int border) {
this.border = border;
@@ -507,7 +557,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* <p>
*
* @param application
- * The application to set
+ * the application to set.
*/
public void setApplication(Application application) {
@@ -515,15 +565,15 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
if (application == this.application)
return;
- // Send detach event if the window is connected to application
+ // Sends detach event if the window is connected to application
if (this.application != null) {
detach();
}
- // Connect to new parent
+ // Connects to new parent
this.application = application;
- // Send attach event if connected to a window
+ // Sends the attach event if connected to a window
if (application != null)
attach();
}
@@ -541,7 +591,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* </p>
*
* @param name
- * The name to set
+ * the name to set.
*/
public void setName(String name) {
@@ -551,7 +601,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
"Window name can not be changed while "
+ "the window is in application");
- // Check the name format
+ // Checks the name format
if (name != null)
for (int i = 0; i < name.length(); i++) {
char c = name.charAt(i);
@@ -566,11 +616,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
/**
- * Set terminal type. The terminal type is set by the the terminal adapter
+ * Sets the terminal type. The terminal type is set by the the terminal adapter
* and may change from time to time.
*
* @param type
- * terminal type to set
+ * the terminal type to set.
*/
public void setTerminal(Terminal type) {
this.terminal = type;
@@ -596,7 +646,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
throw new IllegalArgumentException("Only pixels are supported");
}
- /** Private data structure for storing opening window properties */
+ /**
+ * Private data structure for storing opening window properties.
+ */
private class OpenResource {
private Resource resource;
@@ -609,7 +661,14 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
private int border;
- /** Create new open resource */
+ /**
+ * Creates the new open resource.
+ * @param resource
+ * @param name
+ * @param width
+ * @param height
+ * @param border
+ */
private OpenResource(Resource resource, String name, int width,
int height, int border) {
this.resource = resource;
@@ -619,7 +678,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
this.border = border;
}
- /** Paint the open-tag inside the window. */
+ /**
+ * Paints the open-tag inside the window.
+ * @param target the Paint Event.
+ * @throws PaintException if the Paint Operation fails.
+ */
private void paintContent(PaintTarget target) throws PaintException {
target.startTag("open");
target.addAttribute("src", resource);
@@ -643,13 +706,15 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
/**
+ * Called when one or more variables handled by the implementing class
+ * are changed.
* @see com.itmill.toolkit.terminal.VariableOwner#changeVariables(java.lang.Object,
* java.util.Map)
*/
public void changeVariables(Object source, Map variables) {
super.changeVariables(source, variables);
- // Get focused component
+ // Gets the focused component
String focusedId = (String) variables.get("focused");
if (focusedId != null) {
try {
@@ -681,19 +746,19 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
}
/**
- * Get currently focused component in this window.
+ * Gets the currently focused component in this window.
*
- * @return Focused component or null if none is focused.
+ * @return the Focused component or null if none is focused.
*/
public Component.Focusable getFocusedComponent() {
return this.focusedComponent;
}
/**
- * Set currently focused component in this window.
+ * Sets the currently focused component in this window.
*
* @param focusable
- * Focused component or null if none is focused.
+ * the Focused component or null if none is focused.
*/
public void setFocusedComponent(Component.Focusable focusable) {
this.application.setFocusedComponent(focusable);
@@ -706,7 +771,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
private static Map focusableComponents = new HashMap();
- /** Get an id for focusable component. */
+ /**
+ * Gets an id for focusable component.
+ * @param focusable the focused component.
+ */
public static long getNewFocusableId(Component.Focusable focusable) {
long newId = ++lastUsedFocusableId;
WeakReference ref = new WeakReference(focusable);
@@ -714,7 +782,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
return newId;
}
- /** Map focusable id back to focusable component. */
+ /**
+ * Map focusable id back to focusable component.
+ * @param focusableId the Focused Id.
+ * @return the focusable Id.
+ */
public static Component.Focusable getFocusableById(long focusableId) {
WeakReference ref = (WeakReference) focusableComponents.get(new Long(
focusableId));
@@ -727,7 +799,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
return null;
}
- /** Release focusable component id when not used anymore. */
+ /**
+ * Releases the focusable component id when not used anymore.
+ * @param focusableId the focusable Id to remove.
+ */
public static void removeFocusableId(long focusableId) {
Long id = new Long(focusableId);
WeakReference ref = (WeakReference) focusableComponents.get(id);
@@ -735,24 +810,33 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
focusableComponents.remove(id);
}
- /** Get the distance of Window left border in pixels from left border of the containing (main window).
- * @return Distance of Window left border in pixels from left border of the containing (main window). or -1 if unspecified.
+ /**
+ * Gets the distance of Window left border in pixels from left
+ * border of the containing (main window).
+ * @return the Distance of Window left border in pixels from left
+ * border of the containing (main window). or -1 if unspecified.
* @since 4.0.0
*/
public int getPositionX() {
return positionX;
}
- /** Set the distance of Window left border in pixels from left border of the containing (main window).
- * @param positionX Distance of Window left border in pixels from left border of the containing (main window). or -1 if unspecified
+ /**
+ * Sets the distance of Window left border in pixels from left border
+ * of the containing (main window).
+ * @param positionX the Distance of Window left border in pixels from left
+ * border of the containing (main window). or -1 if unspecified.
* @since 4.0.0
*/
public void setPositionX(int positionX) {
this.positionX = positionX;
}
- /** Get the distance of Window top border in pixels from top border of the containing (main window).
- * @return Distance of Window top border in pixels from top border of the containing (main window). or -1 if unspecified
+ /**
+ * Gets the distance of Window top border in pixels from top border of
+ * the containing (main window).
+ * @return Distance of Window top border in pixels from top border of the
+ * containing (main window). or -1 if unspecified .
*
* @since 4.0.0
*/
@@ -760,8 +844,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
return positionY;
}
- /** Set the distance of Window top border in pixels from top border of the containing (main window).
- * @param positionY of Window top border in pixels from top border of the containing (main window). or -1 if unspecified
+ /**
+ * Sets the distance of Window top border in pixels from top border of the containing (main window).
+ * @param positionY the Distance of Window top border in pixels from top border of the containing (main window). or -1 if unspecified
*
* @since 4.0.0
*/
@@ -788,9 +873,19 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* Serial generated by eclipse.
*/
private static final long serialVersionUID = -7235770057344367327L;
+
+ /**
+ *
+ * @param source
+ */
public CloseEvent(Component source) {
super(source);
}
+
+ /**
+ * Gets the Window.
+ * @return the window
+ */
public Window getWindow() {
return (Window) getSource();
}
@@ -800,10 +895,18 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
public void windowClose(CloseEvent e);
}
+ /**
+ * Adds the listener.
+ * @param listener the listener to add.
+ */
public void addListener(CloseListener listener) {
addListener(CloseEvent.class, listener, WINDOW_CLOSE_METHOD);
}
+ /**
+ * Removes the listener.
+ * @param listener the listener to remove.
+ */
public void removeListener(CloseListener listener) {
addListener(CloseEvent.class, listener, WINDOW_CLOSE_METHOD);
}