com.cc.framework.ui.model
Interface DesignRule

All Superinterfaces:
ClientHandler
All Known Implementing Classes:
DesignRuleImp

public interface DesignRule
extends ClientHandler

A design rule is used to modify the properties of a design model at runtime based on a rule

Version:
$Revision: 1.8 $
Author:
Harald Schulz

Method Summary
 void applyDesign(javax.servlet.jsp.PageContext ctx, org.apache.ecs.ConcreteElement element, java.lang.Object bean)
          This method searches for all matching rules and applies the design to the given HTML element
 DeferredEnvironment getEnvironment()
          Retrieves the EL Environment to evaluate EL Expressions in the context of the current bean
 java.lang.String getRule()
          Returns the rule
 java.lang.String getStyle()
          Returns the Style
 java.lang.String getStyleClass()
          Returns the StyleClass
 java.lang.String getStyleId()
          returns the StyleId
 boolean match()
          Matches the rule against the beans properties.
 void setEnvironment(DeferredEnvironment env)
          Sets the EL Environment to evaluate EL Expressions in the context of the current bean.
 DesignRule setRule(java.lang.String rule)
          Sets the rule.
 DesignRule setStyle(java.lang.String style)
          Sets the Style
 DesignRule setStyleClass(java.lang.String styleClass)
          Sets the StyleClass
 DesignRule setStyleId(java.lang.String styleId)
          Sets the StyleId
 
Methods inherited from interface com.cc.framework.ui.model.ClientHandler
getHandler, getHandlers, setHandler
 

Method Detail

setEnvironment

public void setEnvironment(DeferredEnvironment env)
Sets the EL Environment to evaluate EL Expressions in the context of the current bean. The deferred environment should be set just before any getter of the rule gets called. It should be set to null after the last getter has been called.
 try {
 	rule.setEnvironment(env);
 
 	String style = rule.getStyle();
 
 	// call other members
 
 } catch (Exception e) {
 	// handle exception
 } finally {
 	rule.setEnvironment(null);
 }
 

Parameters:
env - Environment

getEnvironment

public DeferredEnvironment getEnvironment()
Retrieves the EL Environment to evaluate EL Expressions in the context of the current bean

Returns:
Environment or null

match

public boolean match()
              throws java.lang.Exception
Matches the rule against the beans properties.

Returns:
returns true if the bean matches the rule
Throws:
java.lang.Exception - is thrown in case of an error

applyDesign

public void applyDesign(javax.servlet.jsp.PageContext ctx,
                        org.apache.ecs.ConcreteElement element,
                        java.lang.Object bean)
                 throws java.lang.Exception
This method searches for all matching rules and applies the design to the given HTML element

Parameters:
ctx - JSP Page context
element - the HTML element to modify
bean - the bean that holds the values to check
Throws:
java.lang.Exception - is thrown in case of an error

setRule

public DesignRule setRule(java.lang.String rule)
Sets the rule. The design rule will be selected based on this expression language (EL) expression.

Parameters:
rule - The rule to set
Returns:
the rule itself

getRule

public java.lang.String getRule()
Returns the rule

Returns:
rule

setStyle

public DesignRule setStyle(java.lang.String style)
Sets the Style

Parameters:
style - style constant
Returns:
the rule itself

getStyle

public java.lang.String getStyle()
Returns the Style

Returns:
String

setStyleId

public DesignRule setStyleId(java.lang.String styleId)
Sets the StyleId

Parameters:
styleId - HTML-Id of the element
Returns:
the rule itself

getStyleId

public java.lang.String getStyleId()
returns the StyleId

Returns:
string

setStyleClass

public DesignRule setStyleClass(java.lang.String styleClass)
Sets the StyleClass

Parameters:
styleClass - StyleClass
Returns:
the rule itself

getStyleClass

public java.lang.String getStyleClass()
Returns the StyleClass

Returns:
String


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.