Class UrlColumnConfigurator

java.lang.Object
uk.ac.starlink.topcat.activate.AbstractActivatorConfigurator
uk.ac.starlink.topcat.activate.UrlColumnConfigurator
All Implemented Interfaces:
ActivatorConfigurator

public abstract class UrlColumnConfigurator extends AbstractActivatorConfigurator
Partial ActivatorConfigurator implementation for activators that view the location (URL) in a table column using some viewer application.
Since:
21 Dec 2017
Author:
Mark Taylor
  • Constructor Details

    • UrlColumnConfigurator

      protected UrlColumnConfigurator(TopcatModelInfo tinfo, String urlWord, ColFlag[] urlFlags)
      Constructor.
      Parameters:
      tinfo - topcat model information
      urlWord - descriptive term for what's in the URL (displayed as part of GUI)
      urlFlags - list of flags whose columns are to be selected as default values for the URL column selector; earlier entries are preferred over later ones
  • Method Details

    • createActivator

      protected abstract Activator createActivator(uk.ac.starlink.table.ColumnData cdata)
      Creates an activator from a ColumnData giving the URL string.
      Parameters:
      cdata - URL column data, will not be null
      Returns:
      new activator, or null
    • getConfigMessage

      protected abstract String getConfigMessage(uk.ac.starlink.table.ColumnData cdata)
      Returns a config message given that a URL column has been supplied.
      Parameters:
      cdata - URL column data, will not be null
      Returns:
      message indicating why activator is not available, or null
    • getQueryPanel

      protected Box getQueryPanel()
      Returns the component used for storing user interaction components. This is a vertical box, which may have some components already in it.
      Returns:
      query box
    • getActivator

      public Activator getActivator()
      Description copied from interface: ActivatorConfigurator
      Constructs an activator in accordance with the current state of this GUI. If the current state not an adequate specification, null may be returned. In that case, the getConfigMessage method should generally provide an explanation.

      This method may be called often, so should be cheap to invoke. The idea is that it will be called immediately before the activator is used, so the returned object may fix, rather than arrange to gather at a later date, information acquired from the GUI.

      Returns:
      currently configured activator, or null
      See Also:
    • getConfigMessage

      public String getConfigMessage()
      Description copied from interface: ActivatorConfigurator
      Returns a short status message for display to the user. This is supposed to be a comment, if one is needed, on the current state of the configuration.

      As a rule, exactly one of this method and the getActivator should return null. If there is no activator, this method should return some reason why the configuration is incorrect or incomplete, and otherwise it should return null.

      Returns:
      message, typically indicating configuration problems, or null
    • getTopcatModel

      public TopcatModel getTopcatModel()
      Returns the TopcatModel that this configurator is using.
      Returns:
      topcat model
    • getUrlState

      protected ConfigState getUrlState()
      Returns a partial config state, giving the current configuration of the selected URL column.
      Returns:
      url state
    • setUrlState

      protected void setUrlState(ConfigState state)
      Restores the URL selection from a stored state object.
      Parameters:
      state - URL state
    • selectColumnByUCD

      protected void selectColumnByUCD(String ucd)
      If a column exists with the named UCD, select it in the selector.
      Parameters:
      ucd - UCD to match
    • selectColumnByUtype

      protected void selectColumnByUtype(String uType)
      If a column exists with the named UType, select it in the selector.
      Parameters:
      uType - UType to match
    • getWindowLabel

      protected String getWindowLabel(uk.ac.starlink.table.ColumnData cdata)
      Returns a label which identifies a particular column in this configurator's table. Used for labelling display windows.
      Parameters:
      cdata - column data
      Returns:
      label
    • setLocationLabel

      public void setLocationLabel(String label)
      Resets the label for the Location field.
      Parameters:
      label - new label
    • setLocationTooltip

      public void setLocationTooltip(String tooltip)
      Sets the tooltip text for the Location field.
      Parameters:
      tooltip - tooltip text
    • decorateOutcomeWithUrl

      public static Outcome decorateOutcomeWithUrl(Outcome outcome, String url)
      Ensures that an outcome contains a given URL in its message.
      Parameters:
      outcome - input outcome
      url - context URL
      Returns:
      outcome like the input one, but with the url text guaranteed to appear somewhere in its message