com.sas.dataselectors.filters
Class Util

com.sas.dataselectors.filters.Util

public class Util

Utility class for dataselectors containing methods to create Strings representations of a filter tree.


Field Summary
static java.lang.String FILTER_ITEM_MAP_ENTRY
           
static int HTML
           
static java.lang.String HTML_BREAK
           
static java.lang.String HTML_LEFT_PARENTHESIS
           
static java.lang.String HTML_NBSP
           
static java.lang.String HTML_RIGHT_PARENTHESIS
           
static java.lang.String LOGICAL_CONDITION_MAP_ENTRY
           
static java.lang.String LOGICAL_NODE_MAP_ENTRY
           
static java.lang.String NESTING_MAP_ENTRY
           
static java.lang.String RB_KEY
          The prefix used for resource properties associated with this class.
static int TEXT
           
static java.lang.String TEXT_LEFT_PARENTHESIS
           
static java.lang.String TEXT_NEWLINE
           
static java.lang.String TEXT_RIGHT_PARENTHESIS
           
static java.lang.String TEXT_SPACE
           
static java.lang.String VIRTUAL_FILTER_ITEM_MAP_ENTRY
           
 
Constructor Summary
Util()
           
 
Method Summary
static boolean containsInstance(java.util.List list, java.lang.Object o)
           
static java.util.List getExpressionInfo(SimpleFilterLogicTreeInterface tree, int outputType)
          Returns a List of Maps.
static java.util.List getExpressionInfo(SimpleFilterLogicTreeInterface tree, int outputType, java.util.Locale locale, boolean virtualDisplay)
          Returns a List of Maps.
static java.util.List getExpressionInfo(SimpleFilterLogicTreeInterface tree, java.lang.String space, java.lang.String newline, java.lang.String leftParen, java.lang.String rightParen, java.lang.String not, java.lang.String andStr, java.lang.String orStr, boolean virtualDisplay)
          Returns a List of Maps.
static java.lang.String getExpressionString(SimpleFilterLogicTreeInterface tree, int outputType)
          Return an unformatted, unindented String representing the entire filter tree.
static java.lang.String getExpressionString(SimpleFilterLogicTreeInterface tree, int outputType, java.util.Locale locale)
          Return an unformatted, unindented String representing the entire filter tree.
static java.lang.String getFormattedExpressionString(java.util.List expressionList, int outputType, int startSelection, int endSelection)
          Returns the indented, formatted (line breaks) String representing the filter tree.
static java.lang.String getFormattedExpressionString(SimpleFilterLogicTreeInterface tree, java.util.Locale locale, int outputType, int startSelection, int endSelection)
          Returns the indented, formatted (line breaks) String representing the filter tree.
static int getIndexOfChildInstance(javax.swing.tree.TreeNode parent, javax.swing.tree.TreeNode child)
           
static int indexOfInstance(java.util.List list, java.lang.Object o)
           
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
The prefix used for resource properties associated with this class.

See Also:
Constant Field Values

HTML_NBSP

public static java.lang.String HTML_NBSP

HTML_BREAK

public static java.lang.String HTML_BREAK

HTML_LEFT_PARENTHESIS

public static java.lang.String HTML_LEFT_PARENTHESIS

HTML_RIGHT_PARENTHESIS

public static java.lang.String HTML_RIGHT_PARENTHESIS

TEXT_SPACE

public static java.lang.String TEXT_SPACE

TEXT_NEWLINE

public static java.lang.String TEXT_NEWLINE

TEXT_LEFT_PARENTHESIS

public static java.lang.String TEXT_LEFT_PARENTHESIS

TEXT_RIGHT_PARENTHESIS

public static java.lang.String TEXT_RIGHT_PARENTHESIS

HTML

public static final int HTML
See Also:
Constant Field Values

TEXT

public static final int TEXT
See Also:
Constant Field Values

FILTER_ITEM_MAP_ENTRY

public static final java.lang.String FILTER_ITEM_MAP_ENTRY
See Also:
Constant Field Values

VIRTUAL_FILTER_ITEM_MAP_ENTRY

public static final java.lang.String VIRTUAL_FILTER_ITEM_MAP_ENTRY
See Also:
Constant Field Values

LOGICAL_CONDITION_MAP_ENTRY

public static final java.lang.String LOGICAL_CONDITION_MAP_ENTRY
See Also:
Constant Field Values

NESTING_MAP_ENTRY

public static final java.lang.String NESTING_MAP_ENTRY
See Also:
Constant Field Values

LOGICAL_NODE_MAP_ENTRY

public static final java.lang.String LOGICAL_NODE_MAP_ENTRY
See Also:
Constant Field Values
Constructor Detail

Util

public Util()
Method Detail

getFormattedExpressionString

public static java.lang.String getFormattedExpressionString(SimpleFilterLogicTreeInterface tree,
                                                            java.util.Locale locale,
                                                            int outputType,
                                                            int startSelection,
                                                            int endSelection)
Returns the indented, formatted (line breaks) String representing the filter tree. Any time the tree has been modified, a new List must be generated by calling getExpressionInfo which can be saved and passed to this method as needed.

Parameters:
expressionList - The List of Maps representing all the filter conditions and information about them.
locale -
outputType - Set to either Util.HTML or Util.TEXT. Used to write appropriate spaces.
startSelection - The start index of the contiguous selection in the filter list.
endSelection - The end index of the contiguous selection in the filter list.
Returns:
The formatted, indented String to be used in the Expression Area.

getFormattedExpressionString

public static java.lang.String getFormattedExpressionString(java.util.List expressionList,
                                                            int outputType,
                                                            int startSelection,
                                                            int endSelection)
Returns the indented, formatted (line breaks) String representing the filter tree. Any time the tree has been modified, a new List must be generated by calling getExpressionInfo which can be saved and passed to this method as needed.

Parameters:
expressionList - The List of Maps representing all the filter conditions and information about them.
outputType - Set to either Util.HTML or Util.TEXT. Used to write appropriate spaces.
startSelection - The start index of the contiguous selection in the filter list.
endSelection - The end index of the contiguous selection in the filter list.
Returns:
The formatted, indented String to be used in the Expression Area.

getExpressionString

public static java.lang.String getExpressionString(SimpleFilterLogicTreeInterface tree,
                                                   int outputType,
                                                   java.util.Locale locale)
Return an unformatted, unindented String representing the entire filter tree.

Parameters:
tree - The tree representing all the filter conditions and information about them.
outputType - Set to either Util.HTML or Util.TEXT. Used to write appropriate spaces.
locale - for getting localized versions of the "NOT" modifier and such
Returns:
The unformatted filter String

getExpressionString

public static java.lang.String getExpressionString(SimpleFilterLogicTreeInterface tree,
                                                   int outputType)
Return an unformatted, unindented String representing the entire filter tree.

Parameters:
tree - The tree representing all the filter conditions and information about them.
outputType - Set to either Util.HTML or Util.TEXT. Used to write appropriate spaces.
Returns:
The unformatted filter String

getExpressionInfo

public static java.util.List getExpressionInfo(SimpleFilterLogicTreeInterface tree,
                                               int outputType,
                                               java.util.Locale locale,
                                               boolean virtualDisplay)
Returns a List of Maps. The outer most List contains each filter, which is composed of a map with 4 elements (the item including parentheses, the logic condition, and the nested group number of the item. The nested group number is used in the formatting method. To run through the every item, iterate through the list and get map entries with keys FILTER_ITEM_MAP_ENTRY and LOGICAL_CONDITION_MAP_ENTRY, which are the Strings from the map to fill the filter combination boxes.

Parameters:
tree - The tree representing all the filter conditions and information about them.
outputType - Set to either Util.HTML or Util.TEXT. Used to write appropriate spaces and newlines/breaks.
locale - for getting localized versions of the "NOT" modifier and such
virtualDisplay - a flag to indicate whether (TRUE) a virtual representation of the filter logic should be constructed showing only the required groupings or (FALSE) a true representation of the filter logic should be constructed showing the boolean precedence rules in effect.
Returns:
The List of Maps representing the entire filter tree.

getExpressionInfo

public static java.util.List getExpressionInfo(SimpleFilterLogicTreeInterface tree,
                                               int outputType)
Returns a List of Maps. The outer most List contains each filter, which is composed of a map with 4 elements (the item including parentheses, the logic condition, and the nested group number of the item. The nested group number is used in the formatting method. To run through the every item, iterate through the list and get map entries with keys FILTER_ITEM_MAP_ENTRY and LOGICAL_CONDITION_MAP_ENTRY, which are the Strings from the map to fill the filter combination boxes.

Parameters:
tree - The tree representing all the filter conditions and information about them.
outputType - Set to either Util.HTML or Util.TEXT. Used to write appropriate spaces and newlines/breaks.
Returns:
The List of Maps representing the entire filter tree.

getExpressionInfo

public static java.util.List getExpressionInfo(SimpleFilterLogicTreeInterface tree,
                                               java.lang.String space,
                                               java.lang.String newline,
                                               java.lang.String leftParen,
                                               java.lang.String rightParen,
                                               java.lang.String not,
                                               java.lang.String andStr,
                                               java.lang.String orStr,
                                               boolean virtualDisplay)
Returns a List of Maps. The outer most List contains each filter, which is composed of a map with 4 elements (the item including parentheses, the logic condition, and the nested group number of the item. The nested group number is used in the formatting method. To run through the every item, iterate through the list and get map entries with keys FILTER_ITEM_MAP_ENTRY and LOGICAL_CONDITION_MAP_ENTRY, which are the Strings from the map to fill the filter combination boxes.

Parameters:
tree - The tree representing all the filter conditions and information about them.
space - The string to use as a space
newline - The string to start a new line
leftParen - The string to represent a left parenthesis
rightParen - The string to represent a right parenthesis
not - The string to use to NOT a group of conditions
Returns:
The List of Maps representing the entire filter tree.

getIndexOfChildInstance

public static int getIndexOfChildInstance(javax.swing.tree.TreeNode parent,
                                          javax.swing.tree.TreeNode child)
Parameters:
common -
child -
Returns:

containsInstance

public static boolean containsInstance(java.util.List list,
                                       java.lang.Object o)

indexOfInstance

public static int indexOfInstance(java.util.List list,
                                  java.lang.Object o)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.