@@ -38,9 +38,8 @@ import com.itmill.toolkit.ui.Component.Focusable; | |||
* <p> | |||
* Base class required for all IT Mill Toolkit applications. This class provides | |||
* all the basic services required by the toolkit. These services allow external | |||
* discovery and manipulation of the user, | |||
* {@link com.itmill.toolkit.ui.Window windows} and themes, and starting and | |||
* stopping the application. | |||
* discovery and manipulation of the user, {@link com.itmill.toolkit.ui.Window | |||
* windows} and themes, and starting and stopping the application. | |||
* </p> | |||
* | |||
* <p> | |||
@@ -63,8 +62,8 @@ import com.itmill.toolkit.ui.Component.Focusable; | |||
* </p> | |||
* | |||
* <p> | |||
* <strong>Window access.</strong> <code>Application</code> provides methods | |||
* to list, add and remove the windows it contains. | |||
* <strong>Window access.</strong> <code>Application</code> provides methods to | |||
* list, add and remove the windows it contains. | |||
* </p> | |||
* | |||
* <p> | |||
@@ -194,8 +193,8 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* <p> | |||
* Since version 5.0 all windows can be referenced by their names in url | |||
* <code>http://host:port/foo/bar/</code> where | |||
* <code>http://host:port/foo/</code> is the application url as returned | |||
* by getURL() and <code>bar</code> is the name of the window. | |||
* <code>http://host:port/foo/</code> is the application url as returned by | |||
* getURL() and <code>bar</code> is the name of the window. | |||
* </p> | |||
* | |||
* <p> | |||
@@ -207,10 +206,11 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* <p> | |||
* The method should return null if the window does not exists (and is not | |||
* created as a side-effect) or if the application is not running anymore | |||
* </p>. | |||
* </p> | |||
* . | |||
* | |||
* @param name | |||
* the name of the window. | |||
* the name of the window. | |||
* @return the window associated with the given URI or <code>null</code> | |||
*/ | |||
public Window getWindow(String name) { | |||
@@ -237,22 +237,22 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* <p> | |||
* Note that all application-level windows can be accessed by their names in | |||
* url <code>http://host:port/foo/bar/</code> where | |||
* <code>http://host:port/foo/</code> is the application url as returned | |||
* by getURL() and <code>bar</code> is the name of the window. Also note | |||
* that not all windows should be added to application - one can also add | |||
* windows inside other windows - these windows show as smaller windows | |||
* inside those windows. | |||
* <code>http://host:port/foo/</code> is the application url as returned by | |||
* getURL() and <code>bar</code> is the name of the window. Also note that | |||
* not all windows should be added to application - one can also add windows | |||
* inside other windows - these windows show as smaller windows inside those | |||
* windows. | |||
* </p> | |||
* | |||
* @param window | |||
* the new <code>Window</code> to add. If the name of the | |||
* window is <code>null</code>, an unique name is | |||
* automatically given for the window. | |||
* the new <code>Window</code> to add. If the name of the window | |||
* is <code>null</code>, an unique name is automatically given | |||
* for the window. | |||
* @throws IllegalArgumentException | |||
* if a window with the same name as the new window already | |||
* exists in the application. | |||
* if a window with the same name as the new window already | |||
* exists in the application. | |||
* @throws NullPointerException | |||
* if the given <code>Window</code> is <code>null</code>. | |||
* if the given <code>Window</code> is <code>null</code>. | |||
*/ | |||
public void addWindow(Window window) throws IllegalArgumentException, | |||
NullPointerException { | |||
@@ -327,7 +327,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* 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)) { | |||
@@ -382,7 +382,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* </p> | |||
* | |||
* @param user | |||
* the new user. | |||
* the new user. | |||
*/ | |||
public void setUser(Object user) { | |||
final Object prevUser = this.user; | |||
@@ -428,12 +428,12 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* {@link javax.servlet.ServletContext}. | |||
* | |||
* @param applicationUrl | |||
* the URL the application should respond to. | |||
* the URL the application should respond to. | |||
* @param applicationProperties | |||
* the Application properties as specified by the servlet | |||
* configuration. | |||
* the Application properties as specified by the servlet | |||
* configuration. | |||
* @param context | |||
* the context application will be running in. | |||
* the context application will be running in. | |||
* | |||
*/ | |||
public void start(URL applicationUrl, Properties applicationProperties, | |||
@@ -494,7 +494,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* </p> | |||
* | |||
* @param theme | |||
* the new theme for this application. | |||
* the new theme for this application. | |||
*/ | |||
public void setTheme(String theme) { | |||
@@ -537,7 +537,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* </p> | |||
* | |||
* @param mainWindow | |||
* the mainWindow to set. | |||
* the mainWindow to set. | |||
*/ | |||
public void setMainWindow(Window mainWindow) { | |||
@@ -567,7 +567,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* are defined. | |||
* | |||
* @param name | |||
* the name of the property. | |||
* the name of the property. | |||
* @return the value in this property list with the specified key value. | |||
*/ | |||
public String getProperty(String name) { | |||
@@ -579,7 +579,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* user of the application. | |||
* | |||
* @param resource | |||
* the resource to add. | |||
* the resource to add. | |||
*/ | |||
public void addResource(ApplicationResource resource) { | |||
@@ -600,7 +600,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Removes the resource from the application. | |||
* | |||
* @param resource | |||
* the resource to remove. | |||
* the resource to remove. | |||
*/ | |||
public void removeResource(ApplicationResource resource) { | |||
final Object key = resourceKeyMap.get(resource); | |||
@@ -614,7 +614,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Gets the relative uri of the resource. | |||
* | |||
* @param resource | |||
* the resource to get relative location. | |||
* the resource to get relative location. | |||
* @return the relative uri of the resource. | |||
*/ | |||
public String getRelativeLocation(ApplicationResource resource) { | |||
@@ -692,6 +692,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
: ""; | |||
return window.handleURI(windowContext, windowUri); | |||
} catch (final MalformedURLException e) { | |||
terminalError(new ApplicationError(e)); | |||
return null; | |||
} | |||
} | |||
@@ -722,7 +723,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Sets the default locale for this application. | |||
* | |||
* @param locale | |||
* the Locale object. | |||
* the Locale object. | |||
* | |||
*/ | |||
public void setLocale(Locale locale) { | |||
@@ -761,11 +762,11 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Constructor for user change event. | |||
* | |||
* @param source | |||
* the application source. | |||
* the application source. | |||
* @param newUser | |||
* the new User. | |||
* the new User. | |||
* @param prevUser | |||
* the previous User. | |||
* the previous User. | |||
*/ | |||
public UserChangeEvent(Application source, Object newUser, | |||
Object prevUser) { | |||
@@ -818,7 +819,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* application user has changed. | |||
* | |||
* @param event | |||
* the change event. | |||
* the change event. | |||
*/ | |||
public void applicationUserChanged(Application.UserChangeEvent event); | |||
} | |||
@@ -827,7 +828,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Adds the user change listener. | |||
* | |||
* @param listener | |||
* the user change listener to add. | |||
* the user change listener to add. | |||
*/ | |||
public void addListener(UserChangeListener listener) { | |||
if (userChangeListeners == null) { | |||
@@ -840,7 +841,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Removes the user change listener. | |||
* | |||
* @param listener | |||
* the user change listener to remove. | |||
* the user change listener to remove. | |||
*/ | |||
public void removeListener(UserChangeListener listener) { | |||
if (userChangeListeners == null) { | |||
@@ -868,7 +869,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Creates a event. | |||
* | |||
* @param window | |||
* the Detached window. | |||
* the Detached window. | |||
*/ | |||
public WindowDetachEvent(Window window) { | |||
super(Application.this); | |||
@@ -910,7 +911,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Creates a event. | |||
* | |||
* @param window | |||
* the Attached window. | |||
* the Attached window. | |||
*/ | |||
public WindowAttachEvent(Window window) { | |||
super(Application.this); | |||
@@ -945,7 +946,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Window attached | |||
* | |||
* @param event | |||
* the window attach event. | |||
* the window attach event. | |||
*/ | |||
public void windowAttached(WindowAttachEvent event); | |||
} | |||
@@ -959,7 +960,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Window detached. | |||
* | |||
* @param event | |||
* the window detach event. | |||
* the window detach event. | |||
*/ | |||
public void windowDetached(WindowDetachEvent event); | |||
} | |||
@@ -968,7 +969,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Adds the window attach listener. | |||
* | |||
* @param listener | |||
* the window attach listener to add. | |||
* the window attach listener to add. | |||
*/ | |||
public void addListener(WindowAttachListener listener) { | |||
if (windowAttachListeners == null) { | |||
@@ -981,7 +982,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Adds the window detach listener. | |||
* | |||
* @param listener | |||
* the window detach listener to add. | |||
* the window detach listener to add. | |||
*/ | |||
public void addListener(WindowDetachListener listener) { | |||
if (windowDetachListeners == null) { | |||
@@ -994,7 +995,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Removes the window attach listener. | |||
* | |||
* @param listener | |||
* the window attach listener to remove. | |||
* the window attach listener to remove. | |||
*/ | |||
public void removeListener(WindowAttachListener listener) { | |||
if (windowAttachListeners != null) { | |||
@@ -1009,7 +1010,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Removes the window detach listener. | |||
* | |||
* @param listener | |||
* the window detach listener to remove. | |||
* the window detach listener to remove. | |||
*/ | |||
public void removeListener(WindowDetachListener listener) { | |||
if (windowDetachListeners != null) { | |||
@@ -1022,8 +1023,8 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
/** | |||
* 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. | |||
* <code>null</code>, the application is closed normally as defined by the | |||
* application running environment. | |||
* <p> | |||
* Desktop application just closes the application window and | |||
* web-application redirects the browser to application main URL. | |||
@@ -1037,13 +1038,13 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
/** | |||
* 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: Desktop application just closes the | |||
* <code>null</code>, the application is closed normally as defined by the | |||
* application running environment: Desktop application just closes the | |||
* application window and web-application redirects the browser to | |||
* application main URL. | |||
* | |||
* @param logoutURL | |||
* the logoutURL to set. | |||
* the logoutURL to set. | |||
*/ | |||
public void setLogoutURL(String logoutURL) { | |||
this.logoutURL = logoutURL; | |||
@@ -1068,9 +1069,9 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* <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 and prints stack trace to | |||
* standard error stream. | |||
* implementation sets the exceptions as <code>ComponentErrors</code> to the | |||
* component that initiated the exception and prints stack trace to standard | |||
* error stream. | |||
* </p> | |||
* <p> | |||
* You can safely override this method in your application in order to | |||
@@ -1078,7 +1079,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* </p> | |||
* | |||
* @param event | |||
* the change event. | |||
* the change event. | |||
* @see com.itmill.toolkit.terminal.Terminal.ErrorListener#terminalError(com.itmill.toolkit.terminal.Terminal.ErrorEvent) | |||
*/ | |||
public void terminalError(Terminal.ErrorEvent event) { | |||
@@ -1324,18 +1325,18 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* <p> | |||
* The default behavior is to show a notification, and restart the | |||
* application the the user clicks the message. <br/> Instead of restarting | |||
* the application, you can set a specific URL that the user is taken to.<br/> | |||
* Setting both caption and message to null will restart the application (or | |||
* go to the specified URL) without displaying a notification. | |||
* set*NotificationEnabled(false) will achieve the same thing. | |||
* the application, you can set a specific URL that the user is taken | |||
* to.<br/> Setting both caption and message to null will restart the | |||
* application (or go to the specified URL) without displaying a | |||
* notification. set*NotificationEnabled(false) will achieve the same thing. | |||
* </p> | |||
* <p> | |||
* The situations are: | |||
* <li> Session expired: the user session has expired, usually due to | |||
* <li>Session expired: the user session has expired, usually due to | |||
* inactivity.</li> | |||
* <li> Internal error: unhandled critical server error (e.g out of memory, | |||
* <li>Internal error: unhandled critical server error (e.g out of memory, | |||
* database crash) | |||
* <li> Out of sync: the client is not in sync with the server. E.g the user | |||
* <li>Out of sync: the client is not in sync with the server. E.g the user | |||
* opens two windows showing the same application, and makes changes in one | |||
* of the windows - the other window is no longer in sync, and (for | |||
* instance) pressing a button that is no longer present in the UI will | |||
@@ -1351,7 +1352,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Sets the URL to go to when the session has expired. | |||
* | |||
* @param sessionExpiredURL | |||
* the URL to go to, or null to reload current | |||
* the URL to go to, or null to reload current | |||
*/ | |||
public void setSessionExpiredURL(String sessionExpiredURL) { | |||
this.sessionExpiredURL = sessionExpiredURL; | |||
@@ -1362,7 +1363,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* current) is loaded directly. | |||
* | |||
* @param sessionExpiredNotificationEnabled | |||
* true = enabled, false = disabled | |||
* true = enabled, false = disabled | |||
*/ | |||
public void setSessionExpiredNotificationEnabled( | |||
boolean sessionExpiredNotificationEnabled) { | |||
@@ -1374,7 +1375,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* both caption and message is null, the notification is disabled; | |||
* | |||
* @param sessionExpiredCaption | |||
* the caption | |||
* the caption | |||
*/ | |||
public void setSessionExpiredCaption(String sessionExpiredCaption) { | |||
this.sessionExpiredCaption = sessionExpiredCaption; | |||
@@ -1385,7 +1386,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* both caption and message is null, the notification is disabled; | |||
* | |||
* @param sessionExpiredMessage | |||
* the message | |||
* the message | |||
*/ | |||
public void setSessionExpiredMessage(String sessionExpiredMessage) { | |||
this.sessionExpiredMessage = sessionExpiredMessage; | |||
@@ -1395,7 +1396,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Sets the URL to go to when an internal error occurs. | |||
* | |||
* @param internalErrorURL | |||
* the URL to go to, or null to reload current | |||
* the URL to go to, or null to reload current | |||
*/ | |||
public void setInternalErrorURL(String internalErrorURL) { | |||
this.internalErrorURL = internalErrorURL; | |||
@@ -1406,7 +1407,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* current) is loaded directly. | |||
* | |||
* @param internalErrorNotificationEnabled | |||
* true = enabled, false = disabled | |||
* true = enabled, false = disabled | |||
*/ | |||
public void setInternalErrorNotificationEnabled( | |||
boolean internalErrorNotificationEnabled) { | |||
@@ -1418,7 +1419,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* both caption and message is null, the notification is disabled; | |||
* | |||
* @param internalErrorCaption | |||
* the caption | |||
* the caption | |||
*/ | |||
public void setInternalErrorCaption(String internalErrorCaption) { | |||
this.internalErrorCaption = internalErrorCaption; | |||
@@ -1429,7 +1430,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* both caption and message is null, the notification is disabled; | |||
* | |||
* @param internalErrorMessage | |||
* the message | |||
* the message | |||
*/ | |||
public void setInternalErrorMessage(String internalErrorMessage) { | |||
this.internalErrorMessage = internalErrorMessage; | |||
@@ -1439,7 +1440,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* Sets the URL to go to when the client is out-of-sync. | |||
* | |||
* @param outOfSyncURL | |||
* the URL to go to, or null to reload current | |||
* the URL to go to, or null to reload current | |||
*/ | |||
public void setOutOfSyncURL(String outOfSyncURL) { | |||
this.outOfSyncURL = outOfSyncURL; | |||
@@ -1450,7 +1451,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* current) is loaded directly. | |||
* | |||
* @param outOfSyncNotificationEnabled | |||
* true = enabled, false = disabled | |||
* true = enabled, false = disabled | |||
*/ | |||
public void setOutOfSyncNotificationEnabled( | |||
boolean outOfSyncNotificationEnabled) { | |||
@@ -1462,7 +1463,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* both caption and message is null, the notification is disabled; | |||
* | |||
* @param outOfSyncCaption | |||
* the caption | |||
* the caption | |||
*/ | |||
public void setOutOfSyncCaption(String outOfSyncCaption) { | |||
this.outOfSyncCaption = outOfSyncCaption; | |||
@@ -1473,7 +1474,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
* both caption and message is null, the notification is disabled; | |||
* | |||
* @param outOfSyncMessage | |||
* the message | |||
* the message | |||
*/ | |||
public void setOutOfSyncMessage(String outOfSyncMessage) { | |||
this.outOfSyncMessage = outOfSyncMessage; | |||
@@ -1481,4 +1482,17 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener | |||
} | |||
public class ApplicationError implements Terminal.ErrorEvent { | |||
private Throwable throwable; | |||
public ApplicationError(Throwable throwable) { | |||
this.throwable = throwable; | |||
} | |||
public Throwable getThrowable() { | |||
return throwable; | |||
} | |||
} | |||
} |
@@ -85,7 +85,8 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
FILEITEM_ICON = FileItem.class.getMethod("getIcon", new Class[] {}); | |||
FILEITEM_SIZE = FileItem.class.getMethod("getSize", new Class[] {}); | |||
} catch (final NoSuchMethodException e) { | |||
throw new RuntimeException( | |||
"Internal error finding methods in FilesystemContainer"); | |||
} | |||
} | |||
@@ -96,12 +97,12 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
private boolean recursive = true; | |||
/** | |||
* Constructs a new <code>FileSystemContainer</code> with the specified | |||
* file as the root of the filesystem. The files are included recursively. | |||
* Constructs a new <code>FileSystemContainer</code> with the specified file | |||
* as the root of the filesystem. The files are included recursively. | |||
* | |||
* @param root | |||
* the root file for the new file-system container. Null | |||
* values are ignored. | |||
* the root file for the new file-system container. Null values | |||
* are ignored. | |||
*/ | |||
public FilesystemContainer(File root) { | |||
if (root != null) { | |||
@@ -110,13 +111,13 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
} | |||
/** | |||
* Constructs a new <code>FileSystemContainer</code> with the specified | |||
* file as the root of the filesystem. The files are included recursively. | |||
* Constructs a new <code>FileSystemContainer</code> with the specified file | |||
* as the root of the filesystem. The files are included recursively. | |||
* | |||
* @param root | |||
* the root file for the new file-system container. | |||
* the root file for the new file-system container. | |||
* @param recursive | |||
* should the container recursively contain subdirectories. | |||
* should the container recursively contain subdirectories. | |||
*/ | |||
public FilesystemContainer(File root, boolean recursive) { | |||
this(root); | |||
@@ -124,16 +125,16 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
} | |||
/** | |||
* Constructs a new <code>FileSystemContainer</code> with the specified | |||
* file as the root of the filesystem. | |||
* Constructs a new <code>FileSystemContainer</code> with the specified file | |||
* as the root of the filesystem. | |||
* | |||
* @param root | |||
* the root file for the new file-system container. | |||
* the root file for the new file-system container. | |||
* @param extension | |||
* the Filename extension (w/o separator) to limit the files | |||
* in container. | |||
* the Filename extension (w/o separator) to limit the files in | |||
* container. | |||
* @param recursive | |||
* should the container recursively contain subdirectories. | |||
* should the container recursively contain subdirectories. | |||
*/ | |||
public FilesystemContainer(File root, String extension, boolean recursive) { | |||
this(root); | |||
@@ -142,15 +143,15 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
} | |||
/** | |||
* Constructs a new <code>FileSystemContainer</code> with the specified | |||
* root and recursivity status. | |||
* Constructs a new <code>FileSystemContainer</code> with the specified root | |||
* and recursivity status. | |||
* | |||
* @param root | |||
* the root file for the new file-system container. | |||
* the root file for the new file-system container. | |||
* @param filter | |||
* the Filename filter to limit the files in container. | |||
* the Filename filter to limit the files in container. | |||
* @param recursive | |||
* should the container recursively contain subdirectories. | |||
* should the container recursively contain subdirectories. | |||
*/ | |||
public FilesystemContainer(File root, FilenameFilter filter, | |||
boolean recursive) { | |||
@@ -164,8 +165,8 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* directory in the <code>FilesystemContainer</code>. | |||
* | |||
* @param root | |||
* the File to be added as root directory. Null values are | |||
* ignored. | |||
* the File to be added as root directory. Null values are | |||
* ignored. | |||
*/ | |||
public void addRoot(File root) { | |||
if (root != null) { | |||
@@ -184,7 +185,7 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* method returns <code>true</code> for directory Items only. | |||
* | |||
* @param itemId | |||
* the id of the item. | |||
* the id of the item. | |||
* @return <code>true</code> if the specified Item is a directory, | |||
* <code>false</code> otherwise. | |||
*/ | |||
@@ -303,14 +304,14 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* not supported. | |||
* | |||
* @param itemId | |||
* the ID of the item. | |||
* the ID of the item. | |||
* @param areChildrenAllowed | |||
* the boolean value specifying if the Item can have children | |||
* or not. | |||
* 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. | |||
* if the setChildrenAllowed is not supported. | |||
*/ | |||
public boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed) | |||
throws UnsupportedOperationException { | |||
@@ -320,18 +321,18 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
} | |||
/** | |||
* Returns <code>false</code> when moving files around in the filesystem | |||
* is not supported. | |||
* Returns <code>false</code> when moving files around in the filesystem is | |||
* not supported. | |||
* | |||
* @param itemId | |||
* the ID of the item. | |||
* 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. | |||
* 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. | |||
* if the setParent is not supported. | |||
*/ | |||
public boolean setParent(Object itemId, Object newParentId) | |||
throws UnsupportedOperationException { | |||
@@ -385,9 +386,9 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* to the collection. | |||
* | |||
* @param col | |||
* the collection where the found items are added | |||
* the collection where the found items are added | |||
* @param f | |||
* the root file where to start adding files | |||
* the root file where to start adding files | |||
*/ | |||
private void addItemIds(Collection col, File f) { | |||
File[] l; | |||
@@ -450,9 +451,9 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* not one of those, <code>null</code> is returned. | |||
* | |||
* @param itemId | |||
* the ID of the file whose property is requested. | |||
* the ID of the file whose property is requested. | |||
* @param propertyId | |||
* the property's ID. | |||
* the property's ID. | |||
* @return the requested property's value, or <code>null</code> | |||
*/ | |||
public Property getContainerProperty(Object itemId, Object propertyId) { | |||
@@ -495,11 +496,11 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
/** | |||
* 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 propertyId is not one of those, <code>null</code> is returned. | |||
* "Size" is a <code>Long</code>, "Last Modified" is a <code>Date</code>. If | |||
* propertyId is not one of those, <code>null</code> is returned. | |||
* | |||
* @param propertyId | |||
* the ID of the property whose type is requested. | |||
* 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) { | |||
@@ -524,7 +525,7 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* directory. | |||
* | |||
* @param f | |||
* the root to start counting from. | |||
* the root to start counting from. | |||
*/ | |||
private int getFileCounts(File f) { | |||
File[] l; | |||
@@ -636,7 +637,7 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* Properties got from an Item with the same ID are equal. | |||
* | |||
* @param obj | |||
* an object to compare with this object. | |||
* 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 | |||
*/ | |||
@@ -745,7 +746,7 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* Constructs a new FileExtensionFilter using given extension. | |||
* | |||
* @param fileExtension | |||
* the File extension without the separator (dot). | |||
* the File extension without the separator (dot). | |||
*/ | |||
public FileExtensionFilter(String fileExtension) { | |||
filter = "." + fileExtension; | |||
@@ -778,7 +779,7 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* Sets the file filter used to limit the files in this container. | |||
* | |||
* @param filter | |||
* The filter to set. <code>null</code> disables filtering. | |||
* The filter to set. <code>null</code> disables filtering. | |||
*/ | |||
public void setFilter(FilenameFilter filter) { | |||
this.filter = filter; | |||
@@ -788,8 +789,8 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* 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. | |||
* the Filename extension (w/o separator) to limit the files in | |||
* container. | |||
*/ | |||
public void setFilter(String extension) { | |||
filter = new FileExtensionFilter(extension); | |||
@@ -813,7 +814,7 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
* </p> | |||
* | |||
* @param recursive | |||
* the New value for recursive property. | |||
* the New value for recursive property. | |||
*/ | |||
public void setRecursive(boolean recursive) { | |||
this.recursive = recursive; | |||
@@ -822,8 +823,9 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.itmill.toolkit.data.Container#addContainerProperty(java.lang.Object, | |||
* java.lang.Class, java.lang.Object) | |||
* @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 { | |||
@@ -875,7 +877,9 @@ public class FilesystemContainer implements Container.Hierarchical { | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.itmill.toolkit.data.Container#removeContainerProperty(java.lang.Object) | |||
* @see | |||
* com.itmill.toolkit.data.Container#removeContainerProperty(java.lang.Object | |||
* ) | |||
*/ | |||
public boolean removeContainerProperty(Object propertyId) | |||
throws UnsupportedOperationException { |
@@ -60,14 +60,10 @@ public class EventRouter implements MethodEventSource { | |||
if (listenerList != null) { | |||
final Iterator i = listenerList.iterator(); | |||
while (i.hasNext()) { | |||
try { | |||
final ListenerMethod lm = (ListenerMethod) i.next(); | |||
if (lm.matches(eventType, target)) { | |||
i.remove(); | |||
return; | |||
} | |||
} catch (final java.lang.ClassCastException e) { | |||
// Class cast exceptions are ignored | |||
final ListenerMethod lm = (ListenerMethod) i.next(); | |||
if (lm.matches(eventType, target)) { | |||
i.remove(); | |||
return; | |||
} | |||
} | |||
} | |||
@@ -82,14 +78,10 @@ public class EventRouter implements MethodEventSource { | |||
if (listenerList != null) { | |||
final Iterator i = listenerList.iterator(); | |||
while (i.hasNext()) { | |||
try { | |||
final ListenerMethod lm = (ListenerMethod) i.next(); | |||
if (lm.matches(eventType, target, method)) { | |||
i.remove(); | |||
return; | |||
} | |||
} catch (final java.lang.ClassCastException e) { | |||
// Class cast exceptions are ignored | |||
final ListenerMethod lm = (ListenerMethod) i.next(); | |||
if (lm.matches(eventType, target, method)) { | |||
i.remove(); | |||
return; | |||
} | |||
} | |||
} | |||
@@ -118,14 +110,10 @@ public class EventRouter implements MethodEventSource { | |||
if (listenerList != null) { | |||
final Iterator i = listenerList.iterator(); | |||
while (i.hasNext()) { | |||
try { | |||
final ListenerMethod lm = (ListenerMethod) i.next(); | |||
if (lm.matches(eventType, target, method)) { | |||
i.remove(); | |||
return; | |||
} | |||
} catch (final java.lang.ClassCastException e) { | |||
// Class cast exceptions are ignored | |||
final ListenerMethod lm = (ListenerMethod) i.next(); | |||
if (lm.matches(eventType, target, method)) { | |||
i.remove(); | |||
return; | |||
} | |||
} | |||
} | |||
@@ -144,7 +132,7 @@ public class EventRouter implements MethodEventSource { | |||
* the activation method should be called or not. | |||
* | |||
* @param event | |||
* the Event to be sent to all listeners. | |||
* the Event to be sent to all listeners. | |||
*/ | |||
public void fireEvent(EventObject event) { | |||
// It is not necessary to send any events if there are no listeners |
@@ -60,9 +60,9 @@ public class ListenerMethod implements EventListener { | |||
private Object[] arguments; | |||
/** | |||
* 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. | |||
* 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; | |||
@@ -79,25 +79,24 @@ public class ListenerMethod implements EventListener { | |||
* </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. | |||
* 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 | |||
* the object instance that contains the trigger method | |||
* @param method | |||
* the trigger method | |||
* the trigger method | |||
* @param arguments | |||
* the arguments to be passed to the trigger method | |||
* 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 the | |||
* eventArgumentIndex is negative, the triggering event | |||
* object will not be passed to the trigger method, though it | |||
* is still called. | |||
* 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 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> is not a member of | |||
* <code>object</code>. | |||
* if <code>method</code> is not a member of <code>object</code> | |||
* . | |||
*/ | |||
public ListenerMethod(Class eventType, Object object, Method method, | |||
Object[] arguments, int eventArgumentIndex) | |||
@@ -132,34 +131,31 @@ public class ListenerMethod implements EventListener { | |||
* 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. | |||
* <code>object</code>, and <code>java.lang.IllegalArgumentException</code> | |||
* is thrown unless exactly one match is found. | |||
* </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. | |||
* 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. | |||
* 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. | |||
* 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 | |||
* the arguments to be passed to the trigger method. | |||
* 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 the | |||
* eventArgumentIndex is negative, the triggering event | |||
* object will not be passed to the trigger method, though it | |||
* is still called. | |||
* 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 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 <code>methodName</code> is | |||
* found in <code>object</code>. | |||
* unless exactly one match <code>methodName</code> is found in | |||
* <code>object</code>. | |||
*/ | |||
public ListenerMethod(Class eventType, Object object, String methodName, | |||
Object[] arguments, int eventArgumentIndex) | |||
@@ -210,18 +206,17 @@ public class ListenerMethod implements EventListener { | |||
* </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. | |||
* 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. | |||
* the object instance that contains the trigger method. | |||
* @param method | |||
* the trigger method. | |||
* the trigger method. | |||
* @param arguments | |||
* the arguments to be passed to the trigger method. | |||
* 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>. | |||
* if <code>method</code> is not a member of <code>object</code> | |||
* . | |||
*/ | |||
public ListenerMethod(Class eventType, Object object, Method method, | |||
Object[] arguments) throws java.lang.IllegalArgumentException { | |||
@@ -248,26 +243,24 @@ public class ListenerMethod implements EventListener { | |||
* | |||
* <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. | |||
* <code>java.lang.IllegalArgumentException</code> is thrown unless exactly | |||
* one match is found. | |||
* </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. | |||
* 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. | |||
* 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. | |||
* 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 | |||
* the arguments to be passed to the trigger method. | |||
* 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>. | |||
* unless exactly one match <code>methodName</code> is found in | |||
* <code>object</code>. | |||
*/ | |||
public ListenerMethod(Class eventType, Object object, String methodName, | |||
Object[] arguments) throws java.lang.IllegalArgumentException { | |||
@@ -304,16 +297,15 @@ public class ListenerMethod implements EventListener { | |||
* </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. | |||
* 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. | |||
* the object instance that contains the trigger method. | |||
* @param method | |||
* the trigger method. | |||
* the trigger method. | |||
* @throws java.lang.IllegalArgumentException | |||
* if <code>method</code> is not a member of | |||
* <code>object</code>. | |||
* if <code>method</code> is not a member of <code>object</code> | |||
* . | |||
*/ | |||
public ListenerMethod(Class eventType, Object object, Method method) | |||
throws java.lang.IllegalArgumentException { | |||
@@ -349,24 +341,22 @@ public class ListenerMethod implements EventListener { | |||
* | |||
* <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. | |||
* <code>java.lang.IllegalArgumentException</code> is thrown unless exactly | |||
* one match is found. | |||
* </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. | |||
* 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. | |||
* 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. | |||
* 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 <code>methodName</code> is | |||
* found in <code>object</code>. | |||
* unless exactly one match <code>methodName</code> is found in | |||
* <code>object</code>. | |||
*/ | |||
public ListenerMethod(Class eventType, Object object, String methodName) | |||
throws java.lang.IllegalArgumentException { | |||
@@ -407,9 +397,9 @@ public class ListenerMethod implements EventListener { | |||
* result in the trigger method to be called. | |||
* | |||
* @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. | |||
* 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. | |||
*/ | |||
public void receiveEvent(EventObject event) { | |||
// Only send events supported by the method | |||
@@ -432,13 +422,11 @@ public class ListenerMethod implements EventListener { | |||
} catch (final java.lang.IllegalAccessException e) { | |||
// This should never happen | |||
e.printStackTrace(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error - please report: " + e.toString()); | |||
"Internal error - please report",e); | |||
} catch (final java.lang.reflect.InvocationTargetException e) { | |||
// This should never happen | |||
e.printStackTrace(); | |||
throw new MethodException("Invocation if method " + method | |||
throw new MethodException("Invocation of method " + method | |||
+ " failed.", e.getTargetException()); | |||
} | |||
} | |||
@@ -449,14 +437,14 @@ public class ListenerMethod implements EventListener { | |||
* listener. | |||
* | |||
* @param target | |||
* the object to be matched against the object stored by this | |||
* listener. | |||
* 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. * | |||
* 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. * | |||
*/ | |||
public boolean matches(Class eventType, Object target) { | |||
return (target == object) && (eventType.equals(this.eventType)); | |||
@@ -467,17 +455,17 @@ public class ListenerMethod implements EventListener { | |||
* in this listener. | |||
* | |||
* @param target | |||
* the object to be matched against the object stored by this | |||
* listener. | |||
* 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. | |||
* 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> | |||
* 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> | |||
* equals with the method stored in this object | |||
*/ | |||
public boolean matches(Class eventType, Object target, Method method) { | |||
@@ -499,12 +487,14 @@ public class ListenerMethod implements EventListener { | |||
public boolean equals(Object obj) { | |||
if (this == obj) | |||
if (this == obj) { | |||
return true; | |||
} | |||
// return false if obj is a subclass (do not use instanceof check) | |||
if ((obj == null) || (obj.getClass() != this.getClass())) | |||
if ((obj == null) || (obj.getClass() != getClass())) { | |||
return false; | |||
} | |||
// obj is of same class, test it further | |||
ListenerMethod t = (ListenerMethod) obj; | |||
@@ -551,8 +541,8 @@ public class ListenerMethod implements EventListener { | |||
* 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. | |||
* @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() { |
@@ -257,8 +257,7 @@ public class ApplicationConnection { | |||
}); | |||
} catch (final RequestException e) { | |||
// TODO Better reporting to user | |||
console.error(e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
endRequest(); | |||
} | |||
} | |||
@@ -455,7 +454,7 @@ public class ApplicationConnection { | |||
try { | |||
console.dirUIDL(change); | |||
} catch (final Exception e) { | |||
console.log(e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
// TODO: dir doesn't work in any browser although it should | |||
// work (works in hosted mode) | |||
// it partially did at some part but now broken. | |||
@@ -466,16 +465,17 @@ public class ApplicationConnection { | |||
paintable.updateFromUIDL(uidl, this); | |||
} else { | |||
if (!uidl.getTag().equals("window")) { | |||
System.out.println("Received update for " | |||
+ uidl.getTag() | |||
+ ", but there is no such paintable (" | |||
+ uidl.getId() + ") rendered."); | |||
ClientExceptionHandler | |||
.displayError("Received update for " | |||
+ uidl.getTag() | |||
+ ", but there is no such paintable (" | |||
+ uidl.getId() + ") rendered."); | |||
} else { | |||
view.updateFromUIDL(uidl, this); | |||
} | |||
} | |||
} catch (final Throwable e) { | |||
e.printStackTrace(); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
} | |||
@@ -572,7 +572,7 @@ public class ApplicationConnection { | |||
* Returns Paintable element by its id | |||
* | |||
* @param id | |||
* Paintable ID | |||
* Paintable ID | |||
*/ | |||
public Paintable getPaintable(String id) { | |||
return (Paintable) idToPaintable.get(id); | |||
@@ -715,13 +715,13 @@ public class ApplicationConnection { | |||
* when needed. | |||
* | |||
* @param component | |||
* Widget to be updated, expected to implement an instance of | |||
* Paintable | |||
* Widget to be updated, expected to implement an instance of | |||
* Paintable | |||
* @param uidl | |||
* UIDL to be painted | |||
* UIDL to be painted | |||
* @param manageCaption | |||
* True if you want to delegate caption, icon, description | |||
* and error message management to parent. | |||
* True if you want to delegate caption, icon, description and | |||
* error message management to parent. | |||
* | |||
* @return Returns true iff no further painting is needed by caller | |||
*/ | |||
@@ -857,7 +857,7 @@ public class ApplicationConnection { | |||
* parent. | |||
* | |||
* @param uidl | |||
* UIDL to create Paintable from. | |||
* UIDL to create Paintable from. | |||
* @return Either existing or new Paintable corresponding to UIDL. | |||
*/ | |||
public Paintable getPaintable(UIDL uidl) { | |||
@@ -897,7 +897,7 @@ public class ApplicationConnection { | |||
* to browser due URI's in UIDL may contain custom protocols like theme://. | |||
* | |||
* @param toolkitUri | |||
* toolkit URI from uidl | |||
* toolkit URI from uidl | |||
* @return translated URI ready for browser | |||
*/ | |||
public String translateToolkitUri(String toolkitUri) { | |||
@@ -977,7 +977,7 @@ public class ApplicationConnection { | |||
* Adds PNG-fix conditionally (only for IE6) to the specified IMG -element. | |||
* | |||
* @param el | |||
* the IMG element to fix | |||
* the IMG element to fix | |||
*/ | |||
public void addPngFix(Element el) { | |||
BrowserInfo b = BrowserInfo.get(); |
@@ -68,8 +68,7 @@ public class BrowserInfo { | |||
ieVersion = Float.parseFloat(ieVersionString); | |||
} | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
ApplicationConnection.getConsole().error(e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
} | |||
@@ -0,0 +1,27 @@ | |||
package com.itmill.toolkit.terminal.gwt.client; | |||
public class ClientExceptionHandler { | |||
public static void displayError(Throwable e) { | |||
displayError(e.getMessage()); | |||
e.printStackTrace(); | |||
} | |||
public static void displayError(String msg) { | |||
Console console = ApplicationConnection.getConsole(); | |||
if (console != null) { | |||
console.error(msg); | |||
// } else { | |||
// System.err.println(msg); | |||
} | |||
} | |||
public static void displayError(String msg, Throwable e) { | |||
displayError(msg); | |||
displayError(e); | |||
} | |||
} |
@@ -38,7 +38,7 @@ public class DateTimeService { | |||
* Creates a new date time service with a given locale. | |||
* | |||
* @param locale | |||
* e.g. fi, en etc. | |||
* e.g. fi, en etc. | |||
* @throws LocaleNotLoadedException | |||
*/ | |||
public DateTimeService(String locale) throws LocaleNotLoadedException { | |||
@@ -61,8 +61,7 @@ public class DateTimeService { | |||
try { | |||
return LocaleService.getMonthNames(currentLocale)[month]; | |||
} catch (final LocaleNotLoadedException e) { | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
return null; | |||
} | |||
@@ -71,8 +70,7 @@ public class DateTimeService { | |||
try { | |||
return LocaleService.getShortMonthNames(currentLocale)[month]; | |||
} catch (final LocaleNotLoadedException e) { | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
return null; | |||
} | |||
@@ -81,8 +79,7 @@ public class DateTimeService { | |||
try { | |||
return LocaleService.getDayNames(currentLocale)[day]; | |||
} catch (final LocaleNotLoadedException e) { | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
return null; | |||
} | |||
@@ -91,8 +88,7 @@ public class DateTimeService { | |||
try { | |||
return LocaleService.getShortDayNames(currentLocale)[day]; | |||
} catch (final LocaleNotLoadedException e) { | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
return null; | |||
} | |||
@@ -101,8 +97,7 @@ public class DateTimeService { | |||
try { | |||
return LocaleService.getFirstDayOfWeek(currentLocale); | |||
} catch (final LocaleNotLoadedException e) { | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
return 0; | |||
} | |||
@@ -111,8 +106,7 @@ public class DateTimeService { | |||
try { | |||
return LocaleService.isTwelveHourClock(currentLocale); | |||
} catch (final LocaleNotLoadedException e) { | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
return false; | |||
} | |||
@@ -121,8 +115,7 @@ public class DateTimeService { | |||
try { | |||
return LocaleService.getClockDelimiter(currentLocale); | |||
} catch (final LocaleNotLoadedException e) { | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
return ":"; | |||
} | |||
@@ -131,8 +124,7 @@ public class DateTimeService { | |||
try { | |||
return LocaleService.getAmPmStrings(currentLocale); | |||
} catch (final LocaleNotLoadedException e) { | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
final String[] temp = new String[2]; | |||
temp[0] = "AM"; | |||
@@ -148,8 +140,7 @@ public class DateTimeService { | |||
firstDay = LocaleService.getFirstDayOfWeek(currentLocale); | |||
} catch (final LocaleNotLoadedException e) { | |||
firstDay = 0; | |||
// TODO redirect to console | |||
System.out.println(e + ":" + e.getMessage()); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
int start = dateForFirstOfThisMonth.getDay() - firstDay; | |||
if (start < 0) { |
@@ -316,7 +316,7 @@ public class UIDL { | |||
item.addItem(tmp); | |||
} | |||
} catch (final Exception e) { | |||
// Ingonered, no variables | |||
// Ignored, no variables | |||
} | |||
final Iterator i = getChildIterator(); |
@@ -9,6 +9,7 @@ import java.util.Date; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection; | |||
import com.itmill.toolkit.terminal.gwt.client.ClientExceptionHandler; | |||
import com.itmill.toolkit.terminal.gwt.client.DateTimeService; | |||
import com.itmill.toolkit.terminal.gwt.client.LocaleNotLoadedException; | |||
import com.itmill.toolkit.terminal.gwt.client.Paintable; | |||
@@ -81,10 +82,10 @@ public class IDateField extends FlowPanel implements Paintable, Field { | |||
currentLocale = locale; | |||
} catch (final LocaleNotLoadedException e) { | |||
currentLocale = dts.getLocale(); | |||
// TODO redirect this to console | |||
System.out.println("Tried to use an unloaded locale \"" | |||
+ locale + "\". Using default locale (" + currentLocale | |||
+ ")."); | |||
ClientExceptionHandler.displayError( | |||
"Tried to use an unloaded locale \"" + locale | |||
+ "\". Using default locale (" + currentLocale | |||
+ ").", e); | |||
} | |||
} | |||
@@ -55,11 +55,11 @@ public class IPopupView extends HTML implements Paintable, Container { | |||
setStyleName(CLASSNAME); | |||
popup.setStylePrimaryName(CLASSNAME + "-popup"); | |||
this.setHTML("PopupPanel"); | |||
setHTML("PopupPanel"); | |||
popup.setWidget(loading); | |||
// When we click to open the popup... | |||
this.addClickListener(new ClickListener() { | |||
addClickListener(new ClickListener() { | |||
public void onClick(Widget sender) { | |||
updateState(true); | |||
} | |||
@@ -94,10 +94,10 @@ public class IPopupView extends HTML implements Paintable, Container { | |||
updateWindowSize(); | |||
hostPopupVisible = uidl.getBooleanAttribute("popupVisible"); | |||
this.setHTML(uidl.getStringAttribute("html")); | |||
setHTML(uidl.getStringAttribute("html")); | |||
if (uidl.hasAttribute("description")) { | |||
this.setTitle(uidl.getStringAttribute("description")); | |||
setTitle(uidl.getStringAttribute("description")); | |||
} | |||
// Render the popup if visible and show it. The component inside can | |||
@@ -175,7 +175,7 @@ public class IPopupView extends HTML implements Paintable, Container { | |||
popup.hide(); | |||
if (popup != null) { | |||
client.unregisterPaintable((Paintable) popup); | |||
client.unregisterPaintable(popup); | |||
} | |||
popup = (CustomPopup) newComponent; | |||
@@ -191,10 +191,10 @@ public class IPopupView extends HTML implements Paintable, Container { | |||
} | |||
public static native void nativeBlur(Element e) /*-{ | |||
if(e.focus) { | |||
e.blur(); | |||
} | |||
}-*/; | |||
if(e.focus) { | |||
e.blur(); | |||
} | |||
}-*/; | |||
private class CustomPopup extends ToolkitOverlay implements Container { | |||
@@ -277,12 +277,12 @@ public class IPopupView extends HTML implements Paintable, Container { | |||
public void replaceChildComponent(Widget oldComponent, | |||
Widget newComponent) { | |||
System.out.println("CustomPopup replacechildcomponent"); | |||
// System.out.println("CustomPopup replacechildcomponent"); | |||
if (oldComponent != null) { | |||
client.unregisterPaintable((Paintable) oldComponent); | |||
} | |||
popupComponentWidget = (Widget) newComponent; | |||
popupComponentWidget = newComponent; | |||
setWidget(popupComponentWidget); | |||
} |
@@ -13,6 +13,7 @@ import com.google.gwt.user.client.ui.TextBox; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection; | |||
import com.itmill.toolkit.terminal.gwt.client.BrowserInfo; | |||
import com.itmill.toolkit.terminal.gwt.client.ClientExceptionHandler; | |||
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener; | |||
import com.itmill.toolkit.terminal.gwt.client.Focusable; | |||
import com.itmill.toolkit.terminal.gwt.client.LocaleNotLoadedException; | |||
@@ -98,8 +99,7 @@ public class ITextualDate extends IDateField implements Paintable, Field, | |||
formatStr = frmString; | |||
} catch (LocaleNotLoadedException e) { | |||
// TODO Auto-generated catch block | |||
e.printStackTrace(); | |||
ClientExceptionHandler.displayError(e); | |||
} | |||
} | |||
} | |||
@@ -139,7 +139,8 @@ public class ITextualDate extends IDateField implements Paintable, Field, | |||
// remove possibly added invalid value indication | |||
removeStyleName(PARSE_ERROR_CLASSNAME); | |||
} catch (final Exception e) { | |||
ApplicationConnection.getConsole().log(e.getMessage()); | |||
ClientExceptionHandler.displayError(e.getMessage()); | |||
addStyleName(PARSE_ERROR_CLASSNAME); | |||
client.updateVariable(id, "lastInvalidDateString", text | |||
.getText(), false); |
@@ -167,11 +167,11 @@ public class ApplicationServlet extends HttpServlet { | |||
* is being placed into service. | |||
* | |||
* @param servletConfig | |||
* the object containing the servlet's configuration and | |||
* initialization parameters | |||
* the object containing the servlet's configuration and | |||
* initialization parameters | |||
* @throws javax.servlet.ServletException | |||
* if an exception has occurred that interferes with the | |||
* servlet's normal operation. | |||
* if an exception has occurred that interferes with the | |||
* servlet's normal operation. | |||
*/ | |||
public void init(javax.servlet.ServletConfig servletConfig) | |||
throws javax.servlet.ServletException { | |||
@@ -244,9 +244,9 @@ public class ApplicationServlet extends HttpServlet { | |||
classLoader = (ClassLoader) c | |||
.newInstance(new Object[] { getClass().getClassLoader() }); | |||
} catch (final Exception e) { | |||
System.err.println("Could not find specified class loader: " | |||
+ classLoaderName); | |||
throw new ServletException(e); | |||
throw new ServletException( | |||
"Could not find specified class loader: " | |||
+ classLoaderName, e); | |||
} | |||
} | |||
this.classLoader = classLoader; | |||
@@ -278,9 +278,9 @@ public class ApplicationServlet extends HttpServlet { | |||
* Gets an application or system property value. | |||
* | |||
* @param parameterName | |||
* the Name or the parameter. | |||
* the Name or the parameter. | |||
* @param defaultValue | |||
* the Default to be used. | |||
* the Default to be used. | |||
* @return String value or default if not found | |||
*/ | |||
private String getApplicationOrSystemProperty(String parameterName, | |||
@@ -328,16 +328,16 @@ public class ApplicationServlet extends HttpServlet { | |||
* dispatches them. | |||
* | |||
* @param request | |||
* the 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 | |||
* the 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. | |||
* if an input or output error occurs while the servlet is | |||
* 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 { | |||
@@ -508,20 +508,24 @@ public class ApplicationServlet extends HttpServlet { | |||
} catch (final SessionExpired e) { | |||
// Session has expired, notify user | |||
Application.SystemMessages ci = getSystemMessages(); | |||
if (!UIDLrequest) { | |||
// 'plain' http req - e.g. browser reload; | |||
// just go ahead redirect the browser | |||
response.sendRedirect(ci.getSessionExpiredURL()); | |||
} else { | |||
// send uidl redirect | |||
criticalNotification(request, response, ci | |||
.getSessionExpiredCaption(), ci | |||
.getSessionExpiredMessage(), ci.getSessionExpiredURL()); | |||
try { | |||
Application.SystemMessages ci = getSystemMessages(); | |||
if (!UIDLrequest) { | |||
// 'plain' http req - e.g. browser reload; | |||
// just go ahead redirect the browser | |||
response.sendRedirect(ci.getSessionExpiredURL()); | |||
} else { | |||
// send uidl redirect | |||
criticalNotification(request, response, ci | |||
.getSessionExpiredCaption(), ci | |||
.getSessionExpiredMessage(), ci | |||
.getSessionExpiredURL()); | |||
} | |||
} catch (SystemMessageException ee) { | |||
throw new ServletException(ee); | |||
} | |||
} catch (final Throwable e) { | |||
e.printStackTrace(); | |||
// if this was an UIDL request, response UIDL back to client | |||
if (UIDLrequest) { | |||
Application.SystemMessages ci = getSystemMessages(); | |||
@@ -553,23 +557,21 @@ public class ApplicationServlet extends HttpServlet { | |||
return (Application.SystemMessages) m.invoke(null, null); | |||
} catch (ClassNotFoundException e) { | |||
// This should never happen | |||
e.printStackTrace(); | |||
throw new SystemMessageException(e); | |||
} catch (SecurityException e) { | |||
e.printStackTrace(); | |||
System.out | |||
.print("Error: getSystemMessage() should be static public"); | |||
throw new SystemMessageException( | |||
"Application.getSystemMessage() should be static public", e); | |||
} catch (NoSuchMethodException e) { | |||
// This is completely ok and should be silently ignored | |||
} catch (IllegalArgumentException e) { | |||
// This should never happen | |||
e.printStackTrace(); | |||
throw new SystemMessageException(e); | |||
} catch (IllegalAccessException e) { | |||
e.printStackTrace(); | |||
System.out | |||
.print("Error: getSystemMessage() should be static public"); | |||
throw new SystemMessageException( | |||
"Application.getSystemMessage() should be static public", e); | |||
} catch (InvocationTargetException e) { | |||
// This should never happen | |||
e.printStackTrace(); | |||
throw new SystemMessageException(e); | |||
} | |||
return Application.getSystemMessages(); | |||
} | |||
@@ -588,13 +590,11 @@ public class ApplicationServlet extends HttpServlet { | |||
InputStream is = sc.getResourceAsStream(filename); | |||
if (is == null) { | |||
// try if requested file is found from classloader | |||
try { | |||
// strip leading "/" otherwise stream from JAR wont work | |||
filename = filename.substring(1); | |||
is = classLoader.getResourceAsStream(filename); | |||
} catch (final Exception e) { | |||
e.printStackTrace(); | |||
} | |||
// strip leading "/" otherwise stream from JAR wont work | |||
filename = filename.substring(1); | |||
is = classLoader.getResourceAsStream(filename); | |||
if (is == null) { | |||
// cannot serve requested file | |||
System.err | |||
@@ -624,17 +624,17 @@ public class ApplicationServlet extends HttpServlet { | |||
* no knowledge of what application client refers to. | |||
* | |||
* @param request | |||
* the HTTP request instance. | |||
* the HTTP request instance. | |||
* @param response | |||
* the HTTP response to write to. | |||
* the HTTP response to write to. | |||
* @param caption | |||
* for the notification | |||
* for the notification | |||
* @param message | |||
* for the notification | |||
* for the notification | |||
* @param url | |||
* url to load after message, null for current page | |||
* url to load after message, null for current page | |||
* @throws IOException | |||
* if the writing failed due to input/output error. | |||
* if the writing failed due to input/output error. | |||
*/ | |||
void criticalNotification(HttpServletRequest request, | |||
HttpServletResponse response, String caption, String message, | |||
@@ -676,8 +676,10 @@ public class ApplicationServlet extends HttpServlet { | |||
* @param request | |||
* @return string array consisting of application url first and then | |||
* widgetset url. | |||
* @throws MalformedURLException | |||
*/ | |||
private String[] getAppAndWidgetUrl(HttpServletRequest request) { | |||
private String[] getAppAndWidgetUrl(HttpServletRequest request) | |||
throws MalformedURLException { | |||
// don't use server and port in uri. It may cause problems with some | |||
// virtual server configurations which lose the server name | |||
String appUrl = null; | |||
@@ -691,32 +693,28 @@ public class ApplicationServlet extends HttpServlet { | |||
appUrl = URIparts[1]; | |||
} else { | |||
String[] urlParts; | |||
try { | |||
urlParts = getApplicationUrl(request).toString().split("\\/"); | |||
appUrl = ""; | |||
widgetsetUrl = ""; | |||
// if context is specified add it to widgetsetUrl | |||
String ctxPath = request.getContextPath(); | |||
if (ctxPath.length() == 0 | |||
&& request | |||
.getAttribute("javax.servlet.include.context_path") != null) { | |||
// include request (e.g portlet), get contex path from | |||
// attribute | |||
ctxPath = (String) request | |||
.getAttribute("javax.servlet.include.context_path"); | |||
} | |||
if (urlParts.length > 3 | |||
&& urlParts[3].equals(ctxPath.replaceAll("\\/", ""))) { | |||
widgetsetUrl += "/" + urlParts[3]; | |||
} | |||
for (int i = 3; i < urlParts.length; i++) { | |||
appUrl += "/" + urlParts[i]; | |||
} | |||
if (appUrl.endsWith("/")) { | |||
appUrl = appUrl.substring(0, appUrl.length() - 1); | |||
} | |||
} catch (final MalformedURLException e) { | |||
e.printStackTrace(); | |||
urlParts = getApplicationUrl(request).toString().split("\\/"); | |||
appUrl = ""; | |||
widgetsetUrl = ""; | |||
// if context is specified add it to widgetsetUrl | |||
String ctxPath = request.getContextPath(); | |||
if (ctxPath.length() == 0 | |||
&& request | |||
.getAttribute("javax.servlet.include.context_path") != null) { | |||
// include request (e.g portlet), get contex path from | |||
// attribute | |||
ctxPath = (String) request | |||
.getAttribute("javax.servlet.include.context_path"); | |||
} | |||
if (urlParts.length > 3 | |||
&& urlParts[3].equals(ctxPath.replaceAll("\\/", ""))) { | |||
widgetsetUrl += "/" + urlParts[3]; | |||
} | |||
for (int i = 3; i < urlParts.length; i++) { | |||
appUrl += "/" + urlParts[i]; | |||
} | |||
if (appUrl.endsWith("/")) { | |||
appUrl = appUrl.substring(0, appUrl.length() - 1); | |||
} | |||
} | |||
@@ -726,19 +724,19 @@ public class ApplicationServlet extends HttpServlet { | |||
/** | |||
* | |||
* @param request | |||
* the HTTP request. | |||
* the HTTP request. | |||
* @param response | |||
* the HTTP response to write to. | |||
* 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. | |||
* 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. | |||
* if the application is denied access the persistent data store | |||
* represented by the given URL. | |||
*/ | |||
private void writeAjaxPage(HttpServletRequest request, | |||
HttpServletResponse response, Window window, String themeName, | |||
@@ -763,8 +761,9 @@ public class ApplicationServlet extends HttpServlet { | |||
try { | |||
widgetset = (String) reqParam; | |||
} catch (Exception e) { | |||
System.err.println("Warning: request param " + REQUEST_WIDGETSET | |||
+ " could not be used (not a String?)" + e); | |||
// FIXME: Handle exception | |||
System.err.println("Warning: request param '" + REQUEST_WIDGETSET | |||
+ "' could not be used (is not a String)" + e); | |||
} | |||
if (widgetset == null) { | |||
widgetset = applicationProperties.getProperty(PARAMETER_WIDGETSET); | |||
@@ -987,14 +986,13 @@ public class ApplicationServlet extends HttpServlet { | |||
* it is sent to the client. | |||
* | |||
* @param application | |||
* the Application owning the URI. | |||
* the Application owning the URI. | |||
* @param request | |||
* the HTTP request instance. | |||
* the HTTP request instance. | |||
* @param response | |||
* 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. | |||
* 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, | |||
@@ -1035,17 +1033,19 @@ public class ApplicationServlet extends HttpServlet { | |||
* it is sent to the client. | |||
* | |||
* @param stream | |||
* the download stream. | |||
* the download stream. | |||
* | |||
* @param request | |||
* the HTTP request instance. | |||
* the HTTP request instance. | |||
* @param response | |||
* the HTTP response to write to. | |||
* the HTTP response to write to. | |||
* @throws IOException | |||
* | |||
* @see com.itmill.toolkit.terminal.URIHandler | |||
*/ | |||
private void handleDownload(DownloadStream stream, | |||
HttpServletRequest request, HttpServletResponse response) { | |||
HttpServletRequest request, HttpServletResponse response) | |||
throws IOException { | |||
if (stream.getParameter("Location") != null) { | |||
response.setStatus(HttpServletResponse.SC_FOUND); | |||
@@ -1093,19 +1093,13 @@ public class ApplicationServlet extends HttpServlet { | |||
final byte[] buffer = new byte[bufferSize]; | |||
int bytesRead = 0; | |||
try { | |||
final OutputStream out = response.getOutputStream(); | |||
final OutputStream out = response.getOutputStream(); | |||
while ((bytesRead = data.read(buffer)) > 0) { | |||
out.write(buffer, 0, bytesRead); | |||
out.flush(); | |||
} | |||
out.close(); | |||
} catch (final IOException ignored) { | |||
System.err | |||
.println("Warning: ApplicationServlet.handleDownload()" | |||
+ " threw IOException."); | |||
while ((bytesRead = data.read(buffer)) > 0) { | |||
out.write(buffer, 0, bytesRead); | |||
out.flush(); | |||
} | |||
out.close(); | |||
} | |||
@@ -1116,15 +1110,14 @@ public class ApplicationServlet extends HttpServlet { | |||
* are provided by the WebAdapterServlet. | |||
* | |||
* @param request | |||
* the HTTP request. | |||
* the HTTP request. | |||
* @param response | |||
* the HTTP response. | |||
* @return boolean <code>true</code> if the request was handled and | |||
* further processing should be suppressed, <code>false</code> | |||
* 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. | |||
* if an exception has occurred that interferes with the | |||
* servlet's normal operation. | |||
*/ | |||
private boolean handleResourceRequest(HttpServletRequest request, | |||
HttpServletResponse response, String themeName) | |||
@@ -1154,6 +1147,7 @@ public class ApplicationServlet extends HttpServlet { | |||
data = getServletContext().getResourceAsStream( | |||
THEME_DIRECTORY_PATH + themeName + "/" + resourceId); | |||
} catch (final Exception e) { | |||
// FIXME: Handle exception | |||
e.printStackTrace(); | |||
data = null; | |||
} | |||
@@ -1187,6 +1181,7 @@ public class ApplicationServlet extends HttpServlet { | |||
} | |||
} catch (final java.io.IOException e) { | |||
// FIXME: Handle exception | |||
System.err.println("Resource transfer failed: " | |||
+ request.getRequestURI() + ". (" + e.getMessage() + ")"); | |||
} | |||
@@ -1198,46 +1193,40 @@ public class ApplicationServlet extends HttpServlet { | |||
* Gets the current application URL from request. | |||
* | |||
* @param request | |||
* the HTTP request. | |||
* the HTTP request. | |||
* @throws MalformedURLException | |||
* if the application is denied access to the persistent | |||
* data store represented by the given URL. | |||
* if the application is denied access to the persistent data | |||
* store represented by the given URL. | |||
*/ | |||
private URL getApplicationUrl(HttpServletRequest request) | |||
throws MalformedURLException { | |||
URL applicationUrl; | |||
try { | |||
final URL reqURL = new URL( | |||
(request.isSecure() ? "https://" : "http://") | |||
+ request.getServerName() | |||
+ ((request.isSecure() && request.getServerPort() == 443) | |||
|| (!request.isSecure() && request | |||
.getServerPort() == 80) ? "" : ":" | |||
+ request.getServerPort()) | |||
+ request.getRequestURI()); | |||
String servletPath = ""; | |||
if (request.getAttribute("javax.servlet.include.servlet_path") != null) { | |||
// this is an include request | |||
servletPath = request.getAttribute( | |||
"javax.servlet.include.context_path").toString() | |||
+ request | |||
.getAttribute("javax.servlet.include.servlet_path"); | |||
} else { | |||
servletPath = request.getContextPath() | |||
+ request.getServletPath(); | |||
} | |||
if (servletPath.length() == 0 | |||
|| servletPath.charAt(servletPath.length() - 1) != '/') { | |||
servletPath = servletPath + "/"; | |||
} | |||
applicationUrl = new URL(reqURL, servletPath); | |||
} catch (final MalformedURLException e) { | |||
System.err.println("Error constructing application url " | |||
+ request.getRequestURI() + " (" + e + ")"); | |||
throw e; | |||
final URL reqURL = new URL( | |||
(request.isSecure() ? "https://" : "http://") | |||
+ request.getServerName() | |||
+ ((request.isSecure() && request.getServerPort() == 443) | |||
|| (!request.isSecure() && request | |||
.getServerPort() == 80) ? "" : ":" | |||
+ request.getServerPort()) | |||
+ request.getRequestURI()); | |||
String servletPath = ""; | |||
if (request.getAttribute("javax.servlet.include.servlet_path") != null) { | |||
// this is an include request | |||
servletPath = request.getAttribute( | |||
"javax.servlet.include.context_path").toString() | |||
+ request | |||
.getAttribute("javax.servlet.include.servlet_path"); | |||
} else { | |||
servletPath = request.getContextPath() + request.getServletPath(); | |||
} | |||
if (servletPath.length() == 0 | |||
|| servletPath.charAt(servletPath.length() - 1) != '/') { | |||
servletPath = servletPath + "/"; | |||
} | |||
applicationUrl = new URL(reqURL, servletPath); | |||
return applicationUrl; | |||
} | |||
@@ -1287,13 +1276,13 @@ public class ApplicationServlet extends HttpServlet { | |||
* instance for given request based on the requested URL. | |||
* | |||
* @param request | |||
* the HTTP request. | |||
* the HTTP request. | |||
* @param response | |||
* @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. | |||
* if the application is denied access to the persistent data | |||
* store represented by the given URL. | |||
* @throws SAXException | |||
* @throws IllegalAccessException | |||
* @throws InstantiationException | |||
@@ -1345,13 +1334,13 @@ public class ApplicationServlet extends HttpServlet { | |||
* Creates new application for given request. | |||
* | |||
* @param request | |||
* the HTTP request. | |||
* the HTTP request. | |||
* @param response | |||
* @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. | |||
* if the application is denied access to the persistent data | |||
* store represented by the given URL. | |||
* @throws SAXException | |||
* @throws IllegalAccessException | |||
* @throws InstantiationException | |||
@@ -1396,12 +1385,8 @@ public class ApplicationServlet extends HttpServlet { | |||
return application; | |||
} catch (final IllegalAccessException e) { | |||
System.err.println("Illegal access to application class " | |||
+ applicationClass.getName()); | |||
throw e; | |||
} catch (final InstantiationException e) { | |||
System.err.println("Failed to instantiate application class: " | |||
+ applicationClass.getName()); | |||
throw e; | |||
} | |||
} | |||
@@ -1410,13 +1395,13 @@ public class ApplicationServlet extends HttpServlet { | |||
* Ends the application. | |||
* | |||
* @param request | |||
* the HTTP request. | |||
* the HTTP request. | |||
* @param response | |||
* the HTTP response to write to. | |||
* the HTTP response to write to. | |||
* @param application | |||
* the application to end. | |||
* the application to end. | |||
* @throws IOException | |||
* if the writing failed due to input/output error. | |||
* if the writing failed due to input/output error. | |||
*/ | |||
private void endApplication(HttpServletRequest request, | |||
HttpServletResponse response, Application application) | |||
@@ -1441,13 +1426,13 @@ public class ApplicationServlet extends HttpServlet { | |||
* application based on the requested URI. | |||
* | |||
* @param request | |||
* the HTTP Request. | |||
* the HTTP Request. | |||
* @param application | |||
* the Application to query for window. | |||
* the Application to query for window. | |||
* @return Window matching the given URI or null if not found. | |||
* @throws ServletException | |||
* if an exception has occurred that interferes with the | |||
* servlet's normal operation. | |||
* if an exception has occurred that interferes with the | |||
* servlet's normal operation. | |||
*/ | |||
private Window getApplicationWindow(HttpServletRequest request, | |||
Application application) throws ServletException { | |||
@@ -1494,9 +1479,9 @@ public class ApplicationServlet extends HttpServlet { | |||
* Gets relative location of a theme resource. | |||
* | |||
* @param theme | |||
* the Theme name. | |||
* the Theme name. | |||
* @param resource | |||
* the Theme resource. | |||
* the Theme resource. | |||
* @return External URI specifying the resource | |||
*/ | |||
public String getResourceLocation(String theme, ThemeResource resource) { | |||
@@ -1512,8 +1497,8 @@ public class ApplicationServlet extends HttpServlet { | |||
* when debug mode is enabled. | |||
* | |||
* @param parameters | |||
* @return <code>true</code> if the web adapter is in debug mode. | |||
* otherwise <code>false</code>. | |||
* @return <code>true</code> if the web adapter is in debug mode. otherwise | |||
* <code>false</code>. | |||
*/ | |||
public boolean isDebugMode(Map parameters) { | |||
if (parameters != null) { | |||
@@ -1621,7 +1606,7 @@ public class ApplicationServlet extends HttpServlet { | |||
* | |||
* @param servletContext | |||
* @param path | |||
* the resource path. | |||
* the resource path. | |||
* @return the resource path. | |||
*/ | |||
protected static String getResourcePath(ServletContext servletContext, | |||
@@ -1635,6 +1620,7 @@ public class ApplicationServlet extends HttpServlet { | |||
final URL url = servletContext.getResource(path); | |||
resultPath = url.getFile(); | |||
} catch (final Exception e) { | |||
// FIXME: Handle exception | |||
e.printStackTrace(); | |||
} | |||
} |
@@ -103,9 +103,11 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
* @param request | |||
* @param response | |||
* @throws IOException | |||
* @throws FileUploadException | |||
*/ | |||
public void handleFileUpload(HttpServletRequest request, | |||
HttpServletResponse response) throws IOException { | |||
HttpServletResponse response) throws IOException, | |||
FileUploadException { | |||
// Create a new file upload handler | |||
final ServletFileUpload upload = new ServletFileUpload(); | |||
@@ -174,7 +176,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
} | |||
} | |||
} catch (final FileUploadException e) { | |||
e.printStackTrace(); | |||
throw e; | |||
} | |||
// Send short response to acknowledge client that request was done | |||
@@ -240,6 +242,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
"getSystemMessages", null); | |||
ci = (Application.SystemMessages) m.invoke(null, null); | |||
} catch (Exception e2) { | |||
// FIXME: Handle exception | |||
// Not critical, but something is still wrong; print | |||
// stacktrace | |||
e2.printStackTrace(); | |||
@@ -433,6 +436,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
+ ApplicationServlet.THEME_DIRECTORY_PATH | |||
+ themeName + "/" + resource); | |||
} catch (final Exception e) { | |||
// FIXME: Handle exception | |||
e.printStackTrace(); | |||
} | |||
if (is != null) { | |||
@@ -450,6 +454,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
} | |||
r.close(); | |||
} catch (final java.io.IOException e) { | |||
// FIXME: Handle exception | |||
System.err.println("Resource transfer failed: " | |||
+ request.getRequestURI() + ". (" | |||
+ e.getMessage() + ")"); | |||
@@ -458,6 +463,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
+ JsonPaintTarget.escapeJSON(layout.toString()) | |||
+ "\""); | |||
} else { | |||
// FIXME: Handle exception | |||
System.err.println("CustomLayout " + "/" | |||
+ ApplicationServlet.THEME_DIRECTORY_PATH | |||
+ themeName + "/" + resource + " not found!"); | |||
@@ -736,12 +742,12 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
/* | |||
* Time formatting (24 or 12 hour clock and AM/PM suffixes) | |||
*/ | |||
final String timeformat = df.substring(timeStart, df.length()); // Doesn't | |||
// return | |||
// second | |||
// or | |||
// milliseconds | |||
// We use timeformat to determine 12/24-hour clock | |||
final String timeformat = df.substring(timeStart, df.length()); | |||
/* | |||
* Doesn't return second or milliseconds. | |||
* | |||
* We use timeformat to determine 12/24-hour clock | |||
*/ | |||
final boolean twelve_hour_clock = timeformat.indexOf("a") > -1; | |||
// TODO there are other possibilities as well, like 'h' in french | |||
// (ignore them, too complicated) | |||
@@ -771,13 +777,13 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
* application based on the requested URI. | |||
* | |||
* @param request | |||
* the HTTP Request. | |||
* the HTTP Request. | |||
* @param application | |||
* the 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. | |||
* if an exception has occurred that interferes with the | |||
* servlet's normal operation. | |||
*/ | |||
private Window getApplicationWindow(HttpServletRequest request, | |||
Application application) throws ServletException { | |||
@@ -821,13 +827,13 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
* Ends the Application. | |||
* | |||
* @param request | |||
* the HTTP request instance. | |||
* the HTTP request instance. | |||
* @param response | |||
* the HTTP response to write to. | |||
* the HTTP response to write to. | |||
* @param application | |||
* the Application to end. | |||
* the Application to end. | |||
* @throws IOException | |||
* if the writing failed due to input/output error. | |||
* if the writing failed due to input/output error. | |||
*/ | |||
private void endApplication(HttpServletRequest request, | |||
HttpServletResponse response, Application application) | |||
@@ -883,7 +889,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { | |||
/** | |||
* @param w | |||
* root window for which dirty components is to be fetched | |||
* root window for which dirty components is to be fetched | |||
* @return | |||
*/ | |||
private ArrayList getDirtyComponents(Window w) { |
@@ -0,0 +1,57 @@ | |||
package com.itmill.toolkit.terminal.gwt.server; | |||
public class SystemMessageException extends RuntimeException { | |||
/** | |||
* Serial generated by eclipse. | |||
*/ | |||
private static final long serialVersionUID = -8249486543123286960L; | |||
/** | |||
* Cause of the method exception | |||
*/ | |||
private Throwable cause; | |||
/** | |||
* Constructs a new <code>SystemMessageException</code> with the specified | |||
* detail message. | |||
* | |||
* @param msg | |||
* the detail message. | |||
*/ | |||
public SystemMessageException(String msg) { | |||
super(msg); | |||
} | |||
/** | |||
* Constructs a new <code>SystemMessageException</code> with the specified | |||
* detail message and cause. | |||
* | |||
* @param msg | |||
* the detail message. | |||
* @param cause | |||
* the cause of the exception. | |||
*/ | |||
public SystemMessageException(String msg, Throwable cause) { | |||
super(msg, cause); | |||
} | |||
/** | |||
* Constructs a new <code>SystemMessageException</code> from another | |||
* exception. | |||
* | |||
* @param cause | |||
* the cause of the exception. | |||
*/ | |||
public SystemMessageException(Throwable cause) { | |||
this.cause = cause; | |||
} | |||
/** | |||
* @see java.lang.Throwable#getCause() | |||
*/ | |||
public Throwable getCause() { | |||
return cause; | |||
} | |||
} |
@@ -21,6 +21,7 @@ import javax.servlet.http.HttpSessionBindingListener; | |||
import com.itmill.toolkit.Application; | |||
import com.itmill.toolkit.service.ApplicationContext; | |||
import com.itmill.toolkit.terminal.gwt.client.ClientExceptionHandler; | |||
/** | |||
* Web application context for the IT Mill Toolkit applications. | |||
@@ -85,7 +86,7 @@ public class WebApplicationContext implements ApplicationContext, | |||
* Gets the application context for HttpSession. | |||
* | |||
* @param session | |||
* the HTTP session. | |||
* the HTTP session. | |||
* @return the application context for HttpSession. | |||
*/ | |||
static public WebApplicationContext getApplicationContext( | |||
@@ -108,7 +109,7 @@ public class WebApplicationContext implements ApplicationContext, | |||
* boolean value as this object. | |||
* | |||
* @param obj | |||
* the object to compare with. | |||
* the object to compare with. | |||
* @see java.lang.Object#equals(java.lang.Object) | |||
*/ | |||
public boolean equals(Object obj) { | |||
@@ -153,7 +154,7 @@ public class WebApplicationContext implements ApplicationContext, | |||
* | |||
* @param application | |||
* @param request | |||
* the HTTP request. | |||
* the HTTP request. | |||
*/ | |||
protected void startTransaction(Application application, | |||
HttpServletRequest request) { | |||
@@ -171,7 +172,7 @@ public class WebApplicationContext implements ApplicationContext, | |||
* | |||
* @param application | |||
* @param request | |||
* the HTTP request. | |||
* the HTTP request. | |||
*/ | |||
protected void endTransaction(Application application, | |||
HttpServletRequest request) { | |||
@@ -244,6 +245,7 @@ public class WebApplicationContext implements ApplicationContext, | |||
// thread doing HTTP socket write and another thread trying to | |||
// remove same application here. Possible if you got e.g. session | |||
// lifetime 1 min but socket write may take longer than 1 min. | |||
// FIXME: Handle exception | |||
System.err.println("Could not remove application, leaking memory."); | |||
e.printStackTrace(); | |||
} |
@@ -331,7 +331,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource | |||
* actual enabled state of the component. | |||
* | |||
* @param disabledByContainer | |||
* Should the component be disabled | |||
* Should the component be disabled | |||
*/ | |||
public void setDisabledByContainer(boolean disabledByContainer) { | |||
if (disabledByContainer != this.disabledByContainer) { | |||
@@ -776,8 +776,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource | |||
new Class[] { Component.Event.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
e.printStackTrace(); | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in AbstractComponent"); | |||
} | |||
} | |||
@@ -1228,7 +1228,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource | |||
* handle the exception. | |||
* | |||
* @param errorHandler | |||
* AbstractField specific error handler | |||
* AbstractField specific error handler | |||
*/ | |||
public void setErrorHandler(ComponentErrorHandler errorHandler) { | |||
this.errorHandler = errorHandler; |
@@ -93,7 +93,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent | |||
} | |||
} | |||
/* Events ************************************************************ */ | |||
/* Events */ | |||
private static final Method COMPONENT_ATTACHED_METHOD; | |||
@@ -109,7 +109,8 @@ public abstract class AbstractComponentContainer extends AbstractComponent | |||
new Class[] { ComponentDetachEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in AbstractComponentContainer"); | |||
} | |||
} | |||
@@ -143,7 +144,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent | |||
* container. | |||
* | |||
* @param component | |||
* the component that has been added to this container. | |||
* the component that has been added to this container. | |||
*/ | |||
protected void fireComponentAttachEvent(Component component) { | |||
fireEvent(new ComponentAttachEvent(this, component)); | |||
@@ -155,7 +156,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent | |||
* container. | |||
* | |||
* @param component | |||
* the component that has been removed from this container. | |||
* the component that has been removed from this container. | |||
*/ | |||
protected void fireComponentDetachEvent(Component component) { | |||
fireEvent(new ComponentDetachEvent(this, component)); |
@@ -51,7 +51,7 @@ import com.itmill.toolkit.terminal.PaintTarget; | |||
public abstract class AbstractField extends AbstractComponent implements Field, | |||
Property.ReadOnlyStatusChangeNotifier { | |||
/* Private members ************************************************* */ | |||
/* Private members */ | |||
private boolean delayedFocus; | |||
@@ -121,7 +121,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
*/ | |||
private boolean validationVisible = true; | |||
/* Component basics ************************************************ */ | |||
/* Component basics */ | |||
/* | |||
* Paints the field. Don't add a JavaDoc comment here, we use the default | |||
@@ -337,7 +337,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
} | |||
} | |||
/* Property interface implementation ******************************* */ | |||
/* Property interface implementation */ | |||
/** | |||
* Returns the value of the Property in human readable textual format. | |||
@@ -381,7 +381,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
* Sets the value of the field. | |||
* | |||
* @param newValue | |||
* the New value of the field. | |||
* the New value of the field. | |||
* @throws Property.ReadOnlyException | |||
* @throws Property.ConversionException | |||
*/ | |||
@@ -394,9 +394,9 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
* Sets the value of the field. | |||
* | |||
* @param newValue | |||
* the New value of the field. | |||
* the New value of the field. | |||
* @param repaintIsNotNeeded | |||
* True iff caller is sure that repaint is not needed. | |||
* True iff caller is sure that repaint is not needed. | |||
* @throws Property.ReadOnlyException | |||
* @throws Property.ConversionException | |||
*/ | |||
@@ -459,7 +459,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
} | |||
} | |||
/* External data source ******************************************** */ | |||
/* External data source */ | |||
/** | |||
* Gets the current data source of the field, if any. | |||
@@ -488,7 +488,7 @@ 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) { | |||
@@ -546,14 +546,14 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
} | |||
} | |||
/* Validation ****************************************************** */ | |||
/* Validation */ | |||
/** | |||
* Adds a new validator for the field's value. All validators added to a | |||
* 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) { | |||
@@ -580,7 +580,7 @@ public abstract class AbstractField extends AbstractComponent implements 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) { | |||
@@ -750,7 +750,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
} | |||
/* Value change events ****************************************** */ | |||
/* Value change events */ | |||
private static final Method VALUE_CHANGE_METHOD; | |||
@@ -761,7 +761,8 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
new Class[] { Property.ValueChangeEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in AbstractField"); | |||
} | |||
} | |||
@@ -795,7 +796,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
} | |||
} | |||
/* Read-only status change events *************************************** */ | |||
/* Read-only status change events */ | |||
private static final Method READ_ONLY_STATUS_CHANGE_METHOD; | |||
@@ -807,7 +808,8 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
new Class[] { Property.ReadOnlyStatusChangeEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in AbstractField"); | |||
} | |||
} | |||
@@ -832,7 +834,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
* New instance of text change event. | |||
* | |||
* @param source | |||
* the Source of the event. | |||
* the Source of the event. | |||
*/ | |||
public ReadOnlyStatusChangeEvent(AbstractField source) { | |||
super(source); | |||
@@ -881,8 +883,8 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
* forwards. | |||
* | |||
* @param event | |||
* the value change event telling the data source contents | |||
* have changed. | |||
* the value change event telling the data source contents have | |||
* changed. | |||
*/ | |||
public void valueChange(Property.ValueChangeEvent event) { | |||
if (isReadThrough() || !isModified()) { | |||
@@ -915,7 +917,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
* </p> | |||
* | |||
* @param propertyType | |||
* the 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) { | |||
@@ -966,7 +968,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
* variables. | |||
* | |||
* @param newValue | |||
* the new value to be set. | |||
* the new value to be set. | |||
*/ | |||
protected void setInternalValue(Object newValue) { | |||
value = newValue; | |||
@@ -1022,7 +1024,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
* field isEmpty() regardless of any attached validators. | |||
* | |||
* @param required | |||
* Is the field required. | |||
* Is the field required. | |||
*/ | |||
public void setRequired(boolean required) { | |||
this.required = required; | |||
@@ -1073,7 +1075,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, | |||
* validation in their own code. | |||
* | |||
* @param validateAutomatically | |||
* True, if automatic validation is enabled. | |||
* True, if automatic validation is enabled. | |||
*/ | |||
public void setValidationVisible(boolean validateAutomatically) { | |||
if (validationVisible != validateAutomatically) { |
@@ -47,8 +47,8 @@ public abstract class AbstractSelect extends AbstractField implements | |||
Container.ItemSetChangeListener { | |||
/** | |||
* Item caption mode: Item's ID's <code>String</code> representation is | |||
* used as caption. | |||
* Item caption mode: Item's ID's <code>String</code> representation is used | |||
* as caption. | |||
*/ | |||
public static final int ITEM_CAPTION_MODE_ID = 0; | |||
/** | |||
@@ -87,8 +87,8 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* entered value. The value is matched to the item caption. | |||
* <code>FILTERINGMODE_OFF</code> (0) turns the filtering off. | |||
* <code>FILTERINGMODE_STARTSWITH</code> (1) matches from the start of the | |||
* caption. <code>FILTERINGMODE_CONTAINS</code> (1) matches anywhere in | |||
* the caption. | |||
* caption. <code>FILTERINGMODE_CONTAINS</code> (1) matches anywhere in the | |||
* caption. | |||
*/ | |||
public interface Filtering { | |||
public static final int FILTERINGMODE_OFF = 0; | |||
@@ -99,7 +99,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Sets the option filtering mode. | |||
* | |||
* @param filteringMode | |||
* the filtering mode to use | |||
* the filtering mode to use | |||
*/ | |||
public void setFilteringMode(int filteringMode); | |||
@@ -185,7 +185,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
// Caption (Item / Property) change listeners | |||
CaptionChangeListener captionChangeListener; | |||
/* Constructors ********************************************************* */ | |||
/* Constructors */ | |||
/** | |||
* Creates an empty Select. The caption is not used. | |||
@@ -206,10 +206,9 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Creates a new select that is connected to a data-source. | |||
* | |||
* @param caption | |||
* the Caption of the component. | |||
* the Caption of the component. | |||
* @param dataSource | |||
* the Container datasource to be selected from by this | |||
* select. | |||
* the Container datasource to be selected from by this select. | |||
*/ | |||
public AbstractSelect(String caption, Container dataSource) { | |||
setCaption(caption); | |||
@@ -220,9 +219,9 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Creates a new select that is filled from a collection of option values. | |||
* | |||
* @param caption | |||
* the Caption of this field. | |||
* the Caption of this field. | |||
* @param options | |||
* the Collection containing the options. | |||
* the Collection containing the options. | |||
*/ | |||
public AbstractSelect(String caption, Collection options) { | |||
@@ -238,15 +237,15 @@ public abstract class AbstractSelect extends AbstractField implements | |||
setContainerDataSource(c); | |||
} | |||
/* Component methods **************************************************** */ | |||
/* Component methods */ | |||
/** | |||
* Paints the content of this component. | |||
* | |||
* @param target | |||
* the Paint Event. | |||
* the Paint Event. | |||
* @throws PaintException | |||
* if the paint operation failed. | |||
* if the paint operation failed. | |||
*/ | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
@@ -489,9 +488,10 @@ public abstract class AbstractSelect extends AbstractField implements | |||
getItemCaptionPropertyId()).setValue( | |||
newItemCaption); | |||
} catch (final Property.ConversionException ignored) { | |||
// The conversion exception is safely ignored, the | |||
// caption is | |||
// just missing | |||
/* | |||
* The conversion exception is safely ignored, the | |||
* caption is just missing | |||
*/ | |||
} | |||
} | |||
if (isMultiSelect()) { | |||
@@ -526,13 +526,13 @@ public abstract class AbstractSelect extends AbstractField implements | |||
return null; | |||
} | |||
/* Property methods ***************************************************** */ | |||
/* Property methods */ | |||
/** | |||
* Returns the type of the property. <code>getValue</code> and | |||
* <code>setValue</code> methods must be compatible with this type: one | |||
* can safely cast <code>getValue</code> to given type and pass any | |||
* variable assignable to this type as a parameter to <code>setValue</code>. | |||
* <code>setValue</code> methods must be compatible with this type: one can | |||
* safely cast <code>getValue</code> to given type and pass any variable | |||
* assignable to this type as a parameter to <code>setValue</code>. | |||
* | |||
* @return the Type of the property. | |||
*/ | |||
@@ -585,7 +585,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* </p> | |||
* | |||
* @param newValue | |||
* the New selected item or collection of selected items. | |||
* the New selected item or collection of selected items. | |||
* @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object) | |||
*/ | |||
public void setValue(Object newValue) throws Property.ReadOnlyException, | |||
@@ -607,9 +607,9 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* </p> | |||
* | |||
* @param newValue | |||
* the New selected item or collection of selected items. | |||
* the New selected item or collection of selected items. | |||
* @param repaintIsNotNeeded | |||
* True if caller is sure that repaint is not needed. | |||
* True if caller is sure that repaint is not needed. | |||
* @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object, | |||
* java.lang.Boolean) | |||
*/ | |||
@@ -628,14 +628,14 @@ public abstract class AbstractSelect extends AbstractField implements | |||
} | |||
} | |||
/* Container methods **************************************************** */ | |||
/* Container methods */ | |||
/** | |||
* 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. | |||
* the item id. | |||
* @return the item from the container. | |||
*/ | |||
public Item getItem(Object itemId) { | |||
@@ -664,7 +664,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Gets the property type. | |||
* | |||
* @param propertyId | |||
* the Id identifying the property. | |||
* the Id identifying the property. | |||
* @see com.itmill.toolkit.data.Container#getType(java.lang.Object) | |||
*/ | |||
public Class getType(Object propertyId) { | |||
@@ -686,7 +686,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Tests, if the collection contains an item with given id. | |||
* | |||
* @param itemId | |||
* the Id the of item to be tested. | |||
* the Id the of item to be tested. | |||
*/ | |||
public boolean containsId(Object itemId) { | |||
if (itemId != null) { | |||
@@ -779,7 +779,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* returns null. | |||
* | |||
* @param itemId | |||
* the Identification of the item to be created. | |||
* the Identification of the item to be created. | |||
* @return the Created item with the given id, or null in case of failure. | |||
* @see com.itmill.toolkit.data.Container#addItem(java.lang.Object) | |||
*/ | |||
@@ -833,13 +833,13 @@ public abstract class AbstractSelect extends AbstractField implements | |||
return retval; | |||
} | |||
/* Container.Viewer methods ********************************************* */ | |||
/* Container.Viewer methods */ | |||
/** | |||
* Sets the container as data-source for viewing. | |||
* | |||
* @param newDataSource | |||
* the new data source. | |||
* the new data source. | |||
*/ | |||
public void setContainerDataSource(Container newDataSource) { | |||
if (newDataSource == null) { | |||
@@ -852,17 +852,13 @@ public abstract class AbstractSelect extends AbstractField implements | |||
// Removes listeners from the old datasource | |||
if (items != null) { | |||
try { | |||
if (items instanceof Container.ItemSetChangeListener) { | |||
((Container.ItemSetChangeNotifier) items) | |||
.removeListener(this); | |||
} catch (final ClassCastException ignored) { | |||
// Ignored | |||
} | |||
try { | |||
if (items instanceof Container.PropertySetChangeNotifier) { | |||
((Container.PropertySetChangeNotifier) items) | |||
.removeListener(this); | |||
} catch (final ClassCastException ignored) { | |||
// Ignored | |||
} | |||
} | |||
@@ -874,16 +870,12 @@ public abstract class AbstractSelect extends AbstractField implements | |||
// Adds listeners | |||
if (items != null) { | |||
try { | |||
if (items instanceof Container.ItemSetChangeListener) { | |||
((Container.ItemSetChangeNotifier) items).addListener(this); | |||
} catch (final ClassCastException ignored) { | |||
// Ignored | |||
} | |||
try { | |||
if (items instanceof Container.PropertySetChangeNotifier) { | |||
((Container.PropertySetChangeNotifier) items) | |||
.addListener(this); | |||
} catch (final ClassCastException ignored) { | |||
// Ignored | |||
} | |||
} | |||
@@ -901,7 +893,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
return items; | |||
} | |||
/* Select attributes **************************************************** */ | |||
/* Select attributes */ | |||
/** | |||
* Is the select in multiselect mode? In multiselect mode | |||
@@ -918,7 +910,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* selected items, only one of the selected items is kept as selected. | |||
* | |||
* @param multiSelect | |||
* the New value of property multiSelect. | |||
* the New value of property multiSelect. | |||
*/ | |||
public void setMultiSelect(boolean multiSelect) { | |||
if (multiSelect && getNullSelectionItemId() != null) { | |||
@@ -970,7 +962,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Enables or disables possibility to add new options by the user. | |||
* | |||
* @param allowNewOptions | |||
* the New value of property allowNewOptions. | |||
* the New value of property allowNewOptions. | |||
*/ | |||
public void setNewItemsAllowed(boolean allowNewOptions) { | |||
@@ -988,9 +980,9 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* item and index captions. | |||
* | |||
* @param itemId | |||
* the id of the item to be recaptioned. | |||
* the id of the item to be recaptioned. | |||
* @param caption | |||
* the New caption. | |||
* the New caption. | |||
*/ | |||
public void setItemCaption(Object itemId, String caption) { | |||
if (itemId != null) { | |||
@@ -1005,7 +997,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* details. | |||
* | |||
* @param itemId | |||
* the id of the item to be queried. | |||
* the id of the item to be queried. | |||
* @return the caption for specified item. | |||
*/ | |||
public String getItemCaption(Object itemId) { | |||
@@ -1024,10 +1016,11 @@ public abstract class AbstractSelect extends AbstractField implements | |||
break; | |||
case ITEM_CAPTION_MODE_INDEX: | |||
try { | |||
if (items instanceof Container.Indexed) { | |||
caption = String.valueOf(((Container.Indexed) items) | |||
.indexOfId(itemId)); | |||
} catch (final ClassCastException ignored) { | |||
} else { | |||
caption = "ERROR: Container is not indexed"; | |||
} | |||
break; | |||
@@ -1066,9 +1059,9 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Sets the icon for an item. | |||
* | |||
* @param itemId | |||
* the id of the item to be assigned an icon. | |||
* the id of the item to be assigned an icon. | |||
* @param icon | |||
* the New icon. | |||
* the New icon. | |||
*/ | |||
public void setItemIcon(Object itemId, Resource icon) { | |||
if (itemId != null) { | |||
@@ -1085,7 +1078,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Gets the item icon. | |||
* | |||
* @param itemId | |||
* the id of the item to be assigned an icon. | |||
* the id of the item to be assigned an icon. | |||
* @return the Icon for the item or null, if not specified. | |||
*/ | |||
public Resource getItemIcon(Object itemId) { | |||
@@ -1124,13 +1117,13 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* <code>toString</code> is used as item caption.</li> | |||
* <li><code>ITEM_CAPTION_MODE_ITEM</code> : Item-objects | |||
* <code>toString</code> is used as item caption.</li> | |||
* <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is | |||
* used as item caption. The index mode can only be used with the containers | |||
* <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is used | |||
* as item caption. The index mode can only be used with the containers | |||
* implementing <code>Container.Indexed</code> interface.</li> | |||
* <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must | |||
* be explicitly specified.</li> | |||
* <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are | |||
* read from property, that must be specified with | |||
* <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must be | |||
* explicitly specified.</li> | |||
* <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are read | |||
* from property, that must be specified with | |||
* <code>setItemCaptionPropertyId</code>.</li> | |||
* </ul> | |||
* The <code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> is the default | |||
@@ -1138,7 +1131,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* </p> | |||
* | |||
* @param mode | |||
* the One of the modes listed above. | |||
* the One of the modes listed above. | |||
*/ | |||
public void setItemCaptionMode(int mode) { | |||
if (ITEM_CAPTION_MODE_ID <= mode && mode <= ITEM_CAPTION_MODE_PROPERTY) { | |||
@@ -1160,13 +1153,13 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* <code>toString</code> is used as item caption.</li> | |||
* <li><code>ITEM_CAPTION_MODE_ITEM</code> : Item-objects | |||
* <code>toString</code> is used as item caption.</li> | |||
* <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is | |||
* used as item caption. The index mode can only be used with the containers | |||
* <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is used | |||
* as item caption. The index mode can only be used with the containers | |||
* implementing <code>Container.Indexed</code> interface.</li> | |||
* <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must | |||
* be explicitly specified.</li> | |||
* <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are | |||
* read from property, that must be specified with | |||
* <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must be | |||
* explicitly specified.</li> | |||
* <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are read | |||
* from property, that must be specified with | |||
* <code>setItemCaptionPropertyId</code>.</li> | |||
* </ul> | |||
* The <code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> is the default | |||
@@ -1185,18 +1178,19 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* <p> | |||
* Setting the id to a existing property implicitly sets the item caption | |||
* mode to <code>ITEM_CAPTION_MODE_PROPERTY</code>. If the object is in | |||
* <code>ITEM_CAPTION_MODE_PROPERTY</code> mode, setting caption property | |||
* id null resets the item caption mode to | |||
* <code>ITEM_CAPTION_MODE_PROPERTY</code> mode, setting caption property id | |||
* null resets the item caption mode to | |||
* <code>ITEM_CAPTION_EXPLICIT_DEFAULTS_ID</code>. | |||
* </p> | |||
* | |||
* <p> | |||
* Setting the property id to null disables this feature. The id is null by | |||
* default | |||
* </p>. | |||
* </p> | |||
* . | |||
* | |||
* @param propertyId | |||
* the id of the property. | |||
* the id of the property. | |||
* | |||
*/ | |||
public void setItemCaptionPropertyId(Object propertyId) { | |||
@@ -1232,17 +1226,18 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* </p> | |||
* | |||
* <p> | |||
* Note : The icons set with <code>setItemIcon</code> function override | |||
* the icons from the property. | |||
* Note : The icons set with <code>setItemIcon</code> function override the | |||
* icons from the property. | |||
* </p> | |||
* | |||
* <p> | |||
* Setting the property id to null disables this feature. The id is null by | |||
* default | |||
* </p>. | |||
* </p> | |||
* . | |||
* | |||
* @param propertyId | |||
* the Id of the property that specifies icons for items. | |||
* the Id of the property that specifies icons for items. | |||
*/ | |||
public void setItemIconPropertyId(Object propertyId) { | |||
if ((propertyId != null) | |||
@@ -1264,14 +1259,15 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* </p> | |||
* | |||
* <p> | |||
* Note : The icons set with <code>setItemIcon</code> function override | |||
* the icons from the property. | |||
* Note : The icons set with <code>setItemIcon</code> function override the | |||
* icons from the property. | |||
* </p> | |||
* | |||
* <p> | |||
* Setting the property id to null disables this feature. The id is null by | |||
* default | |||
* </p>. | |||
* </p> | |||
* . | |||
* | |||
* @return the Id of the property containing the item icons. | |||
*/ | |||
@@ -1289,7 +1285,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* </p> | |||
* | |||
* @param itemId | |||
* the Id the of the item to be tested. | |||
* the Id the of the item to be tested. | |||
* @see #getNullSelectionItemId() | |||
* @see #setNullSelectionItemId(Object) | |||
* | |||
@@ -1316,7 +1312,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* </p> | |||
* | |||
* @param itemId | |||
* the tem to be selected. | |||
* the tem to be selected. | |||
* @see #getNullSelectionItemId() | |||
* @see #setNullSelectionItemId(Object) | |||
* | |||
@@ -1336,7 +1332,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* Unselects an item. | |||
* | |||
* @param itemId | |||
* the Item to be unselected. | |||
* the Item to be unselected. | |||
* @see #getNullSelectionItemId() | |||
* @see #setNullSelectionItemId(Object) | |||
* | |||
@@ -1495,11 +1491,11 @@ public abstract class AbstractSelect extends AbstractField implements | |||
/** | |||
* Allow of disallow empty selection. If the select is in single-select | |||
* mode, you can make an item represent the empty selection by calling | |||
* <code>setNullSelectionItemId()</code>. This way you can for instance | |||
* set an icon and caption for the null selection item. | |||
* <code>setNullSelectionItemId()</code>. This way you can for instance set | |||
* an icon and caption for the null selection item. | |||
* | |||
* @param nullSelectionAllowed | |||
* whether or not to allow empty selection | |||
* whether or not to allow empty selection | |||
* @see #setNullSelectionItemId(Object) | |||
* @see #isNullSelectionAllowed() | |||
*/ | |||
@@ -1546,7 +1542,7 @@ public abstract class AbstractSelect extends AbstractField implements | |||
* </p> | |||
* | |||
* @param nullSelectionItemId | |||
* the nullSelectionItemId to set. | |||
* the nullSelectionItemId to set. | |||
* @see #getNullSelectionItemId() | |||
* @see #isSelected(Object) | |||
* @see #select(Object) |
@@ -22,7 +22,7 @@ import com.itmill.toolkit.terminal.PaintTarget; | |||
*/ | |||
public class Button extends AbstractField { | |||
/* Private members ************************************************* */ | |||
/* Private members */ | |||
boolean switchMode = false; | |||
@@ -42,7 +42,7 @@ public class Button extends AbstractField { | |||
* default. | |||
* | |||
* @param caption | |||
* the Button caption. | |||
* the Button caption. | |||
*/ | |||
public Button(String caption) { | |||
setCaption(caption); | |||
@@ -53,9 +53,9 @@ public class Button extends AbstractField { | |||
* Creates a new push button with click listener. | |||
* | |||
* @param caption | |||
* the Button caption. | |||
* the Button caption. | |||
* @param listener | |||
* the Button click listener. | |||
* the Button click listener. | |||
*/ | |||
public Button(String caption, ClickListener listener) { | |||
this(caption); | |||
@@ -71,12 +71,12 @@ public class Button extends AbstractField { | |||
* of Button.ClickEvent type. | |||
* | |||
* @param caption | |||
* the Button caption. | |||
* the Button caption. | |||
* @param target | |||
* the Object having the method for listening button clicks. | |||
* the Object having the method for listening button clicks. | |||
* @param methodName | |||
* the name of the method in target object, that receives | |||
* button click events. | |||
* the name of the method in target object, that receives button | |||
* click events. | |||
*/ | |||
public Button(String caption, Object target, String methodName) { | |||
this(caption); | |||
@@ -87,7 +87,7 @@ public class Button extends AbstractField { | |||
* Creates a new switch button with initial value. | |||
* | |||
* @param state | |||
* the Initial state of the switch-button. | |||
* the Initial state of the switch-button. | |||
* @param initialState | |||
*/ | |||
public Button(String caption, boolean initialState) { | |||
@@ -100,7 +100,7 @@ public class Button extends AbstractField { | |||
* Creates a new switch button that is connected to a boolean property. | |||
* | |||
* @param state | |||
* the Initial state of the switch-button. | |||
* the Initial state of the switch-button. | |||
* @param dataSource | |||
*/ | |||
public Button(String caption, Property dataSource) { | |||
@@ -122,11 +122,11 @@ public class Button extends AbstractField { | |||
* Paints the content of this component. | |||
* | |||
* @param event | |||
* the PaintEvent. | |||
* the PaintEvent. | |||
* @throws IOException | |||
* if the writing failed due to input/output error. | |||
* if the writing failed due to input/output error. | |||
* @throws PaintException | |||
* if the paint operation failed. | |||
* if the paint operation failed. | |||
*/ | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
super.paintContent(target); | |||
@@ -153,10 +153,8 @@ public class Button extends AbstractField { | |||
*/ | |||
public void changeVariables(Object source, Map variables) { | |||
super.changeVariables(source, variables); | |||
if (isReadOnly()) { | |||
System.err.println("Button: ignoring variable change for" | |||
+ " read-only component, caption=" + getCaption()); | |||
} else if (variables.containsKey("state")) { | |||
if (!isReadOnly() && variables.containsKey("state")) { | |||
// Gets the new and old button states | |||
final Boolean newValue = (Boolean) variables.get("state"); | |||
final Boolean oldValue = (Boolean) getValue(); | |||
@@ -199,7 +197,7 @@ public class Button extends AbstractField { | |||
* Sets the switchMode. | |||
* | |||
* @param switchMode | |||
* The switchMode to set. | |||
* The switchMode to set. | |||
*/ | |||
public void setSwitchMode(boolean switchMode) { | |||
this.switchMode = switchMode; | |||
@@ -237,7 +235,7 @@ public class Button extends AbstractField { | |||
return Boolean.class; | |||
} | |||
/* Click event ************************************************ */ | |||
/* Click event */ | |||
private static final Method BUTTON_CLICK_METHOD; | |||
@@ -250,7 +248,8 @@ public class Button extends AbstractField { | |||
"buttonClick", new Class[] { ClickEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in Button"); | |||
} | |||
} | |||
@@ -273,7 +272,7 @@ public class Button extends AbstractField { | |||
* New instance of text change event. | |||
* | |||
* @param source | |||
* the Source of the event. | |||
* the Source of the event. | |||
*/ | |||
public ClickEvent(Component source) { | |||
super(source); | |||
@@ -303,7 +302,7 @@ public class Button extends AbstractField { | |||
* Button has been pressed. | |||
* | |||
* @param event | |||
* Button click event. | |||
* Button click event. | |||
*/ | |||
public void buttonClick(ClickEvent event); | |||
} | |||
@@ -312,7 +311,7 @@ public class Button extends AbstractField { | |||
* Adds the button click listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(ClickListener listener) { | |||
addListener(ClickEvent.class, listener, BUTTON_CLICK_METHOD); | |||
@@ -322,7 +321,7 @@ public class Button extends AbstractField { | |||
* Removes the button click listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(ClickListener listener) { | |||
removeListener(ClickEvent.class, listener, BUTTON_CLICK_METHOD); |
@@ -130,7 +130,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* </p> | |||
* | |||
* @param formLayout | |||
* the layout of the form. | |||
* the layout of the form. | |||
*/ | |||
public Form() { | |||
this(null); | |||
@@ -141,7 +141,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* Contructs a new form with given layout. | |||
* | |||
* @param formLayout | |||
* the layout of the form. | |||
* the layout of the form. | |||
*/ | |||
public Form(Layout formLayout) { | |||
this(formLayout, new BaseFieldFactory()); | |||
@@ -151,9 +151,9 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* Contructs a new form with given layout and FieldFactory. | |||
* | |||
* @param formLayout | |||
* the layout of the form. | |||
* the layout of the form. | |||
* @param fieldFactory | |||
* the FieldFactory of the form. | |||
* the FieldFactory of the form. | |||
*/ | |||
public Form(Layout formLayout, FieldFactory fieldFactory) { | |||
super(); | |||
@@ -194,9 +194,10 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
ErrorMessage validationError = null; | |||
if (isValidationVisible()) { | |||
for (final Iterator i = propertyIds.iterator(); i.hasNext();) { | |||
try { | |||
AbstractComponent field = (AbstractComponent) fields.get(i | |||
.next()); | |||
Object f = fields.get(i.next()); | |||
if (f instanceof AbstractComponent) { | |||
AbstractComponent field = (AbstractComponent) f; | |||
validationError = field.getErrorMessage(); | |||
if (validationError != null) { | |||
// Skip empty errors | |||
@@ -205,7 +206,6 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
} | |||
break; | |||
} | |||
} catch (ClassCastException ignored) { | |||
} | |||
} | |||
} | |||
@@ -234,9 +234,8 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* the implicit setting by setting this property as false. | |||
* | |||
* @param makeVisible | |||
* If true (default), validation is made visible when | |||
* commit() is called. If false, the visibility is left as it | |||
* is. | |||
* If true (default), validation is made visible when commit() is | |||
* called. If false, the visibility is left as it is. | |||
*/ | |||
public void setValidationVisibleOnCommit(boolean makeVisible) { | |||
validationVisibleOnCommit = makeVisible; | |||
@@ -263,8 +262,9 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
// Only commit on valid state if so requested | |||
if (!isInvalidCommitted() && !isValid()) { | |||
if (validationVisibleOnCommit) | |||
if (validationVisibleOnCommit) { | |||
setValidationVisible(true); | |||
} | |||
return; | |||
} | |||
@@ -465,9 +465,9 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* </p> | |||
* | |||
* @param propertyId | |||
* the Property id the the field. | |||
* the Property id the the field. | |||
* @param field | |||
* the New field added to the form. | |||
* the New field added to the form. | |||
*/ | |||
public void addField(Object propertyId, Field field) { | |||
@@ -520,7 +520,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* Gets the field identified by the propertyid. | |||
* | |||
* @param propertyId | |||
* the id of the property. | |||
* the id of the property. | |||
*/ | |||
public Field getField(Object propertyId) { | |||
return (Field) fields.get(propertyId); | |||
@@ -634,7 +634,8 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* Gets the layout of the form. | |||
* | |||
* <p> | |||
* By default form uses <code>OrderedLayout</code> with <code>form</code>-style. | |||
* By default form uses <code>OrderedLayout</code> with <code>form</code> | |||
* -style. | |||
* </p> | |||
* | |||
* @return the Layout of the form. | |||
@@ -647,11 +648,12 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* Sets the layout of the form. | |||
* | |||
* <p> | |||
* By default form uses <code>OrderedLayout</code> with <code>form</code>-style. | |||
* By default form uses <code>OrderedLayout</code> with <code>form</code> | |||
* -style. | |||
* </p> | |||
* | |||
* @param newLayout | |||
* the Layout of the form. | |||
* the Layout of the form. | |||
*/ | |||
public void setLayout(Layout newLayout) { | |||
@@ -681,7 +683,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* </p> | |||
* | |||
* @param propertyId | |||
* the id of the property. | |||
* the id of the property. | |||
* @param values | |||
* @param descriptions | |||
* @return the select property generated | |||
@@ -867,7 +869,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* By default the form uses BaseFieldFactory to create Field instances. | |||
* | |||
* @param fieldFactory | |||
* the New factory used to create the fields. | |||
* the New factory used to create the fields. | |||
* @see Field | |||
* @see FieldFactory | |||
*/ | |||
@@ -974,7 +976,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* Sets the visibleProperties. | |||
* | |||
* @param visibleProperties | |||
* the visibleProperties to set. | |||
* the visibleProperties to set. | |||
*/ | |||
public void setVisibleItemProperties(Collection visibleProperties) { | |||
visibleItemProperties = visibleProperties; | |||
@@ -1065,7 +1067,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, | |||
* Sets the layout that is rendered below normal form contens. | |||
* | |||
* @param newFormFooter | |||
* the new Layout | |||
* the new Layout | |||
*/ | |||
public void setFooter(Layout newFormFooter) { | |||
if (formFooter != null) { |
@@ -93,9 +93,9 @@ public class GridLayout extends AbstractLayout implements | |||
* if you add components outside the grid's area. | |||
* | |||
* @param columns | |||
* Number of columns in the grid. | |||
* Number of columns in the grid. | |||
* @param rows | |||
* Number of rows in the grid. | |||
* Number of rows in the grid. | |||
*/ | |||
public GridLayout(int columns, int rows) { | |||
setColumns(columns); | |||
@@ -123,24 +123,24 @@ public class GridLayout extends AbstractLayout implements | |||
* </p> | |||
* | |||
* @param c | |||
* the component to be added. | |||
* the component to be added. | |||
* @param column1 | |||
* the column of the upper left corner of the area | |||
* <code>c</code> is supposed to occupy. | |||
* the column of the upper left corner of the area <code>c</code> | |||
* is supposed to occupy. | |||
* @param row1 | |||
* the row of the upper left corner of the area | |||
* <code>c</code> is supposed to occupy. | |||
* the row of the upper left corner of the area <code>c</code> is | |||
* supposed to occupy. | |||
* @param column2 | |||
* the column of the lower right corner of the area | |||
* <code>c</code> is supposed to occupy. | |||
* the column of the lower right corner of the area | |||
* <code>c</code> is supposed to occupy. | |||
* @param row2 | |||
* the row of the lower right corner of the area | |||
* <code>c</code> is supposed to occupy. | |||
* the row 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. | |||
* if the new component overlaps with any of the components | |||
* already in the grid. | |||
* @throws OutOfBoundsException | |||
* if the cells are outside of the grid area. | |||
* if the cells are outside of the grid area. | |||
*/ | |||
public void addComponent(Component component, int column1, int row1, | |||
int column2, int row2) throws OverlapsException, | |||
@@ -216,9 +216,9 @@ public class GridLayout extends AbstractLayout implements | |||
* grid. | |||
* | |||
* @param area | |||
* the Area to be checked for overlapping. | |||
* the Area to be checked for overlapping. | |||
* @throws OverlapsException | |||
* if <code>area</code> overlaps with any existing area. | |||
* if <code>area</code> overlaps with any existing area. | |||
*/ | |||
private void checkExistingOverlaps(Area area) throws OverlapsException { | |||
for (final Iterator i = areas.iterator(); i.hasNext();) { | |||
@@ -236,11 +236,11 @@ public class GridLayout extends AbstractLayout implements | |||
* the same as column1,row1. Component width and height is 1. | |||
* | |||
* @param c | |||
* the component to be added. | |||
* the component to be added. | |||
* @param column | |||
* the column index. | |||
* the column index. | |||
* @param row | |||
* the row index. | |||
* the row index. | |||
*/ | |||
public void addComponent(Component c, int column, int row) { | |||
this.addComponent(c, column, row, column, row); | |||
@@ -279,7 +279,7 @@ public class GridLayout extends AbstractLayout implements | |||
* grid is automatically extended. | |||
* | |||
* @param c | |||
* the component to be added. | |||
* the component to be added. | |||
*/ | |||
public void addComponent(Component component) { | |||
@@ -291,7 +291,7 @@ public class GridLayout extends AbstractLayout implements | |||
area = new Area(component, cursorX, cursorY, cursorX, cursorY); | |||
checkExistingOverlaps(area); | |||
done = true; | |||
} catch (final OverlapsException ignored) { | |||
} catch (final OverlapsException e) { | |||
space(); | |||
} | |||
} | |||
@@ -307,7 +307,7 @@ public class GridLayout extends AbstractLayout implements | |||
* Removes the given component from this container. | |||
* | |||
* @param c | |||
* the component to be removed. | |||
* the component to be removed. | |||
*/ | |||
public void removeComponent(Component component) { | |||
@@ -340,9 +340,9 @@ public class GridLayout extends AbstractLayout implements | |||
* Removes the component specified with it's cell index. | |||
* | |||
* @param column | |||
* the Component's column. | |||
* the Component's column. | |||
* @param row | |||
* the Component's row. | |||
* the Component's row. | |||
*/ | |||
public void removeComponent(int column, int row) { | |||
@@ -370,9 +370,9 @@ public class GridLayout extends AbstractLayout implements | |||
* Paints the contents of this component. | |||
* | |||
* @param target | |||
* the Paint Event. | |||
* the Paint Event. | |||
* @throws PaintException | |||
* if the paint operation failed. | |||
* if the paint operation failed. | |||
*/ | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
@@ -541,7 +541,9 @@ public class GridLayout extends AbstractLayout implements | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.itmill.toolkit.ui.Layout.AlignmentHandler#getComponentAlignment(com.itmill.toolkit.ui.Component) | |||
* @see | |||
* com.itmill.toolkit.ui.Layout.AlignmentHandler#getComponentAlignment(com | |||
* .itmill.toolkit.ui.Component) | |||
*/ | |||
public int getComponentAlignment(Component childComponent) { | |||
final Integer bitMask = (Integer) componentToAlignment | |||
@@ -606,22 +608,22 @@ public class GridLayout extends AbstractLayout implements | |||
* </p> | |||
* | |||
* @param component | |||
* the component connected to the area. | |||
* the component connected to the area. | |||
* @param column1 | |||
* The column of the upper left corner cell of the area | |||
* <code>c</code> is supposed to occupy. | |||
* The column of the upper left corner cell of the area | |||
* <code>c</code> is supposed to occupy. | |||
* @param row1 | |||
* The row of the upper left corner cell of the area | |||
* <code>c</code> is supposed to occupy. | |||
* The row of the upper left corner cell of the area | |||
* <code>c</code> is supposed to occupy. | |||
* @param column2 | |||
* The column of the lower right corner cell of the area | |||
* <code>c</code> is supposed to occupy. | |||
* The column of the lower right corner cell of the area | |||
* <code>c</code> is supposed to occupy. | |||
* @param row2 | |||
* The row of the lower right corner cell of the area | |||
* <code>c</code> is supposed to occupy. | |||
* The row of the lower right corner cell 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 | |||
* if the new component overlaps with any of the components | |||
* already in the grid | |||
*/ | |||
public Area(Component component, int column1, int row1, int column2, | |||
int row2) { | |||
@@ -636,10 +638,10 @@ public class GridLayout extends AbstractLayout implements | |||
* Tests if the given Area overlaps with an another 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. | |||
* 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. | |||
*/ | |||
public boolean overlaps(Area other) { | |||
return column1 <= other.getColumn2() && row1 <= other.getRow2() | |||
@@ -665,7 +667,7 @@ public class GridLayout extends AbstractLayout implements | |||
* </p> | |||
* | |||
* @param newComponent | |||
* the new connected overriding the existing one. | |||
* the new connected overriding the existing one. | |||
*/ | |||
protected void setComponent(Component newComponent) { | |||
component = newComponent; | |||
@@ -783,8 +785,8 @@ public class GridLayout extends AbstractLayout implements | |||
} | |||
/** | |||
* An <code>Exception</code> object which is thrown when an area exceeds | |||
* the bounds of the grid. | |||
* An <code>Exception</code> object which is thrown when an area exceeds the | |||
* bounds of the grid. | |||
* | |||
* @author IT Mill Ltd. | |||
* @version | |||
@@ -825,7 +827,7 @@ public class GridLayout extends AbstractLayout implements | |||
* reduced if there are any areas that would be outside of the shrunk grid. | |||
* | |||
* @param columns | |||
* the new number of columns in the grid. | |||
* the new number of columns in the grid. | |||
*/ | |||
public void setColumns(int columns) { | |||
@@ -869,7 +871,7 @@ public class GridLayout extends AbstractLayout implements | |||
* reduced if there are any areas that would be outside of the shrunk grid. | |||
* | |||
* @param rows | |||
* the new number of rows in the grid. | |||
* the new number of rows in the grid. | |||
*/ | |||
public void setRows(int rows) { | |||
@@ -977,8 +979,9 @@ public class GridLayout extends AbstractLayout implements | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.itmill.toolkit.ui.Layout.AlignmentHandler#setComponentAlignment(com.itmill.toolkit.ui.Component, | |||
* int, int) | |||
* @see | |||
* com.itmill.toolkit.ui.Layout.AlignmentHandler#setComponentAlignment(com | |||
* .itmill.toolkit.ui.Component, int, int) | |||
*/ | |||
public void setComponentAlignment(Component childComponent, | |||
int horizontalAlignment, int verticalAlignment) { | |||
@@ -1010,7 +1013,7 @@ public class GridLayout extends AbstractLayout implements | |||
* Inserts an empty row at the chosen position in the grid. | |||
* | |||
* @param row | |||
* Number of the row the new row will be inserted before | |||
* Number of the row the new row will be inserted before | |||
*/ | |||
public void insertRow(int row) { | |||
if (row > rows) { | |||
@@ -1047,7 +1050,7 @@ public class GridLayout extends AbstractLayout implements | |||
* row. | |||
* | |||
* @param row | |||
* The row number to remove | |||
* The row number to remove | |||
*/ | |||
public void removeRow(int row) { | |||
if (row >= rows) { |
@@ -20,15 +20,15 @@ import com.itmill.toolkit.terminal.PaintTarget; | |||
* <p> | |||
* The contents of the label may contain simple formatting: | |||
* <ul> | |||
* <li> <b><b></b> Bold | |||
* <li> <b><i></b> Italic | |||
* <li> <b><u></b> Underlined | |||
* <li> <b><br/></b> Linebreak | |||
* <li> <b><ul><li>item 1</li><li>item 2</li></ul></b> List | |||
* of items | |||
* <li><b><b></b> Bold | |||
* <li><b><i></b> Italic | |||
* <li><b><u></b> Underlined | |||
* <li><b><br/></b> Linebreak | |||
* <li><b><ul><li>item 1</li><li>item 2</li></ul></b> List of | |||
* items | |||
* </ul> | |||
* The <b>b</b>,<b>i</b>,<b>u</b> and <b>li</b> tags can contain all the | |||
* tags in the list recursively. | |||
* The <b>b</b>,<b>i</b>,<b>u</b> and <b>li</b> tags can contain all the tags in | |||
* the list recursively. | |||
* </p> | |||
* | |||
* @author IT Mill Ltd. | |||
@@ -154,7 +154,7 @@ public class Label extends AbstractComponent implements Property, | |||
* Set the component to read-only. Readonly is not used in label. | |||
* | |||
* @param readOnly | |||
* True to enable read-only mode, False to disable it. | |||
* True to enable read-only mode, False to disable it. | |||
*/ | |||
public void setReadOnly(boolean readOnly) { | |||
if (dataSource == null) { | |||
@@ -180,9 +180,9 @@ public class Label extends AbstractComponent implements Property, | |||
* Paints the content of this component. | |||
* | |||
* @param target | |||
* the Paint Event. | |||
* the Paint Event. | |||
* @throws PaintException | |||
* if the Paint Operation fails. | |||
* if the Paint Operation fails. | |||
*/ | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
if (contentMode != CONTENT_TEXT) { | |||
@@ -230,7 +230,7 @@ public class Label extends AbstractComponent implements Property, | |||
* label. | |||
* | |||
* @param newValue | |||
* the New value of the label. | |||
* the New value of the label. | |||
*/ | |||
public void setValue(Object newValue) { | |||
if (dataSource == null) { | |||
@@ -275,7 +275,7 @@ public class Label extends AbstractComponent implements Property, | |||
* Sets the property as data-source for viewing. | |||
* | |||
* @param newDataSource | |||
* the new data source Property | |||
* the new data source Property | |||
* @see com.itmill.toolkit.data.Property.Viewer#setPropertyDataSource(com.itmill.toolkit.data.Property) | |||
*/ | |||
public void setPropertyDataSource(Property newDataSource) { | |||
@@ -303,23 +303,23 @@ public class Label extends AbstractComponent implements Property, | |||
* <p> | |||
* Possible content modes include: | |||
* <ul> | |||
* <li><b>CONTENT_TEXT</b> Content mode, where the label contains only | |||
* plain text. The getValue() result is coded to XML when painting.</li> | |||
* <li><b>CONTENT_TEXT</b> Content mode, where the label contains only plain | |||
* text. The getValue() result is coded to XML when painting.</li> | |||
* <li><b>CONTENT_PREFORMATTED</b> Content mode, where the label contains | |||
* preformatted text.</li> | |||
* <li><b>CONTENT_UIDL</b> Formatted content mode, where the contents is | |||
* XML restricted to the UIDL 1.0 formatting markups.</li> | |||
* <li><b>CONTENT_UIDL</b> Formatted content mode, where the contents is XML | |||
* restricted to the UIDL 1.0 formatting markups.</li> | |||
* <li><b>CONTENT_XHTML</b> 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".</li> | |||
* <li><b>CONTENT_XML</b> Content mode, where the label contains | |||
* well-formed or well-balanced XML. Each of the root elements must have | |||
* their default namespace specified.</li> | |||
* <li><b>CONTENT_RAW</b> 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 most cases XHTML mode should be preferred.</li> | |||
* <li><b>CONTENT_XML</b> Content mode, where the label contains well-formed | |||
* or well-balanced XML. Each of the root elements must have their default | |||
* namespace specified.</li> | |||
* <li><b>CONTENT_RAW</b> 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 most cases XHTML mode should be preferred.</li> | |||
* </ul> | |||
* </p> | |||
* | |||
@@ -335,28 +335,28 @@ public class Label extends AbstractComponent implements Property, | |||
* <p> | |||
* Possible content modes include: | |||
* <ul> | |||
* <li><b>CONTENT_TEXT</b> Content mode, where the label contains only | |||
* plain text. The getValue() result is coded to XML when painting.</li> | |||
* <li><b>CONTENT_TEXT</b> Content mode, where the label contains only plain | |||
* text. The getValue() result is coded to XML when painting.</li> | |||
* <li><b>CONTENT_PREFORMATTED</b> Content mode, where the label contains | |||
* preformatted text.</li> | |||
* <li><b>CONTENT_UIDL</b> Formatted content mode, where the contents is | |||
* XML restricted to the UIDL 1.0 formatting markups.</li> | |||
* <li><b>CONTENT_UIDL</b> Formatted content mode, where the contents is XML | |||
* restricted to the UIDL 1.0 formatting markups.</li> | |||
* <li><b>CONTENT_XHTML</b> 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".</li> | |||
* <li><b>CONTENT_XML</b> Content mode, where the label contains | |||
* well-formed or well-balanced XML. Each of the root elements must have | |||
* their default namespace specified.</li> | |||
* <li><b>CONTENT_RAW</b> 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 most cases XHTML mode should be preferred.</li> | |||
* <li><b>CONTENT_XML</b> Content mode, where the label contains well-formed | |||
* or well-balanced XML. Each of the root elements must have their default | |||
* namespace specified.</li> | |||
* <li><b>CONTENT_RAW</b> 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 most cases XHTML mode should be preferred.</li> | |||
* </ul> | |||
* </p> | |||
* | |||
* @param contentMode | |||
* the New content mode of the label. | |||
* the New content mode of the label. | |||
*/ | |||
public void setContentMode(int contentMode) { | |||
if (contentMode >= CONTENT_TEXT && contentMode <= CONTENT_RAW) { | |||
@@ -364,7 +364,7 @@ public class Label extends AbstractComponent implements Property, | |||
} | |||
} | |||
/* Value change events ****************************************** */ | |||
/* Value change events */ | |||
private static final Method VALUE_CHANGE_METHOD; | |||
@@ -375,7 +375,8 @@ public class Label extends AbstractComponent implements Property, | |||
new Class[] { Property.ValueChangeEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in Label"); | |||
} | |||
} | |||
@@ -399,7 +400,7 @@ public class Label extends AbstractComponent implements Property, | |||
* New instance of text change event | |||
* | |||
* @param source | |||
* the Source of the event. | |||
* the Source of the event. | |||
*/ | |||
public ValueChangeEvent(Label source) { | |||
super(source); | |||
@@ -419,7 +420,7 @@ public class Label extends AbstractComponent implements Property, | |||
* Adds the value change listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* 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) { | |||
@@ -430,7 +431,7 @@ public class Label extends AbstractComponent implements Property, | |||
* Removes the value change listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* 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) { | |||
@@ -472,7 +473,7 @@ public class Label extends AbstractComponent implements Property, | |||
* </p> | |||
* | |||
* @param other | |||
* the Other object to compare to. | |||
* 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) | |||
@@ -505,7 +506,7 @@ public class Label extends AbstractComponent implements Property, | |||
* Strips the tags from the XML. | |||
* | |||
* @param xml | |||
* the String containing a XML snippet. | |||
* the String containing a XML snippet. | |||
* @return the original XML without tags. | |||
*/ | |||
private String stripTags(String xml) { |
@@ -216,7 +216,8 @@ public class LoginForm extends CustomComponent { | |||
new Class[] { LoginEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in LoginForm"); | |||
} | |||
} | |||
@@ -14,31 +14,31 @@ import com.itmill.toolkit.terminal.PaintTarget; | |||
* | |||
* Example code: <code> | |||
* class MyPlayer extends CustomComponent implements ValueChangeListener { | |||
* | |||
* Label volumeIndicator = new Label(); | |||
* Slider slider; | |||
* | |||
* public MyPlayer() { | |||
* OrderedLayout ol = new OrderedLayout(); | |||
* setCompositionRoot(ol); | |||
* slider = new Slider("Volume", 0, 100); | |||
* slider.setImmediate(true); | |||
* ol.addComponent(slider); | |||
* ol.addComponent(volumeIndicator); | |||
* volumeIndicator.setValue(new Double(50)); | |||
* slider.addListener(this); | |||
* | |||
* } | |||
* | |||
* public void setVolume(double d) { | |||
* volumeIndicator.setValue("Current volume : " + d); | |||
* } | |||
* | |||
* public void valueChange(ValueChangeEvent event) { | |||
* Double d = (Double) event.getProperty().getValue(); | |||
* setVolume(d.doubleValue()); | |||
* } | |||
* } | |||
* | |||
* Label volumeIndicator = new Label(); | |||
* Slider slider; | |||
* | |||
* public MyPlayer() { | |||
* OrderedLayout ol = new OrderedLayout(); | |||
* setCompositionRoot(ol); | |||
* slider = new Slider("Volume", 0, 100); | |||
* slider.setImmediate(true); | |||
* ol.addComponent(slider); | |||
* ol.addComponent(volumeIndicator); | |||
* volumeIndicator.setValue(new Double(50)); | |||
* slider.addListener(this); | |||
* | |||
* } | |||
* | |||
* public void setVolume(double d) { | |||
* volumeIndicator.setValue("Current volume : " + d); | |||
* } | |||
* | |||
* public void valueChange(ValueChangeEvent event) { | |||
* Double d = (Double) event.getProperty().getValue(); | |||
* setVolume(d.doubleValue()); | |||
* } | |||
* } | |||
* | |||
* </code> | |||
* | |||
@@ -113,7 +113,7 @@ public class Slider extends AbstractField { | |||
* values set to defaults. | |||
* | |||
* @param caption | |||
* The caption for this Slider (e.g. "Volume"). | |||
* The caption for this Slider (e.g. "Volume"). | |||
*/ | |||
public Slider(String caption) { | |||
this(); | |||
@@ -173,7 +173,7 @@ public class Slider extends AbstractField { | |||
* is out of new bounds, the value is set to new minimum. | |||
* | |||
* @param max | |||
* New maximum value of the Slider. | |||
* New maximum value of the Slider. | |||
*/ | |||
public void setMax(double max) { | |||
this.max = max; | |||
@@ -182,6 +182,11 @@ public class Slider extends AbstractField { | |||
super.setValue(new Double(max)); | |||
} | |||
} catch (final ClassCastException e) { | |||
// FIXME: Handle exception | |||
/* | |||
* Where does ClassCastException come from? Can't see any casts | |||
* above | |||
*/ | |||
super.setValue(new Double(max)); | |||
} | |||
requestRepaint(); | |||
@@ -201,7 +206,7 @@ public class Slider extends AbstractField { | |||
* is out of new bounds, the value is set to new minimum. | |||
* | |||
* @param min | |||
* New minimum value of the Slider. | |||
* New minimum value of the Slider. | |||
*/ | |||
public void setMin(double min) { | |||
this.min = min; | |||
@@ -210,6 +215,11 @@ public class Slider extends AbstractField { | |||
super.setValue(new Double(min)); | |||
} | |||
} catch (final ClassCastException e) { | |||
// FIXME: Handle exception | |||
/* | |||
* Where does ClassCastException come from? Can't see any casts | |||
* above | |||
*/ | |||
super.setValue(new Double(min)); | |||
} | |||
requestRepaint(); | |||
@@ -227,8 +237,7 @@ public class Slider extends AbstractField { | |||
/** | |||
* Set the orientation of the Slider. | |||
* | |||
* @param int | |||
* new orientation | |||
* @param int new orientation | |||
*/ | |||
public void setOrientation(int orientation) { | |||
this.orientation = orientation; | |||
@@ -261,10 +270,10 @@ public class Slider extends AbstractField { | |||
* Set the value of this Slider. | |||
* | |||
* @param value | |||
* New value of Slider. Must be within Sliders range (min - | |||
* max), otherwise throws an exception. | |||
* New value of Slider. Must be within Sliders range (min - max), | |||
* otherwise throws an exception. | |||
* @param repaintIsNotNeeded | |||
* If true, client-side is not requested to repaint itself. | |||
* If true, client-side is not requested to repaint itself. | |||
* @throws ValueOutOfBoundsException | |||
*/ | |||
public void setValue(Double value, boolean repaintIsNotNeeded) | |||
@@ -291,8 +300,8 @@ public class Slider extends AbstractField { | |||
* Set the value of this Slider. | |||
* | |||
* @param value | |||
* New value of Slider. Must be within Sliders range (min - | |||
* max), otherwise throws an exception. | |||
* New value of Slider. Must be within Sliders range (min - max), | |||
* otherwise throws an exception. | |||
* @throws ValueOutOfBoundsException | |||
*/ | |||
public void setValue(Double value) throws ValueOutOfBoundsException { | |||
@@ -303,8 +312,8 @@ public class Slider extends AbstractField { | |||
* Set the value of this Slider. | |||
* | |||
* @param value | |||
* New value of Slider. Must be within Sliders range (min - | |||
* max), otherwise throws an exception. | |||
* New value of Slider. Must be within Sliders range (min - max), | |||
* otherwise throws an exception. | |||
* @throws ValueOutOfBoundsException | |||
*/ | |||
public void setValue(double value) throws ValueOutOfBoundsException { | |||
@@ -325,7 +334,7 @@ public class Slider extends AbstractField { | |||
* Set the size for this Slider. | |||
* | |||
* @param size | |||
* in pixels, or -1 auto sizing. | |||
* in pixels, or -1 auto sizing. | |||
* @deprecated use standard setWidth/setHeight instead | |||
*/ | |||
public void setSize(int size) { | |||
@@ -356,7 +365,7 @@ public class Slider extends AbstractField { | |||
* Set the handle size of this Slider. | |||
* | |||
* @param handleSize | |||
* in percentages relative to slider base size. | |||
* in percentages relative to slider base size. | |||
*/ | |||
public void setHandleSize(int handleSize) { | |||
if (handleSize < 0) { | |||
@@ -376,17 +385,17 @@ public class Slider extends AbstractField { | |||
* | |||
* @param visible | |||
*//* | |||
* public void setArrows(boolean visible) { arrows = visible; | |||
* requestRepaint(); } | |||
*/ | |||
* public void setArrows(boolean visible) { arrows = visible; | |||
* requestRepaint(); } | |||
*/ | |||
/* | |||
* Does the slider have arrows? | |||
* | |||
* @return arrows visible | |||
*//* | |||
* public boolean isArrowsVisible() { return arrows; } | |||
*/ | |||
* public boolean isArrowsVisible() { return arrows; } | |||
*/ | |||
public String getTag() { | |||
return "slider"; |
@@ -67,7 +67,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Removes the component from this container. | |||
* | |||
* @param c | |||
* the component to be removed. | |||
* the component to be removed. | |||
*/ | |||
public void removeComponent(Component c) { | |||
if (c != null && tabs.contains(c)) { | |||
@@ -91,7 +91,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* into tab. | |||
* | |||
* @param c | |||
* the component to be added. | |||
* the component to be added. | |||
*/ | |||
public void addComponent(Component c) { | |||
addTab(c); | |||
@@ -101,13 +101,13 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Adds a new tab into TabSheet. | |||
* | |||
* @param c | |||
* the component to be added onto tab. | |||
* the component to be added onto tab. | |||
* @param caption | |||
* the caption to be set for the component and used rendered | |||
* in tab bar | |||
* the caption to be set for the component and used rendered in | |||
* tab bar | |||
* @param icon | |||
* the icon to be set for the component and used rendered in | |||
* tab bar | |||
* the icon to be set for the component and used rendered in tab | |||
* bar | |||
*/ | |||
public void addTab(Component c, String caption, Resource icon) { | |||
if (c != null) { | |||
@@ -126,7 +126,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* into tab. | |||
* | |||
* @param c | |||
* the component to be added onto tab. | |||
* the component to be added onto tab. | |||
*/ | |||
public void addTab(Component c) { | |||
if (c != null) { | |||
@@ -154,7 +154,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* components are removed from the other container. | |||
* | |||
* @param source | |||
* the container components are removed from. | |||
* the container components are removed from. | |||
*/ | |||
public void moveComponentsFrom(ComponentContainer source) { | |||
for (final Iterator i = source.getComponentIterator(); i.hasNext();) { | |||
@@ -175,9 +175,9 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Paints the content of this component. | |||
* | |||
* @param event | |||
* the Paint Event. | |||
* the Paint Event. | |||
* @throws PaintException | |||
* if the paint operation failed. | |||
* if the paint operation failed. | |||
*/ | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
@@ -248,7 +248,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Setter for property tabsHidden. | |||
* | |||
* @param tabsHidden | |||
* True if the tabs should be hidden. | |||
* True if the tabs should be hidden. | |||
*/ | |||
public void hideTabs(boolean tabsHidden) { | |||
this.tabsHidden = tabsHidden; | |||
@@ -259,7 +259,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Gets the caption for a component. | |||
* | |||
* @param c | |||
* the component. | |||
* the component. | |||
*/ | |||
public String getTabCaption(Component c) { | |||
if (c.getCaption() == null) { | |||
@@ -273,9 +273,9 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Sets tabs captions. | |||
* | |||
* @param c | |||
* the component. | |||
* the component. | |||
* @param caption | |||
* the caption to set. | |||
* the caption to set. | |||
*/ | |||
public void setTabCaption(Component c, String caption) { | |||
if (tabs.contains(c)) { | |||
@@ -287,7 +287,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Gets the icon for a component. | |||
* | |||
* @param c | |||
* the component. | |||
* the component. | |||
*/ | |||
public Resource getTabIcon(Component c) { | |||
return c.getIcon(); | |||
@@ -405,7 +405,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
} | |||
/* Click event ************************************************ */ | |||
/* Click event */ | |||
private static final Method SELECTED_TAB_CHANGE_METHOD; | |||
static { | |||
@@ -415,7 +415,8 @@ public class TabSheet extends AbstractComponentContainer implements | |||
new Class[] { SelectedTabChangeEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in TabSheet"); | |||
} | |||
} | |||
@@ -439,7 +440,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* New instance of selected tab change event | |||
* | |||
* @param source | |||
* the Source of the event. | |||
* the Source of the event. | |||
*/ | |||
public SelectedTabChangeEvent(Component source) { | |||
super(source); | |||
@@ -470,7 +471,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Visible tab in tab sheet has has been changed. | |||
* | |||
* @param event | |||
* the Selected tab change event. | |||
* the Selected tab change event. | |||
*/ | |||
public void selectedTabChange(SelectedTabChangeEvent event); | |||
} | |||
@@ -479,7 +480,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Adds the selected tab change listener | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(SelectedTabChangeListener listener) { | |||
addListener(SelectedTabChangeEvent.class, listener, | |||
@@ -490,7 +491,7 @@ public class TabSheet extends AbstractComponentContainer implements | |||
* Removes the selected tab change listener | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(SelectedTabChangeListener listener) { | |||
removeListener(SelectedTabChangeEvent.class, listener, |
@@ -140,7 +140,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
*/ | |||
public static final int ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID = AbstractSelect.ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID; | |||
/* Private table extensions to Select *********************************** */ | |||
/* Private table extensions to Select */ | |||
/** | |||
* True if column collapsing is allowed. | |||
@@ -306,7 +306,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
*/ | |||
private CellStyleGenerator cellStyleGenerator = null; | |||
/* Table constructors *************************************************** */ | |||
/* Table constructors */ | |||
/** | |||
* Creates a new empty table. | |||
@@ -337,7 +337,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
setContainerDataSource(dataSource); | |||
} | |||
/* Table functionality ************************************************** */ | |||
/* Table functionality */ | |||
/** | |||
* Gets the array of visible column id:s, including generated columns. | |||
@@ -364,7 +364,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param visibleColumns | |||
* the Array of shown property id:s. | |||
* the Array of shown property id:s. | |||
*/ | |||
public void setVisibleColumns(Object[] visibleColumns) { | |||
@@ -461,8 +461,8 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param columnHeaders | |||
* the Array of column headers that match the | |||
* <code>getVisibleColumns</code> method. | |||
* the Array of column headers that match the | |||
* <code>getVisibleColumns</code> method. | |||
*/ | |||
public void setColumnHeaders(String[] columnHeaders) { | |||
@@ -521,8 +521,8 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param columnIcons | |||
* the Array of icons that match the | |||
* <code>getVisibleColumns</code>. | |||
* the Array of icons that match the | |||
* <code>getVisibleColumns</code>. | |||
*/ | |||
public void setColumnIcons(Resource[] columnIcons) { | |||
@@ -548,8 +548,8 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* | |||
* <p> | |||
* The items in the array must match the properties identified by | |||
* <code>getVisibleColumns()</code>. The possible values for the | |||
* alignments include: | |||
* <code>getVisibleColumns()</code>. The possible values for the alignments | |||
* include: | |||
* <ul> | |||
* <li><code>ALIGN_LEFT</code>: Left alignment</li> | |||
* <li><code>ALIGN_CENTER</code>: Centered</li> | |||
@@ -579,8 +579,8 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* | |||
* <p> | |||
* The items in the array must match the properties identified by | |||
* <code>getVisibleColumns()</code>. The possible values for the | |||
* alignments include: | |||
* <code>getVisibleColumns()</code>. The possible values for the alignments | |||
* include: | |||
* <ul> | |||
* <li><code>ALIGN_LEFT</code>: Left alignment</li> | |||
* <li><code>ALIGN_CENTER</code>: Centered</li> | |||
@@ -590,7 +590,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param columnAlignments | |||
* the Column alignments array. | |||
* the Column alignments array. | |||
*/ | |||
public void setColumnAlignments(String[] columnAlignments) { | |||
@@ -629,9 +629,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* will make decision of width. | |||
* | |||
* @param columnId | |||
* colunmns property id | |||
* colunmns property id | |||
* @param width | |||
* width to be reserved for colunmns content | |||
* width to be reserved for colunmns content | |||
* @since 4.0.3 | |||
*/ | |||
public void setColumnWidth(Object columnId, int width) { | |||
@@ -673,7 +673,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param pageLength | |||
* the Length of one page. | |||
* the Length of one page. | |||
*/ | |||
public void setPageLength(int pageLength) { | |||
if (pageLength >= 0 && this.pageLength != pageLength) { | |||
@@ -715,17 +715,16 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Setter for property currentPageFirstItemId. | |||
* | |||
* @param currentPageFirstItemId | |||
* the New value of property currentPageFirstItemId. | |||
* the New value of property currentPageFirstItemId. | |||
*/ | |||
public void setCurrentPageFirstItemId(Object currentPageFirstItemId) { | |||
// Gets the corresponding index | |||
int index = -1; | |||
try { | |||
if (items instanceof Container.Indexed) { | |||
index = ((Container.Indexed) items) | |||
.indexOfId(currentPageFirstItemId); | |||
} catch (final ClassCastException e) { | |||
} else { | |||
// If the table item container does not have index, we have to | |||
// calculates the index by hand | |||
Object id = ((Container.Ordered) items).firstItemId(); | |||
@@ -754,7 +753,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Gets the icon Resource for the specified column. | |||
* | |||
* @param propertyId | |||
* the propertyId indentifying the column. | |||
* the propertyId indentifying the column. | |||
* @return the icon for the specified column; null if the column has no icon | |||
* set, or if the column is not visible. | |||
*/ | |||
@@ -769,9 +768,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param propertyId | |||
* the propertyId identifying the column. | |||
* the propertyId identifying the column. | |||
* @param icon | |||
* the icon Resource to set. | |||
* the icon Resource to set. | |||
*/ | |||
public void setColumnIcon(Object propertyId, Resource icon) { | |||
@@ -790,7 +789,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Gets the header for the specified column. | |||
* | |||
* @param propertyId | |||
* the propertyId indentifying the column. | |||
* the propertyId indentifying the column. | |||
* @return the header for the specifed column if it has one. | |||
*/ | |||
public String getColumnHeader(Object propertyId) { | |||
@@ -811,9 +810,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Sets the column header for the specified column; | |||
* | |||
* @param propertyId | |||
* the propertyId indentifying the column. | |||
* the propertyId indentifying the column. | |||
* @param header | |||
* the header to set. | |||
* the header to set. | |||
*/ | |||
public void setColumnHeader(Object propertyId, String header) { | |||
@@ -831,7 +830,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Gets the specified column's alignment. | |||
* | |||
* @param propertyId | |||
* the propertyID identifying the column. | |||
* the propertyID identifying the column. | |||
* @return the specified column's alignment if it as one; null otherwise. | |||
*/ | |||
public String getColumnAlignment(Object propertyId) { | |||
@@ -848,9 +847,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param propertyId | |||
* the propertyID identifying the column. | |||
* the propertyID identifying the column. | |||
* @param alignment | |||
* the desired alignment. | |||
* the desired alignment. | |||
*/ | |||
public void setColumnAlignment(Object propertyId, String alignment) { | |||
@@ -877,7 +876,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Checks if the specified column is collapsed. | |||
* | |||
* @param propertyId | |||
* the propertyID identifying the column. | |||
* the propertyID identifying the column. | |||
* @return true if the column is collapsed; false otherwise; | |||
*/ | |||
public boolean isColumnCollapsed(Object propertyId) { | |||
@@ -890,9 +889,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* | |||
* | |||
* @param propertyId | |||
* the propertyID identifying the column. | |||
* the propertyID identifying the column. | |||
* @param collapsed | |||
* the desired collapsedness. | |||
* the desired collapsedness. | |||
* @throws IllegalAccessException | |||
*/ | |||
public void setColumnCollapsed(Object propertyId, boolean collapsed) | |||
@@ -925,7 +924,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Sets whether column collapsing is allowed or not. | |||
* | |||
* @param collapsingAllowed | |||
* specifies whether column collapsing is allowed. | |||
* specifies whether column collapsing is allowed. | |||
*/ | |||
public void setColumnCollapsingAllowed(boolean collapsingAllowed) { | |||
columnCollapsingAllowed = collapsingAllowed; | |||
@@ -951,7 +950,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Sets whether column reordering is allowed or not. | |||
* | |||
* @param reorderingAllowed | |||
* specifies whether column reordering is allowed. | |||
* specifies whether column reordering is allowed. | |||
*/ | |||
public void setColumnReorderingAllowed(boolean reorderingAllowed) { | |||
columnReorderingAllowed = reorderingAllowed; | |||
@@ -1081,7 +1080,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Setter for property currentPageFirstItem. | |||
* | |||
* @param newIndex | |||
* the New value of property currentPageFirstItem. | |||
* the New value of property currentPageFirstItem. | |||
*/ | |||
public void setCurrentPageFirstItemIndex(int newIndex) { | |||
setCurrentPageFirstItemIndex(newIndex, true); | |||
@@ -1104,7 +1103,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* @deprecated functionality is not needed in ajax rendering model | |||
* | |||
* @param pageBuffering | |||
* the New value of property pageBuffering. | |||
* the New value of property pageBuffering. | |||
*/ | |||
public void setPageBufferingEnabled(boolean pageBuffering) { | |||
@@ -1131,7 +1130,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param selectable | |||
* the New value of property selectable. | |||
* the New value of property selectable. | |||
*/ | |||
public void setSelectable(boolean selectable) { | |||
if (this.selectable != selectable) { | |||
@@ -1153,7 +1152,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Setter for property columnHeaderMode. | |||
* | |||
* @param columnHeaderMode | |||
* the New value of property columnHeaderMode. | |||
* the New value of property columnHeaderMode. | |||
*/ | |||
public void setColumnHeaderMode(int columnHeaderMode) { | |||
if (columnHeaderMode >= COLUMN_HEADER_MODE_HIDDEN | |||
@@ -1386,28 +1385,27 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* <p> | |||
* The mode can be one of the following ones: | |||
* <ul> | |||
* <li><code>ROW_HEADER_MODE_HIDDEN</code>: The row captions are hidden. | |||
* </li> | |||
* <li><code>ROW_HEADER_MODE_HIDDEN</code>: The row captions are hidden.</li> | |||
* <li><code>ROW_HEADER_MODE_ID</code>: Items Id-objects | |||
* <code>toString()</code> is used as row caption. | |||
* <li><code>ROW_HEADER_MODE_ITEM</code>: Item-objects | |||
* <code>toString()</code> is used as row caption. | |||
* <li><code>ROW_HEADER_MODE_PROPERTY</code>: Property set with | |||
* <code>setItemCaptionPropertyId()</code> is used as row header. | |||
* <li><code>ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID</code>: Items | |||
* Id-objects <code>toString()</code> is used as row header. If caption is | |||
* explicitly specified, it overrides the id-caption. | |||
* <li><code>ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID</code>: Items Id-objects | |||
* <code>toString()</code> is used as row header. If caption is explicitly | |||
* specified, it overrides the id-caption. | |||
* <li><code>ROW_HEADER_MODE_EXPLICIT</code>: The row headers must be | |||
* explicitly specified.</li> | |||
* <li><code>ROW_HEADER_MODE_INDEX</code>: The index of the item is used | |||
* as row caption. The index mode can only be used with the containers | |||
* <li><code>ROW_HEADER_MODE_INDEX</code>: The index of the item is used as | |||
* row caption. The index mode can only be used with the containers | |||
* implementing <code>Container.Indexed</code> interface.</li> | |||
* </ul> | |||
* The default value is <code>ROW_HEADER_MODE_HIDDEN</code> | |||
* </p> | |||
* | |||
* @param mode | |||
* the One of the modes listed above. | |||
* the One of the modes listed above. | |||
*/ | |||
public void setRowHeaderMode(int mode) { | |||
if (ROW_HEADER_MODE_HIDDEN == mode) { | |||
@@ -1437,13 +1435,13 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* columns) with given values. | |||
* | |||
* @param cells | |||
* the Object array that is used for filling the visible | |||
* cells new row. The types must be settable to visible | |||
* column property types. | |||
* the Object array that is used for filling the visible cells | |||
* new row. The types must be settable to visible column property | |||
* types. | |||
* @param itemId | |||
* the Id the new row. If null, a new id is automatically | |||
* assigned. If given, the table cant already have a item | |||
* with given id. | |||
* the Id the new row. If null, a new id is automatically | |||
* assigned. If given, the table cant already have a item with | |||
* given id. | |||
* @return Returns item id for the new row. Returns null if operation fails. | |||
*/ | |||
public Object addItem(Object[] cells, Object itemId) | |||
@@ -1490,7 +1488,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
return itemId; | |||
} | |||
/* Overriding select behavior ******************************************** */ | |||
/* Overriding select behavior */ | |||
public void setValue(Object newValue) throws ReadOnlyException, | |||
ConversionException { | |||
@@ -1559,7 +1557,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
} | |||
/* Component basics ***************************************************** */ | |||
/* Component basics */ | |||
/** | |||
* Invoked when the value of a variable has changed. | |||
@@ -1600,6 +1598,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
lastToBeRenderedInClient = ((Integer) variables | |||
.get("lastToBeRendered")).intValue(); | |||
} catch (Exception e) { | |||
// FIXME: Handle exception | |||
e.printStackTrace(); | |||
} | |||
@@ -1680,7 +1679,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
setColumnCollapsed(columnIdMap.get(ids[i].toString()), | |||
true); | |||
} | |||
} catch (final Exception ignored) { | |||
} catch (final Exception e) { | |||
// FIXME: Handle exception | |||
e.printStackTrace(); | |||
} | |||
clientNeedsContentRefresh = true; | |||
} | |||
@@ -1694,7 +1695,10 @@ public class Table extends AbstractSelect implements Action.Container, | |||
ids[i] = columnIdMap.get(ids[i].toString()); | |||
} | |||
setColumnOrder(ids); | |||
} catch (final Exception ignored) { | |||
} catch (final Exception e) { | |||
// FIXME: Handle exception | |||
e.printStackTrace(); | |||
} | |||
clientNeedsContentRefresh = true; | |||
} | |||
@@ -1720,7 +1724,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Go to mode where content content refreshing has effect. | |||
* | |||
* @param refreshContent | |||
* true if content refresh needs to be done | |||
* true if content refresh needs to be done | |||
*/ | |||
protected void enableContentRefreshing(boolean refreshContent) { | |||
isContentRefreshesEnabled = true; | |||
@@ -1732,7 +1736,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.itmill.toolkit.ui.AbstractSelect#paintContent(com.itmill.toolkit.terminal.PaintTarget) | |||
* @see | |||
* com.itmill.toolkit.ui.AbstractSelect#paintContent(com.itmill.toolkit. | |||
* terminal.PaintTarget) | |||
*/ | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
@@ -2100,11 +2106,11 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* the value representation. | |||
* | |||
* @param rowId | |||
* the Id of the row (same as item Id). | |||
* the Id of the row (same as item Id). | |||
* @param colId | |||
* the Id of the column. | |||
* the Id of the column. | |||
* @param property | |||
* the Property to be presented. | |||
* the Property to be presented. | |||
* @return Object Either formatted value or Component for field. | |||
* @see #setFieldFactory(FieldFactory) | |||
*/ | |||
@@ -2127,11 +2133,11 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* and return a empty string for null properties. | |||
* | |||
* @param rowId | |||
* the Id of the row (same as item Id). | |||
* the Id of the row (same as item Id). | |||
* @param colId | |||
* the Id of the column. | |||
* the Id of the column. | |||
* @param property | |||
* the Property to be formatted. | |||
* the Property to be formatted. | |||
* @return the String representation of property and its value. | |||
* @since 3.1 | |||
*/ | |||
@@ -2143,7 +2149,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
return property.toString(); | |||
} | |||
/* Action container *************************************************** */ | |||
/* Action container */ | |||
/** | |||
* Registers a new action handler for this container | |||
@@ -2188,7 +2194,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
} | |||
} | |||
/* Property value change listening support **************************** */ | |||
/* Property value change listening support */ | |||
/** | |||
* Notifies this listener that the Property's value has changed. | |||
@@ -2299,11 +2305,11 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Adds a new property to the table and show it as a visible column. | |||
* | |||
* @param propertyId | |||
* the Id of the proprty. | |||
* the Id of the proprty. | |||
* @param type | |||
* the class of the property. | |||
* the class of the property. | |||
* @param defaultValue | |||
* the default value given for all existing items. | |||
* the default value given for all existing items. | |||
* @see com.itmill.toolkit.data.Container#addContainerProperty(Object, | |||
* Class, Object) | |||
*/ | |||
@@ -2333,21 +2339,21 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Adds a new property to the table and show it as a visible column. | |||
* | |||
* @param propertyId | |||
* the Id of the proprty | |||
* the Id of the proprty | |||
* @param type | |||
* the class of the property | |||
* the class of the property | |||
* @param defaultValue | |||
* the default value given for all existing items | |||
* the default value given for all existing items | |||
* @param columnHeader | |||
* the Explicit header of the column. If explicit header is | |||
* not needed, this should be set null. | |||
* the Explicit header of the column. If explicit header is not | |||
* needed, this should be set null. | |||
* @param columnIcon | |||
* the Icon of the column. If icon is not needed, this should | |||
* be set null. | |||
* the Icon of the column. If icon is not needed, this should be | |||
* set null. | |||
* @param columnAlignment | |||
* the Alignment of the column. Null implies align left. | |||
* the Alignment of the column. Null implies align left. | |||
* @throws UnsupportedOperationException | |||
* if the operation is not supported. | |||
* if the operation is not supported. | |||
* @see com.itmill.toolkit.data.Container#addContainerProperty(Object, | |||
* Class, Object) | |||
*/ | |||
@@ -2382,9 +2388,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* </p> | |||
* | |||
* @param id | |||
* the id of the column to be added | |||
* the id of the column to be added | |||
* @param generatedColumn | |||
* the {@link ColumnGenerator} to use for this column | |||
* the {@link ColumnGenerator} to use for this column | |||
*/ | |||
public void addGeneratedColumn(Object id, ColumnGenerator generatedColumn) { | |||
if (generatedColumn == null) { | |||
@@ -2406,7 +2412,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Removes a generated column previously added with addGeneratedColumn. | |||
* | |||
* @param id | |||
* id of the generated column to remove | |||
* id of the generated column to remove | |||
* @return true if the column could be removed (existed in the Table) | |||
*/ | |||
public boolean removeGeneratedColumn(Object id) { | |||
@@ -2481,7 +2487,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Adding new items is not supported. | |||
* | |||
* @throws UnsupportedOperationException | |||
* if set to true. | |||
* if set to true. | |||
* @see com.itmill.toolkit.ui.Select#setNewItemsAllowed(boolean) | |||
*/ | |||
public void setNewItemsAllowed(boolean allowNewOptions) | |||
@@ -2495,7 +2501,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Focusing to this component is not supported. | |||
* | |||
* @throws UnsupportedOperationException | |||
* if invoked. | |||
* if invoked. | |||
* @see com.itmill.toolkit.ui.AbstractField#focus() | |||
*/ | |||
public void focus() throws UnsupportedOperationException { | |||
@@ -2611,7 +2617,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* BaseFieldFactory is used. | |||
* | |||
* @param fieldFactory | |||
* the field factory to set. | |||
* the field factory to set. | |||
* @see #isEditable | |||
* @see BaseFieldFactory | |||
* | |||
@@ -2654,7 +2660,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* property to true. | |||
* | |||
* @param editable | |||
* true if table should be editable by user. | |||
* true if table should be editable by user. | |||
* @see Field | |||
* @see FieldFactory | |||
* | |||
@@ -2671,8 +2677,8 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Sorts the table. | |||
* | |||
* @throws UnsupportedOperationException | |||
* if the container data source does not implement | |||
* Container.Sortable | |||
* if the container data source does not implement | |||
* Container.Sortable | |||
* @see com.itmill.toolkit.data.Container.Sortable#sort(java.lang.Object[], | |||
* boolean[]) | |||
* | |||
@@ -2697,8 +2703,8 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Sorts the table by currently selected sorting column. | |||
* | |||
* @throws UnsupportedOperationException | |||
* if the container data source does not implement | |||
* Container.Sortable | |||
* if the container data source does not implement | |||
* Container.Sortable | |||
*/ | |||
public void sort() { | |||
if (getSortContainerPropertyId() == null) { | |||
@@ -2735,7 +2741,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Sets the currently sorted column property id. | |||
* | |||
* @param propertyId | |||
* the Container property id of the currently sorted column. | |||
* the Container property id of the currently sorted column. | |||
*/ | |||
public void setSortContainerPropertyId(Object propertyId) { | |||
setSortContainerPropertyId(propertyId, true); | |||
@@ -2765,8 +2771,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
/** | |||
* Is the table currently sorted in ascending order. | |||
* | |||
* @return <code>true</code> if ascending, <code>false</code> if | |||
* descending. | |||
* @return <code>true</code> if ascending, <code>false</code> if descending. | |||
*/ | |||
public boolean isSortAscending() { | |||
return sortAscending; | |||
@@ -2776,8 +2781,8 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Sets the table in ascending order. | |||
* | |||
* @param ascending | |||
* <code>true</code> if ascending, <code>false</code> if | |||
* descending. | |||
* <code>true</code> if ascending, <code>false</code> if | |||
* descending. | |||
*/ | |||
public void setSortAscending(boolean ascending) { | |||
setSortAscending(ascending, true); | |||
@@ -2820,7 +2825,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* columns are given even in the case where datasource would support this. | |||
* | |||
* @param sortDisabled | |||
* True iff sorting is disabled. | |||
* True iff sorting is disabled. | |||
*/ | |||
public void setSortDisabled(boolean sortDisabled) { | |||
if (this.sortDisabled != sortDisabled) { | |||
@@ -2865,13 +2870,12 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* generated. | |||
* | |||
* @param source | |||
* the source Table | |||
* the source Table | |||
* @param itemId | |||
* the itemId (aka rowId) for the of the cell to be | |||
* generated | |||
* the itemId (aka rowId) for the of the cell to be generated | |||
* @param columnId | |||
* the id for the generated column (as specified in | |||
* addGeneratedColumn) | |||
* the id for the generated column (as specified in | |||
* addGeneratedColumn) | |||
* @return | |||
*/ | |||
public abstract Component generateCell(Table source, Object itemId, | |||
@@ -2882,7 +2886,7 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Set cell style generator for Table. | |||
* | |||
* @param cellStyleGenerator | |||
* New cell style generator or null to remove generator. | |||
* New cell style generator or null to remove generator. | |||
*/ | |||
public void setCellStyleGenerator(CellStyleGenerator cellStyleGenerator) { | |||
this.cellStyleGenerator = cellStyleGenerator; | |||
@@ -2910,10 +2914,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
* Called by Table when a cell (and row) is painted. | |||
* | |||
* @param itemId | |||
* The itemId of the painted cell | |||
* The itemId of the painted cell | |||
* @param propertyId | |||
* The propertyId of the cell, null when getting row | |||
* style | |||
* The propertyId of the cell, null when getting row style | |||
* @return The style name to add to this cell or row. (the CSS class | |||
* name will be i-table-cell-content-[style name], or | |||
* i-table-row-[style name] for rows) |
@@ -19,8 +19,8 @@ import com.itmill.toolkit.terminal.PaintTarget; | |||
* </p> | |||
* | |||
* <p> | |||
* Since <code>TextField</code> extends <code>AbstractField</code> it | |||
* implements the {@link com.itmill.toolkit.data.Buffered} interface. A | |||
* 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. | |||
@@ -33,7 +33,7 @@ import com.itmill.toolkit.terminal.PaintTarget; | |||
*/ | |||
public class TextField extends AbstractField { | |||
/* Private members ************************************************* */ | |||
/* Private members */ | |||
/** | |||
* Value formatter used to format the string contents. | |||
@@ -73,7 +73,7 @@ public class TextField extends AbstractField { | |||
*/ | |||
private boolean nullSettingAllowed = false; | |||
/* Constructors **************************************************** */ | |||
/* Constructors */ | |||
/** | |||
* Constructs an empty <code>TextField</code> with no caption. | |||
@@ -86,7 +86,7 @@ public class TextField extends AbstractField { | |||
* Constructs an empty <code>TextField</code> with given caption. | |||
* | |||
* @param caption | |||
* the caption <code>String</code> for the editor. | |||
* the caption <code>String</code> for the editor. | |||
*/ | |||
public TextField(String caption) { | |||
setValue(""); | |||
@@ -98,7 +98,7 @@ public class TextField 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 TextField(Property dataSource) { | |||
setPropertyDataSource(dataSource); | |||
@@ -109,9 +109,9 @@ public class TextField extends AbstractField { | |||
* <code>Property</code> and has the given caption <code>String</code>. | |||
* | |||
* @param caption | |||
* the caption <code>String</code> for the editor. | |||
* the caption <code>String</code> for the editor. | |||
* @param dataSource | |||
* the Property to be edited with this editor. | |||
* the Property to be edited with this editor. | |||
*/ | |||
public TextField(String caption, Property dataSource) { | |||
this(dataSource); | |||
@@ -126,16 +126,16 @@ public class TextField extends AbstractField { | |||
* is called to bind it. | |||
* | |||
* @param caption | |||
* the caption <code>String</code> for the editor. | |||
* the caption <code>String</code> for the editor. | |||
* @param text | |||
* the initial text content of the editor. | |||
* the initial text content of the editor. | |||
*/ | |||
public TextField(String caption, String value) { | |||
setValue(value); | |||
setCaption(caption); | |||
} | |||
/* Component basic features ********************************************* */ | |||
/* Component basic features */ | |||
/* | |||
* Paints this component. Don't add a JavaDoc comment here, we use the | |||
@@ -188,8 +188,8 @@ public class TextField extends AbstractField { | |||
if (format != null && value != null) { | |||
try { | |||
return format.format(value); | |||
} catch (final IllegalArgumentException ignored) { | |||
// Ignored exception | |||
} catch (final IllegalArgumentException e) { | |||
// FIXME: Handle exception ? | |||
} | |||
} | |||
if (value != null) { | |||
@@ -242,7 +242,7 @@ public class TextField extends AbstractField { | |||
} | |||
/* Text field configuration ********************************************* */ | |||
/* Text field configuration */ | |||
/** | |||
* Gets the number of columns in the editor. If the number of columns is set | |||
@@ -261,7 +261,7 @@ public class TextField extends AbstractField { | |||
* adapter. | |||
* | |||
* @param columns | |||
* the number of columns to set. | |||
* the number of columns to set. | |||
*/ | |||
public void setColumns(int columns) { | |||
if (columns < 0) { | |||
@@ -288,7 +288,7 @@ public class TextField extends AbstractField { | |||
* adapter. | |||
* | |||
* @param rows | |||
* the number of rows for this editor. | |||
* the number of rows for this editor. | |||
*/ | |||
public void setRows(int rows) { | |||
if (rows < 0) { | |||
@@ -312,14 +312,14 @@ public class TextField extends AbstractField { | |||
* Sets the editor's word-wrap mode on or off. | |||
* | |||
* @param wordwrap | |||
* the boolean value specifying if the editor should be in | |||
* word-wrap mode after the call or not. | |||
* the boolean value specifying if the editor should be in | |||
* word-wrap mode after the call or not. | |||
*/ | |||
public void setWordwrap(boolean wordwrap) { | |||
this.wordwrap = wordwrap; | |||
} | |||
/* Property features **************************************************** */ | |||
/* Property features */ | |||
/* | |||
* Gets the edited property's type. Don't add a JavaDoc comment here, we use | |||
@@ -345,8 +345,8 @@ public class TextField extends AbstractField { | |||
* secretinformation the information is not echoed to display. | |||
* | |||
* @param secret | |||
* the value specifying if the field is used to enter secret | |||
* information. | |||
* the value specifying if the field is used to enter secret | |||
* information. | |||
*/ | |||
public void setSecret(boolean secret) { | |||
this.secret = secret; | |||
@@ -411,7 +411,7 @@ public class TextField extends AbstractField { | |||
* </p> | |||
* | |||
* @param nullRepresentation | |||
* Textual representation for null strings. | |||
* Textual representation for null strings. | |||
* @see TextField#setNullSettingAllowed(boolean) | |||
*/ | |||
public void setNullRepresentation(String nullRepresentation) { | |||
@@ -435,8 +435,8 @@ public class TextField extends AbstractField { | |||
* </p> | |||
* | |||
* @param nullSettingAllowed | |||
* Should the null-string represenation be allways converted | |||
* to null-values. | |||
* Should the null-string represenation be allways converted to | |||
* null-values. | |||
* @see TextField#getNullRepresentation() | |||
*/ | |||
public void setNullSettingAllowed(boolean nullSettingAllowed) { | |||
@@ -456,8 +456,8 @@ public class TextField extends AbstractField { | |||
* Gets the value formatter of TextField. | |||
* | |||
* @param format | |||
* the Format used to format the value. Null disables the | |||
* formatting. | |||
* the Format used to format the value. Null disables the | |||
* formatting. | |||
*/ | |||
public void setFormat(Format format) { | |||
this.format = format; |
@@ -38,7 +38,7 @@ import com.itmill.toolkit.terminal.Resource; | |||
public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
Action.Container { | |||
/* Static members ***************************************************** */ | |||
/* Static members */ | |||
private static final Method EXPAND_METHOD; | |||
@@ -52,13 +52,12 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
"nodeCollapse", new Class[] { CollapseEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
e.printStackTrace(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error, please report"); | |||
"Internal error finding methods in Tree"); | |||
} | |||
} | |||
/* Private members **************************************************** */ | |||
/* Private members */ | |||
/** | |||
* Set of expanded nodes. | |||
@@ -96,7 +95,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
*/ | |||
private boolean initialPaint = true; | |||
/* Tree constructors ************************************************** */ | |||
/* Tree constructors */ | |||
/** | |||
* Creates a new empty tree. | |||
@@ -124,13 +123,13 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
setContainerDataSource(dataSource); | |||
} | |||
/* Expanding and collapsing ******************************************* */ | |||
/* Expanding and collapsing */ | |||
/** | |||
* Check is an item is expanded | |||
* | |||
* @param itemId | |||
* the item id. | |||
* the item id. | |||
* @return true iff the item is expanded. | |||
*/ | |||
public boolean isExpanded(Object itemId) { | |||
@@ -141,7 +140,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Expands an item. | |||
* | |||
* @param itemId | |||
* the item id. | |||
* the item id. | |||
* @return True iff the expand operation succeeded | |||
*/ | |||
public boolean expandItem(Object itemId) { | |||
@@ -152,10 +151,10 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Expands an item. | |||
* | |||
* @param itemId | |||
* the item id. | |||
* the item id. | |||
* @param sendChildTree | |||
* flag to indicate if client needs subtree or not (may be | |||
* cached) | |||
* flag to indicate if client needs subtree or not (may be | |||
* cached) | |||
* @return True iff the expand operation succeeded | |||
*/ | |||
private boolean expandItem(Object itemId, boolean sendChildTree) { | |||
@@ -229,7 +228,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Collapses an item. | |||
* | |||
* @param itemId | |||
* the item id. | |||
* the item id. | |||
* @return True iff the collapse operation succeeded | |||
*/ | |||
public boolean collapseItem(Object itemId) { | |||
@@ -299,7 +298,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* </p> | |||
* | |||
* @param selectable | |||
* the New value of property selectable. | |||
* the New value of property selectable. | |||
*/ | |||
public void setSelectable(boolean selectable) { | |||
if (this.selectable != selectable) { | |||
@@ -308,7 +307,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
} | |||
} | |||
/* Component API ****************************************************** */ | |||
/* Component API */ | |||
/** | |||
* Gets the UIDL tag corresponding to the component. | |||
@@ -565,7 +564,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
} | |||
} | |||
/* Container.Hierarchical API ***************************************** */ | |||
/* Container.Hierarchical API */ | |||
/** | |||
* Tests if the Item with given ID can have any children. | |||
@@ -595,8 +594,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
} | |||
/** | |||
* Tests if the Item specified with <code>itemId</code> has any child | |||
* Items, that is, is it a leaf Item. | |||
* 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) | |||
*/ | |||
@@ -652,7 +651,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
return success; | |||
} | |||
/* Overriding select behavior******************************************** */ | |||
/* Overriding select behavior */ | |||
/** | |||
* Sets the Container that serves as the data source of the viewer. | |||
@@ -678,7 +677,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
} | |||
} | |||
/* Expand event and listener ****************************************** */ | |||
/* Expand event and listener */ | |||
/** | |||
* Event to fired when a node is expanded. ExapandEvent is fired when a node | |||
@@ -703,7 +702,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* New instance of options change event | |||
* | |||
* @param source | |||
* the Source of the event. | |||
* the Source of the event. | |||
* @param expandedItemId | |||
*/ | |||
public ExpandEvent(Component source, Object expandedItemId) { | |||
@@ -735,7 +734,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* A node has been expanded. | |||
* | |||
* @param event | |||
* the Expand event. | |||
* the Expand event. | |||
*/ | |||
public void nodeExpand(ExpandEvent event); | |||
} | |||
@@ -744,7 +743,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Adds the expand listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(ExpandListener listener) { | |||
addListener(ExpandEvent.class, listener, EXPAND_METHOD); | |||
@@ -754,7 +753,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Removes the expand listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(ExpandListener listener) { | |||
removeListener(ExpandEvent.class, listener, EXPAND_METHOD); | |||
@@ -764,13 +763,13 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Emits the expand event. | |||
* | |||
* @param itemId | |||
* the item id. | |||
* the item id. | |||
*/ | |||
protected void fireExpandEvent(Object itemId) { | |||
fireEvent(new ExpandEvent(this, itemId)); | |||
} | |||
/* Collapse event ****************************************** */ | |||
/* Collapse event */ | |||
/** | |||
* Collapse event | |||
@@ -793,7 +792,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* New instance of options change event. | |||
* | |||
* @param source | |||
* the Source of the event. | |||
* the Source of the event. | |||
* @param collapsedItemId | |||
*/ | |||
public CollapseEvent(Component source, Object collapsedItemId) { | |||
@@ -825,7 +824,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* A node has been collapsed. | |||
* | |||
* @param event | |||
* the Collapse event. | |||
* the Collapse event. | |||
*/ | |||
public void nodeCollapse(CollapseEvent event); | |||
} | |||
@@ -834,7 +833,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Adds the collapse listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(CollapseListener listener) { | |||
addListener(CollapseEvent.class, listener, COLLAPSE_METHOD); | |||
@@ -844,7 +843,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Removes the collapse listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(CollapseListener listener) { | |||
removeListener(CollapseEvent.class, listener, COLLAPSE_METHOD); | |||
@@ -854,13 +853,13 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Emits collapse event. | |||
* | |||
* @param itemId | |||
* the item id. | |||
* the item id. | |||
*/ | |||
protected void fireCollapseEvent(Object itemId) { | |||
fireEvent(new CollapseEvent(this, itemId)); | |||
} | |||
/* Action container *************************************************** */ | |||
/* Action container */ | |||
/** | |||
* Adds an action handler. | |||
@@ -963,7 +962,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Adding new items is not supported. | |||
* | |||
* @throws UnsupportedOperationException | |||
* if set to true. | |||
* if set to true. | |||
* @see com.itmill.toolkit.ui.Select#setNewItemsAllowed(boolean) | |||
*/ | |||
public void setNewItemsAllowed(boolean allowNewOptions) | |||
@@ -977,7 +976,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, | |||
* Focusing to this component is not supported. | |||
* | |||
* @throws UnsupportedOperationException | |||
* if invoked. | |||
* if invoked. | |||
* @see com.itmill.toolkit.ui.AbstractField#focus() | |||
*/ | |||
public void focus() throws UnsupportedOperationException { |
@@ -88,11 +88,10 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* stream given by the Receiver. | |||
* | |||
* @param caption | |||
* Normal component caption. You can set the caption of the | |||
* upload submit button with setButtonCaption(). | |||
* Normal component caption. You can set the caption of the | |||
* upload submit button with setButtonCaption(). | |||
* @param uploadReceiver | |||
* Receiver to call to retrieve output stream when upload | |||
* starts. | |||
* Receiver to call to retrieve output stream when upload starts. | |||
*/ | |||
public Upload(String caption, Receiver uploadReceiver) { | |||
setCaption(caption); | |||
@@ -200,9 +199,9 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Paints the content of this component. | |||
* | |||
* @param target | |||
* Target to paint the content on. | |||
* Target to paint the content on. | |||
* @throws PaintException | |||
* if the paint operation failed. | |||
* if the paint operation failed. | |||
*/ | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
// The field should be focused | |||
@@ -239,16 +238,16 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Invoked when a new upload arrives. | |||
* | |||
* @param filename | |||
* the desired filename of the upload, usually as | |||
* specified by the client. | |||
* the desired filename of the upload, usually as specified | |||
* by the client. | |||
* @param MIMEType | |||
* the MIME type of the uploaded file. | |||
* the MIME type of the uploaded file. | |||
* @return Stream to which the uploaded file should be written. | |||
*/ | |||
public OutputStream receiveUpload(String filename, String MIMEType); | |||
} | |||
/* Upload events ************************************************ */ | |||
/* Upload events */ | |||
private static final Method UPLOAD_FINISHED_METHOD; | |||
@@ -271,7 +270,8 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
new Class[] { SucceededEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException("Internal error"); | |||
throw new java.lang.RuntimeException( | |||
"Internal error finding methods in Upload"); | |||
} | |||
} | |||
@@ -311,13 +311,13 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
/** | |||
* | |||
* @param source | |||
* the source of the file. | |||
* the source of the file. | |||
* @param filename | |||
* the received file name. | |||
* the received file name. | |||
* @param MIMEType | |||
* the MIME type of the received file. | |||
* the MIME type of the received file. | |||
* @param length | |||
* the length of the received file. | |||
* the length of the received file. | |||
*/ | |||
public FinishedEvent(Upload source, String filename, String MIMEType, | |||
long length) { | |||
@@ -570,7 +570,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Upload has started. | |||
* | |||
* @param event | |||
* the Upload started event. | |||
* the Upload started event. | |||
*/ | |||
public void uploadStarted(StartedEvent event); | |||
} | |||
@@ -589,7 +589,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Upload has finished. | |||
* | |||
* @param event | |||
* the Upload finished event. | |||
* the Upload finished event. | |||
*/ | |||
public void uploadFinished(FinishedEvent event); | |||
} | |||
@@ -608,7 +608,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Upload has finished unsuccessfully. | |||
* | |||
* @param event | |||
* the Upload failed event. | |||
* the Upload failed event. | |||
*/ | |||
public void uploadFailed(FailedEvent event); | |||
} | |||
@@ -627,7 +627,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Upload successfull.. | |||
* | |||
* @param event | |||
* the Upload successfull event. | |||
* the Upload successfull event. | |||
*/ | |||
public void uploadSucceeded(SucceededEvent event); | |||
} | |||
@@ -636,7 +636,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Adds the upload started event listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(StartedListener listener) { | |||
addListener(StartedEvent.class, listener, UPLOAD_STARTED_METHOD); | |||
@@ -646,7 +646,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Removes the upload started event listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(StartedListener listener) { | |||
removeListener(StartedEvent.class, listener, UPLOAD_STARTED_METHOD); | |||
@@ -656,7 +656,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Adds the upload received event listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(FinishedListener listener) { | |||
addListener(FinishedEvent.class, listener, UPLOAD_FINISHED_METHOD); | |||
@@ -666,7 +666,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Removes the upload received event listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(FinishedListener listener) { | |||
removeListener(FinishedEvent.class, listener, UPLOAD_FINISHED_METHOD); | |||
@@ -676,7 +676,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Adds the upload interrupted event listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(FailedListener listener) { | |||
addListener(FailedEvent.class, listener, UPLOAD_FAILED_METHOD); | |||
@@ -686,7 +686,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Removes the upload interrupted event listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(FailedListener listener) { | |||
removeListener(FailedEvent.class, listener, UPLOAD_FAILED_METHOD); | |||
@@ -696,7 +696,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Adds the upload success event listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(SucceededListener listener) { | |||
addListener(SucceededEvent.class, listener, UPLOAD_SUCCEEDED_METHOD); | |||
@@ -706,7 +706,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Removes the upload success event listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(SucceededListener listener) { | |||
removeListener(SucceededEvent.class, listener, UPLOAD_SUCCEEDED_METHOD); | |||
@@ -716,7 +716,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Adds the upload success event listener. | |||
* | |||
* @param listener | |||
* the Listener to be added. | |||
* the Listener to be added. | |||
*/ | |||
public void addListener(ProgressListener listener) { | |||
if (progressListeners == null) { | |||
@@ -729,7 +729,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Removes the upload success event listener. | |||
* | |||
* @param listener | |||
* the Listener to be removed. | |||
* the Listener to be removed. | |||
*/ | |||
public void removeListener(ProgressListener listener) { | |||
if (progressListeners != null) { | |||
@@ -806,9 +806,9 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Emits the progress event. | |||
* | |||
* @param totalBytes | |||
* bytes received so far | |||
* bytes received so far | |||
* @param contentLength | |||
* actual size of the file being uploaded, if known | |||
* actual size of the file being uploaded, if known | |||
* | |||
*/ | |||
protected void fireUpdateProgress(long totalBytes, long contentLength) { | |||
@@ -839,7 +839,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Sets the receiver. | |||
* | |||
* @param receiver | |||
* the receiver to set. | |||
* the receiver to set. | |||
*/ | |||
public void setReceiver(Receiver receiver) { | |||
this.receiver = receiver; | |||
@@ -965,10 +965,9 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* Updates progress to listener | |||
* | |||
* @param readBytes | |||
* bytes transferred | |||
* bytes transferred | |||
* @param contentLength | |||
* total size of file currently being uploaded, -1 if | |||
* unknown | |||
* total size of file currently being uploaded, -1 if unknown | |||
*/ | |||
public void updateProgress(long readBytes, long contentLength); | |||
} | |||
@@ -985,7 +984,7 @@ public class Upload extends AbstractComponent implements Component.Focusable { | |||
* method is used to set text in that button. | |||
* | |||
* @param buttonCaption | |||
* text for uploads button. | |||
* text for uploads button. | |||
*/ | |||
public void setButtonCaption(String buttonCaption) { | |||
this.buttonCaption = buttonCaption; |
@@ -127,7 +127,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* </p> | |||
* | |||
* @param caption | |||
* the Title of the window. | |||
* the Title of the window. | |||
*/ | |||
public Window() { | |||
this("", null); | |||
@@ -146,7 +146,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* </p> | |||
* | |||
* @param caption | |||
* the Title of the window. | |||
* the Title of the window. | |||
*/ | |||
public Window(String caption) { | |||
this(caption, null); | |||
@@ -165,9 +165,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* </p> | |||
* | |||
* @param caption | |||
* the Title of the window. | |||
* the Title of the window. | |||
* @param layout | |||
* the Layout of the window. | |||
* the Layout of the window. | |||
*/ | |||
public Window(String caption, Layout layout) { | |||
super(caption, layout); | |||
@@ -220,8 +220,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* | |||
* <p> | |||
* For windows attached directly to the application, parent is | |||
* <code>null</code>. For windows inside other windows, parent is the | |||
* window containing this window. | |||
* <code>null</code>. For windows inside other windows, parent is the window | |||
* containing this window. | |||
* </p> | |||
* | |||
* @return the Value of property parent. | |||
@@ -239,7 +239,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* </p> | |||
* | |||
* @param parent | |||
* the New value of property parent. | |||
* the New value of property parent. | |||
*/ | |||
public void setParent(Component parent) { | |||
super.setParent(parent); | |||
@@ -261,7 +261,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* are attached to root level window. | |||
* | |||
* @param handler | |||
* the URI handler to add. | |||
* the URI handler to add. | |||
*/ | |||
public void addURIHandler(URIHandler handler) { | |||
if (getParent() != null) { | |||
@@ -285,7 +285,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Removes the given URI handler from this window. | |||
* | |||
* @param handler | |||
* the URI handler to remove. | |||
* the URI handler to remove. | |||
*/ | |||
public void removeURIHandler(URIHandler handler) { | |||
if (getParent() != null) { | |||
@@ -342,7 +342,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* handlers are attached to parent windows. | |||
* | |||
* @param handler | |||
* the parameter handler to add. | |||
* the parameter handler to add. | |||
*/ | |||
public void addParameterHandler(ParameterHandler handler) { | |||
if (getParent() != null) { | |||
@@ -367,7 +367,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Removes the given URI handler from this window. | |||
* | |||
* @param handler | |||
* the parameter handler to remove. | |||
* the parameter handler to remove. | |||
*/ | |||
public void removeParameterHandler(ParameterHandler handler) { | |||
if (getParent() != null) { | |||
@@ -439,13 +439,12 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* In Toolkit 5 terminal will reload its host page on theme changes. | |||
* | |||
* @param theme | |||
* the 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) { | |||
if (getParent() != null) { | |||
throw new UnsupportedOperationException( | |||
"Setting theme for sub-windws is not supported."); | |||
"Setting theme for sub-windows is not supported."); | |||
} | |||
this.theme = theme; | |||
requestRepaint(); | |||
@@ -455,9 +454,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Paints the content of this component. | |||
* | |||
* @param event | |||
* the Paint Event. | |||
* the Paint Event. | |||
* @throws PaintException | |||
* if the paint operation failed. | |||
* if the paint operation failed. | |||
*/ | |||
public synchronized void paintContent(PaintTarget target) | |||
throws PaintException { | |||
@@ -477,8 +476,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
if (resizable) { | |||
target.addAttribute("resizable", true); | |||
} | |||
if(centerRequested) { | |||
if (centerRequested) { | |||
target.addAttribute("center", true); | |||
centerRequested = false; | |||
} | |||
@@ -568,9 +567,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* window. | |||
* | |||
* @param resource | |||
* the resource. | |||
* the resource. | |||
* @param windowName | |||
* the name of the window. | |||
* the name of the window. | |||
*/ | |||
public void open(Resource resource, String windowName) { | |||
synchronized (openList) { | |||
@@ -623,7 +622,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
try { | |||
return new URL(application.getURL(), getName() + "/"); | |||
} catch (final MalformedURLException e) { | |||
throw new RuntimeException("Internal problem, please report"); | |||
throw new RuntimeException( | |||
"Internal problem getting window URL, please report"); | |||
} | |||
} | |||
@@ -635,11 +635,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* not used for windows inside other windows. all application-level windows | |||
* can be accessed by their names in url | |||
* <code>http://host:port/foo/bar/</code> where | |||
* <code>http://host:port/foo/</code> is the application url as returned | |||
* by getURL() and <code>bar</code> is the name of the window. Also note | |||
* that not all windows should be added to application - one can also add | |||
* windows inside other windows - these windows show as smaller windows | |||
* inside those windows. | |||
* <code>http://host:port/foo/</code> is the application url as returned by | |||
* getURL() and <code>bar</code> is the name of the window. Also note that | |||
* not all windows should be added to application - one can also add windows | |||
* inside other windows - these windows show as smaller windows inside those | |||
* windows. | |||
* </p> | |||
* | |||
* @return the Name of the Window. | |||
@@ -661,7 +661,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; | |||
@@ -685,7 +685,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) { | |||
@@ -720,7 +720,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) { | |||
@@ -739,7 +739,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* adapter and may change from time to time. | |||
* | |||
* @param type | |||
* the terminal type to set. | |||
* the terminal type to set. | |||
*/ | |||
public void setTerminal(Terminal type) { | |||
terminal = type; | |||
@@ -782,9 +782,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Paints the open-tag inside the window. | |||
* | |||
* @param target | |||
* the Paint Event. | |||
* the Paint Event. | |||
* @throws PaintException | |||
* if the Paint Operation fails. | |||
* if the Paint Operation fails. | |||
*/ | |||
private void paintContent(PaintTarget target) throws PaintException { | |||
target.startTag("open"); | |||
@@ -874,9 +874,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* 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. | |||
* 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) { | |||
@@ -901,9 +900,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* 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 | |||
* the Distance of Window top border in pixels from top border of | |||
* the containing (main window). or -1 if unspecified | |||
* | |||
* @since 4.0.0 | |||
*/ | |||
@@ -918,7 +916,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
"windowClose", new Class[] { CloseEvent.class }); | |||
} catch (final java.lang.NoSuchMethodException e) { | |||
// This should never happen | |||
throw new java.lang.RuntimeException(); | |||
throw new java.lang.RuntimeException( | |||
"Internal error, window close method not found"); | |||
} | |||
} | |||
@@ -955,7 +954,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Adds the listener. | |||
* | |||
* @param listener | |||
* the listener to add. | |||
* the listener to add. | |||
*/ | |||
public void addListener(CloseListener listener) { | |||
addListener(CloseEvent.class, listener, WINDOW_CLOSE_METHOD); | |||
@@ -965,7 +964,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Removes the listener. | |||
* | |||
* @param listener | |||
* the listener to remove. | |||
* the listener to remove. | |||
*/ | |||
public void removeListener(CloseListener listener) { | |||
addListener(CloseEvent.class, listener, WINDOW_CLOSE_METHOD); | |||
@@ -991,9 +990,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* | |||
* @param window | |||
* @throws IllegalArgumentException | |||
* if a window is added inside non-application level window. | |||
* if a window is added inside non-application level window. | |||
* @throws NullPointerException | |||
* if the given <code>Window</code> is <code>null</code>. | |||
* if the given <code>Window</code> is <code>null</code>. | |||
*/ | |||
public void addWindow(Window window) throws IllegalArgumentException, | |||
NullPointerException { | |||
@@ -1016,7 +1015,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Remove the given subwindow from this window. | |||
* | |||
* @param window | |||
* Window to be removed. | |||
* Window to be removed. | |||
*/ | |||
public void removeWindow(Window window) { | |||
subwindows.remove(window); | |||
@@ -1039,7 +1038,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* <b>Note:</b> affects sub-windows only. | |||
* | |||
* @param modality | |||
* true if modality is to be turned on | |||
* true if modality is to be turned on | |||
*/ | |||
public void setModal(boolean modality) { | |||
modal = modality; | |||
@@ -1055,11 +1054,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
} | |||
/** | |||
* Sets sub-window resizable. | |||
* <b>Note:</b> affects sub-windows only. | |||
* Sets sub-window resizable. <b>Note:</b> affects sub-windows only. | |||
* | |||
* @param resizable | |||
* true if resizability is to be turned on | |||
* true if resizability is to be turned on | |||
*/ | |||
public void setResizable(boolean resizeability) { | |||
resizable = resizeability; | |||
@@ -1075,8 +1073,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
} | |||
/** | |||
* Request to center this window on the screen. | |||
* <b>Note:</b> affects sub-windows only. | |||
* Request to center this window on the screen. <b>Note:</b> affects | |||
* sub-windows only. | |||
*/ | |||
public void center() { | |||
centerRequested = true; | |||
@@ -1090,7 +1088,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* @see Notification | |||
* | |||
* @param caption | |||
* The message | |||
* The message | |||
*/ | |||
public void showNotification(String caption) { | |||
addNotification(new Notification(caption)); | |||
@@ -1105,9 +1103,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* @see Notification | |||
* | |||
* @param caption | |||
* The message | |||
* The message | |||
* @param type | |||
* The message type | |||
* The message type | |||
*/ | |||
public void showNotification(String caption, int type) { | |||
addNotification(new Notification(caption, type)); | |||
@@ -1122,9 +1120,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* @see Notification | |||
* | |||
* @param caption | |||
* The caption of the message | |||
* The caption of the message | |||
* @param description | |||
* The message description | |||
* The message description | |||
* | |||
*/ | |||
public void showNotification(String caption, String description) { | |||
@@ -1141,11 +1139,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* @see Notification | |||
* | |||
* @param caption | |||
* The caption of the message | |||
* The caption of the message | |||
* @param description | |||
* The message description | |||
* The message description | |||
* @param type | |||
* The message type | |||
* The message type | |||
*/ | |||
public void showNotification(String caption, String description, int type) { | |||
addNotification(new Notification(caption, description, type)); | |||
@@ -1161,7 +1159,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* @see #showNotification(String, String, int) | |||
* | |||
* @param notification | |||
* The notification message to show | |||
* The notification message to show | |||
*/ | |||
public void showNotification(Notification notification) { | |||
addNotification(notification); | |||
@@ -1188,25 +1186,25 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* still drawing needed attention. There are several basic types of messages | |||
* that can be used in different situations: | |||
* <ul> | |||
* <li> TYPE_HUMANIZED_MESSAGE fades away quickly as soon as the user uses | |||
* <li>TYPE_HUMANIZED_MESSAGE fades away quickly as soon as the user uses | |||
* the mouse or types something. It can be used to show fairly unimportant | |||
* messages, such as feedback that an operation succeeded ("Document Saved") - | |||
* the kind of messages the user ignores once the application is familiar.</li> | |||
* messages, such as feedback that an operation succeeded ("Document Saved") | |||
* - the kind of messages the user ignores once the application is familiar. | |||
* </li> | |||
* <li>TYPE_WARNING_MESSAGE is shown for a short while after the user uses | |||
* the mouse or types something. It's default style is also more noticeable | |||
* than the humanized message. It can be used for messages that do not | |||
* contain a lot of important information, but should be noticed by the | |||
* user. Despite the name, it does not have to be a warning, but can be used | |||
* instead of the humanized message whenever you want to make the message a | |||
* little more noticeable. </li> | |||
* little more noticeable.</li> | |||
* <li>TYPE_ERROR_MESSAGE requires to user to click it before disappearing, | |||
* and can be used for critical messages.</li> | |||
* <li>TYPE_TRAY_NOTIFICATION is shown for a while in the lower left corner | |||
* of the window, and can be used for "convenience notifications" that do | |||
* not have to be noticed immediately, and should not interfere with the | |||
* current task - for instance to show "You have a new message in your | |||
* inbox" while the user is working in some other area of the application. | |||
* </li> | |||
* inbox" while the user is working in some other area of the application.</li> | |||
* </ul> | |||
* </p> | |||
* <p> | |||
@@ -1244,7 +1242,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Creates a "humanized" notification message. | |||
* | |||
* @param caption | |||
* The message to show | |||
* The message to show | |||
*/ | |||
public Notification(String caption) { | |||
this(caption, null, TYPE_HUMANIZED_MESSAGE); | |||
@@ -1254,9 +1252,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Creates a notification message of the specified type. | |||
* | |||
* @param caption | |||
* The message to show | |||
* The message to show | |||
* @param type | |||
* The type of message | |||
* The type of message | |||
*/ | |||
public Notification(String caption, int type) { | |||
this(caption, null, type); | |||
@@ -1267,9 +1265,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* smaller description. | |||
* | |||
* @param caption | |||
* The message caption | |||
* The message caption | |||
* @param description | |||
* The message description | |||
* The message description | |||
*/ | |||
public Notification(String caption, String description) { | |||
this(caption, description, TYPE_HUMANIZED_MESSAGE); | |||
@@ -1280,11 +1278,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* caption and smaller description. | |||
* | |||
* @param caption | |||
* The message caption | |||
* The message caption | |||
* @param description | |||
* The message description | |||
* The message description | |||
* @param type | |||
* The type of message | |||
* The type of message | |||
*/ | |||
public Notification(String caption, String description, int type) { | |||
this.caption = caption; | |||
@@ -1327,7 +1325,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Sets the caption part of the notification message | |||
* | |||
* @param caption | |||
* The message caption | |||
* The message caption | |||
*/ | |||
public void setCaption(String caption) { | |||
this.caption = caption; | |||
@@ -1380,7 +1378,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Sets the position of the notification message. | |||
* | |||
* @param position | |||
* The desired notification position | |||
* The desired notification position | |||
*/ | |||
public void setPosition(int position) { | |||
this.position = position; | |||
@@ -1399,7 +1397,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Sets the icon part of the notification message. | |||
* | |||
* @param icon | |||
* The desired message icon | |||
* The desired message icon | |||
*/ | |||
public void setIcon(Resource icon) { | |||
this.icon = icon; | |||
@@ -1419,8 +1417,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Sets the delay before the notification disappears. | |||
* | |||
* @param delayMsec | |||
* the desired delay in msec, -1 to require the user to | |||
* click the message | |||
* the desired delay in msec, -1 to require the user to click | |||
* the message | |||
*/ | |||
public void setDelayMsec(int delayMsec) { | |||
this.delayMsec = delayMsec; | |||
@@ -1430,7 +1428,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler { | |||
* Sets the style name for the notification message. | |||
* | |||
* @param styleName | |||
* The desired style name. | |||
* The desired style name. | |||
*/ | |||
public void setStyleName(String styleName) { | |||
this.styleName = styleName; |