Author: abelevich
Date: 2010-05-03 05:58:02 -0400 (Mon, 03 May 2010)
New Revision: 16866
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/BehaviorStateHelper.java
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/UIHashParameter.java
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/behavior/ClientBehavior.java
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/behavior/ComponentControlBehavior.java
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/renderkit/ComponentControlBehaviorRenderer.java
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/BehaviorRule.java
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/BehaviorTagHandlerDelegate.java
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/CustomBehaviorHandler.java
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/taglib/ComponentControlHandler.java
Log:
apply checkstyle
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/BehaviorStateHelper.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/BehaviorStateHelper.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/BehaviorStateHelper.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -5,20 +5,19 @@
import org.richfaces.component.behavior.ClientBehavior;
-
/**
* @author Anton Belevich
- *
+ *
*/
public class BehaviorStateHelper extends PartialStateHolderHelper {
-
+
private ClientBehavior behavior;
-
+
public BehaviorStateHelper(ClientBehavior behavior) {
super(behavior);
this.behavior = behavior;
}
-
+
@Override
protected Object getValueExpressionValue(String name) {
Object retVal = null;
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/UIHashParameter.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/UIHashParameter.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/UIHashParameter.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -9,60 +9,59 @@
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIParameter;
-
/**
* @author Anton Belevich
*
*/
public class UIHashParameter extends UIComponentBase {
-
+
public static final String COMPONENT_TYPE = "org.richfaces.HashParameter";
-
+
public static final String COMPONENT_FAMILY =
"org.richfaces.HashParameter";
enum PropertyKeys {
name
}
-
-
+
public UIHashParameter() {
super();
setRendererType(null);
}
-
+
public String getName() {
- return (String)getStateHelper().eval(PropertyKeys.name);
+ return (String) getStateHelper().eval(PropertyKeys.name);
}
-
+
public void setName(String name) {
getStateHelper().put(PropertyKeys.name, name);
}
-
+
public Map<String, Object> getValue() {
List<UIComponent> children = getChildren();
- Map <String, Object> parameters = new HashMap<String, Object>();
+ Map<String, Object> parameters = new HashMap<String, Object>();
- for(UIComponent child: children) {
- if(child instanceof UIParameter) {
- UIParameter parameter = (UIParameter)child;
- parameters.put(parameter.getName(),(String)parameter.getValue());
+ for (UIComponent child : children) {
+ if (child instanceof UIParameter) {
+ UIParameter parameter = (UIParameter) child;
+ parameters.put(parameter.getName(), (String) parameter.getValue());
}
-
- if(child instanceof UIHashParameter) {
- UIHashParameter hashParameter = (UIHashParameter)child;
+
+ if (child instanceof UIHashParameter) {
+ UIHashParameter hashParameter = (UIHashParameter) child;
String name = hashParameter.getName();
- Map<String, Object> value = hashParameter.getValue();
- if(name == null) {
- throw new FacesException("attribute 'name' for the
nested " + UIHashParameter.class.getName() + " component (id = '"
+hashParameter.getClientId()+"') should not be 'null'");
- }else {
+ Map<String, Object> value = hashParameter.getValue();
+ if (name == null) {
+ throw new FacesException("attribute 'name' for the
nested " + UIHashParameter.class.getName()
+ + " component (id = '" +
hashParameter.getClientId() + "') should not be 'null'");
+ } else {
parameters.put(name, value);
}
}
}
-
+
return parameters;
}
-
+
@Override
public String getFamily() {
return (COMPONENT_FAMILY);
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/behavior/ClientBehavior.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/behavior/ClientBehavior.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/behavior/ClientBehavior.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -14,27 +14,25 @@
import javax.faces.context.FacesContext;
import org.richfaces.BehaviorStateHelper;
-
/**
* @author Anton Belevich
- *
- * base class for the client behaviors
+ *
+ * base class for the client behaviors
*/
public abstract class ClientBehavior extends ClientBehaviorBase {
-
+
private StateHelper behaviorStateHelper = null;
-
+
private Map<String, ValueExpression> bindings;
-
-
+
public StateHelper getStateHelper() {
- if(behaviorStateHelper == null) {
+ if (behaviorStateHelper == null) {
behaviorStateHelper = new BehaviorStateHelper(this);
}
return behaviorStateHelper;
}
-
+
public ValueExpression getValueExpression(String name) {
if (name == null) {
throw new NullPointerException();
@@ -42,7 +40,7 @@
return ((bindings == null) ? null : bindings.get(name));
}
-
+
public void setValueExpression(String name, ValueExpression valueExpression) {
if (name == null) {
throw new NullPointerException();
@@ -54,11 +52,11 @@
setLiteralValue(name, valueExpression);
} else {
if (bindings == null) {
- bindings = new HashMap<String, ValueExpression>(6,1.0f);
+ bindings = new HashMap<String, ValueExpression>(6, 1.0f);
}
bindings.put(name, valueExpression);
}
-
+
} else {
if (bindings != null) {
bindings.remove(name);
@@ -69,62 +67,62 @@
}
clearInitialState();
}
-
+
protected FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
public void setLiteralValue(String name, ValueExpression expression) {
- assert(expression.isLiteralText());
+ assert (expression.isLiteralText());
ELContext context = getFacesContext().getELContext();
-
+
try {
setLiteralAttribute(name, expression.getValue(context));
} catch (ELException elem) {
throw new FacesException(elem);
}
}
-
+
public abstract void setLiteralAttribute(String name, Object value);
-
+
@Override
public Object saveState(FacesContext context) {
- Object [] state = null;
-
+ Object[] state = null;
+
Object parentState = super.saveState(context);
- if(initialStateMarked()) {
- if(parentState != null) {
- state = new Object[] {parentState};
+ if (initialStateMarked()) {
+ if (parentState != null) {
+ state = new Object[] { parentState };
}
} else {
state = new Object[3];
state[0] = parentState;
-
+
Object attrs = null;
- if(behaviorStateHelper != null) {
+ if (behaviorStateHelper != null) {
attrs = behaviorStateHelper.saveState(context);
}
state[1] = attrs;
state[2] = saveBindings(context, bindings);
-
+
}
- return state;
+ return state;
}
-
+
@Override
public void restoreState(FacesContext context, Object state) {
- if(state != null) {
- Object [] stateObject = (Object[])state;
+ if (state != null) {
+ Object[] stateObject = (Object[]) state;
super.restoreState(context, stateObject[0]);
- if(stateObject.length > 1) {
- if(behaviorStateHelper != null) {
+ if (stateObject.length > 1) {
+ if (behaviorStateHelper != null) {
behaviorStateHelper.restoreState(context, stateObject[1]);
}
- }
+ }
restoreBindings(context, stateObject[2]);
}
}
-
+
// Utility for saving bindings state
private static Object saveBindings(FacesContext context, Map<String,
ValueExpression> bindings) {
@@ -132,7 +130,7 @@
return (null);
}
- Object values[] = new Object[2];
+ Object[] values = new Object[2];
values[0] = bindings.keySet().toArray(new String[bindings.size()]);
Object[] bindingValues = bindings.values().toArray();
@@ -144,30 +142,30 @@
return (values);
}
-
+
// Utility for restoring bindings from state
private static Map<String, ValueExpression> restoreBindings(FacesContext
context, Object state) {
if (state == null) {
return (null);
}
-
- Object values[] = (Object[]) state;
- String names[] = (String[]) values[0];
- Object states[] = (Object[]) values[1];
+
+ Object[] values = (Object[]) state;
+ String[] names = (String[]) values[0];
+ Object[] states = (Object[]) values[1];
Map<String, ValueExpression> bindings = new HashMap<String,
ValueExpression>(names.length);
for (int i = 0; i < names.length; i++) {
bindings.put(names[i], (ValueExpression)
UIComponentBase.restoreAttachedState(context, states[i]));
}
return (bindings);
}
-
+
protected boolean compare(Serializable key, String name) {
boolean retValue = false;
- if(key != null) {
+ if (key != null) {
String keyName = key.toString();
retValue = keyName.equals(name);
- }
+ }
return retValue;
}
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/behavior/ComponentControlBehavior.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/behavior/ComponentControlBehavior.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/component/behavior/ComponentControlBehavior.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -8,72 +8,71 @@
/**
* @author Anton Belevich
- *
+ *
*/
-(a)FacesBehavior(value="org.richfaces.behavior.ComponentControlBehavior")
+@FacesBehavior(value = "org.richfaces.behavior.ComponentControlBehavior")
public class ComponentControlBehavior extends ClientBehavior {
-
+
public static final String BEHAVIOR_ID =
"org.richfaces.behavior.ComponentControlBehavior";
-
+
private List<UIComponent> children;
-
+
enum PropertyKeys {
event, target, selector, parameters, operation
}
-
-
+
public List<UIComponent> getChildren() {
- if(children == null) {
+ if (children == null) {
children = new ArrayList<UIComponent>();
}
return children;
}
-
+
public String getEvent() {
- return (String)getStateHelper().eval(PropertyKeys.event);
+ return (String) getStateHelper().eval(PropertyKeys.event);
}
-
+
public void setEvent(String eventName) {
getStateHelper().eval(PropertyKeys.event, eventName);
}
-
+
public String getTarget() {
- return (String)getStateHelper().eval(PropertyKeys.target);
+ return (String) getStateHelper().eval(PropertyKeys.target);
}
-
+
public void setTarget(String target) {
getStateHelper().put(PropertyKeys.target, target);
}
-
+
public String getSelector() {
- return (String)getStateHelper().eval(PropertyKeys.selector);
+ return (String) getStateHelper().eval(PropertyKeys.selector);
}
-
+
public void setSelector(String selector) {
getStateHelper().put(PropertyKeys.selector, selector);
}
-
+
public String getOperation() {
- return (String)getStateHelper().eval(PropertyKeys.operation);
+ return (String) getStateHelper().eval(PropertyKeys.operation);
}
-
+
public void setOperation(String operation) {
getStateHelper().put(PropertyKeys.operation, operation);
}
-
+
@Override
public String getRendererType() {
return BEHAVIOR_ID;
}
-
+
@Override
public void setLiteralAttribute(String name, Object value) {
- if(compare(PropertyKeys.operation, name)) {
- setOperation((String)value);
- } else if(compare(PropertyKeys.target, name)) {
- setTarget((String)value);
- } else if(compare(PropertyKeys.selector, name)) {
- setSelector((String)name);
+ if (compare(PropertyKeys.operation, name)) {
+ setOperation((String) value);
+ } else if (compare(PropertyKeys.target, name)) {
+ setTarget((String) value);
+ } else if (compare(PropertyKeys.selector, name)) {
+ setSelector((String) name);
}
}
}
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/renderkit/ComponentControlBehaviorRenderer.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/renderkit/ComponentControlBehaviorRenderer.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/renderkit/ComponentControlBehaviorRenderer.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -22,93 +22,89 @@
import org.richfaces.component.UIHashParameter;
import org.richfaces.component.behavior.ComponentControlBehavior;
-
/**
* @author Anton Belevich
- *
+ *
*/
-(a)FacesBehaviorRenderer(rendererType="org.richfaces.behavior.ComponentControlBehavior",
renderKitId=RenderKitFactory.HTML_BASIC_RENDER_KIT)
-@ResourceDependencies( {@ResourceDependency(library = "javax.faces", name =
"jsf.js"),
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name= "richfaces-event.js"),
- @ResourceDependency(name = "richfaces-queue.js"),
+@FacesBehaviorRenderer(rendererType =
"org.richfaces.behavior.ComponentControlBehavior", renderKitId =
RenderKitFactory.HTML_BASIC_RENDER_KIT)
+@ResourceDependencies( { @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
+ @ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"), @ResourceDependency(name
= "richfaces-queue.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(name = "script/component-control.js")
-})
+ @ResourceDependency(name = "script/component-control.js") })
public class ComponentControlBehaviorRenderer extends ClientBehaviorRenderer {
-
+
private static final String FUNC_NAME =
"RichFaces.ui.ComponentControl.execute";
-
+
private static final String REF_EVENT = "event";
private static final String REF_COMPONENT = "component";
-
+
private static final String PARAM_CALLBACK = "callback";
private static final String PARAM_TARGET = "target";
-
+
private static final String PARAM_SELECTOR = "selector";
-
+
@Override
public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior
behavior) {
- ComponentControlBehavior controlBehavior = (ComponentControlBehavior)behavior;
-
+ ComponentControlBehavior controlBehavior = (ComponentControlBehavior) behavior;
+
JSFunctionDefinition callback = new JSFunctionDefinition();
callback.addParameter(new JSReference(REF_EVENT));
callback.addParameter(new JSReference(REF_COMPONENT));
String apiFunctionName = controlBehavior.getOperation();
-
- //create callback function
+
+ // create callback function
StringBuffer script = new StringBuffer();
script.append(REF_COMPONENT).append("['").append(apiFunctionName).append("'].").append("apply").append("(");
-
- //get client api function parameters
+
+ // get client api function parameters
List<Object> apiFunctionParams = createSignature(controlBehavior);
script.append(REF_COMPONENT).append(",").append(ScriptUtils.toScript(apiFunctionParams.toArray())).append(");");
callback.addToBody(script);
-
+
String target = controlBehavior.getTarget();
- String selector = controlBehavior.getSelector();
-
+ String selector = controlBehavior.getSelector();
+
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(PARAM_CALLBACK, callback);
parameters.put(PARAM_TARGET, target);
parameters.put(PARAM_SELECTOR, selector);
-
- //execution function
+
+ // execution function
JSFunction eventFunction = new JSFunction(FUNC_NAME);
eventFunction.addParameter(new JSReference(REF_EVENT));
eventFunction.addParameter(parameters);
-
+
StringBuffer execution = new StringBuffer();
execution.append(eventFunction.toScript());
execution.append("; return false;");
return execution.toString();
}
-
+
protected List<Object> createSignature(ComponentControlBehavior behavior) {
List<Object> elements = new ArrayList<Object>();
List<UIComponent> children = behavior.getChildren();
- for(UIComponent child: children) {
- if(child instanceof UIParameter) {
- UIParameter parameter = (UIParameter)child;
+ for (UIComponent child : children) {
+ if (child instanceof UIParameter) {
+ UIParameter parameter = (UIParameter) child;
Object value = parameter.getValue();
- if(value != null) {
+ if (value != null) {
elements.add(value);
- }
+ }
}
-
- if(child instanceof UIHashParameter) {
- UIHashParameter parameter = (UIHashParameter)child;
+
+ if (child instanceof UIHashParameter) {
+ UIHashParameter parameter = (UIHashParameter) child;
String name = parameter.getName();
Map<String, Object> value = parameter.getValue();
-
- if(value != null) {
- if(name != null) {
+
+ if (value != null) {
+ if (name != null) {
Map<String, Object> map = new HashMap<String,
Object>();
map.put(name, value);
elements.add(map);
@@ -121,4 +117,3 @@
return elements;
}
}
-
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/BehaviorRule.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/BehaviorRule.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/BehaviorRule.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -12,17 +12,17 @@
/**
* @author Anton Belevich
- *
+ *
*/
public class BehaviorRule extends MetaRule {
-
+
private static Logger log = RichfacesLogger.CONNECTION.getLogger();
-
- final static class LiteralAttributeMetadata extends Metadata {
+ static final class LiteralAttributeMetadata extends Metadata {
+
private final String name;
private final String value;
-
+
public LiteralAttributeMetadata(String name, String value) {
this.value = value;
this.name = name;
@@ -32,17 +32,16 @@
((ClientBehavior) instance).setLiteralAttribute(this.name, this.value);
}
}
-
- final static class ValueExpressionMetadata extends Metadata {
+ static final class ValueExpressionMetadata extends Metadata {
+
private final String name;
private final TagAttribute attr;
private final Class type;
- public ValueExpressionMetadata(String name, Class type,
- TagAttribute attr) {
+ public ValueExpressionMetadata(String name, Class type, TagAttribute attr) {
this.name = name;
this.attr = attr;
this.type = type;
@@ -53,26 +52,28 @@
}
}
-
+
@Override
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta)
{
- if(meta.isTargetInstanceOf(ClientBehavior.class)) {
- if(!attribute.isLiteral()) {
+ if (meta.isTargetInstanceOf(ClientBehavior.class)) {
+ if (!attribute.isLiteral()) {
Class type = meta.getPropertyType(name);
if (type == null) {
type = Object.class;
}
return new ValueExpressionMetadata(name, type, attribute);
- } else if(meta.getWriteMethod(name) == null) {
-
- if(log.isDebugEnabled()) {
- log.debug(attribute + " Property '" + name +
"' is not on type: " + meta.getTargetClass().getName());
+ } else if (meta.getWriteMethod(name) == null) {
+
+ if (log.isDebugEnabled()) {
+ log
+ .debug(attribute + " Property '" + name +
"' is not on type: "
+ + meta.getTargetClass().getName());
}
return new LiteralAttributeMetadata(name, attribute.getValue());
}
}
-
+
return null;
}
}
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/BehaviorTagHandlerDelegate.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/BehaviorTagHandlerDelegate.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/BehaviorTagHandlerDelegate.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -11,45 +11,45 @@
/**
* @author Anton Belevich
- *
+ *
*/
-public class BehaviorTagHandlerDelegate extends TagHandlerDelegate implements
AttachedObjectHandler {
-
+public class BehaviorTagHandlerDelegate extends TagHandlerDelegate implements
AttachedObjectHandler {
+
TagHandlerDelegate wrappedHandlerDelegate;
-
+
CustomBehaviorHandler owner;
-
+
public BehaviorTagHandlerDelegate(CustomBehaviorHandler owner, TagHandlerDelegate
wrappedHandlerDelegate) {
this.owner = owner;
this.wrappedHandlerDelegate = wrappedHandlerDelegate;
}
-
+
@Override
public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
- if(owner.isWrapping()) {
- //TODO: anton create behavior and place it in BehaviorStack
+ if (owner.isWrapping()) {
+ // TODO: anton create behavior and place it in BehaviorStack
owner.applyNextHandler(ctx, comp);
} else {
wrappedHandlerDelegate.apply(ctx, comp);
- }
+ }
}
-
+
@Override
public MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset metaRuleset = wrappedHandlerDelegate.createMetaRuleset(type);
+ MetaRuleset metaRuleset = wrappedHandlerDelegate.createMetaRuleset(type);
metaRuleset.addRule(new BehaviorRule());
return metaRuleset;
}
public void applyAttachedObject(FacesContext context, UIComponent parent) {
- if(wrappedHandlerDelegate instanceof AttachedObjectHandler) {
- ((AttachedObjectHandler)wrappedHandlerDelegate).applyAttachedObject(context,
parent);
+ if (wrappedHandlerDelegate instanceof AttachedObjectHandler) {
+ ((AttachedObjectHandler) wrappedHandlerDelegate).applyAttachedObject(context,
parent);
}
}
public String getFor() {
- if(wrappedHandlerDelegate instanceof AttachedObjectHandler) {
- return ((AttachedObjectHandler)wrappedHandlerDelegate).getFor();
+ if (wrappedHandlerDelegate instanceof AttachedObjectHandler) {
+ return ((AttachedObjectHandler) wrappedHandlerDelegate).getFor();
}
return null;
}
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/CustomBehaviorHandler.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/CustomBehaviorHandler.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/tag/CustomBehaviorHandler.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -4,25 +4,24 @@
import javax.faces.view.facelets.BehaviorHandler;
import javax.faces.view.facelets.TagHandlerDelegate;
-
/**
* @author Anton Belevich
- *
+ *
*/
public abstract class CustomBehaviorHandler extends BehaviorHandler {
TagHandlerDelegate helper;
-
+
public CustomBehaviorHandler(BehaviorConfig config) {
super(config);
}
-
+
public abstract boolean isWrapping();
-
+
@Override
protected TagHandlerDelegate getTagHandlerDelegate() {
- if(helper == null) {
- helper = new BehaviorTagHandlerDelegate(this,
delegateFactory.createBehaviorHandlerDelegate(this));
+ if (helper == null) {
+ helper = new BehaviorTagHandlerDelegate(this,
delegateFactory.createBehaviorHandlerDelegate(this));
}
return helper;
}
Modified:
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/taglib/ComponentControlHandler.java
===================================================================
---
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/taglib/ComponentControlHandler.java 2010-05-02
23:44:02 UTC (rev 16865)
+++
root/ui-sandbox/trunk/components/componentcontrol/src/main/java/org/richfaces/taglib/ComponentControlHandler.java 2010-05-03
09:58:02 UTC (rev 16866)
@@ -22,72 +22,72 @@
/**
* @author Anton Belevich
- *
+ *
*/
public class ComponentControlHandler extends CustomBehaviorHandler {
-
+
public ComponentControlHandler(BehaviorConfig config) {
super(config);
}
-
+
@Override
public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
super.apply(ctx, parent);
processNestedTags(ctx, parent);
}
-
-
+
private void processNestedTags(FaceletContext ctx, UIComponent parent) throws
IOException {
- if(nextHandler instanceof CompositeFaceletHandler) {
- FaceletHandler [] children =
((CompositeFaceletHandler)nextHandler).getHandlers();
- for (FaceletHandler handler: children) {
+ if (nextHandler instanceof CompositeFaceletHandler) {
+ FaceletHandler[] children = ((CompositeFaceletHandler)
nextHandler).getHandlers();
+ for (FaceletHandler handler : children) {
processNextHandler(ctx, handler, parent);
}
} else {
processNextHandler(ctx, nextHandler, parent);
}
}
-
+
private void processNextHandler(FaceletContext ctx, FaceletHandler handler,
UIComponent parent) throws IOException {
- if(handler instanceof ComponentHandler) {
+ if (handler instanceof ComponentHandler) {
ComponentHandler componentHandler = (ComponentHandler) handler;
-
- ComponentConfig componentConfig = componentHandler.getComponentConfig();
- String componentType = componentConfig.getComponentType();
-
- if(isUIParameter(componentType)) {
+
+ ComponentConfig componentConfig = componentHandler.getComponentConfig();
+ String componentType = componentConfig.getComponentType();
+
+ if (isUIParameter(componentType)) {
FacesContext facesContext = ctx.getFacesContext();
-
- UIComponent component =
(UIComponent)facesContext.getApplication().createComponent(facesContext, componentType,
null);
+
+ UIComponent component = (UIComponent)
facesContext.getApplication().createComponent(facesContext,
+ componentType, null);
componentHandler.setAttributes(ctx, component);
-
- if(parent instanceof ClientBehaviorHolder) {
- ClientBehaviorHolder clientBehaviorHolder =
((ClientBehaviorHolder)parent);
- Map<String, List<ClientBehavior>> clientBehaviors =
clientBehaviorHolder.getClientBehaviors();
-
- String eventName = getEventName();
-
- if(eventName == null) {
- eventName = clientBehaviorHolder.getDefaultEventName();
- }
-
- if(eventName != null) {
- List<ClientBehavior> eventClientBehaviors =
clientBehaviors.get(eventName);
- for(ClientBehavior clientBehavior: eventClientBehaviors) {
- if(clientBehavior instanceof ComponentControlBehavior) {
-
((ComponentControlBehavior)clientBehavior).getChildren().add(component);
- }
- }
- }
+
+ if (parent instanceof ClientBehaviorHolder) {
+ ClientBehaviorHolder clientBehaviorHolder = ((ClientBehaviorHolder)
parent);
+ Map<String, List<ClientBehavior>> clientBehaviors =
clientBehaviorHolder.getClientBehaviors();
+
+ String eventName = getEventName();
+
+ if (eventName == null) {
+ eventName = clientBehaviorHolder.getDefaultEventName();
+ }
+
+ if (eventName != null) {
+ List<ClientBehavior> eventClientBehaviors =
clientBehaviors.get(eventName);
+ for (ClientBehavior clientBehavior : eventClientBehaviors) {
+ if (clientBehavior instanceof ComponentControlBehavior) {
+ ((ComponentControlBehavior)
clientBehavior).getChildren().add(component);
+ }
+ }
+ }
}
-
+
componentHandler.applyNextHandler(ctx, component);
}
- }
+ }
}
-
+
private boolean isUIParameter(String type) {
- return (UIParameter.COMPONENT_TYPE.equals(type) ||
UIHashParameter.COMPONENT_TYPE.equals(type));
+ return (UIParameter.COMPONENT_TYPE.equals(type) ||
UIHashParameter.COMPONENT_TYPE.equals(type));
}
@Override
@@ -95,4 +95,3 @@
return false;
}
}
-