You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/05/07 03:00:09 UTC
svn commit: r653960 [3/3] - in /tapestry/tapestry5/trunk:
tapestry-core/src/main/java/org/apache/tapestry/
tapestry-core/src/main/java/org/apache/tapestry/corelib/base/
tapestry-core/src/main/java/org/apache/tapestry/corelib/components/
tapestry-core/s...
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Palette.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Palette.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Palette.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Palette.java Tue May 6 18:00:03 2008
@@ -77,7 +77,7 @@
writeDisabled(writer, isDisabled());
- for (Runnable r : _availableOptions)
+ for (Runnable r : availableOptions)
r.run();
writer.end();
@@ -86,46 +86,46 @@
private final class OptionGroupEnd implements Runnable
{
- private final OptionGroupModel _model;
+ private final OptionGroupModel model;
private OptionGroupEnd(OptionGroupModel model)
{
- _model = model;
+ this.model = model;
}
public void run()
{
- _renderer.endOptionGroup(_model);
+ renderer.endOptionGroup(model);
}
}
private final class OptionGroupStart implements Runnable
{
- private final OptionGroupModel _model;
+ private final OptionGroupModel model;
private OptionGroupStart(OptionGroupModel model)
{
- _model = model;
+ this.model = model;
}
public void run()
{
- _renderer.beginOptionGroup(_model);
+ renderer.beginOptionGroup(model);
}
}
private final class RenderOption implements Runnable
{
- private final OptionModel _model;
+ private final OptionModel model;
private RenderOption(OptionModel model)
{
- _model = model;
+ this.model = model;
}
public void run()
{
- _renderer.option(_model);
+ renderer.option(model);
}
}
@@ -140,9 +140,9 @@
for (Object value : getSelected())
{
- OptionModel model = _valueToOptionModel.get(value);
+ OptionModel model = valueToOptionModel.get(value);
- _renderer.option(model);
+ renderer.option(model);
}
writer.end();
@@ -152,61 +152,61 @@
/**
* List of Runnable commands to render the available options.
*/
- private List<Runnable> _availableOptions;
+ private List<Runnable> availableOptions;
/**
* The image to use for the deselect button (the default is a left pointing arrow).
*/
@Parameter(value = "asset:deselect.png")
- @Property(write=false)
- private Asset _deselect;
+ @Property(write = false)
+ private Asset deselect;
/**
* Encoder used to translate between server-side objects and client-side strings.
*/
@Parameter(required = true)
- private ValueEncoder<Object> _encoder;
+ private ValueEncoder<Object> encoder;
/**
* Model used to define the values and labels used when rendering.
*/
@Parameter(required = true)
- private SelectModel _model;
+ private SelectModel model;
/**
* The image to use for the move down button (the default is a downward pointing arrow).
*/
@Parameter(value = "asset:move_down.png")
- @Property(write=false)
- private Asset _moveDown;
+ @Property(write = false)
+ private Asset moveDown;
/**
* The image to use for the move up button (the default is an upward pointing arrow).
*/
@Parameter(value = "asset:move_up.png")
- @Property(write=false)
- private Asset _moveUp;
+ @Property(write = false)
+ private Asset moveUp;
/**
* Used to include scripting code in the rendered page.
*/
@Environmental
- private PageRenderSupport _renderSupport;
+ private PageRenderSupport renderSupport;
/**
* Needed to access query parameters when processing form submission.
*/
@Inject
- private Request _request;
+ private Request request;
- private SelectModelRenderer _renderer;
+ private SelectModelRenderer renderer;
/**
* The image to use for the select button (the default is a right pointing arrow).
*/
@Parameter(value = "asset:select.png")
- @Property(write=false)
- private Asset _select;
+ @Property(write = false)
+ private Asset select;
/**
* The list of selected values from the {@link SelectModel}. This will be updated when the form is submitted. If the
@@ -214,28 +214,28 @@
* unbound, defaults to a property of the container matching this component's id.
*/
@Parameter(required = true)
- private List<Object> _selected;
+ private List<Object> selected;
/**
* If true, then additional buttons are provided on the client-side to allow for re-ordering of the values.
*/
@Parameter("false")
- @Property(write=false)
- private boolean _reorder;
+ @Property(write = false)
+ private boolean reorder;
/**
* Used during rendering to identify the options corresponding to selected values (from the selected parameter), in
* the order they should be displayed on the page.
*/
- private List<OptionModel> _selectedOptions;
+ private List<OptionModel> selectedOptions;
- private Map<Object, OptionModel> _valueToOptionModel;
+ private Map<Object, OptionModel> valueToOptionModel;
/**
* Number of rows to display.
*/
@Parameter(value = "10")
- private int _size;
+ private int size;
/**
* Defaults the selected parameter to a container property whose name matches this component's id.
@@ -249,7 +249,7 @@
{
return new AvailableRenderer();
}
-
+
public Renderable getSelectedRenderer()
{
return new SelectedRenderer();
@@ -258,17 +258,17 @@
@Override
protected void processSubmission(String elementName)
{
- String parameterValue = _request.getParameter(elementName + ":values");
+ String parameterValue = request.getParameter(elementName + ":values");
JSONArray values = new JSONArray(parameterValue);
// Use a couple of local variables to cut down on access via bindings
- List<Object> selected = _selected;
+ List<Object> selected = this.selected;
if (selected == null) selected = newList();
else selected.clear();
- ValueEncoder encoder = _encoder;
+ ValueEncoder encoder = this.encoder;
int count = values.length();
@@ -281,7 +281,7 @@
selected.add(objectValue);
}
- _selected = selected;
+ this.selected = selected;
}
private void writeDisabled(MarkupWriter writer, boolean disabled)
@@ -293,11 +293,11 @@
{
JSONArray selectedValues = new JSONArray();
- for (OptionModel selected : _selectedOptions)
+ for (OptionModel selected : selectedOptions)
{
Object value = selected.getValue();
- String clientValue = _encoder.toClient(value);
+ String clientValue = encoder.toClient(value);
selectedValues.put(clientValue);
}
@@ -311,7 +311,7 @@
String clientId = getClientId();
- _renderSupport.addScript("new Tapestry.Palette('%s', %s, %s);", clientId, _reorder, naturalOrder);
+ renderSupport.addScript("new Tapestry.Palette('%s', %s, %s);", clientId, reorder, naturalOrder);
writer.element("input", "type", "hidden", "id", clientId + ":values", "name", getControlName() + ":values",
"value", selectedValues);
@@ -334,11 +334,11 @@
@SuppressWarnings("unchecked")
void setupRender(MarkupWriter writer)
{
- _valueToOptionModel = newMap();
- _availableOptions = newList();
- _selectedOptions = newList();
+ valueToOptionModel = newMap();
+ availableOptions = newList();
+ selectedOptions = newList();
_naturalOrder = newList();
- _renderer = new SelectModelRenderer(writer, _encoder);
+ renderer = new SelectModelRenderer(writer, encoder);
final Set selectedSet = newSet(getSelected());
@@ -346,12 +346,12 @@
{
public void beginOptionGroup(OptionGroupModel groupModel)
{
- _availableOptions.add(new OptionGroupStart(groupModel));
+ availableOptions.add(new OptionGroupStart(groupModel));
}
public void endOptionGroup(OptionGroupModel groupModel)
{
- _availableOptions.add(new OptionGroupEnd(groupModel));
+ availableOptions.add(new OptionGroupEnd(groupModel));
}
public void option(OptionModel optionModel)
@@ -366,34 +366,34 @@
if (isSelected)
{
- _selectedOptions.add(optionModel);
- _valueToOptionModel.put(value, optionModel);
+ selectedOptions.add(optionModel);
+ valueToOptionModel.put(value, optionModel);
return;
}
- _availableOptions.add(new RenderOption(optionModel));
+ availableOptions.add(new RenderOption(optionModel));
}
};
- _model.visit(visitor);
+ model.visit(visitor);
}
// Avoids a strange Javassist bytecode error, c'est lavie!
int getSize()
{
- return _size;
+ return size;
}
String toClient(Object value)
{
- return _encoder.toClient(value);
+ return encoder.toClient(value);
}
List<Object> getSelected()
{
- if (_selected == null) return Collections.emptyList();
+ if (selected == null) return Collections.emptyList();
- return _selected;
+ return selected;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java Tue May 6 18:00:03 2008
@@ -40,16 +40,16 @@
{
private static final long serialVersionUID = 5337049721509981997L;
- private final String _property;
+ private final String property;
public SetupEnvironment(String property)
{
- _property = property;
+ this.property = property;
}
public void execute(PropertyEditor component)
{
- component.setupEnvironment(_property);
+ component.setupEnvironment(property);
}
}
@@ -69,7 +69,7 @@
* that a non-null value is ready to be read or updated.
*/
@Parameter(required = true)
- private Object _object;
+ private Object object;
/**
* Where to search for local overrides of property editing blocks as block parameters. This is normally the
@@ -77,45 +77,45 @@
* BeanEditForm's block parameters that will be searched.
*/
@Parameter(value = "componentResources")
- private ComponentResources _overrides;
+ private ComponentResources overrides;
/**
* Identifies the property to be edited by the editor.
*/
@Parameter(required = true)
- private String _property;
+ private String property;
/**
* The model that identifies the parameters to be edited, their order, and every other aspect.
*/
@Parameter(required = true)
- private BeanModel _model;
+ private BeanModel model;
@Inject
- private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
+ private FieldValidatorDefaultSource fieldValidatorDefaultSource;
@Inject
- private Environment _environment;
+ private Environment environment;
@Inject
- private BeanBlockSource _beanBlockSource;
+ private BeanBlockSource beanBlockSource;
@Inject
- private Messages _messages;
+ private Messages messages;
@Inject
- private Locale _locale;
+ private Locale locale;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
@Environmental
- private FormSupport _formSupport;
+ private FormSupport formSupport;
- private PropertyModel _propertyModel;
+ private PropertyModel propertyModel;
@Inject
- private TranslatorSource _translatorSource;
+ private TranslatorSource translatorSource;
/**
* Creates a {@link org.apache.tapestry.services.PropertyEditContext} and pushes it onto the {@link
@@ -123,60 +123,60 @@
*/
void setupEnvironment(final String propertyName)
{
- _propertyModel = _model.get(propertyName);
+ propertyModel = model.get(propertyName);
PropertyEditContext context = new PropertyEditContext()
{
public Messages getContainerMessages()
{
- return _overrides.getContainerMessages();
+ return overrides.getContainerMessages();
}
public String getLabel()
{
- return _propertyModel.getLabel();
+ return propertyModel.getLabel();
}
public String getPropertyId()
{
- return _propertyModel.getId();
+ return propertyModel.getId();
}
public Class getPropertyType()
{
- return _propertyModel.getPropertyType();
+ return propertyModel.getPropertyType();
}
public Object getPropertyValue()
{
- return _propertyModel.getConduit().get(_object);
+ return propertyModel.getConduit().get(object);
}
public Translator getTranslator()
{
- return _translatorSource.getByType(_propertyModel.getPropertyType());
+ return translatorSource.getByType(propertyModel.getPropertyType());
}
public FieldValidator getValidator(Field field)
{
- return _fieldValidatorDefaultSource.createDefaultValidator(field, propertyName,
- _overrides.getContainerMessages(), _locale,
- _propertyModel.getPropertyType(),
- _propertyModel.getConduit());
+ return fieldValidatorDefaultSource.createDefaultValidator(field, propertyName,
+ overrides.getContainerMessages(), locale,
+ propertyModel.getPropertyType(),
+ propertyModel.getConduit());
}
public void setPropertyValue(Object value)
{
- _propertyModel.getConduit().set(_object, value);
+ propertyModel.getConduit().set(object, value);
}
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
- return _propertyModel.getAnnotation(annotationClass);
+ return propertyModel.getAnnotation(annotationClass);
}
};
- _environment.push(PropertyEditContext.class, context);
+ environment.push(PropertyEditContext.class, context);
}
/**
@@ -185,7 +185,7 @@
*/
void cleanupEnvironment()
{
- _environment.pop(PropertyEditContext.class);
+ environment.pop(PropertyEditContext.class);
}
/**
@@ -196,7 +196,7 @@
// Sets up the PropertyEditContext for the duration of the render of this component
// (which will include the duration of the editor block).
- _formSupport.storeAndExecute(this, new SetupEnvironment(_property));
+ formSupport.storeAndExecute(this, new SetupEnvironment(property));
}
/**
@@ -207,7 +207,7 @@
// Removes the PropertyEditContext after this component (including the editor block)
// has rendered.
- _formSupport.storeAndExecute(this, new CleanupEnvironment());
+ formSupport.storeAndExecute(this, new CleanupEnvironment());
}
/**
@@ -216,24 +216,24 @@
*/
Block beginRender()
{
- Block override = _overrides.getBlockParameter(_propertyModel.getId());
+ Block override = overrides.getBlockParameter(propertyModel.getId());
if (override != null)
{
return override;
}
- String dataType = _propertyModel.getDataType();
+ String dataType = propertyModel.getDataType();
try
{
- return _beanBlockSource.getEditBlock(dataType);
+ return beanBlockSource.getEditBlock(dataType);
}
catch (RuntimeException ex)
{
- String message = _messages.format("block-error", _propertyModel.getPropertyName(), dataType, _object, ex);
+ String message = messages.format("block-error", propertyModel.getPropertyName(), dataType, object, ex);
- throw new TapestryException(message, _resources.getLocation(), ex);
+ throw new TapestryException(message, resources.getLocation(), ex);
}
}
@@ -252,11 +252,11 @@
void inject(ComponentResources resources, ComponentResources overrides, PropertyModel propertyModel,
BeanBlockSource beanBlockSource, Messages messages, Object object)
{
- _resources = resources;
- _overrides = overrides;
- _propertyModel = propertyModel;
- _beanBlockSource = beanBlockSource;
- _messages = messages;
- _object = object;
+ this.resources = resources;
+ this.overrides = overrides;
+ this.propertyModel = propertyModel;
+ this.beanBlockSource = beanBlockSource;
+ this.messages = messages;
+ this.object = object;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java Tue May 6 18:00:03 2008
@@ -34,7 +34,7 @@
public class Radio implements Field
{
@Environmental
- private RadioContainer _container;
+ private RadioContainer container;
/**
* The user presentable label for the field. If not provided, a reasonable label is generated from the component's
@@ -42,55 +42,55 @@
* converting the actual id to a presentable string (for example, "userId" to "User Id").
*/
@Parameter(defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
- private String _label;
+ private String label;
/**
* The value associated with this radio button. This is used to determine which radio button will be selected when
* the page is rendered, and also becomes the value assigned when the form is submitted.
*/
@Parameter(required = true, principal = true)
- private Object _value;
+ private Object value;
@Inject
- private ComponentDefaultProvider _defaultProvider;
+ private ComponentDefaultProvider defaultProvider;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
@SuppressWarnings("unused")
@Mixin
- private RenderInformals _renderInformals;
+ private RenderInformals renderInformals;
@SuppressWarnings("unused")
@Mixin
- private RenderDisabled _renderDisabled;
+ private RenderDisabled renderDisabled;
@SuppressWarnings("unused")
@Mixin
- private DiscardBody _discardBody;
+ private DiscardBody discardBody;
@Inject
- private PageRenderSupport _pageRenderSupport;
+ private PageRenderSupport pageRenderSupport;
- private String _clientId;
+ private String clientId;
- private String _controlName;
+ private String controlName;
/**
* If true, then the field will render out with a disabled attribute (to turn off client-side behavior). Further, a
* disabled field ignores any value in the request when the form is submitted.
*/
@Parameter("false")
- private boolean _disabled;
+ private boolean disabled;
String defaultLabel()
{
- return _defaultProvider.defaultLabel(_resources);
+ return defaultProvider.defaultLabel(resources);
}
Binding defaultValue()
{
- return _defaultProvider.defaultBinding("value", _resources);
+ return defaultProvider.defaultBinding("value", resources);
}
/**
@@ -98,12 +98,12 @@
*/
public String getControlName()
{
- return _controlName;
+ return controlName;
}
public String getLabel()
{
- return _label;
+ return label;
}
/**
@@ -112,24 +112,24 @@
*/
public boolean isDisabled()
{
- return _disabled || _container.isDisabled();
+ return disabled || container.isDisabled();
}
public String getClientId()
{
- return _clientId;
+ return clientId;
}
void beginRender(MarkupWriter writer)
{
- String value = _container.toClient(_value);
+ String value = container.toClient(this.value);
- _clientId = _pageRenderSupport.allocateClientId(_resources);
- _controlName = _container.getElementName();
+ clientId = pageRenderSupport.allocateClientId(resources);
+ controlName = container.getElementName();
- writer.element("input", "type", "radio", "id", _clientId, "name", _controlName, "value", value);
+ writer.element("input", "type", "radio", "id", clientId, "name", controlName, "value", value);
- if (_container.isSelected(_value)) writer.attributes("checked", "checked");
+ if (container.isSelected(this.value)) writer.attributes("checked", "checked");
}
void afterRender(MarkupWriter writer)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RadioGroup.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RadioGroup.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RadioGroup.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RadioGroup.java Tue May 6 18:00:03 2008
@@ -27,14 +27,14 @@
* The property read and updated by the group as a whole.
*/
@Parameter(required = true, principal = true)
- private Object _value;
+ private Object value;
/**
* If true, then the field will render out with a disabled attribute (to turn off client-side behavior). Further, a
* disabled field ignores any value in the request when the form is submitted.
*/
@Parameter("false")
- private boolean _disabled;
+ private boolean disabled;
/**
* The user presentable label for the field. If not provided, a reasonable label is generated from the component's
@@ -42,7 +42,7 @@
* converting the actual id to a presentable string (for example, "userId" to "User Id").
*/
@Parameter(defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
- private String _label;
+ private String label;
/**
* Allows a specific implementation of {@link ValueEncoder} to be supplied. This is used to create client-side
@@ -51,57 +51,57 @@
* @see ValueEncoderSource
*/
@Parameter(required = true)
- private ValueEncoder _encoder;
+ private ValueEncoder encoder;
@Inject
- private ComponentDefaultProvider _defaultProvider;
+ private ComponentDefaultProvider defaultProvider;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
@Environmental
- private FormSupport _formSupport;
+ private FormSupport formSupport;
@Inject
- private Environment _environment;
+ private Environment environment;
@Inject
- private Request _request;
+ private Request request;
@Environmental
- private ValidationTracker _tracker;
+ private ValidationTracker tracker;
- private String _controlName;
+ private String controlName;
final Binding defaultValue()
{
- return _defaultProvider.defaultBinding("value", _resources);
+ return defaultProvider.defaultBinding("value", resources);
}
String defaultLabel()
{
- return _defaultProvider.defaultLabel(_resources);
+ return defaultProvider.defaultLabel(resources);
}
final ValueEncoder defaultEncoder()
{
- return _defaultProvider.defaultValueEncoder("value", _resources);
+ return defaultProvider.defaultValueEncoder("value", resources);
}
private static class Setup implements ComponentAction<RadioGroup>
{
private static final long serialVersionUID = -7984673040135949374L;
- private final String _controlName;
+ private final String controlName;
Setup(String controlName)
{
- _controlName = controlName;
+ this.controlName = controlName;
}
public void execute(RadioGroup component)
{
- component.setup(_controlName);
+ component.setup(controlName);
}
}
@@ -117,16 +117,16 @@
private void setup(String elementName)
{
- _controlName = elementName;
+ controlName = elementName;
}
private void processSubmission()
{
- String clientValue = _request.getParameter(_controlName);
+ String clientValue = request.getParameter(controlName);
- _tracker.recordInput(this, clientValue);
+ tracker.recordInput(this, clientValue);
- _value = _encoder.toValue(clientValue);
+ value = encoder.toValue(clientValue);
}
/**
@@ -135,27 +135,27 @@
*/
final void setupRender()
{
- String name = _formSupport.allocateControlName(_resources.getId());
+ String name = formSupport.allocateControlName(resources.getId());
ComponentAction<RadioGroup> action = new Setup(name);
- _formSupport.storeAndExecute(this, action);
+ formSupport.storeAndExecute(this, action);
- String submittedValue = _tracker.getInput(this);
+ String submittedValue = tracker.getInput(this);
- final String selectedValue = submittedValue != null ? submittedValue : _encoder.toClient(_value);
+ final String selectedValue = submittedValue != null ? submittedValue : encoder.toClient(value);
- _environment.push(RadioContainer.class, new RadioContainer()
+ environment.push(RadioContainer.class, new RadioContainer()
{
public String getElementName()
{
- return _controlName;
+ return controlName;
}
public boolean isDisabled()
{
- return _disabled;
+ return disabled;
}
@SuppressWarnings("unchecked")
@@ -163,17 +163,17 @@
{
// TODO: Ensure that value is of the expected type?
- return _encoder.toClient(value);
+ return encoder.toClient(value);
}
public boolean isSelected(Object value)
{
- return TapestryInternalUtils.isEqual(_encoder.toClient(value), selectedValue);
+ return TapestryInternalUtils.isEqual(encoder.toClient(value), selectedValue);
}
});
- _formSupport.store(this, PROCESS_SUBMISSION);
+ formSupport.store(this, PROCESS_SUBMISSION);
}
/**
@@ -181,22 +181,22 @@
*/
final void afterRender()
{
- _environment.pop(RadioContainer.class);
+ environment.pop(RadioContainer.class);
}
public String getControlName()
{
- return _controlName;
+ return controlName;
}
public String getLabel()
{
- return _label;
+ return label;
}
public boolean isDisabled()
{
- return _disabled;
+ return disabled;
}
/**
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java Tue May 6 18:00:03 2008
@@ -29,15 +29,15 @@
public class RenderObject
{
@Parameter(required = true)
- private Object _object;
+ private Object object;
@Inject
@Primary
- private ObjectRenderer<Object> _renderer;
+ private ObjectRenderer<Object> renderer;
boolean beginRender(MarkupWriter writer)
{
- _renderer.render(_object, writer);
+ renderer.render(object, writer);
return false;
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java Tue May 6 18:00:03 2008
@@ -49,7 +49,7 @@
public Renderer(MarkupWriter writer)
{
- super(writer, _encoder);
+ super(writer, encoder);
}
@Override
@@ -66,16 +66,16 @@
* @see ValueEncoderSource
*/
@Parameter
- private ValueEncoder _encoder;
+ private ValueEncoder encoder;
@Inject
- private ComponentDefaultProvider _defaultProvider;
+ private ComponentDefaultProvider defaultProvider;
@Inject
- private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
+ private FieldValidatorDefaultSource fieldValidatorDefaultSource;
@Inject
- private Locale _locale;
+ private Locale locale;
// Maybe this should default to property "<componentId>Model"?
/**
@@ -83,7 +83,7 @@
* automatically for Enum types.
*/
@Parameter(required = true)
- private SelectModel _model;
+ private SelectModel model;
/**
* Controls whether an additional blank option is provided. The blank option precedes all other options and is never
@@ -91,72 +91,72 @@
* label is from the blankLabel parameter (and is often also the empty string).
*/
@Parameter(value = "auto", defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
- private BlankOption _blankOption;
+ private BlankOption blankOption;
/**
* The label to use for the blank option, if rendered. If not specified, the container's message catalog is
* searched for a key, <code><em>id</em>-blanklabel</code>.
*/
@Parameter(defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
- private String _blankLabel;
+ private String blankLabel;
@Inject
- private Request _request;
+ private Request request;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
@Environmental
- private ValidationTracker _tracker;
+ private ValidationTracker tracker;
/**
* Performs input validation on the value supplied by the user in the form submission.
*/
@Parameter(defaultPrefix = "validate")
@SuppressWarnings("unchecked")
- private FieldValidator<Object> _validate = NOOP_VALIDATOR;
+ private FieldValidator<Object> validate = NOOP_VALIDATOR;
/**
* The value to read or update.
*/
@Parameter(required = true, principal = true)
- private Object _value;
+ private Object value;
@Inject
- private FieldValidationSupport _fieldValidationSupport;
+ private FieldValidationSupport fieldValidationSupport;
@SuppressWarnings("unused")
@Mixin
- private RenderDisabled _renderDisabled;
+ private RenderDisabled renderDisabled;
- private String _selectedClientValue;
+ private String selectedClientValue;
private boolean isSelected(String clientValue)
{
- return TapestryInternalUtils.isEqual(clientValue, _selectedClientValue);
+ return TapestryInternalUtils.isEqual(clientValue, selectedClientValue);
}
@SuppressWarnings({ "unchecked" })
@Override
protected void processSubmission(String elementName)
{
- String submittedValue = _request.getParameter(elementName);
+ String submittedValue = request.getParameter(elementName);
- _tracker.recordInput(this, submittedValue);
+ tracker.recordInput(this, submittedValue);
Object selectedValue = InternalUtils.isBlank(submittedValue)
? null :
- _encoder.toValue(submittedValue);
+ encoder.toValue(submittedValue);
try
{
- _fieldValidationSupport.validate(selectedValue, _resources, _validate);
+ fieldValidationSupport.validate(selectedValue, resources, validate);
- _value = selectedValue;
+ value = selectedValue;
}
catch (ValidationException ex)
{
- _tracker.recordError(this, ex.getMessage());
+ tracker.recordError(this, ex.getMessage());
}
}
@@ -169,9 +169,9 @@
{
writer.element("select", "name", getControlName(), "id", getClientId());
- _validate.render(writer);
+ validate.render(writer);
- _resources.renderInformalParameters(writer);
+ resources.renderInformalParameters(writer);
// Disabled is via a mixin
}
@@ -179,18 +179,18 @@
@SuppressWarnings("unchecked")
ValueEncoder defaultEncoder()
{
- return _defaultProvider.defaultValueEncoder("value", _resources);
+ return defaultProvider.defaultValueEncoder("value", resources);
}
@SuppressWarnings("unchecked")
SelectModel defaultModel()
{
- Class valueType = _resources.getBoundType("value");
+ Class valueType = resources.getBoundType("value");
if (valueType == null) return null;
if (Enum.class.isAssignableFrom(valueType))
- return new EnumSelectModel(valueType, _resources.getContainerMessages());
+ return new EnumSelectModel(valueType, resources.getContainerMessages());
return null;
}
@@ -200,13 +200,13 @@
*/
FieldValidator defaultValidate()
{
- Class type = _resources.getBoundType("value");
+ Class type = resources.getBoundType("value");
if (type == null) return null;
- return _fieldValidatorDefaultSource.createDefaultValidator(this, _resources.getId(),
- _resources.getContainerMessages(), _locale, type,
- _resources.getAnnotationProvider("value"));
+ return fieldValidatorDefaultSource.createDefaultValidator(this, resources.getId(),
+ resources.getContainerMessages(), locale, type,
+ resources.getAnnotationProvider("value"));
}
Binding defaultValue()
@@ -216,9 +216,9 @@
Object defaultBlankLabel()
{
- Messages containerMessages = _resources.getContainerMessages();
+ Messages containerMessages = resources.getContainerMessages();
- String key = _resources.getId() + "-blanklabel";
+ String key = resources.getId() + "-blanklabel";
if (containerMessages.contains(key)) return containerMessages.get(key);
@@ -231,44 +231,44 @@
@BeforeRenderTemplate
void options(MarkupWriter writer)
{
- _selectedClientValue = _tracker.getInput(this);
+ selectedClientValue = tracker.getInput(this);
// Use the value passed up in the form submission, if available.
// Failing that, see if there is a current value (via the value parameter), and
// convert that to a client value for later comparison.
- if (_selectedClientValue == null) _selectedClientValue = _value == null ? null : _encoder.toClient(_value);
+ if (selectedClientValue == null) selectedClientValue = value == null ? null : encoder.toClient(value);
if (showBlankOption())
{
writer.element("option", "value", "");
- writer.write(_blankLabel);
+ writer.write(blankLabel);
writer.end();
}
SelectModelVisitor renderer = new Renderer(writer);
- _model.visit(renderer);
+ model.visit(renderer);
}
@Override
public boolean isRequired()
{
- return _validate.isRequired();
+ return validate.isRequired();
}
private boolean showBlankOption()
{
- switch (_blankOption)
+ switch (blankOption)
{
case ALWAYS:
return true;
+
case NEVER:
return false;
default:
-
return !isRequired();
}
}
@@ -277,29 +277,29 @@
void setModel(SelectModel model)
{
- _model = model;
- _blankOption = BlankOption.NEVER;
+ this.model = model;
+ blankOption = BlankOption.NEVER;
}
void setValue(Object value)
{
- _value = value;
+ this.value = value;
}
void setValueEncoder(ValueEncoder encoder)
{
- _encoder = encoder;
+ this.encoder = encoder;
}
void setValidationTracker(ValidationTracker tracker)
{
- _tracker = tracker;
+ this.tracker = tracker;
}
void setBlankOption(BlankOption option, String label)
{
- _blankOption = option;
- _blankLabel = label;
+ blankOption = option;
+ blankLabel = label;
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Submit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Submit.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Submit.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Submit.java Tue May 6 18:00:03 2008
@@ -40,23 +40,23 @@
* submission (this is usually desirable).
*/
@Parameter
- private boolean _defer = true;
+ private boolean defer = true;
@Environmental
- private FormSupport _formSupport;
+ private FormSupport formSupport;
@Environmental
- private Heartbeat _heartbeat;
+ private Heartbeat heartbeat;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
@Inject
- private Request _request;
+ private Request request;
@SuppressWarnings("unused")
@Mixin
- private RenderDisabled _renderDisabled;
+ private RenderDisabled renderDisabled;
public Submit()
{
@@ -64,14 +64,14 @@
Submit(Request request)
{
- _request = request;
+ this.request = request;
}
void beginRender(MarkupWriter writer)
{
writer.element("input", "type", "submit", "name", getControlName(), "id", getClientId());
- _resources.renderInformalParameters(writer);
+ resources.renderInformalParameters(writer);
}
void afterRender(MarkupWriter writer)
@@ -82,7 +82,7 @@
@Override
protected void processSubmission(String elementName)
{
- String value = _request.getParameter(elementName);
+ String value = request.getParameter(elementName);
if (value == null) return;
@@ -90,7 +90,7 @@
{
public void run()
{
- _resources.triggerEvent(SELECTED_EVENT, null, null);
+ resources.triggerEvent(SELECTED_EVENT, null, null);
}
};
@@ -98,8 +98,8 @@
// heartbeat). This is most likely because the Submit is inside a Loop and some contextual
// information will change if we defer.
- if (_defer) _formSupport.defer(sendNotification);
- else _heartbeat.defer(sendNotification);
+ if (defer) formSupport.defer(sendNotification);
+ else heartbeat.defer(sendNotification);
}
@@ -107,13 +107,13 @@
void setDefer(boolean defer)
{
- _defer = defer;
+ this.defer = defer;
}
void setup(ComponentResources resources, FormSupport support, Heartbeat heartbeat)
{
- _resources = resources;
- _formSupport = support;
- _heartbeat = heartbeat;
+ this.resources = resources;
+ formSupport = support;
+ this.heartbeat = heartbeat;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/SubmitNotifier.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/SubmitNotifier.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/SubmitNotifier.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/SubmitNotifier.java Tue May 6 18:00:03 2008
@@ -30,38 +30,38 @@
{
private static final class TriggerEvent implements ComponentAction<SubmitNotifier>
{
- private final String _eventType;
+ private final String eventType;
public TriggerEvent(String eventType)
{
- _eventType = eventType;
+ this.eventType = eventType;
}
public void execute(SubmitNotifier component)
{
- component.trigger(_eventType);
+ component.trigger(eventType);
}
}
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
@Environmental
- private FormSupport _formSupport;
+ private FormSupport formSupport;
void beginRender()
{
- _formSupport.store(this, new TriggerEvent("BeginSubmit"));
+ formSupport.store(this, new TriggerEvent("BeginSubmit"));
}
void afterRender()
{
- _formSupport.store(this, new TriggerEvent("AfterSubmit"));
+ formSupport.store(this, new TriggerEvent("AfterSubmit"));
}
private void trigger(String eventType)
{
- _resources.triggerEvent(eventType, null, null);
+ resources.triggerEvent(eventType, null, null);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/TextArea.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/TextArea.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/TextArea.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/TextArea.java Tue May 6 18:00:03 2008
@@ -28,7 +28,7 @@
*/
public final class TextArea extends AbstractTextField
{
- private String _value;
+ private String value;
@Override
protected final void writeFieldTag(MarkupWriter writer, String value)
@@ -43,14 +43,14 @@
// Save until needed in after()
- _value = value;
+ this.value = value;
}
final void afterRender(MarkupWriter writer)
{
// TextArea will not have a template.
- if (_value != null) writer.write(_value);
+ if (value != null) writer.write(value);
writer.end(); // textarea
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/TextOutput.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/TextOutput.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/TextOutput.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/TextOutput.java Tue May 6 18:00:03 2008
@@ -28,18 +28,18 @@
public class TextOutput
{
@Parameter(required = true)
- private String _value;
+ private String value;
@Mixin
- private DiscardBody _discardBody;
+ private DiscardBody discardBody;
private static final Pattern SPLIT_PATTERN = Pattern.compile("((\\r\\n)|\\r|\\n)", Pattern.MULTILINE);
void beginRender(MarkupWriter writer)
{
- if (_value == null) return;
+ if (value == null) return;
- String[] lines = SPLIT_PATTERN.split(_value);
+ String[] lines = SPLIT_PATTERN.split(value);
for (String line : lines)
{
@@ -53,6 +53,6 @@
void injectValue(String value)
{
- _value = value;
+ this.value = value;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Unless.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Unless.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Unless.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Unless.java Tue May 6 18:00:03 2008
@@ -27,14 +27,14 @@
* If true, then the body of the If component is rendered. If false, the body is omitted.
*/
@Parameter(required = true)
- private boolean _test;
+ private boolean test;
/**
- * An alternate {@link Block} to render if the test parameter is false. The default, null, means render nothing in
- * that situation.
+ * An alternate {@link org.apache.tapestry.Block} to render if the test parameter is false. The default, null, means
+ * render nothing in that situation.
*/
- @Parameter
- private Block _else;
+ @Parameter(name = "else")
+ private Block elseBlock;
/**
* Returns null if the test parameter is true, which allows normal rendering (of the body). If the test parameter is
@@ -42,7 +42,7 @@
*/
Object beginRender()
{
- return !_test ? null : _else;
+ return !test ? null : elseBlock;
}
/**
@@ -51,12 +51,12 @@
*/
boolean beforeRenderBody()
{
- return !_test;
+ return !test;
}
void setup(boolean test, Block elseBlock)
{
- _test = test;
- _else = elseBlock;
+ this.test = test;
+ this.elseBlock = elseBlock;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Zone.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Zone.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Zone.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Zone.java Tue May 6 18:00:03 2008
@@ -48,7 +48,7 @@
* <div> visible before being updated. If not specified, then the basic "show" method is used.
*/
@Parameter(defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
- private String _show;
+ private String show;
/**
* Name of a function on the client-side Tapestry.ElementEffect object that is invoked after the Zone's content has
@@ -56,44 +56,44 @@
* to indicate to the user that and update has taken place.
*/
@Parameter(defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
- private String _update;
+ private String update;
- private String _clientId;
+ private String clientId;
@Environmental
- private PageRenderSupport _pageRenderSupport;
+ private PageRenderSupport pageRenderSupport;
@Environmental
- private ClientBehaviorSupport _clientBehaviorSupport;
+ private ClientBehaviorSupport clientBehaviorSupport;
/**
* If true (the default) then the zone will render normally. If false, then the "t-invisible" CSS class is added,
* which will make the zone initially invisible.
*/
@Parameter
- private boolean _visible = true;
+ private boolean visible = true;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
void beginRender(MarkupWriter writer)
{
- _clientId = _pageRenderSupport.allocateClientId(_resources);
+ clientId = pageRenderSupport.allocateClientId(resources);
- Element e = writer.element("div", "id", _clientId);
+ Element e = writer.element("div", "id", clientId);
- _resources.renderInformalParameters(writer);
+ resources.renderInformalParameters(writer);
e.addClassName("t-zone");
- if (!_visible) e.addClassName("t-invisible");
+ if (!visible) e.addClassName("t-invisible");
// And continue on to render the body
JSONObject spec = new JSONObject();
- spec.put("div", _clientId);
+ spec.put("div", clientId);
- _clientBehaviorSupport.addZone(_clientId, _show, _update);
+ clientBehaviorSupport.addZone(clientId, show, update);
}
void afterRender(MarkupWriter writer)
@@ -103,6 +103,6 @@
public String getClientId()
{
- return _clientId;
+ return clientId;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/MethodAdviceDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/MethodAdviceDemo.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/MethodAdviceDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/MethodAdviceDemo.java Tue May 6 18:00:03 2008
@@ -49,6 +49,28 @@
}
@ReverseStrings
+ public int[] getIntArray()
+ {
+ return null;
+ }
+
+ @ReverseStrings
+ public void setIntArray(int[] array)
+ {
+ }
+
+ @ReverseStrings
+ public String[] getStringArray()
+ {
+ return null;
+ }
+
+ @ReverseStrings
+ public void setStringArray(String[] array)
+ {
+ }
+
+ @ReverseStrings
public String getCranky() throws DearGodWhyMeException
{
throw new DearGodWhyMeException();
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AspectInterceptorBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AspectInterceptorBuilderImpl.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AspectInterceptorBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AspectInterceptorBuilderImpl.java Tue May 6 18:00:03 2008
@@ -211,7 +211,7 @@
if (hasChecked) builder.addln("try").begin();
if (isNonVoid)
- builder.add("%s result = ", returnType.getName());
+ builder.add("%s result = ", ClassFabUtils.toJavaClassName(returnType));
builder.add("_delegate.%s(", method.getName());
Added: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/ArraysSubject.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/ArraysSubject.java?rev=653960&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/ArraysSubject.java (added)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/ArraysSubject.java Tue May 6 18:00:03 2008
@@ -0,0 +1,20 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc.internal.services;
+
+public interface ArraysSubject
+{
+ String[] operation(String[] inputs);
+}
Added: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/ArraysSubjectImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/ArraysSubjectImpl.java?rev=653960&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/ArraysSubjectImpl.java (added)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/ArraysSubjectImpl.java Tue May 6 18:00:03 2008
@@ -0,0 +1,23 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc.internal.services;
+
+public class ArraysSubjectImpl implements ArraysSubject
+{
+ public String[] operation(String[] inputs)
+ {
+ return inputs;
+ }
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/AspectInterceptorBuilderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/AspectInterceptorBuilderImplTest.java?rev=653960&r1=653959&r2=653960&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/AspectInterceptorBuilderImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/AspectInterceptorBuilderImplTest.java Tue May 6 18:00:03 2008
@@ -134,6 +134,43 @@
verify();
}
+ @Test
+ public void arrays_as_parameters_and_result()
+ {
+ ArraysSubject delegate = new ArraysSubjectImpl();
+
+ MethodAdvice advice = new MethodAdvice()
+ {
+ public void advise(Invocation invocation)
+ {
+ String[] param = (String[]) invocation.getParameter(0);
+
+ for (int i = 0; i < param.length; i++)
+ {
+ param[i] = param[i].toUpperCase();
+ }
+
+ invocation.proceed();
+
+ String[] result = (String[]) invocation.getResult();
+
+ for (int i = 0; i < result.length; i++)
+ {
+ result[i] = i + ":" + result[i];
+ }
+ }
+ };
+
+ ArraysSubject advised = decorator.build(ArraysSubject.class, delegate, advice, "whatever");
+
+ String[] inputs = { "Fred", "Barney" };
+
+ String[] result = advised.operation(inputs);
+
+ assertEquals(result[0], "0:FRED");
+ assertEquals(result[1], "1:BARNEY");
+ }
+
protected final MethodAdvice mockAdvice()
{
return newMock(MethodAdvice.class);