de.lehmannet.om
Class Filter

java.lang.Object
  extended by de.lehmannet.om.SchemaElement
      extended by de.lehmannet.om.Filter
All Implemented Interfaces:
IFilter, ISchemaElement

public class Filter
extends SchemaElement
implements IFilter

Filter implements the class de.lehmannet.om.IFilter. A Filter describes a optical filter used during the observation.
This includes all kind of filters like color filters, band filter, ...
The model name and the type are mandatory fields which have to be set.

Since:
1.5
Author:
doergn@users.sourceforge.net

Field Summary
 
Fields inherited from interface de.lehmannet.om.IFilter
FILTER_COLOR_BLUE, FILTER_COLOR_DEEPBLUE, FILTER_COLOR_DEEPRED, FILTER_COLOR_DEEPYELLOW, FILTER_COLOR_GREEN, FILTER_COLOR_LIGHTGREEN, FILTER_COLOR_LIGHTRED, FILTER_COLOR_LIGHTYELLOW, FILTER_COLOR_MEDIUMBLUE, FILTER_COLOR_ORANGE, FILTER_COLOR_PALEBLUE, FILTER_COLOR_RED, FILTER_COLOR_VIOLET, FILTER_COLOR_YELLOW, FILTER_COLOR_YELLOWGREEN, FILTER_TYPE_BROADBAND, FILTER_TYPE_COLOR, FILTER_TYPE_CORRECTIVE, FILTER_TYPE_HALPHA, FILTER_TYPE_HBETA, FILTER_TYPE_NARROWBAND, FILTER_TYPE_NEUTRAL, FILTER_TYPE_OIII, FILTER_TYPE_OTHER, FILTER_TYPE_SOLAR, XML_ELEMENT_COLOR, XML_ELEMENT_FILTER, XML_ELEMENT_MODEL, XML_ELEMENT_SCHOTT, XML_ELEMENT_TYPE, XML_ELEMENT_WRATTEN
 
Fields inherited from interface de.lehmannet.om.ISchemaElement
XML_ELEMENT_ATTRIBUTE_ID
 
Constructor Summary
Filter(org.w3c.dom.Node filter)
          Constructs a new instance of a Filter from an given XML Schema Node.
Filter(java.lang.String model, java.lang.String type)
          Constructs a new instance of a Filter.
 
Method Summary
 org.w3c.dom.Element addAsLinkToXmlElement(org.w3c.dom.Element element)
          Adds the filter link to an given XML DOM Element The filter element itself will be attached to given elements ownerDocument.
 org.w3c.dom.Element addToXmlElement(org.w3c.dom.Element element)
          Adds this Filter to a given parent XML DOM Element.
 java.lang.String getColor()
          Returns the color of this filter.
 java.lang.String getDisplayName()
          Returns a display name for this element.
 java.lang.String getModel()
          Returns the model of this filter.
 java.lang.String getSchott()
          Returns the schott value of this filter.
 java.lang.String getType()
          Returns the filter type.
 java.lang.String getWratten()
          Returns the wratten value of this filter.
 void setColor(java.lang.String color)
          Sets the color of this filter.
 void setModel(java.lang.String model)
          Sets the model name for the filter.
 void setSchott(java.lang.String schott)
          Sets the schott value for the filter.
 void setType(java.lang.String type)
          Sets the filter type.
 void setWratten(java.lang.String wratten)
          Sets the wratten value for the filter.
 java.lang.String toString()
          Overwrittes toString() method from java.lang.Object.
 
Methods inherited from class de.lehmannet.om.SchemaElement
equals, getID, setID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lehmannet.om.ISchemaElement
getID
 

Constructor Detail

Filter

public Filter(org.w3c.dom.Node filter)
       throws SchemaException,
              java.lang.IllegalArgumentException
Constructs a new instance of a Filter from an given XML Schema Node.
Normally this constructor is only used by de.lehmannet.om.util.SchemaLoader

Parameters:
filter - The XML Schema element that represents this filter
Throws:
java.lang.IllegalArgumentException - if parameter is null,
SchemaException - if the given Node does not match the XML Schema specifications

Filter

public Filter(java.lang.String model,
              java.lang.String type)
       throws java.lang.IllegalArgumentException
Constructs a new instance of a Filter.

Parameters:
model - The filter model name
type - The type of the filter (use IFilter constants)
Throws:
java.lang.IllegalArgumentException - if model is empty null or type is empty, null or does not represent a type value from IFilter.
Method Detail

toString

public java.lang.String toString()
Overwrittes toString() method from java.lang.Object.
Returns all fields of the class Filter (unset field will be ignored). The result string will look like this:
Example:
Filter Model: Meade Narrowband
Type: narrow band

Overrides:
toString in class java.lang.Object
Returns:
A string representing the filter
See Also:
Object

getDisplayName

public java.lang.String getDisplayName()
Returns a display name for this element.
The method differs from the toString() method as toString() shows more technical information about the element. Also the formating of toString() can spread over several lines.
This method returns a string (in one line) that can be used as displayname in e.g. a UI dropdown box.

Specified by:
getDisplayName in interface ISchemaElement
Specified by:
getDisplayName in class SchemaElement
Returns:
Returns a String with a one line display name
See Also:
java.lang.Object.toString();

addToXmlElement

public org.w3c.dom.Element addToXmlElement(org.w3c.dom.Element element)
Adds this Filter to a given parent XML DOM Element. The Filter element will be set as a child element of the passed element.

Specified by:
addToXmlElement in interface IFilter
Parameters:
parent - The parent element for this Filter
Returns:
Returns the element given as parameter with this Filter as child element.
Might return null if parent was null.
See Also:
Element

addAsLinkToXmlElement

public org.w3c.dom.Element addAsLinkToXmlElement(org.w3c.dom.Element element)
Adds the filter link to an given XML DOM Element The filter element itself will be attached to given elements ownerDocument. If the ownerDocument has no filter container, it will be created.
Example:
<parameterElement>
<filter>123</filter>
</parameterElement>
More stuff of the xml document goes here
<filterContainer>
<filter id="123">
filter description goes here
</filter>
</filterContainer>

Specified by:
addAsLinkToXmlElement in interface IFilter
Parameters:
element - The element under which the the filter link is created
Returns:
Returns the Element given as parameter with a additional filter link, and the filter element under the filter container of the ownerDocument Might return null if element was null.
See Also:
Element

getColor

public java.lang.String getColor()
Returns the color of this filter.

Specified by:
getColor in interface IFilter
Returns:
Returns a String representing the filters color, or null if the color was never set (e.g. filter type is not IFilter.FILTER_TYPE_COLOR).

setColor

public void setColor(java.lang.String color)
              throws java.lang.IllegalArgumentException
Sets the color of this filter.
In case the current filter type is not IFilter.FILTER_TYPE_COLOR a IllegalArgumentException is thrown, so make sure to set Filter type to color first.
Valid color values can be retrieved from IFilter constants.

Specified by:
setColor in interface IFilter
Parameters:
color - The new color of the filter.
Throws:
java.lang.IllegalArgumentException - if filter type is not IFilter.FILTER_TYPE_COLOR, or the given color is empty null or does not contain a valid value.
See Also:
IFilter

getModel

public java.lang.String getModel()
Returns the model of this filter.

Specified by:
getModel in interface IFilter
Returns:
Returns a String representing the filter model.

setModel

public void setModel(java.lang.String model)
Sets the model name for the filter.

Specified by:
setModel in interface IFilter
Parameters:
model - The new model name to be set.
Throws:
java.lang.IllegalArgumentException - if modelname was null

getSchott

public java.lang.String getSchott()
Returns the schott value of this filter.

Specified by:
getSchott in interface IFilter
Returns:
Returns a String representing the schott value of the filter, or null if the value was never set.

setSchott

public void setSchott(java.lang.String schott)
Sets the schott value for the filter.

Specified by:
setSchott in interface IFilter
Parameters:
schott - The new schott value to be set.

getType

public java.lang.String getType()
Returns the filter type.

Specified by:
getType in interface IFilter
Returns:
Returns a String representing the filter type.

setType

public void setType(java.lang.String type)
Sets the filter type.
The filter type must be a value from the types defined in IFilter.
If the old filter type was IFilter.FILTER_TYPE_COLOR and the new filter type is not, then the filters color is reset to null.

Specified by:
setType in interface IFilter
Parameters:
type - The new filter type to be set.
Throws:
java.lang.IllegalArgumentException - if type was empty, null or does not contain a valid value (see IFilter constants).
See Also:
IFilter

getWratten

public java.lang.String getWratten()
Returns the wratten value of this filter.

Specified by:
getWratten in interface IFilter
Returns:
Returns a String representing the wratten value of the filter, or null if the value was never set.

setWratten

public void setWratten(java.lang.String wratten)
Sets the wratten value for the filter.

Specified by:
setWratten in interface IFilter
Parameters:
schott - The new wratten value to be set.