| java.lang.Object thinwire.ui.Application
All known Subclasses: thinwire.render.web.WebApplication,
Application | abstract public class Application (Code) | | The Application class represents an instance of a ThinWire application. Methods in this class are
those that directly affect the system and it's environment.
author: Joshua J. Gertzen |
Inner Class :public static class Local | |
Method Summary | |
public void | addExceptionListener(ExceptionListener listener) | public void | addGlobalActionListener(String action, ActionListener listener) Adds a ActionListener that will be notified when the specified action occurs on any new component. | public void | addGlobalActionListener(String[] actions, ActionListener listener) Adds a ActionListener that will be notified when any of the specified actions occur on
any new component. | public void | addGlobalDropListener(Component dragSource, DropListener listener) | public void | addGlobalDropListener(Component[] dragSources, DropListener listener) | public void | addGlobalItemChangeListener(ItemChangeListener listener) | public void | addGlobalKeyPressListener(String keyPressCombo, KeyPressListener listener) | public void | addGlobalKeyPressListener(String[] keyPressCombos, KeyPressListener listener) | public void | addGlobalPropertyChangeListener(String propertyName, PropertyChangeListener listener) Adds a PropertyChangeListener that will be notified when the specified property of any new component changes. | public void | addGlobalPropertyChangeListener(String[] propertyNames, PropertyChangeListener listener) Adds a PropertyChangeListener that will be notified when any of the specified properties of
any new component changes. | abstract public void | addTimerTask(Runnable task, long milliseconds) | abstract public void | addTimerTask(Runnable task, long milliseconds, boolean repeat) | abstract protected void | captureThread() | public static Application | current() | abstract public String | getBaseFolder() | public static Style | getDefaultStyle(Class<? extends Component> clazz) | protected Map<Class<? extends Component>, Style> | getDefaultStyles() | abstract protected FileChooser.FileInfo | getFileInfo() | public Frame | getFrame() Gets the Frame that represents the primary application window. | EventListenerImpl<T> | getGlobalListenerSet(Class<T> type, boolean createIfNull) | public static Map<String, String> | getPlatformVersionInfo() Returns the current version info details for the platform. | public Component | getPriorFocus() Returns the Component that previously had focus in the Application. | abstract protected String | getQualifiedURL(String location) | public File | getRelativeFile(String pathname) | public File | getRelativeFile(String parent, String child) | public static InputStream | getResourceAsStream(String uri) Returns an InputStream representing the specified resource.
The following URL's are supported:
- Any valid resource filename.
| public static byte[] | getResourceBytes(String uri) | protected Map<String, Color> | getSystemColors() | protected String | getSystemFile(String value) | protected Map<String, String> | getSystemImages() | abstract protected void | hideWindow(Window w) | protected void | loadStyleSheet(String styleSheet) | public static void | main(String[] args) Displays a version detail dialog. | abstract protected void | releaseThread() | public void | removeExceptionListener(ExceptionListener listener) | abstract protected void | removeFileFromMap(String location) | public void | removeGlobalActionListener(ActionListener listener) Unregister an ActionListener from all action event notifications from any component. | public void | removeGlobalDropListener(DropListener listener) | public void | removeGlobalItemChangeListener(ItemChangeListener listener) | public void | removeGlobalKeyPressListener(KeyPressListener listener) | public void | removeGlobalPropertyChangeListener(PropertyChangeListener listener) Removes the PropertyChangeListener from the list of global listeners that are added to all
new Component 's. | abstract public void | removeTimerTask(Runnable task) | public void | reportException(Object source, Throwable exception) | abstract public void | resetTimerTask(Runnable task) | protected Object | setPackagePrivateMember(String memberName, Component comp, Object value) | void | setPriorFocus(Component comp) | abstract protected void | showWindow(Window w) | static boolean | validateURL(String url) | public static void | writeResourceToStream(String uri, OutputStream os) |
Application | protected Application()(Code) | | |
addGlobalActionListener | public void addGlobalActionListener(String action, ActionListener listener)(Code) | | Adds a ActionListener that will be notified when the specified action occurs on any new component. To
further clarify, a global action listener will receive an event notification for any component that is created after
this global action listener is added, on which the specified action occurs. Therefore, establishing a global
action listener is the same as invoking the
Component.addActionListener(StringActionListener) method on every component after it's creation.
Parameters: action - the action to specficially be notified of. Parameters: listener - the event listener that will receive notification. |
addGlobalActionListener | public void addGlobalActionListener(String[] actions, ActionListener listener)(Code) | | Adds a ActionListener that will be notified when any of the specified actions occur on
any new component. This method is equivalent to calling
Application.addGlobalActionListener(String,ActionListener) once for each action you want to receive notification for.
Parameters: actions - the actions to specficially be notified of. Parameters: listener - the event listener that will receive notifications. |
addGlobalPropertyChangeListener | public void addGlobalPropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code) | | Adds a PropertyChangeListener that will be notified when the specified property of any new component changes. To
further clarify, a global property change listener will receive an event notification for any component that is created after
this global property change listener is added, for which the specified property changes. Therefore, establishing a global
property change listener is the same as invoking the
Component.addPropertyChangeListener(StringPropertyChangeListener) method on every component after it's creation.
As a general rule, you should avoid using this feature because it can cause a large volume of events to be generated. This is
especially true if you listen to a frequently updated property, such as PROPERTY_TEXT . However, there are
cases where this can be quite useful. One such case is when you use the 'userObject' property to store a boolean state that
indicates whether a value is required for the component. In such a case, you can establish a global property change listener
for 'userObject' and then based on the property being set to true you could update the background color so it
is apparent to the user that a value is required.
Example:
Component.addGlobalPropertyChangeListener(Component.PROPERTY_USER_OBJECT, new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent pce) {
Component comp = (Component) pce.getSource();
if (comp.getUserObject() == Boolean.TRUE) {
comp.getStyle().getBackground().setColor(Color.PALEGOLDENROD);
} else {
comp.getStyle().getBackground().setColor(null); //restore the default background color
}
}
});
TextField tf = new TextField();
tf.setUserObject(Boolean.TRUE); //Causes background color to be set to Color.PALEGOLDENROD
tf.setUserObject(Boolean.FALSE); //Causes background color to be set to the default.
Parameters: propertyName - the name of the property that the listener will receive change events for. Parameters: listener - the listener that will receive PropertyChangeEvent objects upon the property of any new component changing. throws: IllegalArgumentException - if listener or propertyName is null or ifpropertyName is an empty string. See Also: Component.addPropertyChangeListener(StringPropertyChangeListener) See Also: thinwire.ui.event.PropertyChangeListener See Also: thinwire.ui.event.PropertyChangeEvent |
addTimerTask | abstract public void addTimerTask(Runnable task, long milliseconds)(Code) | | Parameters: task - Parameters: milliseconds - |
addTimerTask | abstract public void addTimerTask(Runnable task, long milliseconds, boolean repeat)(Code) | | Parameters: task - Parameters: milliseconds - Parameters: repeat - |
captureThread | abstract protected void captureThread()(Code) | | |
current | public static Application current()(Code) | | the current instance of the application, or null if called from a thread other than the UI thread. |
getBaseFolder | abstract public String getBaseFolder()(Code) | | the base folder of the system |
getFrame | public Frame getFrame()(Code) | | Gets the Frame that represents the primary application window.
the Frame that represents the primary application window. |
getPlatformVersionInfo | public static Map<String, String> getPlatformVersionInfo()(Code) | | Returns the current version info details for the platform.
The returned Map is read-only and contains the following keys:
companyName
companyAddress1
companyAddress2
companyCity
companyState
companyZip
companyPhone
companyWebsite
productDescription
productVersion
internalName
legalCopyright
originalFilename
the current version info details for the platform. |
getPriorFocus | public Component getPriorFocus()(Code) | | Returns the Component that previously had focus in the Application. The Component that
previously had focus is the last Component in ANY window that held the focus. This is different from the
behavior of the focus property in which their is one Component with focus PER window.
the Component that previously had focus in the Application, or null if no Component hashad prior focus. See Also: Component.isFocus See Also: Component.setFocus(boolean) |
getRelativeFile | public File getRelativeFile(String pathname)(Code) | | Parameters: pathname - |
getRelativeFile | public File getRelativeFile(String parent, String child)(Code) | | Parameters: parent - Parameters: child - |
getResourceAsStream | public static InputStream getResourceAsStream(String uri)(Code) | | Returns an InputStream representing the specified resource.
The following URL's are supported:
- Any valid resource filename. If Application.current() returns non-null,
which is the typical scenario, then relative paths are interpreted as
relative to the application folder.
Application.getRelativeFile
- class:///com.mypackage.MyClass/resource.ext
- http://www.mycompany.com/resource.ext
an InputStream representing the specified resource or null if the resource was not found. |
getResourceBytes | public static byte[] getResourceBytes(String uri)(Code) | | |
hideWindow | abstract protected void hideWindow(Window w)(Code) | | |
loadStyleSheet | protected void loadStyleSheet(String styleSheet)(Code) | | |
main | public static void main(String[] args) throws Exception(Code) | | Displays a version detail dialog.
Parameters: args - |
releaseThread | abstract protected void releaseThread()(Code) | | |
removeFileFromMap | abstract protected void removeFileFromMap(String location)(Code) | | |
removeGlobalActionListener | public void removeGlobalActionListener(ActionListener listener)(Code) | | Unregister an ActionListener from all action event notifications from any component.
Parameters: listener - the listener that should no longer receive action event notifications. |
removeGlobalPropertyChangeListener | public void removeGlobalPropertyChangeListener(PropertyChangeListener listener)(Code) | | Removes the PropertyChangeListener from the list of global listeners that are added to all
new Component 's. To further clarify, removing a global property change listener will NOT
remove the listener from Component 's that have already been created.
Parameters: listener - the listener to remove from the notification list. throws: IllegalArgumentException - if listener is null. See Also: thinwire.ui.event.PropertyChangeListener |
removeTimerTask | abstract public void removeTimerTask(Runnable task)(Code) | | Parameters: task - |
reportException | public void reportException(Object source, Throwable exception)(Code) | | Parameters: source - Parameters: exception - |
resetTimerTask | abstract public void resetTimerTask(Runnable task)(Code) | | Parameters: task - |
showWindow | abstract protected void showWindow(Window w)(Code) | | |
|
|