Example usage for org.apache.wicket.ajax AbstractAjaxTimerBehavior AbstractAjaxTimerBehavior

List of usage examples for org.apache.wicket.ajax AbstractAjaxTimerBehavior AbstractAjaxTimerBehavior

Introduction

In this page you can find the example usage for org.apache.wicket.ajax AbstractAjaxTimerBehavior AbstractAjaxTimerBehavior.

Prototype

public AbstractAjaxTimerBehavior(final Duration updateInterval) 

Source Link

Document

Construct.

Usage

From source file:org.artifactory.webapp.wicket.page.security.acl.AclsPage.java

License:Open Source License

/**
 * Creates an acls page and opens the permission target for editing.
 *
 * @param ptiToEdit Permission target to edit
 *//*from  www .j  av a  2 s . c om*/
public AclsPage(final MutablePermissionTargetInfo ptiToEdit) {
    // only admins can reach here
    if (!authService.isAdmin()) {
        throw new UnauthorizedInstantiationException(AclsPage.class);
    }
    // create the panel
    final PermissionTargetListPanel panel = new PermissionTargetListPanel("permissionTargetList");
    add(panel);

    if (ptiToEdit != null) {
        // use very short ajax timer to open the edit panel
        add(new AbstractAjaxTimerBehavior(Duration.milliseconds(1)) {
            @Override
            protected void onTimer(AjaxRequestTarget target) {
                stop(); // don't fire again
                ModalHandler modalHandler = ModalHandler.getInstanceFor(AclsPage.this);
                modalHandler.setModalPanel(panel.newUpdateItemPanel(ptiToEdit));
                modalHandler.show(target);
            }
        });
    }
}

From source file:org.bosik.diacomp.web.frontend.wicket.pages.register.activate.ActivationPage.java

License:Open Source License

@Override
protected void onInitialize() {
    super.onInitialize();

    FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
    add(feedbackPanel);/*from   ww w.  j  ava2  s .  c  om*/

    StringValue parKey = getPageParameters().get("key");

    if (parKey.isEmpty()) {
        feedbackPanel.error(getString("feedback.error.invalidKey"));
    } else {
        try {
            // activation
            String key = parKey.toString();
            int userId = authService.activate(key);

            // authentication
            String userName = authService.getNameById(userId);
            String userInfo = String.format("%d:%s", userId, userName);
            List<GrantedAuthority> authorities = new ArrayList<>();
            authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
            Authentication authentication = new UsernamePasswordAuthenticationToken(userInfo, "", authorities);
            SecurityContext context = SecurityContextHolder.getContext();
            context.setAuthentication(authentication);

            // UI feedback
            add(new AbstractAjaxTimerBehavior(Duration.seconds(2)) {
                private static final long serialVersionUID = 5004084381865627895L;

                @Override
                protected void onTimer(AjaxRequestTarget target) {
                    ActivationPage.this.setResponsePage(getApplication().getHomePage());
                }
            });
            feedbackPanel.info(getString("feedback.info.done"));
        } catch (NotAuthorizedException e) {
            feedbackPanel.error(getString("feedback.error.invalidKey"));
        } catch (Exception e) {
            e.printStackTrace();
            feedbackPanel.error(getString("feedback.error.invalidKey"));
        }
    }
}

From source file:org.dcm4chee.web.war.MainPage.java

License:LGPL

public MainPage() {
    super();/*  w  w w.ja  v a  2  s  .  co m*/
    if (StudyPermissionHelper.get().isSSO())
        add(new AbstractAjaxTimerBehavior(Duration.milliseconds(1)) {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onTimer(AjaxRequestTarget arg0) {
                try {
                    StudyPermissionHelper.get().doDicomAuthentication();
                } catch (Exception e) {
                    log.error(getClass().getName() + ": error doing dicom authentication: ", e);
                } finally {
                    this.stop();
                }
            }
        });
    HttpSession session = ((WebRequest) getRequest()).getHttpServletRequest().getSession();
    add(new AbstractAjaxTimerBehavior(Duration.milliseconds((session.getMaxInactiveInterval() + 1) * 1000)) {

        private static final long serialVersionUID = 1L;
        private long lastTime = 0l;

        @Override
        protected void onTimer(AjaxRequestTarget arg0) {
            HttpSession session = ((WebRequest) getRequest()).getHttpServletRequest().getSession();
            long now = System.currentTimeMillis();
            if (log.isDebugEnabled()) {
                log.debug("############### Session Timeout checker!");
                log.debug("####### session getMaxInactiveInterval:" + session.getMaxInactiveInterval());
                log.debug("####### session getLastAccessedTime:" + session.getLastAccessedTime());
                log.debug("####### session currentTime:" + now);
                log.debug("####### session currentTime-lastAccessedTime:"
                        + (now - session.getLastAccessedTime()));
                log.debug("####### session lastTime:" + lastTime);
                log.debug("####### session LastAccessedTime-lastTime:"
                        + (session.getLastAccessedTime() - lastTime));
            }
            if (session.getLastAccessedTime() < lastTime) {
                session.invalidate();
                this.setUpdateInterval(Duration.milliseconds(1000));
            } else {
                long wait = (session.getMaxInactiveInterval() + 1) * 1000 - now + session.getLastAccessedTime();
                lastTime = now + 2000;
                this.setUpdateInterval(Duration.milliseconds(wait));
            }
        }
    });
    addModules(getModuleSelectorPanel());

}

From source file:org.dcm4chee.web.war.tc.imageview.TCImageViewPage.java

License:LGPL

public TCImageViewPage(PageParameters params) {
    super();/*from ww w . jav  a 2  s.c  om*/

    if (StudyPermissionHelper.get().isSSO()) {
        add(new AbstractAjaxTimerBehavior(Duration.milliseconds(1)) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onTimer(AjaxRequestTarget arg0) {
                try {
                    StudyPermissionHelper.get().doDicomAuthentication();
                } catch (Exception e) {
                    log.error(getClass().getName() + ": error doing dicom authentication: ", e);
                } finally {
                    this.stop();
                }
            }
        });
    }

    if (LAYOUT_CSS != null) {
        add(CSSPackageResource.getHeaderContribution(LAYOUT_CSS));
    }

    if (TC_CSS != null) {
        add(CSSPackageResource.getHeaderContribution(TC_CSS));
    }

    if (THEME_CSS != null) {
        add(CSSPackageResource.getHeaderContribution(THEME_CSS));
    }

    final String stuid = params != null ? params.getString("stuid") : null;
    final String suid = params != null ? params.getString("suid") : null;
    final String iuid = params != null ? params.getString("iuid") : null;

    Label titleLabel = new Label("app_browser_title", new Model<String>(
            getLocalizedString("application.browser_title", "Image Viewer (Not for diagnostic use!)")));

    indicatingModel = new Model<String>(getLocalizedString("loading.images.text"));
    indicatingLabel = new Label("tc-images-view-indicating-label", indicatingModel);
    indicatingLabel.setOutputMarkupId(true);

    indicatingImage = new Image("tc-images-view-indicating-image",
            new ResourceReference(TCPanel.class, "css/theme/images/load-indicator-large.gif"));
    indicatingImage.setOutputMarkupId(true);

    indicatingPanel = new WebMarkupContainer("tc-images-view-indicating-panel");
    indicatingPanel.add(indicatingLabel);
    indicatingPanel.add(indicatingImage);
    indicatingPanel.setOutputMarkupId(true);
    indicatingPanel.setOutputMarkupPlaceholderTag(true);
    indicatingPanel.setVisible(true);

    imagesPanel = new WebMarkupContainer("tc-images-view-images-panel");
    imagesPanel.setOutputMarkupId(true);
    imagesPanel.setOutputMarkupPlaceholderTag(true);
    imagesPanel.setVisible(false);

    add(titleLabel);
    add(new Label("diagnosisWarning", new ResourceModel("warning.diagnosis.text"))
            .add(new AttributeModifier("class", true, new Model<String>("diagnosis-warning"))));
    add(imagesPanel);
    add(indicatingPanel);
    add(new StartImageLoadBehavior(stuid, suid, iuid));
    add((popupManager = new TCPopupManager()).getGlobalHideOnOutsideClickHandler());
}

From source file:org.dcm4chee.web.war.tc.TCCaseViewPage.java

License:LGPL

@SuppressWarnings("serial")
public TCCaseViewPage(PageParameters params) {
    super(params);

    if (StudyPermissionHelper.get().isSSO()) {
        add(new AbstractAjaxTimerBehavior(Duration.milliseconds(1)) {
            private static final long serialVersionUID = 1L;

            @Override/*from   ww  w  . j ava 2s  .c  o  m*/
            protected void onTimer(AjaxRequestTarget arg0) {
                try {
                    StudyPermissionHelper.get().doDicomAuthentication();
                } catch (Exception e) {
                    log.error(getClass().getName() + ": error doing dicom authentication: ", e);
                } finally {
                    this.stop();
                }
            }
        });
    }

    add(TCEnvironment.getCSSHeaderContributor());

    add((popupManager = new TCPopupManager()).getGlobalHideOnOutsideClickHandler());

    add(new Label("tc-casepage-title", TCUtilities.getLocalizedString("tc.casepage.title")));

    String uid = params.getString("uid");
    if (uid != null) {
        TCQueryLocal dao = (TCQueryLocal) JNDIUtils.lookup(TCQueryLocal.JNDI_NAME);

        Instance instance = dao.findInstanceByUID(uid);

        final Image logo = new Image("img_logo",
                new ResourceReference(ModuleSelectorPanel.class, "images/logo.gif"));
        logo.setOutputMarkupId(true);
        logo.setVisible(false);
        add(logo);

        if (instance != null) {
            try {
                final TCViewPanel panel = new TCViewPanel("tc-case", new TCModel(instance),
                        new TCAttributeVisibilityStrategy(new Model<Boolean>(false)) {
                            @Override
                            public boolean isAttributeVisible(TCAttribute attr) {
                                if (TCEnvironment.isPrincipalAuthorized("TCViewRestricted")) {
                                    return true;
                                }

                                return !attr.isRestricted();
                            }
                        }, null);

                add(panel);

                add(getErrorComponent(null));

                logo.setVisible(true);

                add(new HeaderContributor(new IHeaderContributor() {
                    public void renderHead(IHeaderResponse response) {
                        StringBuilder js = new StringBuilder();
                        js.append("updateTCViewDialog(true);");
                        js.append(panel.getDisableTabsJavascript());
                        js.append(panel.getHideTabsJavascript());

                        response.renderOnDomReadyJavascript(js.toString());
                    }
                }));
            } catch (Exception e) {
                add(new WebMarkupContainer("tc-case").setVisible(false));
                add(getErrorComponent(TCUtilities.getLocalizedString("tc.casepage.error.text")));
                log.error(null, e);
            }
        } else {
            add(new WebMarkupContainer("tc-case").setVisible(false));
            add(getErrorComponent(MessageFormat
                    .format(TCUtilities.getLocalizedString("tc.casepage.casenotfound.text"), uid)));
        }
    } else {
        add(new WebMarkupContainer("tc-case").setVisible(false));
        add(getErrorComponent(TCUtilities.getLocalizedString("tc.casepage.casenotspecified.text")));
    }
}

From source file:org.dcm4chee.wizard.page.AutoDetectTransferCapabilities.java

License:LGPL

public AutoDetectTransferCapabilities(final ModalWindow window, final String connectedDeviceUrl,
        final String aeTitle, final String deviceName) {
    super();/*  w w  w  .ja va 2s . c om*/

    setOutputMarkupId(true);
    final ExtendedForm form = new ExtendedForm("form");

    add(form);

    final Model<String> feedbackErrorModel = new Model<String>();
    final Label feedbackErrorLabel = new Label("feedback.error", feedbackErrorModel);

    final Model<String> feedbackSuccessModel = new Model<String>();
    final Label feedbackSuccessLabel = new Label("feedback.success", feedbackSuccessModel);

    final Model<String> feedbackProgressModel = new Model<String>();
    final Label feedbackProgressLabel = new Label("feedback.progress", feedbackProgressModel);

    isStarted.set(false);

    form.add(new Label("dicom.autoDetectTC.device", new Model<String>(deviceName)));
    form.add(new Label("dicom.autoDetectTC.ae", new Model<String>(aeTitle)));

    feedbackSuccessLabel.setOutputMarkupId(true);
    feedbackErrorLabel.setOutputMarkupId(true);
    feedbackProgressLabel.setOutputMarkupId(true);

    final Button noBtn = new AjaxFallbackButton("no", new Model<String>("Close"), form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            window.close(target);
        }

        @Override
        protected void onError(AjaxRequestTarget arg0, Form<?> arg1) {
        }
    }.setDefaultFormProcessing(false);
    form.add(noBtn.setOutputMarkupPlaceholderTag(true));

    AbstractAjaxTimerBehavior atb = new AbstractAjaxTimerBehavior(Duration.seconds(2)) {

        @Override
        protected void onTimer(AjaxRequestTarget target) {
            // if process was launched, do update the progress
            if (isStarted.get()) {

                String req = "getAutoConfigProgress";
                HttpURLConnection connection;
                try {
                    connection = (HttpURLConnection) new URL(
                            connectedDeviceUrl + (connectedDeviceUrl.endsWith("/") ? req : "/" + req))
                                    .openConnection();

                    connection.setRequestMethod("GET");
                    connection.setDoInput(true);

                    StringWriter writer = new StringWriter();
                    IOUtils.copy(connection.getInputStream(), writer);
                    String returnedMessage = writer.toString();
                    int responseCode = connection.getResponseCode();

                    if (responseCode == 200) {

                        feedbackProgressModel
                                .setObject(new DecimalFormat("#.##").format(Float.parseFloat(returnedMessage))
                                        + " % completed");
                        target.add(feedbackProgressLabel);

                        // if 100 reached
                        if (Math.abs(Float.parseFloat(returnedMessage) - 100.0) < 0.0001) {

                            log.info("Autodetection finished");

                            // show 'close' button
                            noBtn.setVisible(true);
                            target.add(noBtn);

                            // stop updating
                            isStarted.set(false);

                            // reload the config
                            ((WizardApplication) getApplication()).getDicomConfigurationManager()
                                    .getDicomConfiguration().sync();
                            ((WizardApplication) getApplication()).getDicomConfigurationManager()
                                    .resetDeviceMap();
                            ConfigTreeProvider.get().loadDeviceList();
                        }

                    } else
                        throw new Exception("Unexpected response from the server (" + responseCode + ")");

                } catch (Exception e) {
                    feedbackErrorModel
                            .setObject("Error while trying to request current status: " + e.getMessage());
                    target.add(feedbackErrorLabel);
                }
            }
        }

    };

    form.add(atb);

    form.add(new IndicatingAjaxButton("yes", new ResourceModel("yesBtn"), form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {

            try {

                try {
                    String req = "setTransferCapabilities/" + aeTitle;

                    log.info("Request: {}", req);

                    HttpURLConnection connection = (HttpURLConnection) new URL(
                            connectedDeviceUrl + (connectedDeviceUrl.endsWith("/") ? req : "/" + req))
                                    .openConnection();
                    connection.setRequestMethod("GET");
                    connection.setDoInput(true);

                    StringWriter writer = new StringWriter();
                    IOUtils.copy(connection.getInputStream(), writer);
                    String returnedMessage = writer.toString();
                    int responseCode = connection.getResponseCode();

                    connection.disconnect();

                    if (responseCode == 200) {
                        // show error message to user
                        feedbackSuccessModel.setObject(returnedMessage);
                        this.setVisible(false);
                        isStarted.set(true);

                        feedbackProgressModel.setObject("0.0 % completed");
                        target.add(feedbackProgressLabel);

                        noBtn.setVisible(false);
                        target.add(feedbackSuccessLabel);
                        target.add(noBtn);
                        target.add(this);

                    } else if (responseCode == 404) {
                        String msg = "The server has not found anything matching the Request-URI "
                                + connection.getURL().toString() + ", HTTP Status "
                                + connection.getResponseCode() + ": " + connection.getResponseMessage();
                        throw new Exception(msg);

                    } else
                        throw new Exception(returnedMessage);

                } catch (Exception e) {
                    log.error("Error launching auto detection of TCs", e);

                    // show error message to user
                    feedbackErrorModel.setObject(e.getClass().getName() + " -- " + e.getMessage());
                    target.add(feedbackErrorLabel);
                }

            } catch (Exception e) {
                throw new ModalWindowRuntimeException(e.getLocalizedMessage());
            }
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            if (target != null)
                target.add(form);
        }
    });

    form.add(feedbackErrorLabel);
    form.add(feedbackSuccessLabel);
    form.add(feedbackProgressLabel);
}

From source file:org.dcm4chee.wizard.panel.BasicConfigurationPanel.java

License:LGPL

private AbstractAjaxTimerBehavior getChangeIntervalTimerBehaviour(String checkForChangesInterval) {
    return new AbstractAjaxTimerBehavior(Duration.seconds(Integer.parseInt(checkForChangesInterval))) {
        private static final long serialVersionUID = 1L;

        @Override//from w w w .  j  av a  2 s.  co m
        protected void onTimer(AjaxRequestTarget target) {
            if (ConfigTreeProvider.get().getLastModificationTime()
                    .before(getDicomConfigurationManager().getLastModificationTime())) {
                log.warn("Configuration needs to be reloaded because of concurrent modification");
                refreshMessage.show(target);
            }
        }
    };
}

From source file:org.devproof.portal.core.module.common.page.TemplatePage.java

License:Apache License

private AbstractAjaxTimerBehavior createSessionKeepAliveBehaviour() {
    // 9 minutes session alive, so there are two chances to hit with 4 minutes
    return new AbstractAjaxTimerBehavior(Duration.minutes(4)) {
        private static final long serialVersionUID = -12307329320284540L;

        @Override/*w w  w  .  java 2  s. c om*/
        protected void onTimer(AjaxRequestTarget target) {
            // Do nothing, just keep session alive
        }
    };
}

From source file:org.efaps.ui.wicket.components.dashboard.DashboardPanel.java

License:Apache License

/**
 * Instantiates a new panel.// www. j a  va 2  s. c o m
 *
 * @param _wicketId the _wicket id
 * @param _model the _model
 */
public DashboardPanel(final String _wicketId, final IModel<EsjpInvoker> _model) {
    super(_wicketId, _model);

    setOutputMarkupId(true);
    add(new WebMarkupContainer("hiddenRepeater").setOutputMarkupId(true).setVisible(false));

    add(new AbstractAjaxTimerBehavior(Duration.milliseconds(500)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onTimer(final AjaxRequestTarget _target) {
            if (DashboardPanel.this.state < 2) {
                if (DashboardPanel.this.jobName != null) {
                    final IExecutionBridge bridge = EFapsSession.get()
                            .getBridge4Job(DashboardPanel.this.jobName, true);
                    if (bridge == null) {
                        stop(_target);
                    } else if (bridge.isFinished()) {
                        final Component component = getLazyLoadComponent(LAZY_LOAD_COMPONENT_ID,
                                (String) bridge.getContent());
                        DashboardPanel.this.replace(component);
                        setState((byte) 2);
                        stop(_target);
                    }
                }
                setUpdateInterval(Duration.seconds(3));
                final RepeatingView hiddenRepeater = new RepeatingView("hiddenRepeater");
                DashboardPanel.this.replace(hiddenRepeater);
                final Iterator<EmbeddedLink> linksIter = EFapsSession.get().getEmbededLinks().iterator();
                while (linksIter.hasNext()) {
                    final EmbeddedLink link = linksIter.next();
                    if (DashboardPanel.this.jobName.equals(link.getIdentifier())) {
                        hiddenRepeater.add(new LinkElementLink(hiddenRepeater.newChildId(), link));
                        linksIter.remove();
                    }
                }
            }
            _target.add(DashboardPanel.this);
        }
    });
}

From source file:org.geoserver.backuprestore.web.BackupRestoreDataPage.java

License:Open Source License

/**
 * @param form//from  w  w w  .  j  av  a 2  s  . c o m
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void populateBackupForm(Form form) {
    form.add(new CheckBox("backupOptOverwirte", new Model<Boolean>(false)));
    form.add(new CheckBox("backupOptBestEffort", new Model<Boolean>(false)));
    form.add(statusLabel = new Label("status", new Model()).setOutputMarkupId(true));
    form.add(new AjaxSubmitLink("newBackupStart", form) {
        @Override
        protected void disableLink(ComponentTag tag) {
            super.disableLink(tag);
            tag.setName("a");
            tag.addBehavior(AttributeModifier.replace("class", "disabled"));
        }

        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(feedbackPanel);
        }

        protected void onSubmit(AjaxRequestTarget target, final Form<?> form) {

            //update status to indicate we are working
            statusLabel.add(AttributeModifier.replace("class", "working-link"));
            statusLabel.setDefaultModelObject("Working");
            target.add(statusLabel);

            //enable cancel and disable this
            Component cancel = form.get("cancel");
            cancel.setEnabled(true);
            target.add(cancel);

            setEnabled(false);
            target.add(this);

            final AjaxSubmitLink self = this;

            final Long jobid;
            try {
                jobid = launchBackupExecution(form);
            } catch (Exception e) {
                error(e);
                LOGGER.log(Level.WARNING, "Error starting a new Backup", e);
                return;
            } finally {
                //update the button back to original state
                resetButtons(form, target, "newBackupStart");

                target.add(feedbackPanel);
            }

            cancel.setDefaultModelObject(jobid);
            this.add(new AbstractAjaxTimerBehavior(Duration.milliseconds(100)) {
                @Override
                protected void onTimer(AjaxRequestTarget target) {
                    Backup backupFacade = BackupRestoreWebUtils.backupFacade();
                    BackupExecutionAdapter exec = backupFacade.getBackupExecutions().get(jobid);

                    if (!exec.isRunning()) {
                        try {
                            if (exec.getAllFailureExceptions() != null
                                    && !exec.getAllFailureExceptions().isEmpty()) {
                                getSession().error(exec.getAllFailureExceptions().get(0));
                                setResponsePage(BackupRestoreDataPage.class);
                            } else if (exec.isStopping()) {
                                //do nothing
                            } else {
                                PageParameters pp = new PageParameters();
                                pp.add("id", exec.getId());
                                pp.add("clazz", BackupExecutionAdapter.class.getSimpleName());

                                setResponsePage(BackupRestorePage.class, pp);
                            }
                        } catch (Exception e) {
                            error(e);
                            LOGGER.log(Level.WARNING, "", e);
                        } finally {
                            stop(null);

                            //update the button back to original state
                            resetButtons(form, target, "newBackupStart");

                            target.add(feedbackPanel);
                        }
                        return;
                    }

                    String msg = exec != null ? exec.getStatus().toString() : "Working";

                    statusLabel.setDefaultModelObject(msg);
                    target.add(statusLabel);
                };

                @Override
                public boolean canCallListenerInterface(Component component, Method method) {
                    if (self.equals(component)
                            && method.getDeclaringClass()
                                    .equals(org.apache.wicket.behavior.IBehaviorListener.class)
                            && method.getName().equals("onRequest")) {
                        return true;
                    }
                    return super.canCallListenerInterface(component, method);
                }
            });
        }

        private Long launchBackupExecution(Form<?> form) throws Exception {
            ResourceFilePanel panel = (ResourceFilePanel) newBackupRestorePanel.get("backupResource");
            Resource archiveFile = null;
            try {
                archiveFile = panel.getResource();
            } catch (NullPointerException e) {
                throw new Exception("Backup Archive File is Mandatory!");
            }

            if (archiveFile == null || archiveFile.getType() == Type.DIRECTORY
                    || FilenameUtils.getExtension(archiveFile.name()).isEmpty()) {
                throw new Exception("Backup Archive File is Mandatory and should not be a Directory or URI.");
            }

            Filter filter = null;
            WorkspaceInfo ws = (WorkspaceInfo) workspace.getObject();
            if (ws != null) {
                filter = ECQL.toFilter("name = '" + ws.getName() + "'");
            }

            Hints hints = new Hints(new HashMap(2));

            Boolean backupOptOverwirte = ((CheckBox) form.get("backupOptOverwirte")).getModelObject();
            Boolean backupOptBestEffort = ((CheckBox) form.get("backupOptBestEffort")).getModelObject();

            if (backupOptBestEffort) {
                hints.add(new Hints(new Hints.OptionKey(Backup.PARAM_BEST_EFFORT_MODE),
                        Backup.PARAM_BEST_EFFORT_MODE));
            }

            Backup backupFacade = BackupRestoreWebUtils.backupFacade();

            return backupFacade.runBackupAsync(archiveFile, backupOptOverwirte, filter, hints).getId();
        }
    });

    form.add(new AjaxLink<Long>("cancel", new Model<Long>()) {
        protected void disableLink(ComponentTag tag) {
            super.disableLink(tag);
            tag.setName("a");
            tag.addBehavior(AttributeModifier.replace("class", "disabled"));
        };

        @Override
        public void onClick(AjaxRequestTarget target) {
            Long jobid = getModelObject();

            if (jobid != null) {
                try {
                    BackupRestoreWebUtils.backupFacade().stopExecution(jobid);
                    setResponsePage(BackupRestoreDataPage.class);
                } catch (NoSuchJobExecutionException | JobExecutionNotRunningException e) {
                    LOGGER.log(Level.WARNING, "", e);
                }
            }

            setEnabled(false);

            target.add(this);
        }
    }.setOutputMarkupId(true).setEnabled(false));

    backupRestoreExecutionsTable = new BackupRestoreExecutionsTable("backups",
            new BackupRestoreExecutionsProvider(true, BackupExecutionAdapter.class) {
                @Override
                protected List<org.geoserver.web.wicket.GeoServerDataProvider.Property<AbstractExecutionAdapter>> getProperties() {
                    return Arrays.asList(ID, STATE, STARTED, PROGRESS, ARCHIVEFILE, OPTIONS);
                }
            }, true, BackupExecutionAdapter.class) {
        protected void onSelectionUpdate(AjaxRequestTarget target) {
        };
    };
    backupRestoreExecutionsTable.setOutputMarkupId(true);
    backupRestoreExecutionsTable.setFilterable(false);
    backupRestoreExecutionsTable.setSortable(false);
    form.add(backupRestoreExecutionsTable);
}