Package uk.ac.starlink.topcat.plot2
Class StiltsMonitor
java.lang.Object
uk.ac.starlink.topcat.plot2.StiltsMonitor
Manages text display components for displaying a STILTS command
that is supposed to replicate the plot visible in a PlotPanel.
The replication may not be identical; a best effort is made.
- Since:
- 12 Sep 2017
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAction[]
Returns a list of actions that the GUI can present to the user relating to the displayed command.Returns an action that copies all the current stilts command text into the system clipboard.Returns an action that will pop up the error resulting from attempting to execute the current stilts command in a dialog window, if an error exists.Returns an action that will attempt to execute the current stilts command and display the result in a dialog window.Returns the text panel which displays the stilts command.int
Returns the width of the text display panel in characters.void
setFormatter
(uk.ac.starlink.ttools.plot2.task.StiltsPlotFormatter formatter) Sets the object that controls the details of formatting stilts commands.static JComponent
wrapTextPanel
(JTextComponent textPanel) Utility method for packaging the text panel returned by this object'sgetTextPanel()
method.
-
Constructor Details
-
StiltsMonitor
Constructor.- Parameters:
plotPanel
- panel to mirror
-
-
Method Details
-
setFormatter
public void setFormatter(uk.ac.starlink.ttools.plot2.task.StiltsPlotFormatter formatter) Sets the object that controls the details of formatting stilts commands. This can be assigned by the user to adjust formatting details.- Parameters:
formatter
- new formatter
-
getTextPanel
Returns the text panel which displays the stilts command.- Returns:
- text panel
-
getClipboardAction
Returns an action that copies all the current stilts command text into the system clipboard.- Returns:
- clipboard action
-
getExecuteAction
Returns an action that will attempt to execute the current stilts command and display the result in a dialog window.- Returns:
- execution action
-
getErrorAction
Returns an action that will pop up the error resulting from attempting to execute the current stilts command in a dialog window, if an error exists.- Returns:
- error display action
-
getActions
Returns a list of actions that the GUI can present to the user relating to the displayed command.- Returns:
- action array
-
getWidthCharacters
public int getWidthCharacters()Returns the width of the text display panel in characters. This assumes the font has a fixed width per character, which it does. The returned value gives the width of the scrollpane viewport, if applicable, rather than the width of the JTextComponent itself. That is the best width to use when deciding where to wrap lines.- Returns:
- current visible text region width in units of character width
-
wrapTextPanel
Utility method for packaging the text panel returned by this object'sgetTextPanel()
method. This puts it in a scroll pane, and makes sure the lines don't wrap.- Parameters:
textPanel
- text panel, supposed to be from this monitor- Returns:
- scrolled component containing panel
-