Package uk.ac.starlink.topcat
Class ControlWindow
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
uk.ac.starlink.topcat.AuxWindow
uk.ac.starlink.topcat.ControlWindow
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,ListDataListener
,ListSelectionListener
,TableColumnModelListener
,TableModelListener
,RootPaneContainer
,WindowConstants
,TopcatListener
public class ControlWindow
extends AuxWindow
implements ListSelectionListener, ListDataListener, TableModelListener, TableColumnModelListener, TopcatListener
Main window providing user control of the TOPCAT application.
This is a singleton class.
Note: there is a lot wrong with this class. It's been here for as long as topcat has (i.e. since before I knew better), and it does far too much, often in the wrong way. It would be nice to do something about it one day, but in the meantime, don't assume that there's a good reason for all the implementation details that you see here.
- Since:
- 9 Mar 2004
- Author:
- Mark Taylor (Starlink)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
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
FieldsModifier and TypeFieldDescriptionstatic String
System property giving a list of custom actions to appear in toolbar.Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Frame
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
Fields inherited from class java.awt.Component
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
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptResourceIdList
(String[] ids, String msg, Class<? extends uk.ac.starlink.vo.DalLoader> dalLoaderClass, Class<? extends DalMultiWindow> dalMultiWindowClass) Load received VO resource identifiers into appropriate windows.boolean
acceptSkyPosition
(double raDegrees, double decDegrees) Takes a sky position acquired from somewhere and does something with it.void
addLoadingToken
(LoadingToken token) Adds a LoadingToken to the load list.Adds a table to this windows list.void
void
void
void
void
void
uk.ac.starlink.table.StarTableFactory
createMonitorFactory
(LoadingToken token) Returns a new StarTableFactory which will update the given LoadingToken as rows are read into row stores provided by its storage policy.boolean
exit
(boolean confirm) Shuts down TOPCAT.Returns an action that will reset all authentication contexts.Returns a dialog used for an upload match.Returns the object which acts as this window's server for interop requests.Returns a dialog used for doing table concatenation.Returns a dialog used for a multiple cone search join.Returns the TopcatModel corresponding to the currently selected table.Returns a CDS-style ExtApp object which can be used for control of this control window instance.static ControlWindow
Returns the sole instance of this window, made visible on initialisation.static ControlWindow
getInstance
(boolean initialiseVisible) Returns the sole instance of this window, optionally made visible on initialisation.Returns a dialog used for loading new tables.uk.ac.starlink.table.RowRunner
Returns the RowRunner to be used for multithreaded table processing.getSaver()
Returns a dialog used for saving tables.Returns a dialog used for a multiple SIA join.Returns a dialog used for a multiple SSA join.uk.ac.starlink.table.StarTableFactory
Returns the table factory used by this window.uk.ac.starlink.table.StarTableOutput
Returns the table output manager used by this window.Returns the JList displaying tables available in the application.Returns the list model which keeps track of which tables are available to the application.void
void
boolean
loadDialogMatches
(uk.ac.starlink.table.gui.TableLoadDialog tld, Class<?> tldClass) Indicates whether the given load dialogue is of the type indicated by the given class.void
modelChanged
(TopcatEvent evt) Invoked when the model has changed in some way.void
moveCurrent
(boolean up) Moves the current table one item up or down in the tables list.boolean
multiWindowMatches
(DalMultiWindow mw, Class<? extends DalMultiWindow> mwClass) Indicates whether the given multi window is of the type indicated by the given class.void
removeLoadingToken
(LoadingToken token) Removes a LoadingToken from the load list.void
removeTable
(TopcatModel model) Removes an entry from the table list.void
runLoading
(uk.ac.starlink.table.gui.TableLoader loader, uk.ac.starlink.table.gui.TableLoadClient loadClient, Icon icon) Passes tables from a loader to a load client, presenting progress information and cancellation control as appropriate in the GUI.void
setTableFactory
(uk.ac.starlink.table.StarTableFactory tabfact) Sets the table factory used by this window.void
setViewsVisible
(TopcatModel tcModel, boolean visible) Reveals or hides any existing view windows for a given table.void
void
Updates some window state.void
updateLoadingToken
(LoadingToken token) Updates the state of a LoadingToken.void
Methods inherited from class uk.ac.starlink.topcat.AuxWindow
addHelp, beep, confirm, createImportTableAction, createSaveTableAction, getBodyPanel, getControlPanel, getHelpMenu, getIconImage, getMainArea, getSponsorLogos, getToolBar, getWindowMenu, makeTitledBorder, makeVisible, placeProgressBar, positionAfter, recursiveSetEnabled, setBusy, setCloseIsExit, setMainHeading, setVisible
Methods inherited from class javax.swing.JFrame
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
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
Methods inherited from class java.awt.Window
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, show, toBack, toFront
Methods inherited from class java.awt.Container
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
Methods inherited from class java.awt.Component
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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Field Details
-
TOPCAT_TOOLS_PROP
System property giving a list of custom actions to appear in toolbar. Colon-separated classnames for Action implementations with no-arg constructors.
-
-
Method Details
-
getInstance
Returns the sole instance of this window, made visible on initialisation.- Returns:
- instance of control window
-
getInstance
Returns the sole instance of this window, optionally made visible on initialisation.- Parameters:
initialiseVisible
- if this call results in lazy creation of a window instance, set it visible- Returns:
- instance of control window
-
getExtApp
Returns a CDS-style ExtApp object which can be used for control of this control window instance.- Returns:
- external application object for TOPCAT
-
getCommunicator
Returns the object which acts as this window's server for interop requests.- Returns:
- plastic server
-
getRowRunner
public uk.ac.starlink.table.RowRunner getRowRunner()Returns the RowRunner to be used for multithreaded table processing.- Returns:
- row runner
-
getAuthResetAction
Returns an action that will reset all authentication contexts.- Returns:
- auth reset action
-
addTable
Adds a table to this windows list. Following this, a user will be able to do TOPCATty things with the table in question from this control window.- Parameters:
table
- the table to addlocation
- location string indicating the provenance of table - preferably a URL or filename or somethingselect
- true iff the newly-added table should become the currently selected table- Returns:
- the newly-created TopcatModel object corresponding to table
-
removeTable
Removes an entry from the table list.- Parameters:
model
- the table entry to remove
-
moveCurrent
public void moveCurrent(boolean up) Moves the current table one item up or down in the tables list.- Parameters:
up
- true for move up (to lower index), false for move down (to higher index)
-
runLoading
public void runLoading(uk.ac.starlink.table.gui.TableLoader loader, uk.ac.starlink.table.gui.TableLoadClient loadClient, Icon icon) Passes tables from a loader to a load client, presenting progress information and cancellation control as appropriate in the GUI. If the load client is a TopcatLoadClient, this will have the effect of loading the tables into the application. This method is the usual way of inserting new tables which may be time-consuming to load into the TOPCAT application.- Parameters:
loader
- table sourceloadClient
- table destination (usually aTopcatLoadClient
)icon
- optional icon to accompany the progress GUI
-
addLoadingToken
Adds a LoadingToken to the load list. This indicates that a table is in the process of being loaded. The caller must remove the token later, when the table load has either succeeded or failed.- Parameters:
token
- token to add
-
removeLoadingToken
Removes a LoadingToken from the load list.- Parameters:
token
- token to remove
-
updateLoadingToken
Updates the state of a LoadingToken. If it is in the loading list, it will be repainted.- Parameters:
token
- token to update
-
createMonitorFactory
Returns a new StarTableFactory which will update the given LoadingToken as rows are read into row stores provided by its storage policy. By using this rather than this control window's basic StarTableFactory, the LoadingToken's display will monitor the number of rows loaded, which is useful visual feedback for the user, especially for large/slow tables.- Parameters:
token
- token to update- Returns:
- table factory; note this should only be used for work associated with the given token
-
getCurrentModel
Returns the TopcatModel corresponding to the currently selected table.- Returns:
- selected model
-
getTablesListModel
Returns the list model which keeps track of which tables are available to the application.- Returns:
- list model of
TopcatModel
objects
-
getTablesList
Returns the JList displaying tables available in the application.- Returns:
- list of
TopcatModel
objects
-
getLoadWindow
Returns a dialog used for loading new tables.- Returns:
- a table load window
-
getSaver
Returns a dialog used for saving tables.- Returns:
- a table save window
-
getConcatWindow
Returns a dialog used for doing table concatenation.- Returns:
- concatenation window
-
getConeMultiWindow
Returns a dialog used for a multiple cone search join.- Returns:
- multicone window
-
getSiaMultiWindow
Returns a dialog used for a multiple SIA join.- Returns:
- multi-SIA window
-
getSsaMultiWindow
Returns a dialog used for a multiple SSA join.- Returns:
- multi-SSA window
-
getCdsUploadMatchWindow
Returns a dialog used for an upload match.- Returns:
- upload crossmatch window
-
getTableFactory
public uk.ac.starlink.table.StarTableFactory getTableFactory()Returns the table factory used by this window.- Returns:
- table factory
-
getTableOutput
public uk.ac.starlink.table.StarTableOutput getTableOutput()Returns the table output manager used by this window.- Returns:
- table outputter
-
setTableFactory
public void setTableFactory(uk.ac.starlink.table.StarTableFactory tabfact) Sets the table factory used by this window.- Parameters:
tabfact
- table factory
-
acceptSkyPosition
public boolean acceptSkyPosition(double raDegrees, double decDegrees) Takes a sky position acquired from somewhere and does something with it.- Parameters:
raDegrees
- right ascension in degreesdecDegrees
- declination in degrees- Returns:
- true if any useful work was done
-
acceptResourceIdList
public boolean acceptResourceIdList(String[] ids, String msg, Class<? extends uk.ac.starlink.vo.DalLoader> dalLoaderClass, Class<? extends DalMultiWindow> dalMultiWindowClass) Load received VO resource identifiers into appropriate windows.- Parameters:
ids
- array of candidate ivo:-type resource identifiers to loadmsg
- text to explain to the user what's being loadeddalLoaderClass
- DalLoader subclass for dialogues which may be affected by the loaded IDsdalMultiWindowClass
- DalMultiWindow subclass for dialogues which may be affected by the loaded IDs
-
loadDialogMatches
Indicates whether the given load dialogue is of the type indicated by the given class.- Parameters:
tld
- load dialoguetldClass
- load dialogue type
-
multiWindowMatches
Indicates whether the given multi window is of the type indicated by the given class. -
setViewsVisible
Reveals or hides any existing view windows for a given table.- Parameters:
tcModel
- table to affectvisible
- true to reveal, false to hide
-
exit
public boolean exit(boolean confirm) Shuts down TOPCAT. According to whether or not it is running standalone, this may invokeSystem.exit(int)
itself, or it may just attempt to get rid of all the windows associated with the TOPCAT application. In the latter case, the JVM should survive.- Parameters:
confirm
- whether to seek confirmation from the user- Returns:
- whether shutdown took place. If the user aborted the exit, then false will be returned. If the exit did happen, then either true will be returned or (standalone case) there will be no return.
-
updateControls
public void updateControls()Updates some window state. This should be called at least when the list of tables changes. -
valueChanged
- Specified by:
valueChanged
in interfaceListSelectionListener
-
tableChanged
- Specified by:
tableChanged
in interfaceTableModelListener
-
modelChanged
Description copied from interface:TopcatListener
Invoked when the model has changed in some way.- Specified by:
modelChanged
in interfaceTopcatListener
- Parameters:
evt
- event description
-
columnAdded
- Specified by:
columnAdded
in interfaceTableColumnModelListener
-
columnRemoved
- Specified by:
columnRemoved
in interfaceTableColumnModelListener
-
columnMarginChanged
- Specified by:
columnMarginChanged
in interfaceTableColumnModelListener
-
columnMoved
- Specified by:
columnMoved
in interfaceTableColumnModelListener
-
columnSelectionChanged
- Specified by:
columnSelectionChanged
in interfaceTableColumnModelListener
-
contentsChanged
- Specified by:
contentsChanged
in interfaceListDataListener
-
intervalAdded
- Specified by:
intervalAdded
in interfaceListDataListener
-
intervalRemoved
- Specified by:
intervalRemoved
in interfaceListDataListener
-