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:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible,javax.swing.event.ListDataListener,javax.swing.event.ListSelectionListener,javax.swing.event.TableColumnModelListener,javax.swing.event.TableModelListener,javax.swing.RootPaneContainer,javax.swing.WindowConstants,TopcatListener
public class ControlWindow extends AuxWindow implements javax.swing.event.ListSelectionListener, javax.swing.event.ListDataListener, javax.swing.event.TableModelListener, javax.swing.event.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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTOPCAT_TOOLS_PROPSystem property giving a list of custom actions to appear in toolbar.-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptResourceIdList(java.lang.String[] ids, java.lang.String msg, java.lang.Class<? extends uk.ac.starlink.vo.DalLoader> dalLoaderClass, java.lang.Class<? extends DalMultiWindow> dalMultiWindowClass)Load received VO resource identifiers into appropriate windows.booleanacceptSkyPosition(double raDegrees, double decDegrees)Takes a sky position acquired from somewhere and does something with it.voidaddLoadingToken(LoadingToken token)Adds a LoadingToken to the load list.TopcatModeladdTable(uk.ac.starlink.table.StarTable table, java.lang.String location, boolean select)Adds a table to this windows list.voidcolumnAdded(javax.swing.event.TableColumnModelEvent evt)voidcolumnMarginChanged(javax.swing.event.ChangeEvent evt)voidcolumnMoved(javax.swing.event.TableColumnModelEvent evt)voidcolumnRemoved(javax.swing.event.TableColumnModelEvent evt)voidcolumnSelectionChanged(javax.swing.event.ListSelectionEvent evt)voidcontentsChanged(javax.swing.event.ListDataEvent evt)uk.ac.starlink.table.StarTableFactorycreateMonitorFactory(LoadingToken token)Returns a new StarTableFactory which will update the given LoadingToken as rows are read into row stores provided by its storage policy.booleanexit(boolean confirm)Shuts down TOPCAT.CdsUploadMatchWindowgetCdsUploadMatchWindow()Returns a dialog used for an upload match.TopcatCommunicatorgetCommunicator()Returns the object which acts as this window's server for interop requests.ConcatWindowgetConcatWindow()Returns a dialog used for doing table concatenation.ConeMultiWindowgetConeMultiWindow()Returns a dialog used for a multiple cone search join.TopcatModelgetCurrentModel()Returns the TopcatModel corresponding to the currently selected table.ExtAppgetExtApp()Returns a CDS-style ExtApp object which can be used for control of this control window instance.static ControlWindowgetInstance()Returns the sole instance of this window.LoadWindowgetLoadWindow()Returns a dialog used for loading new tables.uk.ac.starlink.table.RowRunnergetRowRunner()Returns the RowRunner to be used for multithreaded table processing.SaveQueryWindowgetSaver()Returns a dialog used for saving tables.SiaMultiWindowgetSiaMultiWindow()Returns a dialog used for a multiple SIA join.SsaMultiWindowgetSsaMultiWindow()Returns a dialog used for a multiple SSA join.uk.ac.starlink.table.StarTableFactorygetTableFactory()Returns the table factory used by this window.uk.ac.starlink.table.StarTableOutputgetTableOutput()Returns the table output manager used by this window.javax.swing.JList<TopcatModel>getTablesList()Returns the JList displaying tables available in the application.javax.swing.ListModel<TopcatModel>getTablesListModel()Returns the list model which keeps track of which tables are available to the application.voidintervalAdded(javax.swing.event.ListDataEvent evt)voidintervalRemoved(javax.swing.event.ListDataEvent evt)booleanloadDialogMatches(uk.ac.starlink.table.gui.TableLoadDialog tld, java.lang.Class<?> tldClass)Indicates whether the given load dialogue is of the type indicated by the given class.voidmodelChanged(TopcatEvent evt)Invoked when the model has changed in some way.voidmoveCurrent(boolean up)Moves the current table one item up or down in the tables list.booleanmultiWindowMatches(DalMultiWindow mw, java.lang.Class<? extends DalMultiWindow> mwClass)Indicates whether the given multi window is of the type indicated by the given class.voidremoveLoadingToken(LoadingToken token)Removes a LoadingToken from the load list.voidremoveTable(TopcatModel model)Removes an entry from the table list.voidrunLoading(uk.ac.starlink.table.gui.TableLoader loader, uk.ac.starlink.table.gui.TableLoadClient loadClient, javax.swing.Icon icon)Passes tables from a loader to a load client, presenting progress information and cancellation control as appropriate in the GUI.voidsetTableFactory(uk.ac.starlink.table.StarTableFactory tabfact)Sets the table factory used by this window.voidsetViewsVisible(TopcatModel tcModel, boolean visible)Reveals or hides any existing view windows for a given table.voidtableChanged(javax.swing.event.TableModelEvent evt)voidupdateControls()Updates some window state.voidupdateLoadingToken(LoadingToken token)Updates the state of a LoadingToken.voidvalueChanged(javax.swing.event.ListSelectionEvent evt)-
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
-
-
-
-
Method Detail
-
getInstance
public static ControlWindow getInstance()
Returns the sole instance of this window.- Returns:
- instance of control window
-
getExtApp
public ExtApp 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
public TopcatCommunicator 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
-
addTable
public TopcatModel addTable(uk.ac.starlink.table.StarTable table, java.lang.String location, boolean select)
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
public void removeTable(TopcatModel model)
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, javax.swing.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
public void addLoadingToken(LoadingToken token)
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
public void removeLoadingToken(LoadingToken token)
Removes a LoadingToken from the load list.- Parameters:
token- token to remove
-
updateLoadingToken
public void updateLoadingToken(LoadingToken token)
Updates the state of a LoadingToken. If it is in the loading list, it will be repainted.- Parameters:
token- token to update
-
createMonitorFactory
public 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. 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
public TopcatModel getCurrentModel()
Returns the TopcatModel corresponding to the currently selected table.- Returns:
- selected model
-
getTablesListModel
public javax.swing.ListModel<TopcatModel> getTablesListModel()
Returns the list model which keeps track of which tables are available to the application.- Returns:
- list model of
TopcatModelobjects
-
getTablesList
public javax.swing.JList<TopcatModel> getTablesList()
Returns the JList displaying tables available in the application.- Returns:
- list of
TopcatModelobjects
-
getLoadWindow
public LoadWindow getLoadWindow()
Returns a dialog used for loading new tables.- Returns:
- a table load window
-
getSaver
public SaveQueryWindow getSaver()
Returns a dialog used for saving tables.- Returns:
- a table save window
-
getConcatWindow
public ConcatWindow getConcatWindow()
Returns a dialog used for doing table concatenation.- Returns:
- concatenation window
-
getConeMultiWindow
public ConeMultiWindow getConeMultiWindow()
Returns a dialog used for a multiple cone search join.- Returns:
- multicone window
-
getSiaMultiWindow
public SiaMultiWindow getSiaMultiWindow()
Returns a dialog used for a multiple SIA join.- Returns:
- multi-SIA window
-
getSsaMultiWindow
public SsaMultiWindow getSsaMultiWindow()
Returns a dialog used for a multiple SSA join.- Returns:
- multi-SSA window
-
getCdsUploadMatchWindow
public CdsUploadMatchWindow 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(java.lang.String[] ids, java.lang.String msg, java.lang.Class<? extends uk.ac.starlink.vo.DalLoader> dalLoaderClass, java.lang.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
public boolean loadDialogMatches(uk.ac.starlink.table.gui.TableLoadDialog tld, java.lang.Class<?> tldClass)Indicates whether the given load dialogue is of the type indicated by the given class.- Parameters:
tld- load dialoguetldClass- load dialogue type
-
multiWindowMatches
public boolean multiWindowMatches(DalMultiWindow mw, java.lang.Class<? extends DalMultiWindow> mwClass)
Indicates whether the given multi window is of the type indicated by the given class.
-
setViewsVisible
public void setViewsVisible(TopcatModel tcModel, boolean visible)
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
public void valueChanged(javax.swing.event.ListSelectionEvent evt)
- Specified by:
valueChangedin interfacejavax.swing.event.ListSelectionListener
-
tableChanged
public void tableChanged(javax.swing.event.TableModelEvent evt)
- Specified by:
tableChangedin interfacejavax.swing.event.TableModelListener
-
modelChanged
public void modelChanged(TopcatEvent evt)
Description copied from interface:TopcatListenerInvoked when the model has changed in some way.- Specified by:
modelChangedin interfaceTopcatListener- Parameters:
evt- event description
-
columnAdded
public void columnAdded(javax.swing.event.TableColumnModelEvent evt)
- Specified by:
columnAddedin interfacejavax.swing.event.TableColumnModelListener
-
columnRemoved
public void columnRemoved(javax.swing.event.TableColumnModelEvent evt)
- Specified by:
columnRemovedin interfacejavax.swing.event.TableColumnModelListener
-
columnMarginChanged
public void columnMarginChanged(javax.swing.event.ChangeEvent evt)
- Specified by:
columnMarginChangedin interfacejavax.swing.event.TableColumnModelListener
-
columnMoved
public void columnMoved(javax.swing.event.TableColumnModelEvent evt)
- Specified by:
columnMovedin interfacejavax.swing.event.TableColumnModelListener
-
columnSelectionChanged
public void columnSelectionChanged(javax.swing.event.ListSelectionEvent evt)
- Specified by:
columnSelectionChangedin interfacejavax.swing.event.TableColumnModelListener
-
contentsChanged
public void contentsChanged(javax.swing.event.ListDataEvent evt)
- Specified by:
contentsChangedin interfacejavax.swing.event.ListDataListener
-
intervalAdded
public void intervalAdded(javax.swing.event.ListDataEvent evt)
- Specified by:
intervalAddedin interfacejavax.swing.event.ListDataListener
-
intervalRemoved
public void intervalRemoved(javax.swing.event.ListDataEvent evt)
- Specified by:
intervalRemovedin interfacejavax.swing.event.ListDataListener
-
-