de.agilecoders.wicket.extensions.markup.html.bootstrap.form.fileinput.BootstrapFileInputField Java Examples
The following examples show how to use
de.agilecoders.wicket.extensions.markup.html.bootstrap.form.fileinput.BootstrapFileInputField.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccessSpecificSettingsPanel.java From inception with Apache License 2.0 | 6 votes |
private Form<Void> uploadForm(String aFormId, String aFieldId) { Form<Void> importProjectForm = new Form<Void>(aFormId) { private static final long serialVersionUID = -8284858297362896476L; @Override protected void onSubmit() { super.onSubmit(); handleUploadedFiles(); } }; FileInputConfig config = new FileInputConfig(); config.initialCaption("Import project archives ..."); config.showPreview(false); config.showUpload(false); config.removeIcon("<i class=\"fa fa-remove\"></i>"); // config.uploadIcon("<i class=\"fa fa-upload\"></i>"); config.browseIcon("<i class=\"fa fa-folder-open\"></i>"); importProjectForm.add(fileUpload = new BootstrapFileInputField(aFieldId, new ListModel<>(), config)); return importProjectForm; }
Example #2
Source File: ImportGuidelinesPanel.java From webanno with Apache License 2.0 | 6 votes |
public ImportGuidelinesPanel(String aId, IModel<Project> aProject) { super(aId); projectModel = aProject; Form<Void> form = new Form<>("form"); add(form); form.add(fileUpload = new BootstrapFileInputField("guidelines")); fileUpload.getConfig().showPreview(false); fileUpload.getConfig().showUpload(false); fileUpload.getConfig().showRemove(false); fileUpload.setRequired(true); form.add(new LambdaAjaxButton<>("import", this::actionImport)); }
Example #3
Source File: ProjectsOverviewPage.java From inception with Apache License 2.0 | 5 votes |
private Form<Void> createImportProjectForm() { Form<Void> importProjectForm = new Form<>(MID_IMPORT_PROJECT_FORM); FileInputConfig config = new FileInputConfig(); config.initialCaption("Import project archives ..."); config.allowedFileExtensions(asList("zip")); config.showPreview(false); config.showUpload(true); config.removeIcon("<i class=\"fa fa-remove\"></i>"); config.uploadIcon("<i class=\"fa fa-upload\"></i>"); config.browseIcon("<i class=\"fa fa-folder-open\"></i>"); importProjectForm.add(fileUpload = new BootstrapFileInputField(MID_PROJECT_ARCHIVE_UPLOAD, new ListModel<>(), config) { private static final long serialVersionUID = -6794141937368512300L; @Override protected void onSubmit(AjaxRequestTarget aTarget) { actionImport(aTarget, null); } }); authorize(importProjectForm, RENDER, join(",", ROLE_ADMIN.name(), ROLE_PROJECT_CREATOR.name())); return importProjectForm; }
Example #4
Source File: TagSetImportPanel.java From webanno with Apache License 2.0 | 5 votes |
public TagSetImportPanel(String aId, IModel<Project> aModel) { super(aId); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); preferences = Model.of(new Preferences()); selectedProject = aModel; Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences)); BootstrapSelect<String> format = new BootstrapSelect<>("format", asList(JSON_FORMAT, TAB_FORMAT)); form.add(format); format.setModelObject(JSON_FORMAT); // Set after adding to form to have access to for model format.setRequired(true); form.add(new CheckBox("overwrite")); form.add(fileUpload = new BootstrapFileInputField("content", new ListModel<>())); fileUpload.getConfig().showPreview(false); fileUpload.getConfig().showUpload(false); fileUpload.getConfig().showRemove(false); fileUpload.setRequired(true); form.add(new LambdaAjaxButton<>("import", this::actionImport)); add(form); }
Example #5
Source File: ImportDocumentsPanel.java From webanno with Apache License 2.0 | 5 votes |
public ImportDocumentsPanel(String aId, IModel<Project> aProject) { super(aId); projectModel = aProject; Form<Void> form = new Form<>("form"); add(form); format = Model.of(); List<String> readableFormats = listReadableFormats(); if (!readableFormats.isEmpty()) { if (readableFormats.contains("Plain text")) { format.setObject("Plain text"); } else { format.setObject(readableFormats.get(0)); } } form.add(fileUpload = new BootstrapFileInputField("documents")); fileUpload.getConfig().showPreview(false); fileUpload.getConfig().showUpload(false); fileUpload.getConfig().showRemove(false); fileUpload.setRequired(true); DropDownChoice<String> formats = new BootstrapSelect<>("format"); formats.setModel(format); formats.setChoices(LambdaModel.of(this::listReadableFormats)); form.add(formats); form.add(new LambdaAjaxButton<>("import", this::actionImport)); }
Example #6
Source File: ProjectLayersPanel.java From webanno with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public ImportLayerForm(String id) { super(id); add(fileUpload = new BootstrapFileInputField("content", new ListModel<>())); fileUpload.getConfig().showPreview(false); fileUpload.getConfig().showUpload(false); fileUpload.getConfig().showRemove(false); fileUpload.setRequired(true); add(new LambdaAjaxButton("import", this::actionImport)); }
Example #7
Source File: CSVPullWizardBuilder.java From syncope with Apache License 2.0 | 5 votes |
public Details(final CSVPullSpec spec) { FileInputConfig csvFile = new FileInputConfig(). showUpload(false).showRemove(false).showPreview(false). browseClass("btn btn-success").browseIcon("<i class=\"fas fa-folder-open\"></i> "); String language = SyncopeConsoleSession.get().getLocale().getLanguage(); if (!Locale.ENGLISH.getLanguage().equals(language)) { csvFile.withLocale(language); } BootstrapFileInputField csvUpload = new BootstrapFileInputField("csvUpload", new ListModel<>(new ArrayList<>()), csvFile); csvUpload.add(new AjaxFormSubmitBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = 5538299138211283825L; @Override protected void onSubmit(final AjaxRequestTarget target) { FileUpload uploadedFile = csvUpload.getFileUpload(); if (uploadedFile != null) { if (maxUploadSize != null && uploadedFile.getSize() > maxUploadSize.bytes()) { SyncopeConsoleSession.get().error(getString("tooLargeFile"). replace("${maxUploadSizeB}", String.valueOf(maxUploadSize.bytes())). replace("${maxUploadSizeMB}", String.valueOf(maxUploadSize.bytes() / 1000000L))); ((BasePage) getPageReference().getPage()).getNotificationPanel().refresh(target); } else { csv.setObject(uploadedFile.getBytes()); } } } }); add(csvUpload.setRequired(true).setOutputMarkupId(true)); add(new CSVConfPanel("csvconf", spec)); }