Skip to content

Commit

Permalink
Make it easier to customize some of the text and labels using by the …
Browse files Browse the repository at this point in the history
…MultipleSelect component
  • Loading branch information
hlship committed Mar 28, 2011
1 parent e8545af commit 8a14a43
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
Expand Up @@ -39,6 +39,7 @@
import org.apache.tapestry5.func.Flow;
import org.apache.tapestry5.func.Mapper;
import org.apache.tapestry5.internal.bindings.AbstractBinding;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.json.JSONArray;
import org.apache.tapestry5.json.JSONObject;
Expand Down Expand Up @@ -103,6 +104,14 @@ public class MultipleSelect implements Field
@Parameter(defaultPrefix = BindingConstants.LITERAL)
private String label;

@Property(write = false)
@Parameter(defaultPrefix = BindingConstants.LITERAL, value = "message:tapx-multiple-select-selected-column-label")
private String selectedColumnLabel;

@Property(write = false)
@Parameter(defaultPrefix = BindingConstants.LITERAL, value = "message:tapx-multiple-select-available-column-label")
private String availableColumnLabel;

/**
* Alternate label used to represent a "single" instance of the value; this is used as part of
* button labels, and in the title of the modal dialog.
Expand All @@ -123,6 +132,9 @@ public class MultipleSelect implements Field
@Inject
private ComponentResources resources;

@Inject
private Messages messages;

@Inject
private ComponentDefaultProvider defaultProvider;

Expand Down Expand Up @@ -375,4 +387,9 @@ Object onFailureFromNewValue()
{
return newValueEditor.getBody();
}

public String getAddNewButtonLabel()
{
return messages.format("tapx-multiple-select-add-button-label", singularLabel);
}
}

This file was deleted.

Expand Up @@ -2,16 +2,20 @@
<input type="hidden" name="${controlName}"/>
<div>
<div class="tx-available">
<div class="tx-title">Available:</div>
<select id="${clientId}" multiple=" multiple "/>
<label>
<div class="tx-title">${availableColumnLabel}</div>
<select id="${clientId}" multiple=" multiple "/>
</label>
</div>
<div class="tx-controls">
<span class="tx-select tx-disabled" title="Select"/>
<span class="tx-deselect tx-disabled" title="Deselect"/>
</div>
<div class="tx-selected">
<div class="tx-title">Selected:</div>
<select multiple="multiple"/>
<label>
<div class="tx-title">${selectedColumnLabel}</div>
<select multiple="multiple"/>
</label>
</div>
</div>
<div class="tx-input">
Expand All @@ -37,7 +41,7 @@
<t:beaneditor object="newValue" model="beanModel" overrides="componentResources"/>
<div class="t-beaneditor-row">

<input type="submit" value="${message:submit-label}"/>
<input type="submit" value="${message:tapx-multiple-select-submit-label}"/>
</div>
</t:form>
</t:zone>
Expand Down
Expand Up @@ -131,8 +131,9 @@ DIV.tx-multiselect SELECT {
DIV.tx-multiselect .tx-title {
color: white;
background: black;
width: 200px;
width: 197px;
font-weight: bold;
padding: 3px 0px 3px 3px;
}

DIV.tx-multiselect .tx-available, DIV.tx-multiselect .tx-controls, DIV.tx-multiselect .tx-selected {
Expand Down
Expand Up @@ -3,3 +3,15 @@ tapx-default-confirm-title=Confirm
tapx-expand-label=Expand
tapx-collapse-label=Collapse

# MultipleSelect component:

# The submit button in the modal-dialog BeanEditForm when adding a new
# value.

tapx-multiple-select-submit-label=Add

# The substituted value is the singular name of the value type.
tapx-multiple-select-add-button-label=Add New %s

tapx-multiple-select-selected-column-label=Selected
tapx-multiple-select-available-column-label=Available
Expand Up @@ -119,7 +119,7 @@ Tapx.extendInitializer(function() {

var hidden = outerDiv.down("input[type='hidden']");

var selectedSelect = outerDiv.down(".tx-selected > select");
var selectedSelect = outerDiv.down(".tx-selected select");

(spec.model || []).each(function(row) {

Expand Down

0 comments on commit 8a14a43

Please sign in to comment.