Class 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.Frame

        java.awt.Frame.AccessibleAWTFrame
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TOPCAT_TOOLS_PROP
      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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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.
      TopcatModel addTable​(uk.ac.starlink.table.StarTable table, java.lang.String location, boolean select)
      Adds a table to this windows list.
      void columnAdded​(javax.swing.event.TableColumnModelEvent evt)  
      void columnMarginChanged​(javax.swing.event.ChangeEvent evt)  
      void columnMoved​(javax.swing.event.TableColumnModelEvent evt)  
      void columnRemoved​(javax.swing.event.TableColumnModelEvent evt)  
      void columnSelectionChanged​(javax.swing.event.ListSelectionEvent evt)  
      void contentsChanged​(javax.swing.event.ListDataEvent evt)  
      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.
      CdsUploadMatchWindow getCdsUploadMatchWindow()
      Returns a dialog used for an upload match.
      TopcatCommunicator getCommunicator()
      Returns the object which acts as this window's server for interop requests.
      ConcatWindow getConcatWindow()
      Returns a dialog used for doing table concatenation.
      ConeMultiWindow getConeMultiWindow()
      Returns a dialog used for a multiple cone search join.
      TopcatModel getCurrentModel()
      Returns the TopcatModel corresponding to the currently selected table.
      ExtApp getExtApp()
      Returns a CDS-style ExtApp object which can be used for control of this control window instance.
      static ControlWindow getInstance()
      Returns the sole instance of this window.
      LoadWindow getLoadWindow()
      Returns a dialog used for loading new tables.
      uk.ac.starlink.table.RowRunner getRowRunner()
      Returns the RowRunner to be used for multithreaded table processing.
      SaveQueryWindow getSaver()
      Returns a dialog used for saving tables.
      SiaMultiWindow getSiaMultiWindow()
      Returns a dialog used for a multiple SIA join.
      SsaMultiWindow getSsaMultiWindow()
      Returns a dialog used for a multiple SSA join.
      uk.ac.starlink.table.StarTableFactory getTableFactory()
      Returns the table factory used by this window.
      uk.ac.starlink.table.StarTableOutput getTableOutput()
      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.
      void intervalAdded​(javax.swing.event.ListDataEvent evt)  
      void intervalRemoved​(javax.swing.event.ListDataEvent evt)  
      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.
      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, java.lang.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, javax.swing.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 tableChanged​(javax.swing.event.TableModelEvent evt)  
      void updateControls()
      Updates some window state.
      void updateLoadingToken​(LoadingToken token)
      Updates the state of a LoadingToken.
      void valueChanged​(javax.swing.event.ListSelectionEvent evt)  
      • 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 Detail

      • TOPCAT_TOOLS_PROP

        public static java.lang.String 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 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 add
        location - location string indicating the provenance of table - preferably a URL or filename or something
        select - 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 source
        loadClient - table destination (usually a TopcatLoadClient)
        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 TopcatModel objects
      • getTablesList

        public javax.swing.JList<TopcatModel> getTablesList()
        Returns the JList displaying tables available in the application.
        Returns:
        list of TopcatModel objects
      • 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 degrees
        decDegrees - 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 load
        msg - text to explain to the user what's being loaded
        dalLoaderClass - DalLoader subclass for dialogues which may be affected by the loaded IDs
        dalMultiWindowClass - 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 dialogue
        tldClass - 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 affect
        visible - 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 invoke System.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:
        valueChanged in interface javax.swing.event.ListSelectionListener
      • tableChanged

        public void tableChanged​(javax.swing.event.TableModelEvent evt)
        Specified by:
        tableChanged in interface javax.swing.event.TableModelListener
      • columnAdded

        public void columnAdded​(javax.swing.event.TableColumnModelEvent evt)
        Specified by:
        columnAdded in interface javax.swing.event.TableColumnModelListener
      • columnRemoved

        public void columnRemoved​(javax.swing.event.TableColumnModelEvent evt)
        Specified by:
        columnRemoved in interface javax.swing.event.TableColumnModelListener
      • columnMarginChanged

        public void columnMarginChanged​(javax.swing.event.ChangeEvent evt)
        Specified by:
        columnMarginChanged in interface javax.swing.event.TableColumnModelListener
      • columnMoved

        public void columnMoved​(javax.swing.event.TableColumnModelEvent evt)
        Specified by:
        columnMoved in interface javax.swing.event.TableColumnModelListener
      • columnSelectionChanged

        public void columnSelectionChanged​(javax.swing.event.ListSelectionEvent evt)
        Specified by:
        columnSelectionChanged in interface javax.swing.event.TableColumnModelListener
      • contentsChanged

        public void contentsChanged​(javax.swing.event.ListDataEvent evt)
        Specified by:
        contentsChanged in interface javax.swing.event.ListDataListener
      • intervalAdded

        public void intervalAdded​(javax.swing.event.ListDataEvent evt)
        Specified by:
        intervalAdded in interface javax.swing.event.ListDataListener
      • intervalRemoved

        public void intervalRemoved​(javax.swing.event.ListDataEvent evt)
        Specified by:
        intervalRemoved in interface javax.swing.event.ListDataListener