Package adams.gui.flow
Class FlowControlCenterPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.flow.FlowControlCenterPanel
-
- All Implemented Interfaces:
StatusMessageHandler
,MenuBarProvider
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,TableModelListener
public class FlowControlCenterPanel extends BasePanel implements MenuBarProvider, StatusMessageHandler, TableModelListener
A panel that functions as control center for flows.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILE_EXTENSION
the file to store the recent files in.static String
FILENAME
the name of the props file.protected BaseButton
m_ButtonAdd
the button for adding a setup.protected BaseButton
m_ButtonEdit
the button for editing a setup.protected BaseButton
m_ButtonEditFlow
the button for editing a flow directly.protected BaseButton
m_ButtonMoveDown
the button for moving the selected setups down.protected BaseButton
m_ButtonMoveUp
the button for moving the selected setups up.protected BaseButton
m_ButtonPauseAndResume
the button for pausing/resuming setups.protected BaseButton
m_ButtonRemove
the button for removing a setup.protected BaseButton
m_ButtonRemoveAll
the button for removing all setups.protected BaseButton
m_ButtonStart
the button for starting setups.protected BaseButton
m_ButtonStop
the button for stopping setups.protected File
m_CurrentFile
the filename of the current flow.protected BaseFileChooser
m_FileChooser
the filedialog for loading/saving flows.protected FilenameProposer
m_FilenameProposer
for proposing filenames for new flows.protected GenericObjectEditorDialog
m_GOEDialog
the GOE for editing the setups.protected FlowSetupManager
m_Manager
for managing the setups.protected JMenuBar
m_MenuBar
the menu bar, if used.protected JMenuItem
m_MenuItemFileClose
the "exit" menu item.protected JMenuItem
m_MenuItemFileNew
the "new" menu item.protected JMenuItem
m_MenuItemFileOpen
the "open" menu item.protected JMenu
m_MenuItemFileOpenRecent
the "open recent" menu.protected JMenuItem
m_MenuItemFileRevert
the "rever" menu item.protected JMenuItem
m_MenuItemFileSave
the "save" menu item.protected JMenuItem
m_MenuItemFileSaveAs
the "save as" menu item.protected static Properties
m_Properties
the properties.protected RecentFilesHandler<JMenu>
m_RecentFilesHandler
the recent files handler.protected FlowControlCenterPanel
m_Self
the panel itself.protected BaseStatusBar
m_StatusBar
the status.protected FlowSetupTableModel
m_TableModelSetups
the table model for the setups.protected BaseTableWithButtons
m_TableSetups
the table displaying the setups.protected TitleGenerator
m_TitleGenerator
for generating the title.static String
SESSION_FILE
the file to store the recent files in.-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors Constructor Description FlowControlCenterPanel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addSetup()
Adds a setup.protected boolean
checkForModified()
Returns whether we can proceed with the operation or not, depending on whether the user saved the flow or discarded the changes.protected void
cleanUp()
Cleans up.protected void
close()
Closes the dialog or frame.protected void
editFlow()
Edits the selected flow.protected void
editSetup()
Edits the selected setup.File
getCurrentFile()
Returns the current file in use.protected GenericObjectEditorDialog
getGOEDialog()
Initializes the GOE dialog if necessary and returns the instance.JMenuBar
getMenuBar()
Creates a menu bar (singleton per panel object).TitleGenerator
getTitleGenerator()
Returns the title generator in use.protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.void
load(File file)
Loads a setup.protected void
moveRows(boolean up)
Moves the selected rows and updates the selection.protected void
open()
Opens a setup.protected void
pauseAndResumeSetups()
Pauses/resumes the selected setups.protected void
removeAllSetups()
Removes all setups.protected void
removeSetups()
Removes the selected setups.protected void
reset()
Resets the GUI to default values.protected void
revert()
Reverts a setup.protected void
save()
Saves the setup.protected void
saveAs()
Saves the setups.protected void
showMessage(String msg)
Displays the given message in a separate dialog.void
showStatus(String msg)
Displays a message.protected void
showTablePopup(MouseEvent e)
Displays a popup for the table.protected void
startSetups()
Starts the selected setups.protected void
stopSetups()
Stops the selected setups.void
tableChanged(TableModelEvent e)
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.void
undoOccurred(UndoEvent e)
An undo event occurred.protected void
update()
updates the enabled state etc.protected void
updateButtons()
Updates the buttons.protected void
updateMenu()
updates the enabled state of the menu items.protected void
updateTitle()
Updates the title of the dialog.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the name of the props file.- See Also:
- Constant Field Values
-
SESSION_FILE
public static final String SESSION_FILE
the file to store the recent files in.- See Also:
- Constant Field Values
-
FILE_EXTENSION
public static final String FILE_EXTENSION
the file to store the recent files in.- See Also:
- Constant Field Values
-
m_Properties
protected static Properties m_Properties
the properties.
-
m_Self
protected FlowControlCenterPanel m_Self
the panel itself.
-
m_TitleGenerator
protected TitleGenerator m_TitleGenerator
for generating the title.
-
m_MenuBar
protected JMenuBar m_MenuBar
the menu bar, if used.
-
m_MenuItemFileNew
protected JMenuItem m_MenuItemFileNew
the "new" menu item.
-
m_MenuItemFileOpen
protected JMenuItem m_MenuItemFileOpen
the "open" menu item.
-
m_MenuItemFileOpenRecent
protected JMenu m_MenuItemFileOpenRecent
the "open recent" menu.
-
m_MenuItemFileSave
protected JMenuItem m_MenuItemFileSave
the "save" menu item.
-
m_MenuItemFileSaveAs
protected JMenuItem m_MenuItemFileSaveAs
the "save as" menu item.
-
m_MenuItemFileRevert
protected JMenuItem m_MenuItemFileRevert
the "rever" menu item.
-
m_MenuItemFileClose
protected JMenuItem m_MenuItemFileClose
the "exit" menu item.
-
m_StatusBar
protected BaseStatusBar m_StatusBar
the status.
-
m_RecentFilesHandler
protected RecentFilesHandler<JMenu> m_RecentFilesHandler
the recent files handler.
-
m_CurrentFile
protected File m_CurrentFile
the filename of the current flow.
-
m_FileChooser
protected BaseFileChooser m_FileChooser
the filedialog for loading/saving flows.
-
m_Manager
protected FlowSetupManager m_Manager
for managing the setups.
-
m_TableModelSetups
protected FlowSetupTableModel m_TableModelSetups
the table model for the setups.
-
m_TableSetups
protected BaseTableWithButtons m_TableSetups
the table displaying the setups.
-
m_ButtonAdd
protected BaseButton m_ButtonAdd
the button for adding a setup.
-
m_ButtonEdit
protected BaseButton m_ButtonEdit
the button for editing a setup.
-
m_ButtonEditFlow
protected BaseButton m_ButtonEditFlow
the button for editing a flow directly.
-
m_ButtonStart
protected BaseButton m_ButtonStart
the button for starting setups.
-
m_ButtonPauseAndResume
protected BaseButton m_ButtonPauseAndResume
the button for pausing/resuming setups.
-
m_ButtonStop
protected BaseButton m_ButtonStop
the button for stopping setups.
-
m_ButtonMoveUp
protected BaseButton m_ButtonMoveUp
the button for moving the selected setups up.
-
m_ButtonMoveDown
protected BaseButton m_ButtonMoveDown
the button for moving the selected setups down.
-
m_ButtonRemove
protected BaseButton m_ButtonRemove
the button for removing a setup.
-
m_ButtonRemoveAll
protected BaseButton m_ButtonRemoveAll
the button for removing all setups.
-
m_GOEDialog
protected GenericObjectEditorDialog m_GOEDialog
the GOE for editing the setups.
-
m_FilenameProposer
protected FilenameProposer m_FilenameProposer
for proposing filenames for new flows.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classBasePanel
-
showTablePopup
protected void showTablePopup(MouseEvent e)
Displays a popup for the table.- Parameters:
e
- the mouse event that triggered the popup
-
addSetup
protected void addSetup()
Adds a setup.
-
editSetup
protected void editSetup()
Edits the selected setup.
-
editFlow
protected void editFlow()
Edits the selected flow.
-
startSetups
protected void startSetups()
Starts the selected setups.
-
pauseAndResumeSetups
protected void pauseAndResumeSetups()
Pauses/resumes the selected setups.
-
stopSetups
protected void stopSetups()
Stops the selected setups.
-
moveRows
protected void moveRows(boolean up)
Moves the selected rows and updates the selection.- Parameters:
up
- if true then the selected rows are moved up, otherwise down
-
removeSetups
protected void removeSetups()
Removes the selected setups.
-
removeAllSetups
protected void removeAllSetups()
Removes all setups.
-
getMenuBar
public JMenuBar getMenuBar()
Creates a menu bar (singleton per panel object). Can be used in frames.- Specified by:
getMenuBar
in interfaceMenuBarProvider
- Returns:
- the menu bar
-
getGOEDialog
protected GenericObjectEditorDialog getGOEDialog()
Initializes the GOE dialog if necessary and returns the instance.- Returns:
- the GOE dialog
-
showStatus
public void showStatus(String msg)
Displays a message.- Specified by:
showStatus
in interfaceStatusMessageHandler
- Parameters:
msg
- the message to display
-
undoOccurred
public void undoOccurred(UndoEvent e)
An undo event occurred.- Parameters:
e
- the event
-
update
protected void update()
updates the enabled state etc. of all the GUI elements.
-
getTitleGenerator
public TitleGenerator getTitleGenerator()
Returns the title generator in use.- Returns:
- the generator
-
updateTitle
protected void updateTitle()
Updates the title of the dialog.
-
updateButtons
protected void updateButtons()
Updates the buttons.
-
updateMenu
protected void updateMenu()
updates the enabled state of the menu items.
-
checkForModified
protected boolean checkForModified()
Returns whether we can proceed with the operation or not, depending on whether the user saved the flow or discarded the changes.- Returns:
- true if safe to proceed
-
cleanUp
protected void cleanUp()
Cleans up.
-
reset
protected void reset()
Resets the GUI to default values.
-
getCurrentFile
public File getCurrentFile()
Returns the current file in use.- Returns:
- the current file, can be null
-
load
public void load(File file)
Loads a setup.- Parameters:
file
- the setup to load
-
open
protected void open()
Opens a setup.
-
revert
protected void revert()
Reverts a setup.
-
save
protected void save()
Saves the setup.
-
saveAs
protected void saveAs()
Saves the setups.
-
close
protected void close()
Closes the dialog or frame.
-
showMessage
protected void showMessage(String msg)
Displays the given message in a separate dialog.- Parameters:
msg
- the message to display
-
tableChanged
public void tableChanged(TableModelEvent e)
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.- Specified by:
tableChanged
in interfaceTableModelListener
- Parameters:
e
- the event
-
-