Package com.im.ijc.cf.api
Class CFClassifier
- java.lang.Object
-
- com.im.ijc.cf.api.CFAbstractItem
-
- com.im.ijc.cf.api.CFClassifier
-
public final class CFClassifier extends CFAbstractItem
Classifier is a code representation for conditional formatting. Follow the link to understand how conditional formatting works.This class is an entry point for managing bin sets (known as Type of formatting) and expression sets, where each expression set is associated with one bin set in
1:Nrelation. I.e. one bin set might be used by more expression sets.- Author:
- Petr Hamernik
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROP_BIN_SETSName of property change event fired when bin sets of this classifier have changed.static java.lang.StringPROP_EXPRESSION_SETSName of property change event fired when expression sets of this classifier have changed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CFBinSetaddBinSet(java.lang.String displayName)Create a new bin set and return it.CFBinSetaddBinSetFromTemplate(CFBinSet template)Create a new bin set from template.voidaddChangeListener(javax.swing.event.ChangeListener listener)Add change listener to know about any change in thisCFClassifierand in all of subelements (allCFBinSetsand theirCFBins, also in allCFExpressionSets).CFClassifierclone()This method can be used for deep cloning of whole classifier with all itsCFBinSets andCFExpressionSets.CFExpressionSetcreateExpressionSetFor(CFBinSet binSet, java.lang.String displayName, CFFieldType fieldType, CFBin defaultBin)Creates new empty expression set.static CFClassifiercreateNewClassifier()Create a new classifier.CFBinSetfindBinSetById(java.lang.String id)Tries to find a bin set with givenidand, in case it is found, returns it.CFExpressionSetfindExpressionSetById(java.lang.String id)Tries to find a expression set with givenidand, in case it is found, returns it.java.util.List<CFBinSet>getBinSets()java.util.List<CFExpressionSet>getExpressionsSets()voidremoveBinSet(CFBinSet bs)Remove the given bin set.voidremoveChangeListener(javax.swing.event.ChangeListener listener)voidremoveExpressionSet(CFExpressionSet es)Removes given expression set from this classifier.CFBinSetrestoreBinSet(java.lang.String displayName, java.lang.String id)Use only for persistence.CFExpressionSetrestoreExpressionSet(CFBinSet binSet, java.lang.String displayName, CFFieldType fieldType, CFBin defaultBin, java.lang.String id)Do NOT use.voidupdateWith(CFClassifier source)Updates this classifier using bin sets and expression sets from the givensourceclassifier.-
Methods inherited from class com.im.ijc.cf.api.CFAbstractItem
addPropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
PROP_BIN_SETS
public static final java.lang.String PROP_BIN_SETS
Name of property change event fired when bin sets of this classifier have changed.- See Also:
- Constant Field Values
-
PROP_EXPRESSION_SETS
public static final java.lang.String PROP_EXPRESSION_SETS
Name of property change event fired when expression sets of this classifier have changed.- See Also:
- Constant Field Values
-
-
Method Detail
-
createNewClassifier
public static CFClassifier createNewClassifier()
Create a new classifier. Usually you won't need this constructor since the "higher-level" API usually provides their API client with an instance. E.g. grid view instance from Forms Model API is already associated with a default (or deserialized) instance of classifier instance.- Returns:
- new empty classifier
-
clone
public CFClassifier clone()
This method can be used for deep cloning of whole classifier with all itsCFBinSets andCFExpressionSets.- Overrides:
clonein classjava.lang.Object- Returns:
- newly cloned classifier
-
getBinSets
public java.util.List<CFBinSet> getBinSets()
- Returns:
- bin sets belonging to this classifier
-
addBinSet
public CFBinSet addBinSet(java.lang.String displayName)
Create a new bin set and return it.- Parameters:
displayName- Display name of a new bin set- Returns:
- new instance of bin set which belong to this classifier.
-
addBinSetFromTemplate
public CFBinSet addBinSetFromTemplate(CFBinSet template)
Create a new bin set from template. That is deep copy of a bin set with all of its bins.- Parameters:
template- template to be copied- Returns:
- new replica with unique ID
-
restoreBinSet
public CFBinSet restoreBinSet(java.lang.String displayName, java.lang.String id)
Use only for persistence.
-
removeBinSet
public void removeBinSet(CFBinSet bs)
Remove the given bin set. Since eachexpression setmust be associated with at least one bin set this method also removes all expression sets belonging to this classifier which are currently associated with the given bin set.- Parameters:
bs- bin set to be removed
-
findBinSetById
public CFBinSet findBinSetById(java.lang.String id)
Tries to find a bin set with givenidand, in case it is found, returns it.- Parameters:
id- id of bin set to be found- Returns:
- found bin set or
null
-
createExpressionSetFor
public CFExpressionSet createExpressionSetFor(CFBinSet binSet, java.lang.String displayName, CFFieldType fieldType, CFBin defaultBin)
Creates new empty expression set. I.e. with no expression.- Parameters:
binSet- bin set used by the new expression setdisplayName- display name used in UIfieldType- field typedefaultBin- default bin used when no expression matches- Returns:
- newly created expression set
-
restoreExpressionSet
public CFExpressionSet restoreExpressionSet(CFBinSet binSet, java.lang.String displayName, CFFieldType fieldType, CFBin defaultBin, java.lang.String id)
Do NOT use. Only for persistence.
-
removeExpressionSet
public void removeExpressionSet(CFExpressionSet es)
Removes given expression set from this classifier.- Parameters:
es- expression set to be removed
-
getExpressionsSets
public java.util.List<CFExpressionSet> getExpressionsSets()
- Returns:
- expression sets belonging to this classifier
-
findExpressionSetById
public CFExpressionSet findExpressionSetById(java.lang.String id)
Tries to find a expression set with givenidand, in case it is found, returns it.- Parameters:
id- id of expression set to be found- Returns:
- found expression set or
null
-
updateWith
public void updateWith(CFClassifier source)
Updates this classifier using bin sets and expression sets from the givensourceclassifier. Used when copy-pasting widgets between forms.- Parameters:
source- classifier of the source form- Since:
- 18.23.0
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener listener)
Add change listener to know about any change in thisCFClassifierand in all of subelements (allCFBinSetsand theirCFBins, also in allCFExpressionSets). Leaves elementsCFFormatterandCFExpressionare immutable, so no change can happen there.It means you don't need to register
PropertyChangeListenerto each bin set, bin and expression set, but you can be notified through this single listener about all changes in the whole hierarchy (e.g. when some bin changes itsCFFormatter, when new bin set is added etc.)- Parameters:
listener- to be added
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener listener)
- Parameters:
listener- listener to be removed from notification about changes.- See Also:
addChangeListener(javax.swing.event.ChangeListener)
-
-