Author: ehillenius
Date: Sun Aug 5 21:43:19 2007
New Revision: 563024
URL: http://svn.apache.org/viewvc?view=rev&rev=563024
Log:
added accessor methods for members
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/AttributeModifier.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/AttributeModifier.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/AttributeModifier.java?view=diff&rev=563024&r1=563023&r2=563024
==============================================================================
---
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/AttributeModifier.java
(original)
+++
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/AttributeModifier.java
Sun Aug 5 21:43:19 2007
@@ -44,8 +44,8 @@
* </p>
* <p>
* Instances of this class should be added to components via the
- * [EMAIL PROTECTED] org.apache.wicket.Component#add(AttributeModifier)}
method after the component
- * has been constucted.
+ * [EMAIL PROTECTED] org.apache.wicket.Component#add(AttributeModifier)}
method after the
+ * component has been constucted.
* <p>
* It is possible to create new subclasses of AttributeModifier by overriding
* the newValue(String, String) method. For example, you could create an
@@ -149,7 +149,7 @@
this.attribute = attribute;
this.pattern = pattern;
- this.enabled = true;
+ enabled = true;
this.addAttributeIfNotPresent = addAttributeIfNotPresent;
this.replaceModel = replaceModel;
}
@@ -189,13 +189,28 @@
}
/**
- * Made final to support the parameterless variant.
- *
- * @see
org.apache.wicket.behavior.AbstractBehavior#isEnabled(org.apache.wicket.Component)
+ * @return whether to add the attribute if it is not an attribute in the
+ * markup
*/
- public boolean isEnabled(Component component)
+ public final boolean getAddAttributeIfNotPresent()
{
- return enabled;
+ return addAttributeIfNotPresent;
+ }
+
+ /**
+ * @return the attribute name to replace the value for
+ */
+ public final String getAttribute()
+ {
+ return attribute;
+ }
+
+ /**
+ * @return the pattern of the current attribute value to match
+ */
+ public final String getPattern()
+ {
+ return pattern;
}
/**
@@ -210,6 +225,16 @@
}
/**
+ * Made final to support the parameterless variant.
+ *
+ * @see
org.apache.wicket.behavior.AbstractBehavior#isEnabled(org.apache.wicket.Component)
+ */
+ public boolean isEnabled(Component component)
+ {
+ return enabled;
+ }
+
+ /**
* @see
org.apache.wicket.behavior.IBehavior#onComponentTag(org.apache.wicket.Component,
* org.apache.wicket.markup.ComponentTag)
*/
@@ -288,8 +313,25 @@
*/
public String toString()
{
- return "[AttributeModifier attribute=" + attribute + ",
enabled=" + enabled + ", pattern="
- + pattern + ", replacementModel=" +
replaceModel + "]";
+ return "[AttributeModifier attribute=" + attribute + ",
enabled=" + enabled + ", pattern=" +
+ pattern + ", replacementModel=" + replaceModel
+ "]";
+ }
+
+ /* gets replacement with null check. */
+ private Object getReplacementOrNull(final Component component)
+ {
+ IModel model = replaceModel;
+ if (model instanceof IComponentAssignedModel)
+ {
+ model =
((IComponentAssignedModel)model).wrapOnAssignment(component);
+ }
+ return (model != null) ? model.getObject() : null;
+ }
+
+ /* gets replacement as a string with null check. */
+ private String toStringOrNull(final Object replacementValue)
+ {
+ return (replacementValue != null) ? replacementValue.toString()
: null;
}
/**
@@ -317,22 +359,5 @@
protected String newValue(final String currentValue, final String
replacementValue)
{
return replacementValue;
- }
-
- /* gets replacement with null check. */
- private Object getReplacementOrNull(final Component component)
- {
- IModel model = replaceModel;
- if (model instanceof IComponentAssignedModel)
- {
- model =
((IComponentAssignedModel)model).wrapOnAssignment(component);
- }
- return (model != null) ? model.getObject() : null;
- }
-
- /* gets replacement as a string with null check. */
- private String toStringOrNull(final Object replacementValue)
- {
- return (replacementValue != null) ? replacementValue.toString()
: null;
}
}
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java?view=diff&rev=563024&r1=563023&r2=563024
==============================================================================
---
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java
(original)
+++
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java
Sun Aug 5 21:43:19 2007
@@ -32,7 +32,7 @@
/** The attribute */
private final String attribute;
-
+
/** The value to set */
private final CharSequence value;
@@ -59,24 +59,41 @@
}
/**
- * @see
org.apache.wicket.behavior.AbstractBehavior#onComponentTag(org.apache.wicket.Component,
- * org.apache.wicket.markup.ComponentTag)
+ * @return the attribute
*/
- public void onComponentTag(final Component component, final
ComponentTag tag)
+ public final String getAttribute()
{
- if (isEnabled(component))
- {
- tag.getAttributes().put(attribute, value);
- }
+ return attribute;
}
-
+
+ /**
+ * @return the value to set
+ */
+ public final CharSequence getValue()
+ {
+ return value;
+ }
+
/**
* This method is deprecated, use the isEnabled(Component)
+ *
* @return true
* @deprecated use isEnabled(Component) now.
*/
public final boolean isEnabled()
{
return true;
+ }
+
+ /**
+ * @see
org.apache.wicket.behavior.AbstractBehavior#onComponentTag(org.apache.wicket.Component,
+ * org.apache.wicket.markup.ComponentTag)
+ */
+ public void onComponentTag(final Component component, final
ComponentTag tag)
+ {
+ if (isEnabled(component))
+ {
+ tag.getAttributes().put(attribute, value);
+ }
}
}