下に 2 つのラジオ ボタン (値 A または B) とパレット領域があります。値Aが選択されているときにパレットを表示し、Bが選択されているときにパレットを非表示にしたいので、ajaxを更新します。どうやってするの?既存のプロジェクトで古い Tapestry 4.0.2 を使用しているため、アップグレードできません。
これまでの私のコードは次のとおりです
マークアップ:
<span jwcid="models@RadioGroup" selected="ognl:modelOption">
<tr>
<td class="dataLabel" width="15%">
</td>
<td>
<input type="radio" jwcid="@Radio" value="ognl:@com.example.MyPage@ALL"/> All models (Default)
</td>
</tr>
<tr>
<td class="dataLabel" width="15%">
</td>
<td>
<input type="radio" jwcid="@Radio" value="ognl:@com.example.MyPage@SPECIFIC"/> Specific models
</td>
</tr>
</span>
<span jwcid="@If" condition="ognl:specificDeviceModels">
<tr>
<td class="dataLabel" width="15%">
<span key="supportedDeviceModelsLabel">Supported device models:</span>:
</td>
<td>
<div class="bundle_palette">
<span jwcid="palette"/>
</div>
</td>
</tr>
</span>
ジャワ:
public static final Integer ALL = new Integer(1);
public static final Integer SPECIFIC = new Integer(2);
public abstract Integer getModelOption();
public abstract List<DeviceModel> getSelectedDeviceModels();
public abstract void setSelectedDeviceModels(List<DeviceModel> deviceModels);
public abstract void setDeviceModels(List<DeviceModel> deviceModels);
public abstract List<DeviceModel> getDeviceModels();
@Component(type = "contrib:Palette", bindings = {"selected=selectedDeviceModels", "model=deviceModel"})
public abstract Palette getPalette();
public IPropertySelectionModel getDeviceModel() {
return new OptionValueSelectionModel(getDeviceModels()).sorted();
}
public void pageBeginRender(PageEvent event) {
setDeviceModels(getDeviceService().findDeviceModels(null));
}
public boolean getSpecificDeviceModels() {
//here I need to set boolean value and return it
return true/false;
}