Search in sources :

Example 1 with LaddaAjaxButton

use of de.agilecoders.wicket.extensions.markup.html.bootstrap.ladda.LaddaAjaxButton in project ocvn by devgateway.

the class VietnamImportPage method addDoneButton.

protected void addDoneButton() {
    doneButton = new LaddaAjaxButton("done", Type.Default) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            setResponsePage(Homepage.class);
        }
    };
    doneButton.setDefaultFormProcessing(false);
    doneButton.setLabel(new ResourceModel("done"));
    doneButton.setDefaultFormProcessing(false);
    doneButton.setIconType(FontAwesomeIconType.thumbs_up);
    importForm.add(doneButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Homepage(org.devgateway.toolkit.forms.wicket.page.Homepage) LaddaAjaxButton(de.agilecoders.wicket.extensions.markup.html.bootstrap.ladda.LaddaAjaxButton) ResourceModel(org.apache.wicket.model.ResourceModel)

Example 2 with LaddaAjaxButton

use of de.agilecoders.wicket.extensions.markup.html.bootstrap.ladda.LaddaAjaxButton in project ocvn by devgateway.

the class VietnamImportPage method addImportButton.

protected void addImportButton() {
    importButton = new LaddaAjaxButton("import", Type.Danger) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            send(getPage(), Broadcast.BREADTH, new EditingDisabledEvent());
            logText.getSelfUpdatingBehavior().restart(target);
            importContainer.setVisibilityAllowed(true);
            target.add(importContainer);
            target.add(form);
            try {
                vnExcelImportService.importAllSheets(importForm.getModelObject().getFileTypes(), importForm.getModelObject().getSourceFiles().getPrototypeDatabaseFile().isEmpty() ? null : importForm.getModelObject().getSourceFiles().getPrototypeDatabaseFile().iterator().next().getContent().getBytes(), importForm.getModelObject().getSourceFiles().getLocationsFile().isEmpty() ? null : importForm.getModelObject().getSourceFiles().getLocationsFile().iterator().next().getContent().getBytes(), importForm.getModelObject().getSourceFiles().getPublicInstitutionsSuppliersFile().isEmpty() ? null : importForm.getModelObject().getSourceFiles().getPublicInstitutionsSuppliersFile().iterator().next().getContent().getBytes(), importForm.getModelObject().getSourceFiles().getCityDepartmentGroupFile().isEmpty() ? null : importForm.getModelObject().getSourceFiles().getCityDepartmentGroupFile().iterator().next().getContent().getBytes(), importForm.getModelObject().getDropData(), importForm.getModelObject().getValidateData(), importForm.getModelObject().getFlagData());
            } catch (Exception e) {
                logger.error(e);
                e.printStackTrace();
            } finally {
                target.add(logText);
                target.add(feedbackPanel);
                this.setEnabled(false);
                target.add(this);
            }
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form<?> form) {
            ValidationError error = new ValidationError();
            error.addKey("formHasErrors");
            error(error);
            target.add(form);
            target.add(feedbackPanel);
        }
    };
    importButton.setLabel(new ResourceModel("startImportProcess"));
    importButton.setIconType(FontAwesomeIconType.hourglass_start);
    importForm.add(importButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) LaddaAjaxButton(de.agilecoders.wicket.extensions.markup.html.bootstrap.ladda.LaddaAjaxButton) ResourceModel(org.apache.wicket.model.ResourceModel) EditingDisabledEvent(org.devgateway.toolkit.forms.wicket.events.EditingDisabledEvent) ValidationError(org.apache.wicket.validation.ValidationError)

Aggregations

LaddaAjaxButton (de.agilecoders.wicket.extensions.markup.html.bootstrap.ladda.LaddaAjaxButton)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 ResourceModel (org.apache.wicket.model.ResourceModel)2 ValidationError (org.apache.wicket.validation.ValidationError)1 EditingDisabledEvent (org.devgateway.toolkit.forms.wicket.events.EditingDisabledEvent)1 Homepage (org.devgateway.toolkit.forms.wicket.page.Homepage)1