com.crystaldecisions.sdk.occa.report.data
Class Filter

java.lang.Object
  extended by Formula
      extended by com.crystaldecisions.sdk.occa.report.data.Filter
All Implemented Interfaces:
IFilter, IClone

public class Filter
extends Formula
implements IFilter, IClone

This object defines filters that are used in record selection and group selection. As the name implies, they are used to select specified data. Initially, the filter is a simple string written in Crystal syntax. When the file is opened, the string is parsed into an array of FilterItems, which is stored in the Filter object's FilterItems property. When possible, use the IFilter interface to manipulate this object.


Constructor Summary
Filter()
           
Filter(FilterType filterType)
           
Filter(IFilter src)
           
 
Method Summary
 java.lang.Object clone(boolean deepClone)
           
 java.lang.String computeText()
           Returns a String representation of the field value that can be used in a report formula.
 void copyTo(java.lang.Object destObject, boolean deepCopy)
           
 java.lang.Object createMember(java.lang.String eleName, org.xml.sax.Attributes attrs, XMLSerializationContext ctxt, java.util.Map objState, boolean[] bLoaded)
           
 java.lang.String displayText(FieldDisplayNameType type, java.util.Locale locale)
           Returns a UI-friendly string representation of the filter.
 void endElement(java.lang.String eleName, java.util.Map objState)
           
 FilterItems getFilterItems()
           Returns the result of a parsed filter string.
 FilterType getFilterType()
          For internal use only
 java.lang.String getFreeEditingText()
           Returns the formula text that was originally used to define the filter.
 java.lang.String getName()
          Returns the name of the filter.
 java.lang.String getText()
           
 boolean hasContent(java.lang.Object srcFilter)
           
 void readElement(java.lang.String eleName, java.lang.String sVal, org.xml.sax.Attributes attrs, java.util.Map objState)
           
 void save(XMLWriter writer, java.lang.String sTag, XMLSerializationContext ctxt)
           
 void save(XMLWriter writer, XMLSerializationContext ctxt)
           
 void saveContents(XMLWriter writer, XMLSerializationContext ctxt)
           
 void setFilterItems(FilterItems filterItems)
           Sets the result of a parsed filter string.
 void setFilterType(FilterType filterType)
          For internal use only
 void setFreeEditingText(java.lang.String freeEditingText)
           Sets the formula text that will be used to define the filter.
 void setName(java.lang.String name)
          Sets the name of the filter.
 void setText(java.lang.String text)
           
 void startElement(java.lang.String eleName, java.util.Map objState, org.xml.sax.Attributes attrs)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.crystaldecisions.sdk.occa.report.data.IFilter
getFormulaNullTreatment, setFormulaNullTreatment
 

Constructor Detail

Filter

public Filter(IFilter src)

Filter

public Filter()

Filter

public Filter(FilterType filterType)
Method Detail

clone

public java.lang.Object clone(boolean deepClone)

computeText

public java.lang.String computeText()
Description copied from interface: IFilter

Returns a String representation of the field value that can be used in a report formula. The string is not formatted or localized. The syntax will always be Crystal syntax.

If the field contains a date, computeText returns Date(x, x, x); if it contains a date and time, computeText returns DateTime(x, x, x, x, x, x). However, when the date is 1900, 0, 1 (the Java start date), computeText returns Time(x, x, x). If you want to set a field to a time value only (that is, with no date), you should set the date to 1900, 0, 1, so that computeText will retrieve the correct information.

Specified by:
computeText in interface IFilter
Returns:
A String representation of the field value that can be used in a report formula.

copyTo

public void copyTo(java.lang.Object destObject,
                   boolean deepCopy)

createMember

public java.lang.Object createMember(java.lang.String eleName,
                                     org.xml.sax.Attributes attrs,
                                     XMLSerializationContext ctxt,
                                     java.util.Map objState,
                                     boolean[] bLoaded)

displayText

public java.lang.String displayText(FieldDisplayNameType type,
                                    java.util.Locale locale)
Description copied from interface: IFilter

Returns a UI-friendly string representation of the filter. This method attempts to structure the filter formula as close to a localized phrase as possible. If you do not pass in a locale, it attempts to localize the string using the user's default locale.

If the field contains a date, displayText returns a locale-specific Date string; if it contains a date and time, displayText returns a locale-specific DateTime string; if it contains a time string, displayText returns a locale-specific Time string.

Specified by:
displayText in interface IFilter
Parameters:
type - Indicates how the name of the field is displayed.
locale - Localizes the string according to a specific locale.
Returns:
A UI-friendly string representation of the filter.

endElement

public void endElement(java.lang.String eleName,
                       java.util.Map objState)

getFilterItems

public FilterItems getFilterItems()
Description copied from interface: IFilter

Returns the result of a parsed filter string. When a filter string is parsed, it is broken into the following categories:

This property contains all of these categories. This property will contain data only if the original filter string was successfully parsed. Use the getFreeEditingText method to check whether the formula was parsed successfully. If it is empty, then the parsing was successful.

Note: If you modify the filter using this method, the FreeEditingText property will not be updated.

Specified by:
getFilterItems in interface IFilter
Returns:
A FilterItems object containing the result of a parsed filter string.

getFreeEditingText

public java.lang.String getFreeEditingText()
Description copied from interface: IFilter

Returns the formula text that was originally used to define the filter. This String will be empty if the formula was successfully parsed into the FilterItems property. If the formula text was too complicated to be parsed, this property will still contain the formula text and the getFilterItems method will return null.

Note: If you modify the filter using this property, the FilterItems property will not be updated until the file is saved and reopened--regardless of whether the initial parsing was successful or not.

Specified by:
getFreeEditingText in interface IFilter
Returns:
A String containing the formula text that was originally used to define the filter.

getText

public java.lang.String getText()

setText

public void setText(java.lang.String text)

getName

public java.lang.String getName()
Description copied from interface: IFilter
Returns the name of the filter.

Specified by:
getName in interface IFilter
Returns:
A String containing the name of the filter.

hasContent

public boolean hasContent(java.lang.Object srcFilter)

readElement

public void readElement(java.lang.String eleName,
                        java.lang.String sVal,
                        org.xml.sax.Attributes attrs,
                        java.util.Map objState)

save

public void save(XMLWriter writer,
                 XMLSerializationContext ctxt)
          throws java.io.IOException
Throws:
java.io.IOException

save

public void save(XMLWriter writer,
                 java.lang.String sTag,
                 XMLSerializationContext ctxt)
          throws java.io.IOException
Throws:
java.io.IOException

saveContents

public void saveContents(XMLWriter writer,
                         XMLSerializationContext ctxt)
                  throws java.io.IOException
Throws:
java.io.IOException

setFilterItems

public void setFilterItems(FilterItems filterItems)
Description copied from interface: IFilter

Sets the result of a parsed filter string. When a filter string is parsed, it is broken into the following categories:

This property contains all of these categories. This property will contain data only if the original filter string was successfully parsed. Use the getFreeEditingText method to check whether the formula was parsed successfully. If it is empty, then the parsing was successful.

Note: If you modify the filter using this method, the FreeEditingText property will not be updated.

Specified by:
setFilterItems in interface IFilter
Parameters:
filterItems - A FilterItems object containing the result of a parsed filter string.

setFreeEditingText

public void setFreeEditingText(java.lang.String freeEditingText)
Description copied from interface: IFilter

Sets the formula text that will be used to define the filter. This String will be empty if the formula is successfully parsed into the FilterItems property. If the formula text is too complicated to be parsed, this property will still contain the formula text and the getFilterItems method will return null.

Note: If you modify the filter using this property, the FilterItems property will not be updated until the file is saved and reopened--regardless of whether the initial parsing was successful or not.

Specified by:
setFreeEditingText in interface IFilter
Parameters:
freeEditingText - A String containing the formula text that was originally used to define the filter.

setName

public void setName(java.lang.String name)
Description copied from interface: IFilter
Sets the name of the filter.

Specified by:
setName in interface IFilter
Parameters:
name - A String containing the name of the filter.

startElement

public void startElement(java.lang.String eleName,
                         java.util.Map objState,
                         org.xml.sax.Attributes attrs)

getFilterType

public FilterType getFilterType()
Description copied from interface: IFilter
For internal use only

Specified by:
getFilterType in interface IFilter

setFilterType

public void setFilterType(FilterType filterType)
Description copied from interface: IFilter
For internal use only

Specified by:
setFilterType in interface IFilter