20 package net.sf.gridarta.model.filter;
22 import java.util.Collections;
23 import java.util.HashMap;
25 import org.apache.log4j.Category;
26 import org.apache.log4j.Logger;
27 import org.jetbrains.annotations.NotNull;
50 private final Map<String, FilterConfig<?, ?>>
map =
new HashMap<>();
62 fireEvent(filterConfigChangeType, filterConfig);
81 if (oldConfig != null) {
84 if (LOG.isDebugEnabled()) {
85 LOG.debug(
"removing config for " + filterName);
87 map.remove(filterName);
93 if (LOG.isDebugEnabled()) {
94 LOG.debug(
"adding config for " + filterName);
96 map.put(filterName, newConfig);
103 owner.addFilterListener(namedFilterListener);
129 if (this.inverted == inverted) {
144 if (filterConfig == null) {
145 throw new IllegalArgumentException();
165 if (LOG.isDebugEnabled()) {
166 LOG.debug(
"setSubFilterEnabled(" + name +
", " + enabled +
")");
184 return Collections.unmodifiableMap(map);
Interface for listeners interested in NamedFilter related events.
A Filter that aggregates named filters.
boolean enabled
Whether the filter is enabled.
final F filter
The Filter this filter config belongs to.
void fireEvent( @NotNull final FilterConfigChangeType filterConfigChangeType, @NotNull final FilterConfig<?, ?> filterConfig)
Notify all listeners that a FilterConfig has happened.
Abstract base class for filter configurations.
void setSubFilterEnabled(@NotNull final String name, final boolean enabled)
Sets whether a sub-filter is enabled.
void setEnabled(boolean enabled)
Enables or disables the filter.
boolean isSubFilterEnabled(@NotNull final String name)
Returns whether a sub-filter is enabled.
final Map< String, FilterConfig<?, ?> > map
void accept(@NotNull final FilterConfigVisitor visitor)
Types of FilterConfig change types.
Interface for visitors of filter configs.
boolean isEnabled()
Returns whether the filter is enabled.
static final Category LOG
The Logger for printing log messages.
NamedFilterConfig(@NotNull final NamedFilter owner)
Creates a new instance.
boolean inverted
Whether the filter should match if all sub-filters match (.
FilterConfig<?, ?> getConfig(@NotNull final String name)
Returns the FilterConfig for a sub-filter.
CHANGE
The filter config has changed.
final FilterConfigListener filterConfigListener
Map< String, FilterConfig<?, ?> > getEntries()
Returns a Map containing all configurations of sub-filters.
void addConfigChangeListener(FilterConfigListener listener)
Adds a FilterConfigListener to be notified about changes.
void setInverted(final boolean inverted)
Sets whether the filter should match if all sub-filters match or if at least one sub-filter does not ...
boolean isInverted()
Returns whether the filter should match if all sub-filters match or if at least one sub-filter does n...
NamedFilterConfig getThis()
void removeConfigChangeListener(FilterConfigListener listener)
Removes a FilterConfigListener to be notified about changes.
Enumeration of event types of NamedFilterEvent.
A FilterConfig that has a name.
Interface for listeners interested in FilterConfig related changes.