Riena/UI filters

From Eclipsepedia

Jump to: navigation, search

Contents

UI Filters

Introduction

With the help of the UI filters some restrictions can be added to certain UI elements of a Riena application. E.g. add a validator to a text field or hide a sub module in the navigation. UI Filters exits of a collection of rules. Is a filter added its rules are applied for the corresponding UI elements. A UI element can be a menu item, a node of the navigation or a ridget. The UI Filters can be composed by adding any kid of rule. The UI filters themselves are added to any node of the navigation. The rules of a filter are only exploited for the node with this filter and all the child nodes. At every time filters can be added to and removed from the navigation model. The changes which are results are immediately visible at the GUI. So the UI filter can be used in a very flexible way and they are also very dynamically.

UI Filter

An UI filter itself only consists of a collection of rules and an identifier.

public interface IUIFilter {
 
	Collection<? extends IUIFilterRule> getFilterRules();
 
	String getFilterID();
 
}

UI filters can be added to any navigation node. They can also be removed. All nodes of the navigation (INavigationNode) are implemented the following interface:

public interface IUIFilterable {
 
	void addFilter(IUIFilter filter);
 
	void removeFilter(IUIFilter filter);
 
	void removeFilter(String filterID);
 
	void removeAllFilters();
 
	Collection<? extends IUIFilter> getFilters();
 
}

The implementation updates the GUI after adding or removing an UI filter.

Rules

How the UI elements will be manipulated is defined by the rules of the UI-Filters.
Therefore two scenarios exist.

A UI Filter is added.
The rule checks for every UI elements, if it is responsible for this element (matches).
Is this the case the rule is applied.

A UI Filter is removed.
Also the rule checks for every UI elements, if it is responsible for this element (matches).
Is this the case the changes which are caused by this rule are removed.

public interface IUIFilterRule {
 
	boolean matches(Object... args);
 
	void apply(Object object);
 
	void remove(Object object);
 
}

The rules can be divided in several categories.

  1. What are the changes of the rules? Is a Marker added (IUIFilterRuleMarker) or a validator (IUIFilterRuleValidator)?
  2. Is the rule responsible for a navigation node or a ridget?

Rules for navigation nodes