|
||||||||||
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.Dialog
javax.swing.JDialog
org.peace_tools.core.WorkspaceChooser
public class WorkspaceChooser
This class provides a pretty sophisticated dialog box that is displayed initially to the user to select a work space. A work space is simply a directory in which PEACE GUI stores all the files that are pertinent to a given GUI session. This class is used in the following manner:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JDialog |
---|
javax.swing.JDialog.AccessibleJDialog |
Nested classes/interfaces inherited from class java.awt.Dialog |
---|
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private CustomPanel |
cp
A custom panel that actually has the PEACE logo as the background image. |
private boolean |
firstLaunch
Flag to indicate if this is the first time ever the user is running PEACE GUI. |
private static java.lang.String |
FirstTimeMsg
A static piece of text that is prepended to the license text when PEACE is launched for the first time to provide the user with some additional information. |
private PEACE |
peace
Reference to the main PEACE class. |
private static java.lang.String |
Separator
A simple separator to make the license text look pretty. |
private static long |
serialVersionUID
The generated serial version ID to keep the Java compiler happy about serializing this class. |
private boolean |
showFirstTimeMsg
Flag that tracks if the first time welcome message has already been displayed or now. |
private javax.swing.JTabbedPane |
tabs
The set of tabs that are displayed in this dialog for the user to work with. |
private java.lang.String |
workspace
The selected work space that is set after the user successfully chooses a work space. |
private javax.swing.JComboBox |
wsList
The list of work spaces that the user can choose from or edit to start up the GUI session. |
Fields inherited from class javax.swing.JDialog |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Dialog |
---|
DEFAULT_MODALITY_TYPE |
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, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
WorkspaceChooser(javax.swing.JFrame owner,
PEACE peace)
The constructor. |
Method Summary | |
---|---|
private void |
accept(java.awt.event.ActionEvent event)
This is a refactored (to keep code clutter to a minimum in the actionPerformed() method) method that is called only from the actionPerformed() method whenever the user clicks on the "Accept" button in the license tab. |
void |
actionPerformed(java.awt.event.ActionEvent event)
This method handles the actions associated with various controls in the dialog. |
private javax.swing.JComponent |
createChooserDialog(boolean firstTime)
This is a helper method that creates the work space chooser dialog that prompts the user to choose a work space for this session of the GUI. |
private javax.swing.JComponent |
createLicenceTab(boolean firstTime)
This is a helper method that is used to create the license tab in the work space chooser. |
boolean |
createTabs()
Helper method to setup the tabs to be displayed in this frame. |
java.lang.String |
getWorkspace()
Obtain the work space that was successfully selected by the user. |
private void |
loadWorkspaceList(boolean firstTime,
javax.swing.JComboBox list)
This is a helper method that is used to load the list of previously used work space paths from the default ".workspace_list" file in the default working directory. |
private void |
okAction()
This is a refactored (to keep code clutter to a minimum in the actionPerformed() method) method that is called only from the actionPerformed() method whenever the user clicks on the "OK" button in the workspace tab. |
private void |
saveWorkspaceList(javax.swing.JComboBox list)
This is a helper method that is used to save the current list of work space paths to the work space list file. |
Methods inherited from class javax.swing.JDialog |
---|
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
Methods inherited from class java.awt.Dialog |
---|
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, show, toBack |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private boolean firstLaunch
private boolean showFirstTimeMsg
private javax.swing.JTabbedPane tabs
private javax.swing.JComboBox wsList
private java.lang.String workspace
private final PEACE peace
private CustomPanel cp
private static final long serialVersionUID
private static java.lang.String FirstTimeMsg
private static java.lang.String Separator
Constructor Detail |
---|
public WorkspaceChooser(javax.swing.JFrame owner, PEACE peace)
Method Detail |
---|
public boolean createTabs()
public java.lang.String getWorkspace()
private javax.swing.JComponent createChooserDialog(boolean firstTime)
firstTime
- This flag indicates if PEACE is being run
for the first time ever (or not).
private javax.swing.JComponent createLicenceTab(boolean firstTime) throws java.lang.Exception
firstTime
- If this parameter is true, then this method
creates an accept button at the bottom of the license panel. In
addition, it also adds an introductory message to the license
information.
java.lang.Exception
private void loadWorkspaceList(boolean firstTime, javax.swing.JComboBox list)
firstTime
- If this flag is true then it indicates that the
PEACE program is being launched for the first time.list
- The combo box to be populated with the list of work
space paths.private void saveWorkspaceList(javax.swing.JComboBox list)
list
- The combo box whose data is to be saved.public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
private void accept(java.awt.event.ActionEvent event)
event
- The action event that triggered this action.private void okAction()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |