public class AlgorithmTextView extends View
AlgorithmText
and visualizes the executing AlgorithmStep
.
AlgorithmTextView(PluginHost, String, AlgorithmText, boolean, LanguageFile, String)
to specify a language file from which
labels, tooltips and messages are read by the given language id. The following language labels are available:
Resources.LANGUAGE_FILE
.
setHighlightBackground(Color)
and setHighlightForeground(Color)
to change the colors that visualize a step that is currently in
execution.
View.saveConfiguration(Configuration)
and View.loadConfiguration(Configuration)
.
It is saved or restored the visibility of the view, the highlight background and foreground, the halted background and foreground, the font size of the
algorithm text view and the active breakpoints of the steps. This makes it possible that you can store the state of the view persistent.javax.swing.JComponent.AccessibleJComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
AlgorithmTextView(PluginHost host,
java.lang.String title,
AlgorithmText text)
Creates a new view for the visualization of an algorithm text.
|
AlgorithmTextView(PluginHost host,
java.lang.String title,
AlgorithmText text,
boolean closable)
Creates a new view for the visualization of an algorithm text.
|
AlgorithmTextView(PluginHost host,
java.lang.String title,
AlgorithmText text,
boolean closable,
LanguageFile langFile,
java.lang.String langID)
Creates a new view for the visualization of an algorithm text.
|
Modifier and Type | Method and Description |
---|---|
protected void |
autoRepaint()
Repaints the view but only if auto repainting is allowed.
|
boolean |
getAutoRepaint()
Indicates whether auto repaint is enabled in the view.
|
java.awt.Color |
getHaltedBackground()
Gets the background color of the highlighted step when he is halted (meaning he has a breakpoint).
|
java.awt.Color |
getHaltedForeground()
Gets the foreground color of the highlighted step when he is halted (meaning he has a breakpoint).
|
java.awt.Color |
getHighlightBackground()
Gets the background color of the highlighted step.
|
java.awt.Color |
getHighlightForeground()
Gets the foreground color of the highlighted step.
|
AlgorithmText |
getText()
Gets the algorithm text that is displayed in the view.
|
protected void |
readConfigurationData(Configuration cd)
Reads the configuration data of the view.
|
protected void |
repaintComponent()
Repaints the component.
|
void |
reset()
Deselects a step if a step is currently selected and updates the text layout.
|
void |
setAutoRepaint(boolean autoRepaint)
Sets whether the view is allowed to be auto repainted.
|
void |
setFont(java.awt.Font f)
Sets the font of the algorithm text.
|
void |
setHaltedBackground(java.awt.Color c)
Sets the background color of the highlighted step when he is halted (meaning he has a breakpoint).
|
void |
setHaltedForeground(java.awt.Color c)
Sets the foreground color of the highlighted step when he is halted (meaning he has a breakpoint).
|
void |
setHighlightBackground(java.awt.Color c)
Sets the background color of the highlighted step.
|
void |
setHighlightForeground(java.awt.Color c)
Sets the foreground color of the highlighted step.
|
protected void |
writeConfigurationData(Configuration cd)
Writes the configuration data of the view.
|
addHeaderBarComponent, addHeaderBarSeparator, addImpl, beforeRemove, close, extendTitle, getContentPanel, getTitle, highlight, highlight, isClosable, isVisible, loadConfiguration, loadConfiguration, removeAll, removeHeaderBarComponent, saveConfiguration, saveConfiguration, setBorder, setCloseButtonToolTip, setLayout, setVisible, toString
isRepaintDisabled, repaint, setRepaintDisabled
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
public AlgorithmTextView(PluginHost host, java.lang.String title, AlgorithmText text) throws java.lang.IllegalArgumentException
host
- the host application of the plugin that uses the algorithm text viewtitle
- the title of the view which is displayed in the header bartext
- the algorithm text that should be displayedjava.lang.IllegalArgumentException
- public AlgorithmTextView(PluginHost host, java.lang.String title, AlgorithmText text, boolean closable) throws java.lang.IllegalArgumentException
host
- the host application of the plugin that uses the algorithm text viewtitle
- the title of the view which is displayed in the header bartext
- the algorithm text that should be displayedclosable
- true
if the text view can be closed by the user using the "X" in the header bar otherwise false
(if a text view is not closable he must be set invisible manually using View.setVisible(boolean)
if required)java.lang.IllegalArgumentException
- public AlgorithmTextView(PluginHost host, java.lang.String title, AlgorithmText text, boolean closable, LanguageFile langFile, java.lang.String langID) throws java.lang.IllegalArgumentException
LanguageFile
and a language id to display language dependent
messages and tooltips in the text view. The following language labels are available:
host
- the host application of the plugin that uses the algorithm text viewtitle
- the title of the view which is displayed in the header bartext
- the algorithm text that should be displayedclosable
- true
if the text view can be closed by the user using the "X" in the header bar otherwise false
(if a text view is not closable he must be set invisible manually using View.setVisible(boolean)
if required)langFile
- the language file or null
if the text view should not use language dependent labels, tooltips or messages (in this case the predefined labels, tooltips and messages are shown)langID
- the language idjava.lang.IllegalArgumentException
- public boolean getAutoRepaint()
getAutoRepaint
in class View
true
if auto repainting is allowed otherwise false
public void setAutoRepaint(boolean autoRepaint)
BaseComponent.repaint()
on your own to visualize the changes you made to a component or view.
BaseComponent.repaint()
method of the view is automatically
invoked to make the changes visible. But ensure that this does not overload the EDT (event dispatch thread).n
objects in a loop and you activate the auto repaint option.n
calls to BaseComponent.repaint()
instead of one call at the end of the loop.GuiRequest
) and in consequence of that
the algorithm must wait until the pending event is processed in the EDT.setAutoRepaint
in class View
autoRepaint
- true
if auto repainting should be enabled otherwise false
public AlgorithmText getText()
public java.awt.Color getHighlightForeground()
public void setHighlightForeground(java.awt.Color c) throws java.lang.IllegalArgumentException
setAutoRepaint(boolean)
)!c
- the foreground color of the executing stepjava.lang.IllegalArgumentException
- public java.awt.Color getHighlightBackground()
public void setHighlightBackground(java.awt.Color c) throws java.lang.IllegalArgumentException
setAutoRepaint(boolean)
)!c
- the background color of the executing stepjava.lang.IllegalArgumentException
- public java.awt.Color getHaltedForeground()
public void setHaltedForeground(java.awt.Color c) throws java.lang.IllegalArgumentException
setAutoRepaint(boolean)
)!c
- the foreground color of the step with the currently active breakpointjava.lang.IllegalArgumentException
- public java.awt.Color getHaltedBackground()
public void setHaltedBackground(java.awt.Color c) throws java.lang.IllegalArgumentException
setAutoRepaint(boolean)
)!c
- the background color of the step with the currently active breakpointjava.lang.IllegalArgumentException
- public void reset()
public void setFont(java.awt.Font f)
setFont
in class javax.swing.JComponent
f
- the fontprotected void repaintComponent()
BaseComponent.repaint()
. You can override this method to repaint sub-components but ensure that
the super type method is invoked too meaning:
protected void repaintComponent() { // repaint the parent super.repaintComponent(); // repaint sub-components ... }
repaintComponent
in class BaseComponent
protected void autoRepaint()
autoRepaint
in class View
protected void readConfigurationData(Configuration cd)
... protected void readConfigurationData(Configuration cd) { super.readConfigurationData(cd); // load custom data like // foreground = cd.getColor("foreground"); // ... } ...Furthermore it is read the highlight background and foreground (keys "highlightBG"/"highlightFG"), the halted background and foreground (keys "haltedBG"/"haltedFG"), the font size (key "fontSize") of the algorithm text view and a collection of step identifiers (key "breakpoints") which have a breakpoint.
readConfigurationData
in class View
cd
- the configuration dataprotected void writeConfigurationData(Configuration cd)
... protected void writeConfigurationData(Configuration cd) { super.writeConfigurationData(cd); // write custom data like // cd.addColor("foreground", foreground); // ... } ...Furthermore it is written the highlight background and foreground (keys "highlightBG"/"highlightFG"), the halted background and foreground (keys "haltedBG"/"haltedFG"), the font size (key "fontSize") of the algorithm text view and a collection of step identifiers (key "breakpoints") which have a breakpoint.
writeConfigurationData
in class View
cd
- the configuration data