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 StringFILE_EXTENSIONthe file to store the recent files in.static StringFILENAMEthe name of the props file.protected BaseButtonm_ButtonAddthe button for adding a setup.protected BaseButtonm_ButtonEditthe button for editing a setup.protected BaseButtonm_ButtonEditFlowthe button for editing a flow directly.protected BaseButtonm_ButtonMoveDownthe button for moving the selected setups down.protected BaseButtonm_ButtonMoveUpthe button for moving the selected setups up.protected BaseButtonm_ButtonPauseAndResumethe button for pausing/resuming setups.protected BaseButtonm_ButtonRemovethe button for removing a setup.protected BaseButtonm_ButtonRemoveAllthe button for removing all setups.protected BaseButtonm_ButtonStartthe button for starting setups.protected BaseButtonm_ButtonStopthe button for stopping setups.protected Filem_CurrentFilethe filename of the current flow.protected BaseFileChooserm_FileChooserthe filedialog for loading/saving flows.protected FilenameProposerm_FilenameProposerfor proposing filenames for new flows.protected GenericObjectEditorDialogm_GOEDialogthe GOE for editing the setups.protected FlowSetupManagerm_Managerfor managing the setups.protected JMenuBarm_MenuBarthe menu bar, if used.protected JMenuItemm_MenuItemFileClosethe "exit" menu item.protected JMenuItemm_MenuItemFileNewthe "new" menu item.protected JMenuItemm_MenuItemFileOpenthe "open" menu item.protected JMenum_MenuItemFileOpenRecentthe "open recent" menu.protected JMenuItemm_MenuItemFileRevertthe "rever" menu item.protected JMenuItemm_MenuItemFileSavethe "save" menu item.protected JMenuItemm_MenuItemFileSaveAsthe "save as" menu item.protected static Propertiesm_Propertiesthe properties.protected RecentFilesHandler<JMenu>m_RecentFilesHandlerthe recent files handler.protected FlowControlCenterPanelm_Selfthe panel itself.protected BaseStatusBarm_StatusBarthe status.protected FlowSetupTableModelm_TableModelSetupsthe table model for the setups.protected BaseTableWithButtonsm_TableSetupsthe table displaying the setups.protected TitleGeneratorm_TitleGeneratorfor generating the title.static StringSESSION_FILEthe 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 voidaddSetup()Adds a setup.protected booleancheckForModified()Returns whether we can proceed with the operation or not, depending on whether the user saved the flow or discarded the changes.protected voidcleanUp()Cleans up.protected voidclose()Closes the dialog or frame.protected voideditFlow()Edits the selected flow.protected voideditSetup()Edits the selected setup.FilegetCurrentFile()Returns the current file in use.protected GenericObjectEditorDialoggetGOEDialog()Initializes the GOE dialog if necessary and returns the instance.JMenuBargetMenuBar()Creates a menu bar (singleton per panel object).TitleGeneratorgetTitleGenerator()Returns the title generator in use.protected voidinitGUI()Initializes the widgets.protected voidinitialize()Initializes the members.voidload(File file)Loads a setup.protected voidmoveRows(boolean up)Moves the selected rows and updates the selection.protected voidopen()Opens a setup.protected voidpauseAndResumeSetups()Pauses/resumes the selected setups.protected voidremoveAllSetups()Removes all setups.protected voidremoveSetups()Removes the selected setups.protected voidreset()Resets the GUI to default values.protected voidrevert()Reverts a setup.protected voidsave()Saves the setup.protected voidsaveAs()Saves the setups.protected voidshowMessage(String msg)Displays the given message in a separate dialog.voidshowStatus(String msg)Displays a message.protected voidshowTablePopup(MouseEvent e)Displays a popup for the table.protected voidstartSetups()Starts the selected setups.protected voidstopSetups()Stops the selected setups.voidtableChanged(TableModelEvent e)This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.voidundoOccurred(UndoEvent e)An undo event occurred.protected voidupdate()updates the enabled state etc. of all the GUI elements.protected voidupdateButtons()Updates the buttons.protected voidupdateMenu()updates the enabled state of the menu items.protected voidupdateTitle()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:
initializein 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:
getMenuBarin 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:
showStatusin 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:
tableChangedin interfaceTableModelListener- Parameters:
e- the event
-
-