uk.ac.starlink.topcat.plot2
Class StiltsMonitor

java.lang.Object
  extended by uk.ac.starlink.topcat.plot2.StiltsMonitor

public class StiltsMonitor
extends Object

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
StiltsMonitor(PlotPanel plotPanel)
          Constructor.
 
Method Summary
 Action[] getActions()
          Returns a list of actions that the GUI can present to the user relating to the displayed command.
 Action getClipboardAction()
          Returns an action that copies all the current stilts command text into the system clipboard.
 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.
 Action getExecuteAction()
          Returns an action that will attempt to execute the current stilts command and display the result in a dialog window.
 JTextComponent getTextPanel()
          Returns the text panel which displays the stilts command.
 int getWidthCharacters()
          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's getTextPanel() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StiltsMonitor

public StiltsMonitor(PlotPanel plotPanel)
Constructor.

Parameters:
plotPanel - panel to mirror
Method Detail

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

public JTextComponent getTextPanel()
Returns the text panel which displays the stilts command.

Returns:
text panel

getClipboardAction

public Action getClipboardAction()
Returns an action that copies all the current stilts command text into the system clipboard.

Returns:
clipboard action

getExecuteAction

public 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

public 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

public 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

public static JComponent wrapTextPanel(JTextComponent textPanel)
Utility method for packaging the text panel returned by this object's getTextPanel() 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


Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.