Class 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 class  AttributeFilter.AttributeFilterItem
      One attribute value which other variables should have.
    • 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.
    • Constructor Detail

      • AttributeFilter

        AttributeFilter()
        Creates a new filter which will filter variables, having not at least one attribute assignment of the specified list.
    • 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: AbstractConfigurationFilter
        Determines whether a given variable should be shown inside the editor or not. Parents of variables which shall be shown should not be filtered. The AbstractConfigurationFilter ensures 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:
        checkVariable in class AbstractConfigurationFilter
        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.