public class ZmtConsole extends Console
Two menus are added by this console. The 'Add' menu adds optional definitions
to the simulation while the 'Inspect' menu is used for displaying inspectors
like that from Output
which is added by default.
GUIState.createController()
,
Serialized FormModifier and Type | Class and Description |
---|---|
static interface |
ZmtConsole.InspectorSupplier |
static interface |
ZmtConsole.TimeBoxItem
An item that can be added to the time box at the bottom of the console
window.
|
JFrame.AccessibleJFrame
Frame.AccessibleAWTFrame
Window.AccessibleAWTWindow, Window.Type
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
allControllers, AUTOMATIC_PAUSE_STEPS_KEY, AUTOMATIC_PAUSE_TIME_KEY, AUTOMATIC_STOP_STEPS_KEY, AUTOMATIC_STOP_TIME_KEY, CONSOLE_KEY, DEFAULT_GUTTER, DEFAULT_HEIGHT, DEFAULT_PREFERENCES_KEY, DEFAULT_WIDTH, DELAY_KEY, DISPLAY_HEIGHT_KEY, DISPLAY_SHOWN_KEY, DISPLAY_WIDTH_KEY, DISPLAY_X_KEY, DISPLAY_Y_KEY, INCREMENT_KEY, MAXIMUM_STEPS, NAME_INDICATOR, NUM_DISPLAYS_KEY, ONLY_INDICATOR, PS_PAUSED, PS_PLAYING, PS_STOPPED, REPEAT_KEY, STEPS_KEY
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ZmtConsole(GUIState gui)
Constructs a new
ZmtConsole . |
Modifier and Type | Method and Description |
---|---|
void |
addDefinitionMenuItem(Class<? extends ParamDefinition> definitionClass)
Adds menu item for adding new parameter definition objects to the 'Add'
menu.
|
void |
addDefinitionMenuItem(Class<? extends ParamDefinition> definitionClass,
String menuItemText)
Adds menu item for adding new parameter definition objects to the 'Add'
menu.
|
protected void |
addDefinitionMenuItem(Class<? extends ParamDefinition> definitionClass,
String menuItemText,
JMenu menu)
Adds menu item for adding new parameter definition objects.
|
<T extends SimState> |
addInspectMenuItem(String menuItemText,
Function<T,Object> objectFromState)
Appends a menu item adding the
Inspector of an object from a
supplier function when triggered. |
protected <T extends SimState> |
addInspectMenuItem(String menuItemText,
Function<T,Object> objectFromState,
JMenu menu)
Appends a menu item adding the
Inspector of an object from a
supplier function when triggered. |
JMenuItem |
addInspectMenuItem(String menuItemText,
ZmtConsole.InspectorSupplier supplier)
Appends a menu item to the 'Inspect' menu adding the
Inspector
from given supplier when triggered. |
protected JMenuItem |
addInspectMenuItem(String menuItemText,
ZmtConsole.InspectorSupplier supplier,
JMenu menu)
Appends a menu item adding the
Inspector from given supplier when
triggered. |
boolean |
addTimeBoxItem(ZmtConsole.TimeBoxItem item)
Adds a
ZmtConsole.TimeBoxItem to the combo box at the bottom of the console
window. |
protected JMenu |
getAddMenu()
Gets the menu for adding optional definitions.
|
protected JMenu |
getInspectMenu()
Gets the menu for inspecting various things.
|
JMenu |
getParamsMenu()
Returns the menu for opening / saving parameters.
|
boolean |
removeTimeBoxItem(ZmtConsole.TimeBoxItem item)
Removes a
ZmtConsole.TimeBoxItem from the combo box at the bottom of the
console window. |
void |
selectTimeBoxItem(ZmtConsole.TimeBoxItem item)
Selects a
ZmtConsole.TimeBoxItem in the combo box at the bottom of the
console window. |
doAbout, doChangeCode, doClose, doNew, doOpen, doQuit, doSave, doSaveAs, getAllFrames, getAllInspectors, getIncrementSeedOnPlay, getIncrementSeedOnStop, getModelInspector, getNumStepsPerStepButtonPress, getPlaySleep, getPlayState, getRequiresConfirmationToStop, getShouldRepeat, getSimulation, getStepsPerSecond, getTabPane, getThreadPriority, getWhenShouldEnd, getWhenShouldEndTime, getWhenShouldPause, getWhenShouldPauseTime, hideAllFrames, isNewMenuAllowed, isOpenMenuAllowed, isSaveMenuAllowed, main, pressPause, pressPlay, pressStop, refresh, registerFrame, registerInspector, removeAllInspectors, setIncrementSeedOnPlay, setIncrementSeedOnStop, setInspectors, setNewMenuAllowed, setNumStepsPerStepButtonPress, setOpenMenuAllowed, setPlaySleep, setRequiresConfirmationToStop, setSaveMenuAllowed, setShouldRepeat, setThreadPriority, setWhenShouldEnd, setWhenShouldEndTime, setWhenShouldPause, setWhenShouldPauseTime, showAllFrames, stopAllInspectors, unregisterAllFrames, unregisterFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, 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, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFont, postEvent
public ZmtConsole(GUIState gui)
gui
- gui state to be usedpublic void addDefinitionMenuItem(Class<? extends ParamDefinition> definitionClass)
definitionClass
- the class to be used, needs a public no-argument constructorpublic void addDefinitionMenuItem(Class<? extends ParamDefinition> definitionClass, String menuItemText)
definitionClass
- the class to be used, needs a public no-argument constructormenuItemText
- the text of the menu item to add a new definitionprotected void addDefinitionMenuItem(Class<? extends ParamDefinition> definitionClass, String menuItemText, JMenu menu)
definitionClass
- the class to be used, needs a public no-argument constructormenuItemText
- the text of the menu item to add a new definitionmenu
- the JMenu
where the item is addedpublic JMenuItem addInspectMenuItem(String menuItemText, ZmtConsole.InspectorSupplier supplier)
Inspector
from given supplier when triggered.menuItemText
- the menu item text to be displayedsupplier
- the supplier for the inspectorComponent
addedpublic <T extends SimState> JMenuItem addInspectMenuItem(String menuItemText, Function<T,Object> objectFromState)
Inspector
of an object from a
supplier function when triggered.menuItemText
- the menu item text to be displayedobjectFromState
- the supplier function to get the object to be inspected from
the SimState
Component
addedClassCastException
- if the SimState
could not be cast to the class
required by the supplier functionprotected <T extends SimState> JMenuItem addInspectMenuItem(String menuItemText, Function<T,Object> objectFromState, JMenu menu)
Inspector
of an object from a
supplier function when triggered.menuItemText
- the menu item text to be displayedobjectFromState
- the supplier function to get the object to be inspected from
the SimState
menu
- the JMenu
where the item is addedComponent
addedClassCastException
- if the SimState
could not be cast to the class
required by the supplier functionprotected JMenuItem addInspectMenuItem(String menuItemText, ZmtConsole.InspectorSupplier supplier, JMenu menu)
Inspector
from given supplier when
triggered.menuItemText
- the menu item text to be displayedsupplier
- the supplier for the inspectormenu
- the JMenu
where the item is addedComponent
addedpublic boolean addTimeBoxItem(ZmtConsole.TimeBoxItem item)
ZmtConsole.TimeBoxItem
to the combo box at the bottom of the console
window.item
- the ZmtConsole.TimeBoxItem
to addpublic boolean removeTimeBoxItem(ZmtConsole.TimeBoxItem item)
ZmtConsole.TimeBoxItem
from the combo box at the bottom of the
console window.item
- the ZmtConsole.TimeBoxItem
to removepublic void selectTimeBoxItem(ZmtConsole.TimeBoxItem item)
ZmtConsole.TimeBoxItem
in the combo box at the bottom of the
console window.item
- the Time
to selectpublic JMenu getParamsMenu()
protected JMenu getAddMenu()
protected JMenu getInspectMenu()