|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.ui.GenericMapper
public class GenericMapper
This class maps data sources and index to generic java Objects. 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.
Nested Class Summary | |
---|---|
protected static class |
GenericMapper.Expression
|
static class |
GenericMapper.ExpressionDialog
|
protected static class |
GenericMapper.ExpressionEditor
|
protected class |
GenericMapper.ExpressionMappingTable
Copied from Java Tutorial on tables, they had the very good idea to set up a colored cell table :)))) |
static class |
GenericMapper.Interval
Associate a value for a data interval. |
protected class |
GenericMapper.MapperTableModel
|
Field Summary | |
---|---|
protected java.lang.Object |
defaultValue
|
protected java.util.Vector |
intervals
|
protected ListenerManager |
listeners
|
protected java.util.TreeMap |
map
Associate a mappedValue for a data value of any type |
protected java.lang.String |
name
|
static java.util.ResourceBundle |
resources
|
Constructor Summary | |
---|---|
GenericMapper()
|
|
GenericMapper(java.lang.String name)
|
Method Summary | |
---|---|
void |
addListener(MapperListener l)
|
java.lang.Object |
clone()
|
static GenericMapper |
createMapperDialog(javax.swing.JDialog owner)
|
GenericMapper.MapperTableModel |
createModel()
|
protected java.lang.Object |
createNewValue()
For subclasses to specialize, create a new object of the specialized type |
javax.swing.JPanel |
createPanel(javax.swing.JDialog owner,
java.awt.event.ActionListener listener)
Creates a panel to configure this Mapper. |
protected GenericMapper.ExpressionMappingTable |
createTable(javax.swing.JDialog parent)
For subclasses to specialize |
void |
editDialog(javax.swing.JDialog owner)
|
boolean |
equals(java.lang.Object obj)
|
protected java.util.ArrayList |
getAllMapperValues()
|
java.lang.Object |
getDefaultValue()
The value returned when nothing match |
java.util.Vector |
getIntervals()
|
java.util.TreeMap |
getMap()
|
java.lang.Object |
getMapping(DataSource ds)
Realizes the mapping, and returns the object for this data source and index |
java.lang.Object |
getMapping(DataSource ds,
long index)
Realizes the mapping, and returns the object for this data source and index |
java.lang.Object |
getMapping(java.lang.Object value)
|
protected void |
notifyListeners()
|
void |
removeListener(MapperListener l)
|
void |
setDefaultValue(java.lang.Object defaultValue)
The value to return when nothing match |
protected void |
setMapperValues(GenericMapper m)
|
void |
setMapping(boolean isMore,
double value,
boolean boundIncluded,
java.lang.Object mappedValue)
Associate a mappedValue with a double value infinite range. |
void |
setMapping(boolean isMore,
double value,
java.lang.Object mappedValue)
Associate a mappedValue with a double value infinite range (bound included). |
void |
setMapping(boolean isMore,
long value,
boolean boundIncluded,
java.lang.Object mappedValue)
Associate a mappedValue with a long value infinite range. |
void |
setMapping(boolean isMore,
long value,
java.lang.Object mappedValue)
Associate a mappedValue with a long value infinite range (bound included). |
void |
setMapping(boolean isMore,
java.lang.String value,
boolean boundIncluded,
java.lang.Object mappedValue)
Associate a mappedValue with a String value infinite range. |
void |
setMapping(boolean isMore,
java.lang.String value,
java.lang.Object mappedValue)
Associate a mappedValue with a String value infinite range (bound included). |
void |
setMapping(double minvalue,
boolean boundedMin,
double maxvalue,
boolean boundedMax,
java.lang.Object mappedValue)
Associate a mappedValue with a double value interval. |
void |
setMapping(double minvalue,
double maxvalue,
java.lang.Object mappedValue)
Associate a mappedValue with a double value interval (bounds included) |
void |
setMapping(long minvalue,
boolean boundedMin,
long maxvalue,
boolean boundedMax,
java.lang.Object mappedValue)
Associate a mappedValue with a long value interval. |
void |
setMapping(long minvalue,
long maxvalue,
java.lang.Object mappedValue)
Associate a mappedValue with a long value interval (bounds included) |
void |
setMapping(java.lang.Object value,
java.lang.Object mappedValue)
Associate a mappedValue with a value |
void |
setMapping(java.lang.String minvalue,
boolean boundedMin,
java.lang.String maxvalue,
boolean boundedMax,
java.lang.Object mappedValue)
Associate a mappedValue with a String value interval. |
void |
setMapping(java.lang.String minvalue,
java.lang.String maxvalue,
java.lang.Object mappedValue)
Associate a mappedValue with a String value interval (bounds included) |
void |
setName(java.lang.String name)
Set mapper name |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.util.ResourceBundle resources
protected java.util.TreeMap map
protected java.util.Vector intervals
protected java.lang.String name
protected java.lang.Object defaultValue
protected transient ListenerManager listeners
Constructor Detail |
---|
public GenericMapper()
public GenericMapper(java.lang.String name)
Method Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
protected void setMapperValues(GenericMapper m)
protected java.util.ArrayList getAllMapperValues()
public void addListener(MapperListener l)
public void removeListener(MapperListener l)
protected void notifyListeners()
public java.lang.Object getMapping(DataSource ds, long index)
ds
- The data source to mapindex
- The index in the data source (may be used, or not)
public java.lang.Object getMapping(DataSource ds)
ds
- The data source to mapindex
- The index in the data source (may be used, or not, and defaults to the last index is used)
public java.lang.Object getMapping(java.lang.Object value)
public void setDefaultValue(java.lang.Object defaultValue)
public java.lang.Object getDefaultValue()
public void setMapping(java.lang.Object value, java.lang.Object mappedValue)
public void setMapping(double minvalue, double maxvalue, java.lang.Object mappedValue)
public void setMapping(double minvalue, boolean boundedMin, double maxvalue, boolean boundedMax, java.lang.Object mappedValue)
public void setMapping(boolean isMore, double value, java.lang.Object mappedValue)
isMore
- if true, the interval is x >= value, else it is x <= valuepublic void setMapping(boolean isMore, double value, boolean boundIncluded, java.lang.Object mappedValue)
isMore
- if true, the interval is x >= value, else it is x <= valuepublic void setMapping(long minvalue, long maxvalue, java.lang.Object mappedValue)
public void setMapping(long minvalue, boolean boundedMin, long maxvalue, boolean boundedMax, java.lang.Object mappedValue)
public void setMapping(boolean isMore, long value, java.lang.Object mappedValue)
isMore
- if true, the interval is x >= value, else it is x <= valuepublic void setMapping(boolean isMore, long value, boolean boundIncluded, java.lang.Object mappedValue)
isMore
- if true, the interval is x >= value, else it is x <= valuepublic void setMapping(java.lang.String minvalue, java.lang.String maxvalue, java.lang.Object mappedValue)
public void setMapping(java.lang.String minvalue, boolean boundedMin, java.lang.String maxvalue, boolean boundedMax, java.lang.Object mappedValue)
public void setMapping(boolean isMore, java.lang.String value, java.lang.Object mappedValue)
isMore
- if true, the interval is x >= value, else it is x <= valuepublic void setMapping(boolean isMore, java.lang.String value, boolean boundIncluded, java.lang.Object mappedValue)
isMore
- if true, the interval is x >= value, else it is x <= valuepublic java.lang.String toString()
toString
in class java.lang.Object
public void setName(java.lang.String name)
name
- public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static GenericMapper createMapperDialog(javax.swing.JDialog owner)
public GenericMapper.MapperTableModel createModel()
protected GenericMapper.ExpressionMappingTable createTable(javax.swing.JDialog parent)
protected java.lang.Object createNewValue()
public javax.swing.JPanel createPanel(javax.swing.JDialog owner, java.awt.event.ActionListener listener)
owner
- An optional owner framelistener
- An optional listener for the title and the OK button. If null, these components won't be displayed
The action listener can be sent two action id:
public void editDialog(javax.swing.JDialog owner)
public java.util.Vector getIntervals()
public java.util.TreeMap getMap()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |