Class AttributeFilter
- java.lang.Object
-
- org.eclipse.jface.viewers.ViewerFilter
-
- net.ssehub.easy.producer.ui.productline_editor.configuration.AbstractConfigurationFilter
-
- net.ssehub.easy.producer.ui.productline_editor.configuration.AttributeFilter
-
class AttributeFilter extends AbstractConfigurationFilter
Filter for filtering elements having certain attribute assignments.- Author:
- El-Sharkawy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAttributeFilter.AttributeFilterItemOne attribute value which other variables should have.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,AttributeFilter.AttributeFilterItem>attributes
-
Constructor Summary
Constructors Constructor Description AttributeFilter()Creates a new filter which will filter variables, having not at least one attribute assignment of the specified list.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Attribute attribute, Value value)Adds an attribute to this filter.private static java.lang.StringattributeToKey(Attribute attr)Creates a key based on a given attribute.protected booleancheckVariable(GUIVariable variable)Determines whether a given variable should be shown inside the editor or not.-
Methods inherited from class net.ssehub.easy.producer.ui.productline_editor.configuration.AbstractConfigurationFilter
checkVariableRecursivley, select
-
-
-
-
Field Detail
-
attributes
private java.util.Map<java.lang.String,AttributeFilter.AttributeFilterItem> attributes
-
-
Method Detail
-
attributeToKey
private static java.lang.String attributeToKey(Attribute attr)
Creates a key based on a given attribute. If the same attribute is applied on different elements than the same key should be returned.- Parameters:
attr- The attribute for which a key (String) shall be created (must not be null.- Returns:
- A key to identify the attribute.
-
add
public void add(Attribute attribute, Value value)
Adds an attribute to this filter. Filtered items must have the same attribute and the same value set.- Parameters:
attribute- The Attribute which other variables should have.value- The value of the attribute which the variables should have. Can be null, than the variable's attribute value must also be null.
-
checkVariable
protected boolean checkVariable(GUIVariable variable)
Description copied from class:AbstractConfigurationFilterDetermines whether a given variable should be shown inside the editor or not. Parents of variables which shall be shown should not be filtered. TheAbstractConfigurationFilterensures that.
This method must also ensure that nested elements of a shown variable are also displayed. Therefore, this method should also be written in a recursive manner to check nested elements of displayed variables. This should be done in the following way:
if(checkVariable(variable)) {
for(GUIVariable nestedVariable : variable.getNestedVars()) {
checkVariable(nestedVariable);
}
}- Specified by:
checkVariablein classAbstractConfigurationFilter- Parameters:
variable- The variable which should be tested whether it should be displayed inside the editor- Returns:
- true if the variable should be displayed, false otherwise.
-
-