You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by John Coleman <jo...@sopranewellandbudge.com> on 2006/11/13 17:09:46 UTC
PropertySelection
Hi,
I've created my own flavour of PropertySelection called
PropertySelectionWithHint that may display a "choose an option below" in the
first option of the list.
When there are no elements in the list the components render method just
returns . When this happens I'd like the associated TextField label
component to also not display.
So I added this @If to the template:
<span jwcid="@If" condition="ognl:components.ProductComponentSelect.renderable">
<div class="formLine">
<div class="colLabel">
<span jwcid="topicDetailLabel">Topic Detail</span>
</div>
<div id="productComponentFilter">
<select id="selComponent" jwcid="ProductComponentSelect" tabindex="2"
onchange="displayProductComponentChangeWaitMessage(); this.form.events.refresh
()"/>
</div>
<div id="productComponentWait" class="hide">
Please wait...
</div>
</div>
I've added this method to the component:
public Boolean isRenderable()
{
IPropertySelectionModel model = getModel();
if (model == null)
{
throw Tapestry.createRequiredParameterException
(this, "model");
}
int count = model.getOptionCount();
// we only render anything if there are some items to actually
chose from
return new Boolean(count > 0);
}
How do I access the method or a property so that my @If will work please? I
tried adding abstract methods but can't see how I invoke them when required.
For example putting the property set in the constructor seems no good:
public PropertySelectionWithHint()
{
setRenderable(isRenderable());
}
TIA
John
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org