개발햄비

[wicket]wicket ラジオ、radio使い方、例 본문

개발/wicket

[wicket]wicket ラジオ、radio使い方、例

개발햄 2019. 1. 27. 13:39

ラジオボタンの例です。


public class RadioChoicePage extends WebPage {

 

   //variable to hold radiobox values

   private String selected ;

   public RadioChoicePage(final PageParameters parameters) {

 

      add(new FeedbackPanel("feedback"));

      Form<Void> form =new Form<Void>("form");

 

      add(form);

      List<TableData> list =new ArrayList<TableData>();

      SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");

      for(int i= 1 ;i<5 ;i++) {

         TableData list1 =new TableData();

         list1.setNumber("0000000"+i);

         list1.setTime(format.format(new Date()));

         list1.setProductNum("0000000"+i);

         if(i==1) {

            list1.setStatus("0");

         }else {

            list1.setStatus("1");

         }

         list.add(list1);

      }

 

      final RadioGroup group=new RadioGroup("group",new PropertyModel<String>(this,                                             "selected"));

      form.add(group);

      ListView<TableData> testListView = new ListView<TableData>("persons", list) {

         private static final long serialVersionUID = 1L;

 

         @Override

         protected void populateItem(ListItem<TableData> item) {

            TableData list1 = item.getModelObject();


            item.add(new Radio("radio", Model.of(list1.getNumber())));

            item.add(new Label("number", list1.getNumber()));

            item.add(new Label("time", list1.getTime()));

            item.add(new Label("productNum", list1.setProductNum()));

            item.add(new Label("status", list1.getStatus()));

 

         }

      };

      group.add(testListView);

'개발 > wicket' 카테고리의 다른 글

[wicket] radioGroup 例  (0) 2019.03.19
[wicket] wicket button javascript 転送の例  (0) 2019.02.16
[wicket] wicket button 例  (0) 2019.02.16