Class ControlWindow

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListDataListener, ListSelectionListener, TableColumnModelListener, TableModelListener, RootPaneContainer, WindowConstants, 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:
  • Field Details

    • TOPCAT_TOOLS_PROP

      public static 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 Details

    • getInstance

      public static ControlWindow getInstance()
      Returns the sole instance of this window, made visible on initialisation.
      Returns:
      instance of control window
    • getInstance

      public static ControlWindow getInstance(boolean initialiseVisible)
      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

      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, 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, 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 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 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(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 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, 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, 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(ListSelectionEvent evt)
      Specified by:
      valueChanged in interface ListSelectionListener
    • tableChanged

      public void tableChanged(TableModelEvent evt)
      Specified by:
      tableChanged in interface TableModelListener
    • modelChanged

      public void modelChanged(TopcatEvent evt)
      Description copied from interface: TopcatListener
      Invoked when the model has changed in some way.
      Specified by:
      modelChanged in interface TopcatListener
      Parameters:
      evt - event description
    • columnAdded

      public void columnAdded(TableColumnModelEvent evt)
      Specified by:
      columnAdded in interface TableColumnModelListener
    • columnRemoved

      public void columnRemoved(TableColumnModelEvent evt)
      Specified by:
      columnRemoved in interface TableColumnModelListener
    • columnMarginChanged

      public void columnMarginChanged(ChangeEvent evt)
      Specified by:
      columnMarginChanged in interface TableColumnModelListener
    • columnMoved

      public void columnMoved(TableColumnModelEvent evt)
      Specified by:
      columnMoved in interface TableColumnModelListener
    • columnSelectionChanged

      public void columnSelectionChanged(ListSelectionEvent evt)
      Specified by:
      columnSelectionChanged in interface TableColumnModelListener
    • contentsChanged

      public void contentsChanged(ListDataEvent evt)
      Specified by:
      contentsChanged in interface ListDataListener
    • intervalAdded

      public void intervalAdded(ListDataEvent evt)
      Specified by:
      intervalAdded in interface ListDataListener
    • intervalRemoved

      public void intervalRemoved(ListDataEvent evt)
      Specified by:
      intervalRemoved in interface ListDataListener