|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.jurvis.swing.app.JvApplication
public class JvApplication
A class representing a Swing application. Each application is named and has a ResourceBundle containing localized text for all the components within the application.
Though it's possible, it isn't intended that this class be extended. The
expected usage is for a main routine to create an
NApplication. For example:
class WebTail
{
public static void main(String[] args)
{
JvSwingFactory factory = JvSwingFactory.getInstance(WebTail.class.getName());
JvApplication app = factory.createApplication("webTailApp");
app.setActiveView(new WebTail(app));
app.setVisible(true);
}
}
JvApplication creates and provides two Actions.
The Action to exit the application is named "exitApp." The
Action to display an about dialog is named "aboutApp."
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JFrame |
|---|
JFrame.AccessibleJFrame |
| Nested classes/interfaces inherited from class java.awt.Frame |
|---|
Frame.AccessibleAWTFrame |
| Nested classes/interfaces inherited from class java.awt.Window |
|---|
Window.AccessibleAWTWindow |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected JvView |
activeView
The active view. |
protected static Collection |
instances
List of the applications running in the JVM. |
protected Preferences |
preferences
The preferences associated with this application. |
protected PropertyChangeListener |
propertyChangeListener
PropertyChangeListener for listening to changes in the
active view. |
protected Collection |
views
The views contained within this application. |
| Fields inherited from class javax.swing.JFrame |
|---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Frame |
|---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.WindowConstants |
|---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JvApplication(String name,
JvSwingFactory factory)
Construct an JvApplication with the specified name and
factory. |
|
| Method Summary | |
|---|---|
protected void |
capturePreferences()
Capture any preferences of this application that should be persisted across sessions. |
protected boolean |
closeViews(int status)
Close the views of the application. |
void |
exit(int status)
Requests terminatination of the application. |
protected void |
extractPreferences()
Extract any apply saved preferences applicable for this application. |
JvView |
getActiveView()
Return the application's active view. |
Action |
getExitAction()
Return an Action that when invoked will exit the application. |
JvSwingFactory |
getFactory()
Return the factory used to construct this application. |
boolean |
isBusy()
Determine if the application is busy. |
static boolean |
isBusy(Component child)
Determine if the application containing child is busy and
is unable to respond to user events. |
void |
setActiveView(JvView view)
Set the application's active view to the specified view. |
void |
setBusy(boolean busy)
Indicate if the application is busy and is unable to respond to user events. |
static void |
setBusy(Component child,
boolean busy)
Indicate if the application containing child is busy and
is unable to respond to user events. |
protected void |
setupWindowListener()
Sets up a window listener for the application |
void |
setVisible(boolean visible)
Makes the component visible or invisible. |
| Methods inherited from class java.awt.Frame |
|---|
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.MenuContainer |
|---|
getFont, postEvent |
| Field Detail |
|---|
protected Collection views
protected JvView activeView
protected Preferences preferences
protected static Collection instances
Vector for thread safety.
protected final PropertyChangeListener propertyChangeListener
PropertyChangeListener for listening to changes in the
active view.
| Constructor Detail |
|---|
public JvApplication(String name,
JvSwingFactory factory)
JvApplication with the specified name and
factory.
name - the name of the applicationfactory - the factory used to create all components in the application| Method Detail |
|---|
protected void setupWindowListener()
public void setActiveView(JvView view)
view - the view to be made activepublic final JvView getActiveView()
public final JvSwingFactory getFactory()
protected void extractPreferences()
protected void capturePreferences()
preferences. This method captures the applications location
and size. Each application view is requested to save its modifications.
public void setVisible(boolean visible)
Component.setVisible in order to set a default location.
setVisible in class Componentvisible - true to make the component visiblepublic void setBusy(boolean busy)
busy - true if the application is busypublic boolean isBusy()
public static void setBusy(Component child,
boolean busy)
child is busy and
is unable to respond to user events.
child - the child of the applicationbusy - true if the application is busypublic static boolean isBusy(Component child)
child is busy and
is unable to respond to user events.
child - the child of the application
public void exit(int status)
System.exit or Runtime.exit
because both of those methods terminates the currently running Java
Virtual Machine ignoring the possiblity that we may be running more than
a single application in the JVM.
The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.
If the application contains views that have outstanding modifications, the user will be prompted to save the changes, discard the changes, or cancel the exit.
Any user preferences including the application's window size and location are saved on exit.
status - exit statusprotected boolean closeViews(int status)
status - exit status
public Action getExitAction()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||