com.sas.dataselectors.filters
Class FilterValueFormatter

com.sas.dataselectors.filters.FilterValueFormatter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class FilterValueFormatter

See Also:
Serialized Form

Method Summary
 java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
           
static FilterValueFormatter getInstance()
          Returns a FilterValueFormatter that doesn't show unformatted values for the default locale.
static FilterValueFormatter getInstance(java.util.Locale inLocale)
          Returns a FilterValueFormatter that doesn't show unformatted values for the specified locale.
static FilterValueFormatter getInstance(java.util.Locale inLocale, boolean showUnformattedValues)
          Returns a FilterValueFormatter for the specified locale.
 java.lang.String getNullValueText()
           
static java.lang.String getPromptDescription(com.sas.iquery.metadata.business.Prompt prompt, com.sas.iquery.metadata.business.BusinessQuery businessQuery, java.lang.String formatString, java.util.Locale locale)
          Returns the description of the specified prompt using the specified format string.
 java.lang.String getPromptFormatString()
           
protected  java.lang.String getPromptValues(com.sas.iquery.metadata.business.Prompt promptValue)
          Deprecated. use FilterValueFormatter.getPromptValues(prompt, businessQuery, locale) instead
 java.lang.String getUnformattedValueFormatString()
          Returns the format string to use when both the formatted and unformatted values are shown.
 boolean isUnformattedValuesShown()
          Returns true if unformatted filter values are shown (when available), false if not shown.
 java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
           
 void setBusinessQuery(com.sas.iquery.metadata.business.BusinessQuery businessQuery)
           
 void setNullValueText(java.lang.String nullValueText)
          Sets the string to show for null filter values.
 void setPromptFormatString(java.lang.String promptFormatString)
           
 void setShowUnformattedValues(boolean showUnformattedValues)
          If set to true then unformatted values will be shown along with formatted values when these values differ.
 void setUnformattedValueFormatString(java.lang.String unformattedValuesShownFormatString)
          Sets the format string to use when showUnformattedValues is true and the formatted and unformatted values are different.
 

Method Detail

getInstance

public static FilterValueFormatter getInstance()
Returns a FilterValueFormatter that doesn't show unformatted values for the default locale.


getInstance

public static FilterValueFormatter getInstance(java.util.Locale inLocale)
Returns a FilterValueFormatter that doesn't show unformatted values for the specified locale.

Parameters:
inLocale - the given locale
Returns:
a FilterValueFormatter that doesn't show unformatted values for the specified locale

getInstance

public static FilterValueFormatter getInstance(java.util.Locale inLocale,
                                               boolean showUnformattedValues)
Returns a FilterValueFormatter for the specified locale. If showUnformattedValues is false, then the FilterValueFormatter will not show unformatted filter values, unless there is no formatted value available and the unformatted value is the only available value. If showUnformattedValues is true, then unformatted filter values are shown. If both the formatted and unformatted values are the same, then only one value is shown.

Parameters:
inLocale - the given locale
showUnformattedValues - specifies whether this FilterValueFormatter will display unformatted filter values
Returns:
a FilterValueFormatter for the specified locale

setShowUnformattedValues

public void setShowUnformattedValues(boolean showUnformattedValues)
If set to true then unformatted values will be shown along with formatted values when these values differ.

If false, then unformatted values are not shown unless there is no formatted value.

Parameters:
showUnformattedValues - indicates if unformatted values should be shown along with the formatted values

setNullValueText

public void setNullValueText(java.lang.String nullValueText)
Sets the string to show for null filter values. The default is "null".

Parameters:
nullValueText - the string to show for null filter values

getNullValueText

public java.lang.String getNullValueText()

setPromptFormatString

public void setPromptFormatString(java.lang.String promptFormatString)

getPromptFormatString

public java.lang.String getPromptFormatString()

setUnformattedValueFormatString

public void setUnformattedValueFormatString(java.lang.String unformattedValuesShownFormatString)
Sets the format string to use when showUnformattedValues is true and the formatted and unformatted values are different. The default is "{0} [ {1} ]", where {0} is the formatted value and {1} is the unformattedValue.

Parameters:
unformattedValuesShownFormatString -

getUnformattedValueFormatString

public java.lang.String getUnformattedValueFormatString()
Returns the format string to use when both the formatted and unformatted values are shown. The default format is "{0} [ {1} ]", where {0} is the formatted value and {1} is the unformatted value.

Returns:
the format string to use when both the formatted and unformatted values are shown

isUnformattedValuesShown

public boolean isUnformattedValuesShown()
Returns true if unformatted filter values are shown (when available), false if not shown. The unformatted value will only be shown if it is different from the formatted value. The format to use when both the formatted and unformatted values are shown can be set by calling the setUnformattedValueFormatString method.

Returns:
true if unformatted filter values are shown (when available), false if not shown

setBusinessQuery

public void setBusinessQuery(com.sas.iquery.metadata.business.BusinessQuery businessQuery)

format

public java.lang.StringBuffer format(java.lang.Object obj,
                                     java.lang.StringBuffer toAppendTo,
                                     java.text.FieldPosition pos)
Specified by:
format in class java.text.Format

parseObject

public java.lang.Object parseObject(java.lang.String source,
                                    java.text.ParsePosition pos)
Specified by:
parseObject in class java.text.Format

getPromptDescription

public static java.lang.String getPromptDescription(com.sas.iquery.metadata.business.Prompt prompt,
                                                    com.sas.iquery.metadata.business.BusinessQuery businessQuery,
                                                    java.lang.String formatString,
                                                    java.util.Locale locale)
Returns the description of the specified prompt using the specified format string. The formatString specifies the format used to describe the prompt. The following parameters may be used in the format string: A formatString of "{2}" will be used if a null value is passed in. This will result in only the prompt values being used in the description and not the prompt name or label.

Parameters:
prompt - the prompt to return the description for
businessQuery - the BusinessQuery containing the prompt
formatString - the format string used to describe the prompt
locale - the Locale to use when describing the prompt
Returns:

getPromptValues

protected java.lang.String getPromptValues(com.sas.iquery.metadata.business.Prompt promptValue)
Deprecated. use FilterValueFormatter.getPromptValues(prompt, businessQuery, locale) instead

Returns the currently set prompt values for the specified promptValue.

Parameters:
promptValue - the prompt to return the current prompt values for
Returns:



Copyright © 2009 SAS Institute Inc. All Rights Reserved.