|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JOptionPane
org.vizzini.ui.AbstractOptionPane
public abstract class AbstractOptionPane
Provides a generic option pane base class for creating platform sensitive dialogs.
A subclass must override fillMainPanel( JPanel )
for its
custom components, and getTitleKey()
for its custom dialog
title. A subclass should call fillMainPanel()
in its
constructor.
The default option type is OK_CANCEL_OPTION
; other choices
may be set by using setOptionType( int )
or setOptionType(
int, String )
. The latter allows custom button labels to be set on the
OK button. The dialog is shown with
optionPane.getDialog().show()
and brought to the front with
optionPane.getDialog().toFront()
.
For specialized closing behavior, subclasses may override the following
methods:
okActionPerformed()
cancelActionPerformed()
applyActionPerformed()
noActionPerformed()
closedActionPerformed()
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JOptionPane |
---|
JOptionPane.AccessibleJOptionPane |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
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 String |
_title
Full title including the owner title, if any. |
static int |
APPLY_OPTION
Added option for use with option type OK_CANCEL_APPLY_OPTION. |
static int |
CUSTOM_CANCEL_APPLY_OPTION
Added option type for a custom OK button. |
static int |
CUSTOM_CANCEL_OPTION
Added option type for a custom OK button. |
static int |
CUSTOM_OPTION
Added option type for a custom OK button. |
static int |
OK_CANCEL_APPLY_OPTION
Added option type. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
protected |
AbstractOptionPane()
Construct this dialog. |
protected |
AbstractOptionPane(Component parentComponent)
Construct this dialog. |
protected |
AbstractOptionPane(Component parentComponent,
String ownerTitle)
Construct this dialog. |
Method Summary | |
---|---|
protected void |
applyActionPerformed()
Callback for the apply button. |
protected void |
cancelActionPerformed()
Callback for the cancel button. |
protected void |
checkComponents()
Check components for their enable state. |
protected void |
closedActionPerformed()
Callback for the window closed button. |
protected JPanel |
createMainPanel()
Create the main panel which is placed in the message area of the option pane. |
protected void |
fillMainPanel()
Fill the main panel which is placed in the message area of the option pane. |
protected abstract void |
fillMainPanel(JPanel mainPanel)
Fill the main panel which is placed in the message area of the option pane. |
protected boolean |
findAndSetDefaultButton(Component[] components)
Locate and set the default button. |
JDialog |
getDialog()
Return the dialog for this option pane, creating it if necessary. |
protected JPanel |
getMainPanel()
Return the main panel. |
int |
getOptionType()
Extend the super method to handle OK_CANCEL_APPLY_OPTION, CUSTOM_OPTION, CUSTOM_CANCEL_OPTION, and CUSTOM_CANCEL_APPLY_OPTION. |
protected String |
getOwnerTitle()
Return the owner title. |
int |
getResult()
Return the result. |
protected abstract String |
getTitleKey()
Return the title string key. |
protected void |
init(Component parentComponent,
String ownerTitle)
Initialize this option pane. |
protected static void |
initializeOptionStrings()
Initialize the option strings. |
boolean |
isActionApproved()
Return true if the dialog was approved. |
boolean |
isDirty()
Answer true if data was changed in the dialog. |
protected void |
noActionPerformed()
Callback for the no button. |
protected void |
okActionPerformed()
Callback for the OK button. |
protected void |
performUpdates()
Provides a hook for updating the dialog contents. |
protected void |
processResult()
Process the result. |
void |
setCursorBusy(boolean busy)
Set the cursor to show busy. |
void |
setDirty(boolean isDirty)
Set the dirty flag. |
void |
setOptionType(int optionType)
Extend the super method to handle OK_CANCEL_APPLY_OPTION. |
void |
setOptionType(int optionType,
String customKey)
Extend the super method to handle CUSTOM_OPTION ,
CUSTOM_CANCEL_OPTION , and CUSTOM_CANCEL_APPLY_OPTION . |
protected void |
setTitle(String title)
Set the title of this dialog. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int APPLY_OPTION
public static final int CUSTOM_OPTION
public static final int CUSTOM_CANCEL_OPTION
public static final int CUSTOM_CANCEL_APPLY_OPTION
public static final int OK_CANCEL_APPLY_OPTION
protected String _title
Constructor Detail |
---|
protected AbstractOptionPane()
protected AbstractOptionPane(Component parentComponent)
parentComponent
- The parent component.protected AbstractOptionPane(Component parentComponent, String ownerTitle)
parentComponent
- The parent component.ownerTitle
- Title representing the owning application.Method Detail |
---|
public JDialog getDialog()
public int getOptionType()
getOptionType
in class JOptionPane
public int getResult()
public boolean isActionApproved()
public boolean isDirty()
public void setCursorBusy(boolean busy)
public void setDirty(boolean isDirty)
public void setOptionType(int optionType)
setOptionType
in class JOptionPane
optionType
- Option type.public void setOptionType(int optionType, String customKey)
CUSTOM_OPTION
,
CUSTOM_CANCEL_OPTION
, and CUSTOM_CANCEL_APPLY_OPTION
.
optionType
- Option type.customKey
- Resource key for the custom button text.
IllegalArgumentException
- if optionType
is not one
of CUSTOM_OPTION
,
CUSTOM_CANCEL_OPTION
, or
CUSTOM_CANCEL_APPLY_OPTION
.protected abstract void fillMainPanel(JPanel mainPanel)
protected abstract String getTitleKey()
protected static void initializeOptionStrings()
protected void applyActionPerformed()
protected void cancelActionPerformed()
protected void checkComponents()
protected void closedActionPerformed()
protected JPanel createMainPanel()
BorderLayout
with horizontal and
vertical gaps of size GUIConstants.GAP
.
protected void fillMainPanel()
protected boolean findAndSetDefaultButton(Component[] components)
protected JPanel getMainPanel()
protected String getOwnerTitle()
protected void init(Component parentComponent, String ownerTitle)
protected void noActionPerformed()
protected void okActionPerformed()
protected void performUpdates()
protected void processResult()
protected void setTitle(String title)
getDialog()
in
order for the title to take effect.
title
- New title.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |