edu.neu.ccs.jpf
Class JPF

java.lang.Object
  |
  +--edu.neu.ccs.jpf.JPFBase
        |
        +--edu.neu.ccs.jpf.JPF
All Implemented Interfaces:
ConsoleAware, JPTConstants, SwingConstants

public class JPF
extends JPFBase
implements JPTConstants, ConsoleAware

The Java Power Framework class JPF provides the foundation for creating an automatic Java GUI application with access to:

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:

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 JPFBase. The class JPFBase 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.

Since:
2.2

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
 
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
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.
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 setFrameTitle(String title)
          Sets the title of the application frame to the given title.
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 edu.neu.ccs.jpf.JPFBase
declaresConstructor, declaresConstructorNoDialog, declaresConstructors, declaresConstructorsAndMethods, declaresConstructorsAndMethodsNoDialog, declaresConstructorsNoDialog, declaresMethod, declaresMethodNoDialog, declaresMethods, declaresMethodsNoDialog, providesConstructorsAndMethods, providesConstructorsAndMethodsNoDialog, providesMethod, providesMethodNoDialog, providesMethods, providesMethodsNoDialog, report
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

window

public BufferedPanel window
The graphics buffered panel window.

Constructor Detail

JPF

public JPF()
Construct the JPF application using as the given initializer the derived class that uses this constructor.

Method Detail

setFrameTitle

public void setFrameTitle(String title)
Sets the title of the application frame to the given title.

Parameters:
title - title text for the frame

frame

public static JPTFrame frame(Object object)

Frame the given object in a JPTFrame and open the frame; return the frame constructed.

Parameters:
object - the object to frame
Returns:
the frame constructed
Since:
2.3.4

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.

Parameters:
object - the object to frame
location - the constant representing the frame location
Returns:
the frame constructed
Since:
2.3.4

frame

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.

Parameters:
object - the object to frame
title - the title for the frame
Returns:
the frame constructed
Since:
2.3.4

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.

Parameters:
object - the object to frame
title - the title for the frame
location - the constant representing the frame location
Returns:
the frame constructed
Since:
2.3.4

frame

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.

Parameters:
object - the object to frame
title - the title for the frame
insets - the screen insets to use to adjust the location
Returns:
the frame constructed
Since:
2.3.4

frame

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.

Parameters:
object - the object to frame
title - the title for the frame
location - the constant representing the frame location
insets - the screen insets to use to adjust the location
Returns:
the frame constructed
Since:
2.3.4

OKDialog

public static GeneralDialog OKDialog(Object object)

Place the given object in a modal OK dialog and open the dialog; return the dialog constructed.

Parameters:
object - the object to place in the dialog
Returns:
the dialog constructed
Since:
2.3.4

OKDialog

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.

Parameters:
object - the object to place in the dialog
title - the title for the dialog
Returns:
the dialog constructed
Since:
2.3.4

OKCancelDialog

public static GeneralDialog OKCancelDialog(Object object)

Place the given object in a modal OK-Cancel dialog and open the dialog; return the dialog constructed.

Parameters:
object - the object to place in the dialog
Returns:
the dialog constructed
Since:
2.3.4

OKCancelDialog

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.

Parameters:
object - the object to place in the dialog
title - the title for the dialog
Returns:
the dialog constructed
Since:
2.3.4

YesNoCancelDialog

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.

Parameters:
object - the object to place in the dialog
Returns:
the dialog constructed
Since:
2.3.4

YesNoCancelDialog

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.

Parameters:
object - the object to place in the dialog
title - the title for the dialog
Returns:
the dialog constructed
Since:
2.3.4

generalDialog

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:

If 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:

If the option parameter is not specified, it is taken to be DialogAction.AUTO_CLOSE.

Parameters:
object - the object to place in the dialog
actionData - the action data
Returns:
the dialog constructed
Since:
2.3.4

generalDialog

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:

If 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:

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.

Parameters:
object - the object to place in the dialog
actionData - the action data
defaultAction - the default action
Returns:
the dialog constructed
Since:
2.3.4

generalDialog

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:

If 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:

If the option parameter is not specified, it is taken to be DialogAction.AUTO_CLOSE.

Parameters:
object - the object to place in the dialog
title - the title for the dialog
actionData - the action data
Returns:
the dialog constructed
Since:
2.3.4

generalDialog

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:

If 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:

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.

Parameters:
object - the object to place in the dialog
title - the title for the dialog
actionData - the action data
defaultAction - the default action
Returns:
the dialog constructed
Since:
2.3.4