Protege 4.1.0

org.protege.editor.core.ui.wizard
Class Wizard

java.lang.Object
  extended by java.awt.event.WindowAdapter
      extended by org.protege.editor.core.ui.wizard.Wizard
All Implemented Interfaces:
WindowFocusListener, WindowListener, WindowStateListener, PropertyChangeListener, EventListener
Direct Known Subclasses:
CreateClassHierarchyWizard, CreateOntologyWizard, ExportInferredOntologyWizard, MergeOntologiesWizard, MissingImportWizard, MoveAxiomsWizard, OntologyImportWizard

public class Wizard
extends WindowAdapter
implements PropertyChangeListener

This class implements a basic wizard dialog, where the programmer can insert one or more Components to act as panels. These panels can be navigated through arbitrarily using the 'Next' or 'Back' buttons, or the dialog itself can be closed using the 'Cancel' button. Note that even though the dialog uses a CardLayout manager, the order of the panels is not linear. Each panel determines at runtime what its next and previous panel will be.


Field Summary
static String BACK_BUTTON_ACTION_COMMAND
          The String-based action command for the 'Back' button.
static String CANCEL_BUTTON_ACTION_COMMAND
          The String-based action command for the 'Cancel' button.
static int CANCEL_RETURN_CODE
          Indicates that the 'Cancel' button was pressed to dispose the dialog, or the user pressed the dispose box in the corner of the window.
static int ERROR_RETURN_CODE
          Indicates that the dialog closed due to an internal error.
static int FINISH_RETURN_CODE
          Indicates that the 'Finish' button was pressed to dispose the dialog.
static String NEXT_BUTTON_ACTION_COMMAND
          The String-based action command for the 'Next' button.
 
Constructor Summary
Wizard()
          Default constructor.
Wizard(Dialog owner)
          This method accepts a java.awt.Dialog object as the javax.swing.JDialog's parent.
Wizard(Frame owner)
          This method accepts a java.awt.Frame object as the javax.swing.JDialog's parent.
 
Method Summary
 void dispose()
           
 boolean getBackButtonEnabled()
          Mirrors the WizardModel method of the same name.
 boolean getCancelButtonEnabled()
          Mirrors the WizardModel method of the same name.
 JDialog getDialog()
          Returns an instance of the JDialog that this class created.
 WizardModel getModel()
          Returns the current model of the wizard dialog.
 boolean getNextFinishButtonEnabled()
          Mirrors the WizardModel method of the same name.
 Component getOwner()
          Returns the owner of the generated javax.swing.JDialog.
 int getReturnCode()
          Retrieves the last return code set by the dialog.
 String getTitle()
          Returns the current title of the generated dialog.
 boolean isModal()
          Returns the modality of the dialog.
 void propertyChange(PropertyChangeEvent evt)
          Method used to listen for property change events from the model and update the dialog's graphical components as necessary.
 void registerWizardPanel(Object id, WizardPanel panel)
          Add a Component as a panel for the wizard dialog by registering its WizardPanel object.
 void resetButtonStates()
           
 void setBackButtonEnabled(boolean newValue)
          Mirrors the WizardModel method of the same name.
 void setCancelButtonEnabled(boolean newValue)
          Mirrors the WizardModel method of the same name.
 void setCurrentPanel(Object id)
          Displays the panel identified by the object passed in.
 void setModal(boolean b)
          Sets the modality of the generated javax.swing.JDialog.
 void setNextFinishButtonEnabled(boolean newValue)
          Mirrors the WizardModel method of the same name.
 void setTitle(String s)
          Sets the title of the generated javax.swing.JDialog.
 int showModalDialog()
          Convienence method that displays a modal wizard dialog and blocks until the dialog has completed.
 void windowClosing(WindowEvent e)
          If the user presses the dispose box on the dialog's window, treat it as a cancel.
 
Methods inherited from class java.awt.event.WindowAdapter
windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FINISH_RETURN_CODE

public static final int FINISH_RETURN_CODE
Indicates that the 'Finish' button was pressed to dispose the dialog.

See Also:
Constant Field Values

CANCEL_RETURN_CODE

public static final int CANCEL_RETURN_CODE
Indicates that the 'Cancel' button was pressed to dispose the dialog, or the user pressed the dispose box in the corner of the window.

See Also:
Constant Field Values

ERROR_RETURN_CODE

public static final int ERROR_RETURN_CODE
Indicates that the dialog closed due to an internal error.

See Also:
Constant Field Values

NEXT_BUTTON_ACTION_COMMAND

public static final String NEXT_BUTTON_ACTION_COMMAND
The String-based action command for the 'Next' button.

See Also:
Constant Field Values

BACK_BUTTON_ACTION_COMMAND

public static final String BACK_BUTTON_ACTION_COMMAND
The String-based action command for the 'Back' button.

See Also:
Constant Field Values

CANCEL_BUTTON_ACTION_COMMAND

public static final String CANCEL_BUTTON_ACTION_COMMAND
The String-based action command for the 'Cancel' button.

See Also:
Constant Field Values
Constructor Detail

Wizard

public Wizard()
Default constructor. This method creates a new WizardModel object and passes it into the overloaded constructor.


Wizard

public Wizard(Dialog owner)
This method accepts a java.awt.Dialog object as the javax.swing.JDialog's parent.

Parameters:
owner - The java.awt.Dialog object that is the owner of this dialog.

Wizard

public Wizard(Frame owner)
This method accepts a java.awt.Frame object as the javax.swing.JDialog's parent.

Parameters:
owner - The java.awt.Frame object that is the owner of the javax.swing.JDialog.
Method Detail

getDialog

public JDialog getDialog()
Returns an instance of the JDialog that this class created. This is useful in the event that you want to change any of the JDialog parameters manually.

Returns:
The JDialog instance that this class created.

getOwner

public Component getOwner()
Returns the owner of the generated javax.swing.JDialog.

Returns:
The owner (java.awt.Frame or java.awt.Dialog) of the javax.swing.JDialog generated by this class.

setTitle

public void setTitle(String s)
Sets the title of the generated javax.swing.JDialog.

Parameters:
s - The title of the dialog.

getTitle

public String getTitle()
Returns the current title of the generated dialog.

Returns:
The String-based title of the generated dialog.

setModal

public void setModal(boolean b)
Sets the modality of the generated javax.swing.JDialog.

Parameters:
b - the modality of the dialog

isModal

public boolean isModal()
Returns the modality of the dialog.

Returns:
A boolean indicating whether or not the generated javax.swing.JDialog is modal.

showModalDialog

public int showModalDialog()
Convienence method that displays a modal wizard dialog and blocks until the dialog has completed.

Returns:
Indicates how the dialog was closed. Compare this value against the RETURN_CODE constants at the beginning of the class.

getModel

public WizardModel getModel()
Returns the current model of the wizard dialog.

Returns:
A WizardModel instance, which serves as the model for the wizard dialog.

registerWizardPanel

public void registerWizardPanel(Object id,
                                WizardPanel panel)
Add a Component as a panel for the wizard dialog by registering its WizardPanel object. Each panel is identified by a unique Object-based identifier (often a String), which can be used by the setCurrentPanel() method to display the panel at runtime.

Parameters:
id - An Object-based identifier used to identify the WizardPanel object.
panel - The WizardPanel object which contains helpful information about the panel.

setCurrentPanel

public void setCurrentPanel(Object id)
Displays the panel identified by the object passed in. This is the same Object-based identified used when registering the panel.

Parameters:
id - The Object-based identifier of the panel to be displayed.

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Method used to listen for property change events from the model and update the dialog's graphical components as necessary.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - PropertyChangeEvent passed from the model to signal that one of its properties has changed value.

getReturnCode

public int getReturnCode()
Retrieves the last return code set by the dialog.

Returns:
An integer that identifies how the dialog was closed. See the *_RETURN_CODE constants of this class for possible values.

getBackButtonEnabled

public boolean getBackButtonEnabled()
Mirrors the WizardModel method of the same name.

Returns:
A boolean indicating if the button is enabled.

setBackButtonEnabled

public void setBackButtonEnabled(boolean newValue)
Mirrors the WizardModel method of the same name.

Parameters:
newValue - The new enabled status of the button.

getNextFinishButtonEnabled

public boolean getNextFinishButtonEnabled()
Mirrors the WizardModel method of the same name.

Returns:
A boolean indicating if the button is enabled.

setNextFinishButtonEnabled

public void setNextFinishButtonEnabled(boolean newValue)
Mirrors the WizardModel method of the same name.

Parameters:
newValue - The new enabled status of the button.

getCancelButtonEnabled

public boolean getCancelButtonEnabled()
Mirrors the WizardModel method of the same name.

Returns:
A boolean indicating if the button is enabled.

setCancelButtonEnabled

public void setCancelButtonEnabled(boolean newValue)
Mirrors the WizardModel method of the same name.

Parameters:
newValue - The new enabled status of the button.

resetButtonStates

public void resetButtonStates()

windowClosing

public void windowClosing(WindowEvent e)
If the user presses the dispose box on the dialog's window, treat it as a cancel.

Specified by:
windowClosing in interface WindowListener
Overrides:
windowClosing in class WindowAdapter
Parameters:
e - The event passed in from AWT.

dispose

public void dispose()

Protege 4.1.0

Submit a bug report or feature request

For further API reference and developer documentation, see Protege 4 Developer Documentation.

Copyright © 2010 Stanford Center for Biomedical Informatics Research