Package uk.ac.starlink.topcat.activate
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
UrlColumnConfigurator.LocationColumnActivator
Utility class providing a partial Activator implementation for UrlColumnConfigurators that want a location (file or URL) value.protected static class
UrlColumnConfigurator.UrlColumnActivator
Utility class providing a partial Activator implementation for UrlColumnConfigurators that want an actual URL value.
-
Constructor Summary
Constructors Modifier Constructor Description protected
UrlColumnConfigurator(TopcatModelInfo tinfo, java.lang.String urlWord, ColFlag[] urlFlags)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Activator
createActivator(uk.ac.starlink.table.ColumnData cdata)
Creates an activator from a ColumnData giving the URL string.static Outcome
decorateOutcomeWithUrl(Outcome outcome, java.lang.String url)
Ensures that an outcome contains a given URL in its message.Activator
getActivator()
Constructs an activator in accordance with the current state of this GUI.java.lang.String
getConfigMessage()
Returns a short status message for display to the user.protected abstract java.lang.String
getConfigMessage(uk.ac.starlink.table.ColumnData cdata)
Returns a config message given that a URL column has been supplied.protected javax.swing.Box
getQueryPanel()
Returns the component used for storing user interaction components.TopcatModel
getTopcatModel()
Returns the TopcatModel that this configurator is using.protected ConfigState
getUrlState()
Returns a partial config state, giving the current configuration of the selected URL column.protected java.lang.String
getWindowLabel(uk.ac.starlink.table.ColumnData cdata)
Returns a label which identifies a particular column in this configurator's table.protected void
selectColumnByUCD(java.lang.String ucd)
If a column exists with the named UCD, select it in the selector.protected void
selectColumnByUtype(java.lang.String uType)
If a column exists with the named UType, select it in the selector.void
setLocationLabel(java.lang.String label)
Resets the label for the Location field.void
setLocationTooltip(java.lang.String tooltip)
Sets the tooltip text for the Location field.protected void
setUrlState(ConfigState state)
Restores the URL selection from a stored state object.-
Methods inherited from class uk.ac.starlink.topcat.activate.AbstractActivatorConfigurator
addActionListener, createDisplayField, createDisplayLabel, getActionForwarder, getPanel, removeActionListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.ac.starlink.topcat.activate.ActivatorConfigurator
getSafety, getState, setState
-
-
-
-
Constructor Detail
-
UrlColumnConfigurator
protected UrlColumnConfigurator(TopcatModelInfo tinfo, java.lang.String urlWord, ColFlag[] urlFlags)
Constructor.- Parameters:
tinfo
- topcat model informationurlWord
- 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 Detail
-
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 java.lang.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 javax.swing.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:
ActivatorConfigurator.getConfigMessage()
-
getConfigMessage
public java.lang.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(java.lang.String ucd)
If a column exists with the named UCD, select it in the selector.- Parameters:
ucd
- UCD to match
-
selectColumnByUtype
protected void selectColumnByUtype(java.lang.String uType)
If a column exists with the named UType, select it in the selector.- Parameters:
uType
- UType to match
-
getWindowLabel
protected java.lang.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(java.lang.String label)
Resets the label for the Location field.- Parameters:
label
- new label
-
setLocationTooltip
public void setLocationTooltip(java.lang.String tooltip)
Sets the tooltip text for the Location field.- Parameters:
tooltip
- tooltip text
-
decorateOutcomeWithUrl
public static Outcome decorateOutcomeWithUrl(Outcome outcome, java.lang.String url)
Ensures that an outcome contains a given URL in its message.- Parameters:
outcome
- input outcomeurl
- context URL- Returns:
- outcome like the input one, but with the
url
text guaranteed to appear somewhere in its message
-
-