0

我有两个单选按钮(值 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;
}
4

1 回答 1

0

作为旧版 Tapestry 的解决方案,我不得不使用 tacos 库:

http://tacos.sourceforge.net/components/tapestry/RadioGroup.html

于 2013-06-25T11:29:56.483 回答