|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--edu.neu.ccs.jpf.JPFBase
|
+--edu.neu.ccs.jpf.JPF
The Java Power Framework class JPF provides the
foundation for creating an automatic Java GUI application with access to:
console I/O via the interface
ConsoleAware
BufferedPanel.
In this automatic Java GUI application. the action buttons are created
automatically from public methods whose arguments and return
type are one of the following types:
void
boolean, char, byte, short, int, long, float, double
String, Color, BigInteger, BigDecimal
Stringable interface.
The creation of the automatic Java GUI application is accomplished by a combination of Java reflection and the use of the rest of the Java Power Tools. Since these techniques are encapsulated, the user of the Java Power Framework need not have any knowledge of the JPT.
To use the Java Power Framework class JPF, simply
define a class that extends JPF, directly or indirectly,
and execute the default constructor on that new class.
For example, if a class named Methods extends
JPF, directly or indirectly, then all public
methods that satisfy the above constraints and are defined either in the
class Methods itself or in some intermediate class between
Methods and JPF will give rise to buttons in
the automatically generated GUI application.
The structure of a typical Methods class that directly
extends JPF will therefore look as follows:
public class Methods extends JPF {
public static void main(String[] args) { new Methods(); }
// enter here any member or static data declarations as desired
// enter here the public methods to be made into GUI buttons
// enter here any non-public helper methods as desired
}
The Java Power Framework may be used to create GUI buttons in an automatically generated application for any of the following purposes:
To illustrate how to define a method to launch a separate Java application
that we will name, for convenience, Foo, here is the code:
public void LaunchFoo() { Foo.main(null); }
Placing this code in the Methods class will cause a button to be
created in the automatic GUI that is labeled "LaunchFoo" and which launches
the application Foo when clicked.
The class JPF itself extends .
The class JPFBaseJPFBase provides a series of methods that may be used to
determine if a class possesses a required set of constructors and/or methods.
These testing methods are automatically inherited by any class Methods
that extends JPF and may be used to create unit test suites.
In 2.4.0, added the methods normalConsole,
iconifyConsole, maximizeConsole,
and toggleConsole.
| Field Summary | |
BufferedPanel |
window
The graphics buffered panel window. |
| Fields inherited from interface edu.neu.ccs.util.JPTConstants |
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface edu.neu.ccs.console.ConsoleAware |
console |
| Constructor Summary | |
JPF()
Construct the JPF application using as the given initializer the derived class that uses this constructor. |
|
| Method Summary | |
void |
clearGraphics()
Clears the graphics window. |
static JPTFrame |
frame(Object object)
Frame the given object in a JPTFrame and open the frame; return the frame constructed. |
static JPTFrame |
frame(Object object,
int location)
Frame the given object in a JPTFrame and open the frame; use the given location which should be either CENTER or one of the standard constants
for one of the eight compass directions;
return the frame constructed. |
static JPTFrame |
frame(Object object,
String title)
Frame the given object in a JPTFrame and open the frame; use the given title for the frame; return the frame constructed. |
static JPTFrame |
frame(Object object,
String title,
Insets insets)
Frame the given object in a JPTFrame and open the frame; use the given title for the frame; use the given insets to inset the frame in the screen; return the frame constructed. |
static JPTFrame |
frame(Object object,
String title,
int location)
Frame the given object in a JPTFrame and open the frame; use the given title for the frame; use the given location which should be either CENTER or one of the standard constants
for one of the eight compass directions;
return the frame constructed. |
static JPTFrame |
frame(Object object,
String title,
int location,
Insets insets)
Frame the given object in a JPTFrame and open the frame; use the given title for the frame; use the given location which should be either CENTER or one of the standard constants
for one of the eight compass directions;
use the given insets to inset the frame in the screen;
return the frame constructed. |
static GeneralDialog |
generalDialog(Object object,
Object[][] actionData)
Place the given object in a modal general dialog and open the dialog; use the action data to define the dialog buttons; return the dialog constructed. |
static GeneralDialog |
generalDialog(Object object,
Object[][] actionData,
Object defaultAction)
Place the given object in a modal general dialog and open the dialog; use the action data to define the dialog buttons; use the default action object to define the default button; return the dialog constructed. |
static GeneralDialog |
generalDialog(Object object,
String title,
Object[][] actionData)
Place the given object in a modal general dialog and open the dialog; use the given title for the dialog; use the action data to define the dialog buttons; return the dialog constructed. |
static GeneralDialog |
generalDialog(Object object,
String title,
Object[][] actionData,
Object defaultAction)
Place the given object in a modal general dialog and open the dialog; use the given title for the dialog; use the action data to define the dialog buttons; use the default action object to define the default button; return the dialog constructed. |
void |
iconifyConsole()
Sets the state of an activated console window to iconified. |
boolean |
isConsoleActivated()
Returns whether or not the console window is activated. |
boolean |
isGraphicsVisible()
Returns whether or not the graphics window is visible. |
void |
normalConsole()
Sets the state of an activated console window to normal. |
static GeneralDialog |
OKCancelDialog(Object object)
Place the given object in a modal OK-Cancel dialog and open the dialog; return the dialog constructed. |
static GeneralDialog |
OKCancelDialog(Object object,
String title)
Place the given object in a modal OK-Cancel dialog and open the dialog; use the given title for the dialog; return the dialog constructed. |
static GeneralDialog |
OKDialog(Object object)
Place the given object in a modal OK dialog and open the dialog; return the dialog constructed. |
static GeneralDialog |
OKDialog(Object object,
String title)
Place the given object in a modal OK dialog and open the dialog; use the given title for the dialog; return the dialog constructed. |
void |
setConsoleActivated(boolean activate)
Sets the activation of the console window. |
void |
setFrameTitle(String title)
Sets the title of the application frame to the given title. |
void |
setGraphicsVisible(boolean visible)
Sets the visibility of the graphics window. |
void |
toggleConsole()
Toggles the state of an activated console window between normal and iconified. |
void |
toggleGraphics()
Toggles the visibility of the graphics window. |
static GeneralDialog |
YesNoCancelDialog(Object object)
Place the given object in a modal Yes-No-Cancel dialog and open the dialog; return the dialog constructed. |
static GeneralDialog |
YesNoCancelDialog(Object object,
String title)
Place the given object in a modal Yes-No-Cancel dialog and open the dialog; use the given title for the dialog; return the dialog constructed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public BufferedPanel window
| Constructor Detail |
public JPF()
| Method Detail |
public void setFrameTitle(String title)
title - title text for the framepublic boolean isConsoleActivated()
public void setConsoleActivated(boolean activate)
Sets the activation of the console window.
Does nothing if activation will not change.
activate - the desired activation settingpublic void normalConsole()
public void iconifyConsole()
public void toggleConsole()
public void clearGraphics()
public boolean isGraphicsVisible()
public void setGraphicsVisible(boolean visible)
Sets the visibility of the graphics window.
Does nothing if visibility will not change.
visible - the desired visibility settingpublic void toggleGraphics()
public static JPTFrame frame(Object object)
Frame the given object in a JPTFrame and open the frame; return the frame constructed.
object - the object to frame
public static JPTFrame frame(Object object,
int location)
Frame the given object in a JPTFrame
and open the frame;
use the given location which should be either
CENTER or one of the standard constants
for one of the eight compass directions;
return the frame constructed.
object - the object to framelocation - the constant representing the frame location
public static JPTFrame frame(Object object,
String title)
Frame the given object in a JPTFrame and open the frame; use the given title for the frame; return the frame constructed.
object - the object to frametitle - the title for the frame
public static JPTFrame frame(Object object,
String title,
int location)
Frame the given object in a JPTFrame
and open the frame;
use the given title for the frame;
use the given location which should be either
CENTER or one of the standard constants
for one of the eight compass directions;
return the frame constructed.
object - the object to frametitle - the title for the framelocation - the constant representing the frame location
public static JPTFrame frame(Object object,
String title,
Insets insets)
Frame the given object in a JPTFrame and open the frame; use the given title for the frame; use the given insets to inset the frame in the screen; return the frame constructed.
object - the object to frametitle - the title for the frameinsets - the screen insets to use to adjust the location
public static JPTFrame frame(Object object,
String title,
int location,
Insets insets)
Frame the given object in a JPTFrame
and open the frame;
use the given title for the frame;
use the given location which should be either
CENTER or one of the standard constants
for one of the eight compass directions;
use the given insets to inset the frame in the screen;
return the frame constructed.
object - the object to frametitle - the title for the framelocation - the constant representing the frame locationinsets - the screen insets to use to adjust the location
public static GeneralDialog OKDialog(Object object)
Place the given object in a modal OK dialog and open the dialog; return the dialog constructed.
object - the object to place in the dialog
public static GeneralDialog OKDialog(Object object,
String title)
Place the given object in a modal OK dialog and open the dialog; use the given title for the dialog; return the dialog constructed.
object - the object to place in the dialogtitle - the title for the dialog
public static GeneralDialog OKCancelDialog(Object object)
Place the given object in a modal OK-Cancel dialog and open the dialog; return the dialog constructed.
object - the object to place in the dialog
public static GeneralDialog OKCancelDialog(Object object,
String title)
Place the given object in a modal OK-Cancel dialog and open the dialog; use the given title for the dialog; return the dialog constructed.
object - the object to place in the dialogtitle - the title for the dialog
public static GeneralDialog YesNoCancelDialog(Object object)
Place the given object in a modal Yes-No-Cancel dialog and open the dialog; return the dialog constructed.
object - the object to place in the dialog
public static GeneralDialog YesNoCancelDialog(Object object,
String title)
Place the given object in a modal Yes-No-Cancel dialog and open the dialog; use the given title for the dialog; return the dialog constructed.
object - the object to place in the dialogtitle - the title for the dialog
public static GeneralDialog generalDialog(Object object,
Object[][] actionData)
Place the given object in a modal general dialog and open the dialog; use the action data to define the dialog buttons; return the dialog constructed.
The parameter actionData
is an Object[][] array that specifies
each dialog Action in one of the following ways:
ActionIf the option parameter is specified, it must be one of the following values that will determine what is done to the dialog when the action is finished:
- DialogAction.KEEP_OPEN
- DialogAction.AUTO_CLOSE
- DialogAction.SET_CANCEL
If the option parameter is not specified, it is taken to be
DialogAction.AUTO_CLOSE.
object - the object to place in the dialogactionData - the action data
public static GeneralDialog generalDialog(Object object,
Object[][] actionData,
Object defaultAction)
Place the given object in a modal general dialog and open the dialog; use the action data to define the dialog buttons; use the default action object to define the default button; return the dialog constructed.
The parameter actionData
is an Object[][] array that specifies
each dialog Action in one of the following ways:
ActionIf the option parameter is specified, it must be one of the following values that will determine what is done to the dialog when the action is finished:
- DialogAction.KEEP_OPEN
- DialogAction.AUTO_CLOSE
- DialogAction.SET_CANCEL
If the option parameter is not specified, it is taken to be
DialogAction.AUTO_CLOSE.
The Object supplied for the default action must either be
an Action or a name that is supplied in the action data. If
the parameter is null, no default action is set.
object - the object to place in the dialogactionData - the action datadefaultAction - the default action
public static GeneralDialog generalDialog(Object object,
String title,
Object[][] actionData)
Place the given object in a modal general dialog and open the dialog; use the given title for the dialog; use the action data to define the dialog buttons; return the dialog constructed.
The parameter actionData
is an Object[][] array that specifies
each dialog Action in one of the following ways:
ActionIf the option parameter is specified, it must be one of the following values that will determine what is done to the dialog when the action is finished:
- DialogAction.KEEP_OPEN
- DialogAction.AUTO_CLOSE
- DialogAction.SET_CANCEL
If the option parameter is not specified, it is taken to be
DialogAction.AUTO_CLOSE.
object - the object to place in the dialogtitle - the title for the dialogactionData - the action data
public static GeneralDialog generalDialog(Object object,
String title,
Object[][] actionData,
Object defaultAction)
Place the given object in a modal general dialog and open the dialog; use the given title for the dialog; use the action data to define the dialog buttons; use the default action object to define the default button; return the dialog constructed.
The parameter actionData
is an Object[][] array that specifies
each dialog Action in one of the following ways:
ActionIf the option parameter is specified, it must be one of the following values that will determine what is done to the dialog when the action is finished:
- DialogAction.KEEP_OPEN
- DialogAction.AUTO_CLOSE
- DialogAction.SET_CANCEL
If the option parameter is not specified, it is taken to be
DialogAction.AUTO_CLOSE.
The Object supplied for the default action must either be
an Action or a name that is supplied in the action data. If
the parameter is null, no default action is set.
object - the object to place in the dialogtitle - the title for the dialogactionData - the action datadefaultAction - the default action
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||