You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shale.apache.org by gv...@apache.org on 2006/07/09 02:24:26 UTC
svn commit: r420232 [1/3] - in
/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay: component/
component/chain/ config/ config/beans/ convert/ faces/ parser/
parser/builder/ parser/builder/chain/ taglib/ utils/
Author: gvanmatre
Date: Sat Jul 8 17:24:24 2006
New Revision: 420232
URL: http://svn.apache.org/viewvc?rev=420232&view=rev
Log:
Another batch of Checkstyle fixes.
Modified:
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/Clay.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/ClayContext.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateValueChangeListenerCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/ClayConfigureListener.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/AbstractBean.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/Attributes.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigBeanFactory.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConverterBean.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/PageNotFoundException.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/SymbolBean.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ValueChangeListenerBean.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/convert/TimeZoneConverter.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/AttributeTokenizer.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/Node.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/NodeTokenizer.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/Parser.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/Token.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/Builder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/CommandButtonBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/CommentBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/ElementBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/FormBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/IgnoreBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/JsfDefaultBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/OutputLabelBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/OutputLinkBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/SelectItemBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/VoidBuilder.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/chain/BuilderRuleContext.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/chain/DirectiveBuilderRule.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/chain/FormBuilderRule.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/chain/LabelBuilderRule.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/chain/OptionBuilderRule.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/chain/SelectBuilderRule.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/chain/TextareaBuilderRule.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/taglib/ClayTagValidator.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/ClayAmalgam.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/FalseLookupCommand.java
shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/PluggableLookupCommand.java
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/Clay.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/Clay.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/Clay.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/Clay.java Sat Jul 8 17:24:24 2006
@@ -77,6 +77,8 @@
/**
* <p>Returns the symbol table for the component.</p>
+ *
+ * @return Map of {@link org.apache.shale.clay.config.beans.SymbolBean}
*/
public Map getSymbols() {
return symbols;
@@ -93,6 +95,7 @@
*
* @return {@link Catalog} instance of a catalog defined by catalog
* <code>Globals.CLAY_CATALOG_NAME</code>
+ * @exception Exception loading catalog
*/
protected Catalog getCatalog() throws Exception {
@@ -149,6 +152,8 @@
* <p>
* Returns the unique identifier used to build the component subtree.
* </p>
+ *
+ * @return jsfid
*/
public String getJsfid() {
return jsfid;
@@ -158,6 +163,8 @@
* <p>
* Sets the unique identifier used to build the component subtree.
* </p>
+ *
+ * @param jsfid root identifier of the sub tree
*/
public void setJsfid(String jsfid) {
this.jsfid = jsfid;
@@ -169,6 +176,8 @@
* Sets the unique identifier used to build the component subtree.
* This property is not accessible from the JSP tag.
* </p>
+ *
+ * @param jsfid alias to the jsfid property
*/
public void setClayJsfid(String jsfid) {
this.jsfid = jsfid;
@@ -179,6 +188,8 @@
* Returns the unique identifier used to build the component subtree.
* This property is not accessible from the JSP tag.
* </p>
+ *
+ * @return jsfid alias
*/
public String getClayJsfid() {
return jsfid;
@@ -190,6 +201,8 @@
* Retuns the <code>validator</code> signature event that is invoked when
* the component metadata is retrieved.
* </p>
+ *
+ * @return method binding expression
*/
public String getShapeValidator() {
return shapeValidator;
@@ -200,6 +213,8 @@
* Sets the <code>validator</code> signature event that is invoked when
* the component metadata is retrieved.
* </p>
+ *
+ * @param loadShapeAction method binding expression
*/
public void setShapeValidator(String loadShapeAction) {
this.shapeValidator = loadShapeAction;
@@ -210,6 +225,8 @@
* Returns the logical bean name that replaces any occurance of
* "@managed-bean-name" within a binding expression.
* </p>
+ *
+ * @return managed bean name symbol
*/
public String getManagedBeanName() {
SymbolBean symbol = (SymbolBean) symbols.get(Globals.MANAGED_BEAN_MNEMONIC);
@@ -221,6 +238,8 @@
* Sets the logical bean name that replaces any occurrences of
* "@managed-bean-name" within a binding expression.
* </p>
+ *
+ * @param mbeanMnemonic managed bean symbol
*/
public void setManagedBeanName(String mbeanMnemonic) {
SymbolBean symbol = new SymbolBean();
@@ -234,21 +253,25 @@
* Returns the root metadata component that is used to add to the component
* tree. It locates the {@link ComponentBean} using the <code>jsfid</code>
* attribute as the key. A call to the {@link ConfigBeanFactory} locates the
- * correct {@link ConfigBean} used to find the {@link ComponentBean}. </b>
+ * correct {@link ConfigBean} used to find the {@link ComponentBean}. </p>
+ *
+ * @return root config bean used to define the subtree
*/
protected ComponentBean getRootElement() {
ConfigBean config = ConfigBeanFactory.findConfig(getJsfid());
- if (config == null)
+ if (config == null) {
throw new NullPointerException(messages
.getMessage("clay.config.notloaded"));
+ }
// find the top-level display element associated with the subtree
ComponentBean b = config.getElement(getJsfid());
- if (b == null)
+ if (b == null) {
throw new NullPointerException(messages.getMessage(
"clay.jsfid.notfound", new Object[] { getJsfid() }));
+ }
return b;
}
@@ -257,14 +280,17 @@
* <p>
* This is where the clay component loads the root {@link ComponentBean} by
* calling the
- * <code>getRootElement()<code> method or while invoking the <code>shapeValidator</code> callback event.
+ * <code>getRootElement()</code> method or while invoking the <code>shapeValidator</code> callback event.
* The subtree is created using the <code>Globals.ADD_COMPONENT_COMMAND_NAME</code> from the
* <code>Globals.CLAY_CATALOG_NAME</code> in the <code>Globals.CLAY_RESOURCE_NAME</code>.
+ *
+ * @param context faces context
*/
public void encodeBegin(FacesContext context) throws IOException {
- if (log.isTraceEnabled())
+ if (log.isTraceEnabled()) {
log.trace("encodeBegin(FacesContext)");
+ }
//I added a more descriptive message to the null pointer exception.
//The challenge here is that the symbol replacement happens after the
@@ -273,9 +299,8 @@
if (getJsfid() == null) {
String attrClayJsfid = "null";
ComponentBean displayElement = (ComponentBean) getAttributes().get(Globals.CLAY_RESERVED_ATTRIBUTE);
- AttributeBean attr = null;
- if (displayElement != null &&
- (attr = displayElement.getAttribute("clayJsfid")) != null) {
+ AttributeBean attr = displayElement.getAttribute("clayJsfid");
+ if (displayElement != null && (attr != null)) {
attrClayJsfid = attr.getValue();
}
throw new NullPointerException(messages.getMessage("clay.jsfid.null",
@@ -354,7 +379,7 @@
log.error(e);
}
Command command = catalog
- .getCommand(Globals.ADD_COMPONENT_COMMAND_NAME);
+ .getCommand(Globals.ADD_COMPONENT_COMMAND_NAME);
try {
command.execute(clayContext);
@@ -369,6 +394,9 @@
* <p>
* Recursively invokes the rendering of the sub component tree.
* </p>
+ *
+ * @param child faces component
+ * @param context faces context
*/
protected void recursiveRenderChildren(UIComponent child,
FacesContext context) throws IOException {
@@ -380,10 +408,11 @@
if (c.isRendered()) {
c.encodeBegin(context);
- if (!c.getRendersChildren())
+ if (!c.getRendersChildren()) {
recursiveRenderChildren(c, context);
- else
+ } else {
c.encodeChildren(context);
+ }
c.encodeEnd(context);
c = null;
@@ -399,11 +428,15 @@
* <p>
* Called by JSF, this method delegates to <code>recursiveRenderChildren</code>.
* </p>
+ *
+ * @param context faces context
+ * @exception IOException render error
*/
public void encodeChildren(FacesContext context) throws IOException {
- if (log.isTraceEnabled())
+ if (log.isTraceEnabled()) {
log.trace("encodeChildren(FacesContext)");
+ }
recursiveRenderChildren(this, context);
@@ -412,13 +445,17 @@
/**
* <p>
* Called by JSF, this method simply emits a logging statement
- * if tracing is enabled.
+ * if tracing is enabled.
* </p>
+ *
+ * @param context faces context
+ * @exception IOException render error
*/
public void encodeEnd(FacesContext context) throws IOException {
- if (log.isTraceEnabled())
+ if (log.isTraceEnabled()) {
log.trace("encodeEnd(FacesContext)");
+ }
}
@@ -427,6 +464,8 @@
* Returns the root {@link ComponentBean} used to build the clay subtree
* component.
* </p>
+ *
+ * @return root config bean
*/
protected ComponentBean getDisplayElementRoot() {
return displayElementRoot;
@@ -437,6 +476,8 @@
* Sets the root {@link ComponentBean} used to build the clay subtree
* component.
* </p>
+ *
+ * @param displayElementRoot root config bean
*/
protected void setDisplayElementRoot(ComponentBean displayElementRoot) {
this.displayElementRoot = displayElementRoot;
@@ -449,6 +490,9 @@
*
* @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext,
* java.lang.Object)
+ *
+ * @param context faces context
+ * @param object component state
*/
public void restoreState(FacesContext context, Object obj) {
@@ -468,6 +512,7 @@
* </p>
*
* @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
+ * @param context faces context
*/
public Object saveState(FacesContext context) {
Object[] aobj = new Object[5];
@@ -483,7 +528,9 @@
/**
* <p>Returns <code>true</code> indicating that this
* component renders it's children. That means JSF will
- * invoke <code>encodeChildren()</code> method.
+ * invoke <code>encodeChildren()</code> method.</p>
+ *
+ * @return <code>true</code>
*/
public boolean getRendersChildren() {
return true;
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java Sat Jul 8 17:24:24 2006
@@ -32,7 +32,8 @@
/**
* <p>
* Determines if the {@link ComponentBean} has a {@link org.apache.shale.clay.config.beans.ConverterBean} assigned.
- * A <code>Converter</code> is created by invoking the {@link org.apache.shale.clay.component.chain.CreateConverterCommand}.
+ * A <code>Converter</code> is created by invoking the
+ * {@link org.apache.shale.clay.component.chain.CreateConverterCommand}.
* </p>
*/
public class AssignConverterCommand extends AbstractCommand {
@@ -49,28 +50,36 @@
/**
* <p>
- * Checks to see if the {@link org.apache.shale.clay.config.beans.ComponentBean} has a {@link org.apache.shale.clay.config.beans.ConverterBean}
+ * Checks to see if the {@link org.apache.shale.clay.config.beans.ComponentBean}
+ * has a {@link org.apache.shale.clay.config.beans.ConverterBean}
* assigned. The <code>Globals.ADD_CONVERTER_COMMAND_NAME</code> is
* invoked to create a <code>Converter</code>.
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
+ }
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.childComponent"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
+ }
if (displayElement.getConverter() != null) {
if (child instanceof ValueHolder) {
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java Sat Jul 8 17:24:24 2006
@@ -61,32 +61,39 @@
* </dl>
* </p>
*
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
+ }
Iterator ai = displayElement.getAttributeIterator();
Catalog catalog = getCatalog();
Command defaultCommand = catalog.getCommand(Globals.SET_ATTRIBUTE_COMMAND_NAME);
next: while (ai.hasNext()) {
AttributeBean a = (AttributeBean) ai.next();
- if (a.getValue() == null)
+ if (a.getValue() == null) {
continue next;
+ }
- Command command = null;
- if ((command = catalog.getCommand(a.getName())) == null)
+ Command command = catalog.getCommand(a.getName());
+ if (command == null) {
command = defaultCommand;
+ }
clayContext.setAttribute(a);
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java Sat Jul 8 17:24:24 2006
@@ -55,25 +55,32 @@
* Executes the {@link org.apache.shale.clay.component.chain.CreateValidatorCommand} using the
* <code>Globals.ADD_VALIDATOR_COMMAND_NAME</code> command to create a
* <code>Validator</code>.
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
+ }
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.childComponent"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
+ }
if (displayElement.getValidators().size() > 0) {
if (child instanceof EditableValueHolder) {
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java Sat Jul 8 17:24:24 2006
@@ -55,26 +55,33 @@
/**
* <p>
* Uses the <code>Globals.ADD_VALUE_CHANGE_LISTENER_COMMAND_NAME</code>
- * command to create a <code>ValueChangeListener</code>.
+ * command to create a <code>ValueChangeListener</code>.</p>
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
+ }
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.childComponent"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
+ }
if (displayElement.getValueChangeListeners().size() > 0) {
if (child instanceof EditableValueHolder) {
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/ClayContext.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/ClayContext.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/ClayContext.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/ClayContext.java Sat Jul 8 17:24:24 2006
@@ -37,6 +37,9 @@
*/
public class ClayContext extends ContextBase {
+ /**
+ * <p>Unique serialization id.</p>
+ */
private static final long serialVersionUID = 3618132372818901298L;
/**
@@ -48,10 +51,13 @@
/**
* <p>Returns a Map containing replacement symbols
* within meta-component attributes.</p>
+ *
+ * @return map of {@link org.apache.shale.clay.config.beans.SymbolBean}
*/
public Map getSymbols() {
- if (symbols == null)
+ if (symbols == null) {
symbols = new TreeMap();
+ }
return symbols;
}
@@ -59,6 +65,8 @@
/**
* <p>Sets a Map containing replacement symbols
* within meta-component attributes.</p>
+ *
+ * @param symbols map of {@link org.apache.shale.clay.config.beans.SymbolBean}
*/
public void setSymbols(Map symbols) {
this.symbols = symbols;
@@ -72,6 +80,8 @@
/**
* <p>Returns the unique identifier for a component metadata definition.</p>
+ *
+ * @return jsfid
*/
public String getJsfid() {
return jsfid;
@@ -79,6 +89,8 @@
/**
* <p>Sets the unique identifier for a component metadata definition.</p>
+ *
+ * @param jsfid unique component identifier
*/
public void setJsfid(String jsfid) {
this.jsfid = jsfid;
@@ -96,6 +108,8 @@
* <b>Returns a child component that can be a UIComponent, Validator,
* Listener or Converter.
* </b>
+ *
+ * @return child component
*/
public Object getChild() {
return child;
@@ -105,6 +119,8 @@
* <p>Sets a child component that can be a UIComponent, Validator,
* Listener or Converter.
* </p>
+ *
+ * @param child component
*/
public void setChild(Object child) {
this.child = child;
@@ -123,6 +139,8 @@
* <p>Returns the root config object used to construct the
* {@link org.apache.shale.clay.component.Clay} component subtree.
* </p>
+ *
+ * @return config bean
*/
public ComponentBean getRootElement() {
return rootElement;
@@ -132,6 +150,8 @@
* <p>Sets the root config object used to construct the
* {@link org.apache.shale.clay.component.Clay} component subtree.
* </p>
+ *
+ * @param rootElement parent config bean
*/
public void setRootElement(ComponentBean rootElement) {
this.rootElement = rootElement;
@@ -157,6 +177,8 @@
* <p>Sets the current attribute for each in
* {@link org.apache.shale.clay.component.chain.AssignPropertiesCommand}.
* </p>
+ *
+ * @param attribute current attribute bean
*/
public void setAttribute(AttributeBean attribute) {
this.attribute = attribute;
@@ -166,6 +188,8 @@
* <p>Gets the current attribute for each in
* {@link org.apache.shale.clay.component.chain.AssignPropertiesCommand}.
* </p>
+ *
+ * @return current attribute bean
*/
public AttributeBean getAttribute() {
return attribute;
@@ -181,6 +205,8 @@
* <p>Returns the current component metadata used to build
* a JSF resource.
* </p>
+ *
+ * @return current config bean
*/
public ComponentBean getDisplayElement() {
return displayElement;
@@ -190,6 +216,8 @@
* <p>Sets the current component metadata used to build
* a JSF resource.
* </p>
+ *
+ * @param displayElement config bean
*/
public void setDisplayElement(ComponentBean displayElement) {
this.displayElement = displayElement;
@@ -202,6 +230,8 @@
/**
* <p>Returns the current faces Context.</p>
+ *
+ * @return faces context
*/
public FacesContext getFacesContext() {
return facesContext;
@@ -209,13 +239,15 @@
/**
* <p>Sets the current faces Context.</p>
+ *
+ * @param facesContext jsf context
*/
public void setFacesContext(FacesContext facesContext) {
this.facesContext = facesContext;
}
/**
- * <p>The <strong>parent</storng> of the <strong>child</strong>
+ * <p>The <strong>parent</strong> of the <strong>child</strong>
* component. The <strong>parent</strong> can be something other
* than a subclass of <code>UIComponent</code>.
* </p>
@@ -224,6 +256,8 @@
/**
* <p>Returns the <strong>parent</strong> of the <strong>child</strong>.</p>
+ *
+ * @return current parent component
*/
public UIComponent getParent() {
return parent;
@@ -231,6 +265,8 @@
/**
* <p>Sets the <strong>parent</strong> of the <strong>child</strong>.</p>
+ *
+ * @param parent current
*/
public void setParent(UIComponent parent) {
this.parent = parent;
@@ -244,18 +280,20 @@
/**
* <p>Returns the index at which a new component must be added in the list
* of childs.</p>
+ *
+ * @return current child index
*/
- public int getChildIndex()
- {
+ public int getChildIndex() {
return childIndex;
}
/**
* <p>Sets the index at which a new component must be added in the list
* of childs.</p>
+ *
+ * @param index current child index
*/
- public void setChildIndex(int index)
- {
+ public void setChildIndex(int index) {
childIndex = index;
}
}
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java Sat Jul 8 17:24:24 2006
@@ -55,42 +55,52 @@
* <code>displayElement</code> that is derived from type
* {@link ComponentBean}.
* </p>
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
+ }
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.childComponent"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
+ }
ActionSource parent = (ActionSource) clayContext.getParent();
- if (parent == null)
+ if (parent == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.parentComponent"));
+ }
FacesContext facesContext = clayContext.getFacesContext();
- if (facesContext == null)
+ if (facesContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.facesContext"));
+ }
ActionListener listener = null;
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
- if (loader == null)
+ if (loader == null) {
loader = getClass().getClassLoader();
+ }
listener = (ActionListener) loader.loadClass(
displayElement.getComponentType()).newInstance();
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java Sat Jul 8 17:24:24 2006
@@ -54,20 +54,24 @@
/**
* <p>Tests to see if myfaces runtime is installed by trying to load a known class.</p>
+ *
+ * @return <code>true</code> if myfaces runtime is loaded
*/
private boolean isMyfacesRuntimeInstalled() {
try {
Class.forName("org.apache.myfaces.application.jsp.JspViewHandlerImpl");
return true;
} catch (ClassNotFoundException e) {
+ return false;
}
-
- return false;
}
/**
* <p>Returns a unique component id for the request/response lifecycle.</p>
+ *
+ * @param facesContext faces context
+ * @return unique component id
*/
private String createUniqueId(FacesContext facesContext) {
String id = null;
@@ -93,30 +97,37 @@
* <p>
* Creates a new faces component from the component metadata.
* </p>
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = true;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
+ }
UIComponent parent = clayContext.getParent();
- if (parent == null)
+ if (parent == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.parentBean"));
+ }
FacesContext facesContext = clayContext.getFacesContext();
- if (facesContext == null)
+ if (facesContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.facesContext"));
+ }
// create a new scoped symbol table
Map symbolTable = new Attributes();
@@ -131,11 +142,12 @@
realizeSymbols(clayContext);
- String id = null;
- if ((id = displayElement.getId()) == null)
+ String id = displayElement.getId();
+ if (id == null) {
id = createUniqueId(facesContext);
- else
+ } else {
id = replaceMnemonic(clayContext, id);
+ }
//Check to see if the replacement failed. This can happen if the
//symbol is missing. The id will still containing the symbol delimiter
@@ -143,23 +155,25 @@
if (id == null || id.indexOf('@') > -1) {
- if (id == null)
+ if (id == null) {
id = displayElement.getId();
+ }
throw new RuntimeException(getMessages().getMessage("create.component.invalid.id",
new Object[] {id, symbolTable}));
}
UIComponent child = null;
- if (displayElement.getFacetName() != null)
+ if (displayElement.getFacetName() != null) {
child = parent.getFacet(displayElement.getFacetName());
- else
+ } else {
child = parent.findComponent(id);
+ }
if (child == null) {
try {
- AttributeBean attr = null;
- if ((attr = displayElement.getAttribute("binding")) != null
+ AttributeBean attr = displayElement.getAttribute("binding");
+ if (attr != null
&& attr.getValue() != null) {
clayContext.setAttribute(attr);
@@ -185,16 +199,18 @@
if (displayElement.getFacetName() != null) {
parent.getFacets().put(replaceMnemonic(clayContext, displayElement.getFacetName()), child);
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug(getMessages().getMessage("create.facet.component",
new Object[] { id, displayElement.getJsfid()}));
+ }
} else {
parent.getChildren().add(clayContext.getChildIndex(), child);
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug(getMessages().getMessage("create.component",
new Object[] { id, displayElement.getJsfid(), new Integer(clayContext.getChildIndex()) }));
+ }
}
@@ -208,9 +224,10 @@
// continue with the addComponent chain
isFinal = false;
} else {
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug(getMessages().getMessage("create.component.exists",
new Object[] { id, displayElement.getJsfid(), new Integer(clayContext.getChildIndex()) }));
+ }
}
// if target is a Clay component it might contain symbols
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateValueChangeListenerCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateValueChangeListenerCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateValueChangeListenerCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateValueChangeListenerCommand.java Sat Jul 8 17:24:24 2006
@@ -50,43 +50,53 @@
* Creates a <code>ValueChangeListener</code> and assigns it to the
* <code>parent</code> attribute.
* </p>
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
+ }
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.childComponent"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
+ }
EditableValueHolder parent = (EditableValueHolder) clayContext
.getParent();
- if (parent == null)
+ if (parent == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.parentComponent"));
+ }
FacesContext facesContext = clayContext.getFacesContext();
- if (facesContext == null)
+ if (facesContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.facesContext"));
+ }
ValueChangeListener listener = null;
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
- if (loader == null)
+ if (loader == null) {
loader = getClass().getClassLoader();
+ }
listener = (ValueChangeListener) loader.loadClass(
displayElement.getComponentType()).newInstance();
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java Sat Jul 8 17:24:24 2006
@@ -66,33 +66,43 @@
* value. This <code>Command</code> is invoked from the
* {@link AssignPropertiesCommand} chain.
* </p>
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.clayContext"));
+ }
AttributeBean attributeBean = clayContext.getAttribute();
- if (attributeBean == null)
+ if (attributeBean == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.attributeBean"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.componentBean"));
+ }
FacesContext facesContext = clayContext.getFacesContext();
- if (facesContext == null)
+ if (facesContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.facesContext"));
+ }
- if (tagUtils == null)
+ if (tagUtils == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.tagUtils"));
+ }
if (attributeBean.getName().equals("action") && attributeBean.getValue() != null) {
isFinal = true;
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.childComponent"));
+ }
if (child instanceof ActionSource) {
String expr = null;
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java Sat Jul 8 17:24:24 2006
@@ -65,30 +65,39 @@
* value. This <code>Command</code> is invoked from the
* {@link AssignPropertiesCommand} chain.
* </p>
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.clayContext"));
+ }
AttributeBean attributeBean = clayContext.getAttribute();
- if (attributeBean == null)
+ if (attributeBean == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.attributeBean"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.componentBean"));
+ }
FacesContext facesContext = clayContext.getFacesContext();
- if (facesContext == null)
+ if (facesContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.facesContext"));
+ }
if (attributeBean.getName().equals("actionListener") && attributeBean.getValue() != null) {
isFinal = true;
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.childComponent"));
+ }
if (child instanceof ActionSource) {
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java Sat Jul 8 17:24:24 2006
@@ -65,29 +65,38 @@
* <code>true</code> value. Otherwise, return a <code>false</code>
* value.
* </p>
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.clayContext"));
+ }
AttributeBean attributeBean = clayContext.getAttribute();
- if (attributeBean == null)
+ if (attributeBean == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.attributeBean"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.componentBean"));
+ }
FacesContext facesContext = clayContext.getFacesContext();
- if (facesContext == null)
+ if (facesContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.facesContext"));
+ }
if (attributeBean.getName().equals("validator") && attributeBean.getValue() != null) {
isFinal = true;
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException("child");
+ }
if (child instanceof EditableValueHolder) {
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java Sat Jul 8 17:24:24 2006
@@ -65,29 +65,38 @@
* <code>true</code> value. Otherwise, return a <code>false</code>
* value.
* </p>
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.clayContext"));
+ }
AttributeBean attributeBean = clayContext.getAttribute();
- if (attributeBean == null)
+ if (attributeBean == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.attributeBean"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.childComponent"));
+ }
FacesContext facesContext = clayContext.getFacesContext();
- if (facesContext == null)
+ if (facesContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.facesContext"));
+ }
if (attributeBean.getName().equals("valueChangeListener") && attributeBean.getValue() != null) {
isFinal = true;
UIComponent child = (UIComponent) clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException("child");
+ }
if (child instanceof EditableValueHolder) {
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java Sat Jul 8 17:24:24 2006
@@ -65,6 +65,11 @@
* value is a String, the data type is converted to the target type
* using the <code>ConverterHelper</code>. The value is applied to
* the component using <code>PropertyHelper</code>.</p>
+ *
+ * @param context faces context
+ * @param target object with the property
+ * @param propertyName name of the target property
+ * @param propertyValue value of the target property
*/
private void setProperty(FacesContext context, Object target, String propertyName, Object propertyValue) {
Class classz = null;
@@ -73,7 +78,7 @@
try {
classz = propertyHelper.getType(target, actualPropertyName.toString());
} catch (PropertyNotFoundException e) {
- if (propertyName.length() > 3 && propertyName.startsWith("is") ) {
+ if (propertyName.length() > "isX".length() && propertyName.startsWith("is")) {
actualPropertyName.delete(0, 2);
actualPropertyName.setCharAt(0, Character.toLowerCase(actualPropertyName.charAt(0)));
@@ -106,33 +111,43 @@
* Otherwise, the binding expression is applied to the component in a prepared state.
* A <code>true</code> value is always returned because this is the default handler.
* </p>
+ *
+ * @param context common chains
+ * @return <code>true</code> if the chain is complete
+ * @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = true;
ClayContext clayContext = (ClayContext) context;
- if (clayContext == null)
+ if (clayContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.clayContext"));
+ }
AttributeBean attributeBean = clayContext.getAttribute();
- if (attributeBean == null)
+ if (attributeBean == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.attributeBean"));
+ }
Object child = clayContext.getChild();
- if (child == null)
+ if (child == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.childComponent"));
+ }
ComponentBean displayElement = clayContext.getDisplayElement();
- if (displayElement == null)
+ if (displayElement == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.componentBean"));
+ }
FacesContext facesContext = clayContext.getFacesContext();
- if (facesContext == null)
+ if (facesContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.facesContext"));
+ }
// replace all symbols returning the target attribute value
String expr = replaceMnemonic(clayContext);
//exit if null or empty string
- if (expr == null)
+ if (expr == null) {
return isFinal;
+ }
//when using the html templating, javascript and css will have matching curly braces {}.
//and pound sign # too.
@@ -145,8 +160,9 @@
rightCurly = expr.indexOf('}');
String bindingType = attributeBean.getBindingType();
- if (bindingType == null)
+ if (bindingType == null) {
bindingType = AttributeBean.BINDING_TYPE_NONE;
+ }
//contains expression language
boolean isEL = ((pound > -1 && leftCurly > -1 && rightCurly > -1)
@@ -157,27 +173,29 @@
//use early binding
boolean isEarly = bindingType.equals(AttributeBean.BINDING_TYPE_EARLY);
- if (isEL && isVB)
+ if (isEL && isVB) {
tagUtils.setValueBinding((UIComponentBase) child, attributeBean.getName(), expr);
- else if (isEL && isEarly) {
+ } else if (isEL && isEarly) {
ValueBinding vb = facesContext.getApplication().createValueBinding(expr);
Object value = vb.getValue(facesContext);
try {
- setProperty(facesContext ,child, attributeBean.getName(), value);
+ setProperty(facesContext, child, attributeBean.getName(), value);
} catch (Exception e) {
- if (child instanceof UIComponentBase)
+ if (child instanceof UIComponentBase) {
((UIComponentBase) child).getAttributes().put(attributeBean.getName(), expr);
- else
+ } else {
throw e;
+ }
}
} else {
try {
setProperty(facesContext, child, attributeBean.getName(), expr);
} catch (Exception e) {
- if (child instanceof UIComponentBase)
+ if (child instanceof UIComponentBase) {
((UIComponentBase) child).getAttributes().put(attributeBean.getName(), expr);
- else
+ } else {
throw e;
+ }
}
}
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/ClayConfigureListener.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/ClayConfigureListener.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/ClayConfigureListener.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/ClayConfigureListener.java Sat Jul 8 17:24:24 2006
@@ -68,12 +68,13 @@
* with the factory {@link ConfigBeanFactory}. All configuration bean pools implement the
* {@link org.apache.shale.clay.config.beans.ConfigBean} interface.
* </p>
- *
+ * @param event servlet context
* @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
*/
public void contextInitialized(ServletContextEvent event) {
- if (log.isInfoEnabled())
+ if (log.isInfoEnabled()) {
log.info(messages.getMessage("config.load.begin"));
+ }
try {
@@ -99,20 +100,22 @@
throw e;
}
- if (log.isInfoEnabled())
+ if (log.isInfoEnabled()) {
log.info(messages.getMessage("config.load.done"));
+ }
}
/**
* <p>Tear down the factories and clean house.</p>
- *
+ * @param event servlet context
* @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
*/
public void contextDestroyed(ServletContextEvent event) {
- if (log.isInfoEnabled())
+ if (log.isInfoEnabled()) {
log.debug(messages.getMessage("config.destroy"));
+ }
ConfigBeanFactory.destroy();
LogFactory.release(Thread.currentThread().getContextClassLoader());
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/AbstractBean.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/AbstractBean.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/AbstractBean.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/AbstractBean.java Sat Jul 8 17:24:24 2006
@@ -35,6 +35,8 @@
/**
* <p>Returns the <code>description</code> of the bean.</p>
+ *
+ * @return description of the config bean
*/
public String getDescription() {
return description;
@@ -42,6 +44,8 @@
/**
* <p>Sets the <code>description</code> of the bean.</p>
+ *
+ * @param description of the config bean
*/
public void setDescription(String description) {
this.description = description;
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/Attributes.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/Attributes.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/Attributes.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/Attributes.java Sat Jul 8 17:24:24 2006
@@ -26,44 +26,61 @@
*/
public class Attributes extends TreeMap {
+ /**
+ * <p>Unique serial id.</p>
+ */
private static final long serialVersionUID = 3905244515647173938L;
/**
* <p>Make the key case insensitive.</p>
+ *
+ * @param key attribute key
+ * @return <code>true</code> if key is contained
*/
public boolean containsKey(Object key) {
Object normKey = null;
- if (key != null && key instanceof String)
+ if (key != null && key instanceof String) {
normKey = ((String) key).toLowerCase();
- else
+ } else {
normKey = key;
+ }
return super.containsKey(normKey);
}
/**
* <p>Make the key case insensitive.</p>
+ *
+ * @param key attribute name
+ * @return value
*/
public Object get(Object key) {
Object normKey = null;
- if (key != null && key instanceof String)
+ if (key != null && key instanceof String) {
normKey = ((String) key).toLowerCase();
- else
+ } else {
normKey = key;
+ }
return super.get(normKey);
}
/**
* <p>Make the key case insensitive.</p>
+ *
+ * @param key attribute name
+ * @param value attribute value
+ *
+ * @return original value
*/
public Object put(Object key, Object value) {
Object normKey = null;
- if (key != null && key instanceof String)
+ if (key != null && key instanceof String) {
normKey = ((String) key).toLowerCase();
- else
+ } else {
normKey = key;
+ }
return super.put(normKey, value);
}
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigBeanFactory.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigBeanFactory.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigBeanFactory.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigBeanFactory.java Sat Jul 8 17:24:24 2006
@@ -18,17 +18,25 @@
package org.apache.shale.clay.config.beans;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.TreeSet;
+
/**
* <p>This is an abstract factory that contains a ordered collection of
* object pools {@link ConfigBean}. The configuration beans are registered on
* application startup by the {@link ClayConfigListener}.
* </p>
*/
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.TreeSet;
+public final class ConfigBeanFactory {
+
+ /**
+ * <p>Hide constructor on a factory class.</p>
+ */
+ private ConfigBeanFactory() {
+ super();
+ }
-public class ConfigBeanFactory {
/**
* <p>A static ordered set of {@link ConfigBean} instances.</p>
*/
@@ -50,6 +58,9 @@
* to return component metadata. The suffix of the parameter is used to
* find a <code>ConfigBean</code> that has the metadata.
* </p>
+ *
+ * @param id jsfid
+ * @return config bean
*/
public static ConfigBean findConfig(String id) {
Iterator ci = configBeans.iterator();
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java Sat Jul 8 17:24:24 2006
@@ -24,12 +24,18 @@
import org.apache.shale.application.AbstractRegExpFilter;
import org.apache.shale.faces.ShaleWebContext;
+/**
+ * <p>This is the timing mechanism for looking for modified
+ * Clay templates and configuration files. This is a preprocess
+ * filter chains command that should only be used in the
+ * development environment.</p>
+ */
public class ConfigDefinitionsWatchdogFilter extends AbstractRegExpFilter {
/**
* <p>Log instance for this class.</p>
*/
- private static final Log log = LogFactory.getLog(ConfigDefinitionsWatchdogFilter.class);
+ private static Log log = LogFactory.getLog(ConfigDefinitionsWatchdogFilter.class);
/**
@@ -37,6 +43,7 @@
* (if any) for this request.</p>
*
* @param context <code>Context</code> for the current request
+ * @return servletPath and pathInfo
*/
protected String value(ShaleWebContext context) {
@@ -61,6 +68,8 @@
* configuration files are checked for changes and reloaded.</p>
*
* @param context <code>ShaleWebContext</code> for this request
+ * @return <code>true</code> if the chain is done
+ * @exception Exception thrown back to the calling command
*/
public boolean execute(Context context) throws Exception {
@@ -95,6 +104,7 @@
* is made.</p>
*
* @param context <code>Context</code> for the current request
+ * @exception Exception thrown back to the caller
*/
protected void accept(ShaleWebContext context) throws Exception {
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConverterBean.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConverterBean.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConverterBean.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ConverterBean.java Sat Jul 8 17:24:24 2006
@@ -24,6 +24,9 @@
*/
public class ConverterBean extends InnerComponentBean {
+ /**
+ * <p>Unique serialization id.</p>
+ */
private static final long serialVersionUID = 3258417218273621552L;
/**
@@ -35,6 +38,8 @@
/**
* <p>Returns the {@link ComponentBean}'s <code>id</code>.</p>
+ *
+ * @return converter's id
*/
public String getId() {
return id;
@@ -43,6 +48,8 @@
/**
* <p>Sets the {@link ComponentBean}'s <code>id</code>.</p>
+ *
+ * @param id converter's id
*/
public void setId(String id) {
this.id = id;
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/PageNotFoundException.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/PageNotFoundException.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/PageNotFoundException.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/PageNotFoundException.java Sat Jul 8 17:24:24 2006
@@ -33,6 +33,9 @@
*/
public class PageNotFoundException extends RuntimeException {
+ /**
+ * <p>Unique serial is use in object serialization.</p>
+ */
private static final long serialVersionUID = 3258689897039672375L;
/**
* <p>The requested resource.</p>
@@ -53,6 +56,8 @@
/**
* <p>Returns the missing resource.</p>
+ *
+ * @return uri of the requested page
*/
public String getResource() {
return resource;
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/SymbolBean.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/SymbolBean.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/SymbolBean.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/SymbolBean.java Sat Jul 8 17:24:24 2006
@@ -48,7 +48,7 @@
/**
* <p>Returns a name corresponding to an associated JSF object property.</p>
- *
+ *
* @return symbol name
*/
public String getName() {
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java Sat Jul 8 17:24:24 2006
@@ -26,7 +26,7 @@
import org.apache.shale.clay.config.Globals;
/**
- * <This ConfigBean is responsible for handling full XML views. For full XML views,
+ * <p>This ConfigBean is responsible for handling full XML views. For full XML views,
* the viewId will correspond to an XML file that defines meta-component declarations
* specific for the page. It's assumed that here will be a top-level component with a
* jsfid matching the viewId.</p>
@@ -37,6 +37,8 @@
* <p>Returns an integer value use to order the registered {@link ConfigBean} instances
* with the {@link ConfigBeanFactory}.
* </p>
+ *
+ * @return a weight of 2
*/
public int getWeight() {
return 2;
@@ -72,8 +74,8 @@
// adds the watcher to a map identified by name
watchDogs.put(watchDog.getName(), watchDog);
- // loads the config files
- watchDog.refresh(true);
+ // loads the config files
+ watchDog.refresh(true);
}
@@ -93,6 +95,8 @@
* initialization parameter are reloaded if modified or if a
* <code>forceReload</code> is specified.</p>
*
+ * @param forceReload <code>true</code> if the group of associated resources should be reloaded
+ * @return <code>true</code> if one of the resources changed
*/
public boolean refresh(boolean forceReload) {
boolean wasDirty = forceReload;
@@ -104,8 +108,9 @@
if (forceReload) {
//remove from the list without the clean-up
- if (defaultWatchDog != null)
+ if (defaultWatchDog != null) {
watchDogs.remove(Globals.DEFAULT_COMPONENT_CONFIG_WATCHDOG);
+ }
// remove all old templates
Iterator wi = watchDogs.entrySet().iterator();
@@ -113,14 +118,16 @@
Map.Entry e = (Map.Entry) wi.next();
WatchDog watchDog = (WatchDog) e.getValue();
clear(watchDog.getName());
- if (watchDog != null)
+ if (watchDog != null) {
watchDog.destroy();
+ }
}
watchDogs.clear();
//push back into the list
- if (defaultWatchDog != null)
+ if (defaultWatchDog != null) {
watchDogs.put(Globals.DEFAULT_COMPONENT_CONFIG_WATCHDOG, defaultWatchDog);
+ }
}
@@ -141,6 +148,9 @@
* defined in the web deployment descriptor as a initialization parameter with
* the name defined by <code>Globals.CLAY_XML_TEMPLATE_SUFFIX</code> Or, using
* the default defined by <code>Globals.CLAY_DEFAULT_XML_TEMPLATE_SUFFIX</code>
+ *
+ * @param id jsfid
+ * @return <code>true</code> if the jsfid can be handle
*/
public boolean validMoniker(String id) {
return id.endsWith(suffixes[1]);
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ValueChangeListenerBean.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ValueChangeListenerBean.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ValueChangeListenerBean.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ValueChangeListenerBean.java Sat Jul 8 17:24:24 2006
@@ -24,8 +24,11 @@
* This meta component will be used to construct a JSF <code>ValueChangeListener</code>. It is
* a subclass of {@link ComponentBean} where this class acts like an enumerated type.
*/
-public class ValueChangeListenerBean extends InnerComponentBean implements Serializable{
+public class ValueChangeListenerBean extends InnerComponentBean implements Serializable {
+ /**
+ * <p>Unique serialization id.</p>
+ */
private static final long serialVersionUID = 3256718472791536436L;
@@ -38,6 +41,8 @@
/**
* <p>Returns the {@link ComponentBean}'s <code>id</code>.</p>
+ *
+ * @return component id
*/
public String getId() {
return id;
@@ -46,6 +51,8 @@
/**
* <p>Sets the {@link ComponentBean}'s <code>id</code>.</p>
+ *
+ * @param id component id
*/
public void setId(String id) {
this.id = id;
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/convert/TimeZoneConverter.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/convert/TimeZoneConverter.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/convert/TimeZoneConverter.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/convert/TimeZoneConverter.java Sat Jul 8 17:24:24 2006
@@ -23,15 +23,22 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
+/**
+ * <p>Converts a time zone id literal string into the
+ * <code>TimeZone</code> and back to a string.</p>
+ */
public class TimeZoneConverter implements Converter {
/**
* <p>Converts the string zone ID into a TimeZone object.</p>
+ *
+ * @param facesContext jsf faces context
+ * @param component converter assigned
+ * @param value to be converterd
+ * @return strong typed value
*/
- public Object getAsObject(FacesContext facesContext, UIComponent component, String value)
- throws ConverterException {
+ public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
TimeZone zone = TimeZone.getTimeZone(value);
return zone;
@@ -39,13 +46,18 @@
/**
* <p>Converts a TimeZone object into the string zone id.</p>
+ *
+ * @param facesContext jsf faces context
+ * @param component converter assigned
+ * @param value to be converterd
+ * @return string represention of the value
*/
- public String getAsString(FacesContext facesContext, UIComponent component, Object value)
- throws ConverterException {
+ public String getAsString(FacesContext facesContext, UIComponent component, Object value) {
TimeZone zone = (TimeZone) value;
- if (value != null)
+ if (value != null) {
return zone.getID();
+ }
return null;
}
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java Sat Jul 8 17:24:24 2006
@@ -45,13 +45,17 @@
* <p>Looks at the request uri to determine if the target page
* is a clay template. If the request's pathInfo matches the
* clay template suffixes, a flag is added to the request attributes.
- * This is need for the MyFaces JSF implementation.
+ * This is need for the MyFaces JSF implementation.</p>
+ *
+ * @param context commons chains
+ * @return <code>true</code> if the chains is final
+ * @exception Exception throws back up the calling stack
*/
public boolean execute(Context context) throws Exception {
ShaleWebContext webContext = (ShaleWebContext) context;
- int index = -1;
- if ((index = indexOfClayTemplateSuffix(webContext)) !=-1) {
+ int index = indexOfClayTemplateSuffix(webContext);
+ if (index != -1) {
webContext.getRequest().setAttribute(Globals.CLAY_FULL_VIEW_SUFFIX, suffixes[index]);
}
@@ -63,6 +67,9 @@
* <p>Checks the <code>request.uri</code> to determine if it's suffix matches one of
* the <code>suffixes</code>. If a match is found, the index into the <code>suffixes</code>
* array is returned. A value of -1 is returned if a match is not found.</p>
+ *
+ * @param context commons chains
+ * @return index into <code>suffixes</code>
*/
protected int indexOfClayTemplateSuffix(ShaleWebContext context) {
@@ -86,7 +93,7 @@
if (uri != null) {
//look at the path
- for (int i =0; i < suffixes.length; i++) {
+ for (int i = 0; i < suffixes.length; i++) {
if (uri.endsWith(suffixes[i])) {
return i;
}
Modified: shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/AttributeTokenizer.java
URL: http://svn.apache.org/viewvc/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/AttributeTokenizer.java?rev=420232&r1=420231&r2=420232&view=diff
==============================================================================
--- shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/AttributeTokenizer.java (original)
+++ shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/AttributeTokenizer.java Sat Jul 8 17:24:24 2006
@@ -296,7 +296,7 @@
* name and value pairs.
* </p>
*
- * @param tokenIndex populated attribute offset of a beging node body
+ * @param tokenIndex populated attribute offset of a beging node body
*/
protected synchronized void parse(ArrayList tokenIndex) {
currOffset = beginOffset;
@@ -324,27 +324,33 @@
// looks for the key value delimiter
TokenOffset key = nextToken(currOffset, " ", "=", true);
- if (key == null)
+ if (key == null) {
break;
+ }
boolean skipValue = false;
currOffset++;
String delim = " "; // old school html color=red
String otherDelim = "\"";
- if (currOffset < buffer.length() &&
- buffer.charAt(currOffset) == '"') { // xmlish attribute
+ if (currOffset < buffer.length()
+ && buffer.charAt(currOffset) == '"') {
+
+ // xmlish attribute
delim = "\"";
otherDelim = " ";
currOffset++;
- } else if (currOffset < buffer.length() && currOffset > 0 &&
- buffer.charAt(currOffset - 1) == ' ') { //attribute without value
+ } else if (currOffset < buffer.length() && currOffset > 0
+ && buffer.charAt(currOffset - 1) == ' ') {
+
+ //attribute without value
currOffset--; //back up <option selected value=
skipValue = true;
}
TokenOffset value = null;
- if (!skipValue) // no value part <option selected value=xxx>
+ if (!skipValue) { // no value part <option selected value=xxx>
value = nextToken(currOffset, delim, otherDelim, false);
+ }
tokenIndex.add(new AttributeEntry(key, value));
@@ -370,7 +376,7 @@
* @param endDelim primary token delimiter
* @param otherDelim secondary token delimiter
* @param isKey looking for an attribute name not a value
- * @return next token offset
+ * @return next token offset
*/
protected TokenOffset nextToken(int startOffset, String endDelim, String otherDelim, boolean isKey) {
//If isKey is true, we are looking for an attribute name with a endDelim or otherDelim.
@@ -381,17 +387,19 @@
if (isKey) {
int offsetEnd = Math.min(buffer.indexOf(endDelim, startOffset), endOffset);
int offsetOther = Math.min(buffer.indexOf(otherDelim, startOffset), endOffset);
- if (offsetEnd == -1)
+ if (offsetEnd == -1) {
currOffset = offsetOther;
- else if (offsetOther == -1)
+ } else if (offsetOther == -1) {
currOffset = offsetOther;
- else
+ } else {
currOffset = Math.min(offsetEnd, offsetOther);
+ }
} else {
currOffset = Math.min(buffer.indexOf(endDelim, startOffset), endOffset);
// try another delimiter
- if (currOffset == -1)
+ if (currOffset == -1) {
currOffset = Math.min(buffer.indexOf(otherDelim, startOffset), endOffset);
+ }
}
@@ -405,10 +413,11 @@
int e = currOffset;
//forgive an attribute with Inconsistent delimiters, color=red"
- if (buffer.charAt(e - 1) == '"' ||
- (Character.isWhitespace(buffer.charAt(e - 1)) &&
- buffer.charAt(e - 1) != ' '))
+ if (buffer.charAt(e - 1) == '"'
+ || (Character.isWhitespace(buffer.charAt(e - 1))
+ && buffer.charAt(e - 1) != ' ')) {
--e;
+ }
TokenOffset value = new TokenOffset(startOffset, e);
@@ -439,7 +448,7 @@
private ArrayList tokenIndex = null;
/**
- * <p>Internal <code>tokenIndex</code> iterator.</p>
+ * <p>Internal <code>tokenIndex</code> iterator.</p>
*/
private Iterator ti = null;
@@ -478,7 +487,7 @@
}
/**
- * <p>This method is not implemented</p>
+ * <p>This method is not implemented.</p>
*
* @deprecated
*/