Package org.wicketstuff.progressbar.spring

Examples of org.wicketstuff.progressbar.spring.TaskProgressionModel


  }

  public TaskServiceProgressExamplePage() {
    final Form form = new Form("form");
    final ProgressBar bar;
    final TaskProgressionModel progressionModel = new TaskProgressionModel() {
      @Override
      protected ITaskService getTaskService() {
        return getExampleApplication().getTaskService();
      }
    };
    form.add(bar = new ProgressBar("bar", progressionModel) {
      @Override
      protected void onFinished(AjaxRequestTarget target) {
        ITaskService taskService = getExampleApplication()
            .getTaskService();
        // finish the task!
        taskService.finish(progressionModel.getTaskId());
        // Hide progress bar after finish
        setVisible(false);
        // Add some JavaScript after finish
        target.appendJavaScript("alert('Task done and finished!')");

        // re-enable button
        Component button = form.get("submit");
        button.setEnabled(true);
        target.addComponent(button);
      }
    });
    // Hide progress bar initially
    bar.setVisible(false);

    form.add(new IndicatingAjaxButton("submit", form) {
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form form) {
        ITaskService taskService = getExampleApplication()
            .getTaskService();
        // Schedule and start a new task
        Long taskId = taskService.scheduleAndStart(new DummyTask(60));
        // Set taskId for model
        progressionModel.setTaskId(taskId);
        // Start the progress bar, will set visibility to true
        bar.start(target);

        // disable button
        setEnabled(false);
View Full Code Here


  public TaskServiceProgressExamplePage()
  {
    final Form<Void> form = new Form<Void>("form");
    final ProgressBar bar;
    final TaskProgressionModel progressionModel = new TaskProgressionModel()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected ITaskService getTaskService()
      {
        return getExampleApplication().getTaskService();
      }
    };
    form.add(bar = new ProgressBar("bar", progressionModel)
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onFinished(AjaxRequestTarget target)
      {
        ITaskService taskService = getExampleApplication().getTaskService();
        // finish the task!
        taskService.finish(progressionModel.getTaskId());
        // Hide progress bar after finish
        setVisible(false);
        // Add some JavaScript after finish
        target.appendJavaScript("alert('Task done and finished!')");

        // re-enable button
        Component button = form.get("submit");
        button.setEnabled(true);
        target.add(button);
      }
    });
    // Hide progress bar initially
    bar.setVisible(false);

    form.add(new IndicatingAjaxButton("submit", form)
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        ITaskService taskService = getExampleApplication().getTaskService();
        // Schedule and start a new task
        Long taskId = taskService.scheduleAndStart(new DummyTask(60));
        // Set taskId for model
        progressionModel.setTaskId(taskId);
        // Start the progress bar, will set visibility to true
        bar.start(target);

        // disable button
        setEnabled(false);
View Full Code Here

TOP

Related Classes of org.wicketstuff.progressbar.spring.TaskProgressionModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.