2 Replies Latest reply on May 15, 2009 5:24 PM by Iskandar Salim

    Wicket Jbpm

    Iskandar Salim Newbie

      Hi,


      I'm trying to port the seam todo example to Wicket. I've managed to insert task instances but how do I retrieve the task list like in the seam todo example? In the todo.jsp in the example, task lists are retrieved with the #{taskInstancePriorityList} variable. How do I do this in Wicket?


      What would be the correct scope for the injected TaskInstancePriorityList?


      Below is what I have. In this case, taskInstancePriorityList is always null.


      Thanks.


      public class HomePage extends BasePage {
      
          @In
          Actor actor;
          @In(create = true)
          Login login;
          @In(required = false, scope = ScopeType.APPLICATION)
          TaskInstancePriorityList taskInstancePriorityList;
          @In(create = true)
          TodoList todoList;
          List<TaskInstance> taskInstances = new ArrayList<TaskInstance>();
      
          public HomePage() {
              if (taskInstancePriorityList != null) {
                  setTaskInstances(taskInstancePriorityList.getTaskInstanceList());
              }
              ListView view = new ListView("taskInstances", new PropertyModel(this, "taskInstances")) {
      
                  @Override
                  protected void populateItem(ListItem item) {
                      TaskInstance taskInstance = (TaskInstance) item.getModelObject();
                      item.add(new Label("id", new Model(taskInstance.getId())));
                  }
              };
              add(view);
              Form form = new Form("form") {
      
                  @Override
                  protected void onSubmit() {
                      ValueMap values = (ValueMap) getModelObject();
                      String description = values.getString("description");
                      todoList.setDescription(description);
                      todoList.createTodo();
                      super.onSubmit();
                  }
              };
              form.setModel(new CompoundPropertyModel(new ValueMap()));
              form.add(new TextField("description"));
              add(form);
          }
      
          public List<TaskInstance> getTaskInstances() {
              return taskInstances;
          }
      
          public void setTaskInstances(List<TaskInstance> taskInstances) {
              this.taskInstances = taskInstances;
          }
      }