simtools.ui
Class TextMapper

java.lang.Object
  extended by simtools.ui.GenericMapper
      extended by simtools.ui.TextMapper
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class TextMapper
extends GenericMapper

This class maps data sources and index to text strings. The mapping is user defined, and based on the value of the data source The data source shall not be saved into the object. Rather, this class goal is to implement a mapping independent of the data source given.

See Also:
Serialized Form

Nested Class Summary
protected  class TextMapper.TextMapperChoiceFormat
           
protected  class TextMapper.TextMapperTableModel
           
 
Nested classes/interfaces inherited from class simtools.ui.GenericMapper
GenericMapper.Expression, GenericMapper.ExpressionDialog, GenericMapper.ExpressionEditor, GenericMapper.ExpressionMappingTable, GenericMapper.Interval, GenericMapper.MapperTableModel
 
Field Summary
protected  TextMapper.TextMapperChoiceFormat choiceFormat
           
static java.util.ResourceBundle resources
           
protected  int textIndex
           
static java.util.Vector textMappers
          The text mappers are application global
 
Fields inherited from class simtools.ui.GenericMapper
defaultValue, intervals, listeners, map, name
 
Constructor Summary
TextMapper()
           
TextMapper(java.lang.String name)
           
 
Method Summary
 GenericMapper.MapperTableModel createModel()
           
protected  java.lang.Object createNewValue()
          For subclasses to specialize, create a new object of the specialized type
static TextMapper createTextMapperDialog(javax.swing.JDialog owner)
           
 java.text.ChoiceFormat getChoiceFormat()
           
 java.lang.String getDefaultPaint()
           
 java.lang.String getString(DataSource ds)
           
 java.lang.String getString(DataSource ds, long index)
          Realizes the mapping, and returns a String object for this data source and index
 java.lang.String getString(java.lang.Object value)
           
static TextMapper getTextMapper(java.lang.String id)
          Method getTextMapperFromName<\b> returns mapper linked to specified name return null if no mapper were found
static void main(java.lang.String[] args)
           
 void setDefaultString(java.lang.String defaultValue)
           
 void setString(boolean isMore, double value, boolean boundIncluded, java.lang.String string)
          Associate a string with a double value infinite range.
 void setString(boolean isMore, double value, java.lang.String string)
          Associate a string with a double value infinite range (bound included).
 void setString(boolean isMore, long value, boolean boundIncluded, java.lang.String string)
          Associate a string with a long value infinite range.
 void setString(boolean isMore, long value, java.lang.String string)
          Associate a string with a long value infinite range (bound included).
 void setString(boolean isMore, java.lang.String value, boolean boundIncluded, java.lang.String string)
          Associate a string with a String value infinite range.
 void setString(boolean isMore, java.lang.String value, java.lang.String string)
          Associate a string with a String value infinite range (bound included).
 void setString(double minvalue, boolean boundedMin, double maxvalue, boolean boundedMax, java.lang.String string)
          Associate a string with a double value interval.
 void setString(double minvalue, double maxvalue, java.lang.String string)
          Associate a string with a double value interval (bounds included)
 void setString(long minvalue, boolean boundedMin, long maxvalue, boolean boundedMax, java.lang.String string)
          Associate a string with a long value interval.
 void setString(long minvalue, long maxvalue, java.lang.String string)
          Associate a string with a long value interval (bounds included)
 void setString(java.lang.Object value, java.lang.String string)
          Associate a string with a value
 void setString(java.lang.String minvalue, boolean boundedMin, java.lang.String maxvalue, boolean boundedMax, java.lang.String string)
          Associate a string with a String value interval.
 void setString(java.lang.String minvalue, java.lang.String maxvalue, java.lang.String string)
          Associate a string with a String value interval (bounds included)
static TextMapper updateTextMapper(TextMapper m)
          If the mapper already exists in the list, update its values Otherwise add it to the list of existing mappers
 
Methods inherited from class simtools.ui.GenericMapper
addListener, clone, createMapperDialog, createPanel, createTable, editDialog, equals, getAllMapperValues, getDefaultValue, getIntervals, getMap, getMapping, getMapping, getMapping, notifyListeners, removeListener, setDefaultValue, setMapperValues, setMapping, setMapping, setMapping, setMapping, setMapping, setMapping, setMapping, setMapping, setMapping, setMapping, setMapping, setMapping, setMapping, setName, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resources

public static java.util.ResourceBundle resources

textIndex

protected int textIndex

choiceFormat

protected transient TextMapper.TextMapperChoiceFormat choiceFormat

textMappers

public static java.util.Vector textMappers
The text mappers are application global

Constructor Detail

TextMapper

public TextMapper()

TextMapper

public TextMapper(java.lang.String name)
Parameters:
name -
Method Detail

updateTextMapper

public static TextMapper updateTextMapper(TextMapper m)
If the mapper already exists in the list, update its values Otherwise add it to the list of existing mappers

Parameters:
m, - the mapper to update
Returns:

getTextMapper

public static TextMapper getTextMapper(java.lang.String id)
Method getTextMapperFromName<\b> returns mapper linked to specified name return null if no mapper were found

Parameters:
name -
Returns:

getString

public java.lang.String getString(DataSource ds,
                                  long index)
Realizes the mapping, and returns a String object for this data source and index

Parameters:
ds - The data source to map
index - The index in the data source (may be used, or not)
Returns:
a String object

getString

public java.lang.String getString(DataSource ds)

getString

public java.lang.String getString(java.lang.Object value)

setDefaultString

public void setDefaultString(java.lang.String defaultValue)

getDefaultPaint

public java.lang.String getDefaultPaint()

setString

public void setString(java.lang.Object value,
                      java.lang.String string)
Associate a string with a value


setString

public void setString(double minvalue,
                      double maxvalue,
                      java.lang.String string)
Associate a string with a double value interval (bounds included)


setString

public void setString(double minvalue,
                      boolean boundedMin,
                      double maxvalue,
                      boolean boundedMax,
                      java.lang.String string)
Associate a string with a double value interval. Interval bounds are specified


setString

public void setString(boolean isMore,
                      double value,
                      java.lang.String string)
Associate a string with a double value infinite range (bound included).

Parameters:
isMore - if true, the interval is x >= value, else it is x <= value

setString

public void setString(boolean isMore,
                      double value,
                      boolean boundIncluded,
                      java.lang.String string)
Associate a string with a double value infinite range.

Parameters:
isMore - if true, the interval is x >= value, else it is x <= value

setString

public void setString(long minvalue,
                      long maxvalue,
                      java.lang.String string)
Associate a string with a long value interval (bounds included)


setString

public void setString(long minvalue,
                      boolean boundedMin,
                      long maxvalue,
                      boolean boundedMax,
                      java.lang.String string)
Associate a string with a long value interval. Interval bounds are specified


setString

public void setString(boolean isMore,
                      long value,
                      java.lang.String string)
Associate a string with a long value infinite range (bound included).

Parameters:
isMore - if true, the interval is x >= value, else it is x <= value

setString

public void setString(boolean isMore,
                      long value,
                      boolean boundIncluded,
                      java.lang.String string)
Associate a string with a long value infinite range.

Parameters:
isMore - if true, the interval is x >= value, else it is x <= value

setString

public void setString(java.lang.String minvalue,
                      java.lang.String maxvalue,
                      java.lang.String string)
Associate a string with a String value interval (bounds included)


setString

public void setString(java.lang.String minvalue,
                      boolean boundedMin,
                      java.lang.String maxvalue,
                      boolean boundedMax,
                      java.lang.String string)
Associate a string with a String value interval. Interval bounds are specified


setString

public void setString(boolean isMore,
                      java.lang.String value,
                      java.lang.String string)
Associate a string with a String value infinite range (bound included).

Parameters:
isMore - if true, the interval is x >= value, else it is x <= value

setString

public void setString(boolean isMore,
                      java.lang.String value,
                      boolean boundIncluded,
                      java.lang.String string)
Associate a string with a String value infinite range.

Parameters:
isMore - if true, the interval is x >= value, else it is x <= value

createModel

public GenericMapper.MapperTableModel createModel()
Overrides:
createModel in class GenericMapper

createNewValue

protected java.lang.Object createNewValue()
Description copied from class: GenericMapper
For subclasses to specialize, create a new object of the specialized type

Overrides:
createNewValue in class GenericMapper

createTextMapperDialog

public static TextMapper createTextMapperDialog(javax.swing.JDialog owner)

main

public static void main(java.lang.String[] args)

getChoiceFormat

public java.text.ChoiceFormat getChoiceFormat()