|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.filter.FilterFactoryManager
public class FilterFactoryManager
FilterFactoryManager is a class that contains the FilterFactory for each data type. It is only used in
CustomFilterEditor to explore the possible filters for each data type. By default, we categorized the data type into
Boolean, Date/Calendar, String and Number. There is registerDefaultFilterFactories()
method which registers
FilterFactories for all four categories.
setDefaultInstance(FilterFactoryManager)
to register an instance of your class as AutoFilterBox
will
use getDefaultInstance()
to get an instance and use it.
Field Summary | |
---|---|
static String |
DATA_TYPE_BOOLEAN
|
static String |
DATA_TYPE_DATE
|
static String |
DATA_TYPE_NUMBER
|
static String |
DATA_TYPE_STRING
|
Constructor Summary | |
---|---|
FilterFactoryManager()
|
Method Summary | |
---|---|
void |
clear()
Removes all registered filters. |
Filter |
createFilter(FilterFactory filterFactory,
Object... objects)
Creates Filter using the specified filterFactory and the necessary parameters for the filter. |
Filter |
createFilter(String filterFactoryName,
Class type,
Object... objects)
Creates Filter using the specified filterFactoryName and the necessary parameters for the filter. |
FilterFactory |
findFilterFactoryByName(Class type,
String filterFactoryName)
Finds the FilterFactory from the FilterFactoryManager by the filter name. |
static FilterFactoryManager |
getDefaultInstance()
Gets a default instance of the FilterFactoryManager. |
List<FilterFactory> |
getFilterFactories(Class<?> type)
Gets the registered FilterFactories. |
void |
registerDefaultFilterFactories()
Registers default filter factories. |
void |
registerDefaultFilterFactories(boolean includeTwoParameters)
Registers default filter factories. |
void |
registerFilterFactory(Class type,
FilterFactory filterFactory)
Registers the FilterFactory . |
void |
registerFilterFactory(Class type,
FilterFactory filterFactory,
int index)
Registers the FilterFactory . |
static void |
setDefaultInstance(FilterFactoryManager filterFactoryManager)
Sets a default instance. |
boolean |
unregisterFilterFactory(Class type,
FilterFactory filterFactory)
Unregisters the FilterFactory . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DATA_TYPE_DATE
public static final String DATA_TYPE_STRING
public static final String DATA_TYPE_NUMBER
public static final String DATA_TYPE_BOOLEAN
Constructor Detail |
---|
public FilterFactoryManager()
Method Detail |
---|
public void registerFilterFactory(Class type, FilterFactory filterFactory)
FilterFactory
. Here is a sample code to register a FilterFactory
.
registerFilterFactory(Integer, new FilterFactory() {
public Filter createFilter(Object... objects) {
return new EqualFilter((Integer) objects[0]);
}
public Class[] getExpectedDataTypes() {
return new Class[]{Integer.class};
}
public String getConditionString(Locale locale) {
return "equals";
}
});
Once you register this FilterFactory
, getFilterFactories(Class)
will find it if the Class
is Integer.class or int.class.
type
- the typefilterFactory
- the FilterFactory to be registered.public void registerFilterFactory(Class type, FilterFactory filterFactory, int index)
FilterFactory
.
type
- the typefilterFactory
- the FilterFactory
to be registered.index
- the order index of the newly registered FilterFactory. -1 means appending at the end (the
last one).public boolean unregisterFilterFactory(Class type, FilterFactory filterFactory)
FilterFactory
.
type
- the typefilterFactory
- the FilterFactory
to be unregistered.
FilterFactory
is
not registered before.public List<FilterFactory> getFilterFactories(Class<?> type)
type
- the type.
public void clear()
public void registerDefaultFilterFactories()
public void registerDefaultFilterFactories(boolean includeTwoParameters)
includeTwoParameters
- true if those factories that have two parameters should be included. Otherwise
false.public static FilterFactoryManager getDefaultInstance()
public static void setDefaultInstance(FilterFactoryManager filterFactoryManager)
AutoFilterBox
will call getDefaultInstance()
to get an instance of
FilterFactoryManager so it is important you call this method to set it if you subclasses FilterFactoryManager.
filterFactoryManager
- a new instance of FilterFactoryManager.public FilterFactory findFilterFactoryByName(Class type, String filterFactoryName)
type
- the data type.filterFactoryName
- the name of the FilterFactory.
public Filter createFilter(String filterFactoryName, Class type, Object... objects)
filterFactoryName
- the filter factory name.type
- the data type.objects
- the parameters for the filter
public Filter createFilter(FilterFactory filterFactory, Object... objects)
filterFactory
- the filter factoryobjects
- the parameters for the filter
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |