public FilterComponentFactory getFilterComponentFactory() { if (filterComponentFactory == null) { // Is the default configuration known for this type? if (columnType != null && FilterDatatypeConfig.DEFAULT_CONFIGURATION.containsKey(columnType)) { return FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(columnType); } else if (columnModel.getMaster().getFilterModel().isWysiwyg()) { return FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(String.class); } else { throw new UnsupportedOperationException( "Unknown datatype was used in listbox filter for column '" + column + "'. For type " + (columnType == null ? "unknown" : columnType.getCanonicalName()) + " have to be defined special filter component."); } } else { return filterComponentFactory; } }
/** * Return quickFilterOperator based on a value. If quickFilterOperator is set directly to the * listheader, it is always returned as is. However, for operator based on datatype it may be * changed according to a value. For example - compare strings with EQUAL operator until it * contains some kind of wildcard - than use LIKE * * @param value actual filter value for which the operator should be created * @return operator - always not null, if not defined use EQUAL */ public DLFilterOperator getQuickFilterOperator(String value) { if (quickFilterOperator != null) { return quickFilterOperator; } if (columnType == null) { // Is this type defined? return DLFilterOperator.EQUAL; } else { if (FilterDatatypeConfig.DEFAULT_CONFIGURATION.containsKey( columnType)) { // Is the default configuration known for this type? if (value != null) return FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(columnType).getQuickOperator(value); else return FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(columnType).getQuickOperator(); } else { LOGGER.debug( "Unknown datatype was used in listbox quick filter. For type '{}' have been used EQUAL operator.", columnType.getCanonicalName()); return DLFilterOperator.EQUAL; } } }
public List<DLFilterOperator> getFilterOperators() { if (filterOperators == null) { // No LOGGER.debug( "Get operators for type: '{}'.", (getColumnType() == null ? "null" : getColumnType().getCanonicalName())); if (columnType == null && column == null) { // empty model filterOperators = Collections.emptyList(); } else if (columnType == null) { // Is this type defined? know name but known type filterOperators = Collections.singletonList(DLFilterOperator.EQUAL); } else if (FilterDatatypeConfig.DEFAULT_CONFIGURATION.containsKey( columnType)) { // Is the default configuration known for this type? filterOperators = FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(columnType).getOperators(); } else if (columnModel.getMaster().getFilterModel().isWysiwyg()) { return FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(String.class).getOperators(); } else { throw new UnsupportedOperationException( "Unknown datatype was used in listbox filter. For type " + columnType.getCanonicalName() + " have to be defined special filter component."); } LOGGER.debug("Operator list: '{}'.", filterOperators.size()); } return filterOperators; }
public boolean isFilterComponent() { return filterComponentFactory != null || (columnType != null && FilterDatatypeConfig.DEFAULT_CONFIGURATION.containsKey(columnType)); }