org.apache.wicket.markup.html.form.upload.FileUploadField Java Examples
The following examples show how to use
org.apache.wicket.markup.html.form.upload.FileUploadField.
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: BinaryEditPanel.java From Orienteer with Apache License 2.0 | 6 votes |
public BinaryEditPanel(String id, IModel<byte[]> model) { super(id, model); fileUploadField = new FileUploadField("data", Model.ofList(new ArrayList<FileUpload>())); add(fileUploadField); fileUploadField.setOutputMarkupId(true); clear = new AjaxCheckBox("clear", Model.of(Boolean.FALSE)) { @Override protected void onUpdate(AjaxRequestTarget target) { Boolean shouldClear = clear.getConvertedInput(); if (shouldClear) { fileUploadField.clearInput(); } fileUploadField.setEnabled(!shouldClear); target.add(fileUploadField); } }; add(clear); }
Example #2
Source File: AbstractUploadFilePanel.java From Orienteer with Apache License 2.0 | 6 votes |
public AbstractUploadFilePanel(String id, final ModalWindow modal,final AbstractModalWindowCommand<?> command) { super(id); modal.setMinimalHeight(300); modal.showUnloadConfirmation(false); Form<?> uploadForm = new Form<Object>("uploadForm"); final FileUploadField inputFile = new FileUploadField("inputFile"); uploadForm.add(inputFile); uploadForm.add(new AjaxButton("loadFile",getLoadButtonTitle(),uploadForm) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target) { FileUpload file = inputFile.getFileUpload(); if (file!=null){ onLoadFile(file); command.onAfterModalSubmit(); modal.close(target); } } }); add(uploadForm); }
Example #3
Source File: AbstractConfigPanel.java From JPPF with Apache License 2.0 | 5 votes |
/** * @param type the type of config panel to add this button to. */ public AbstractConfigPanel(final ConfigType type) { super(type.getPrefix()); this.type = type; add(form = new Form<>(type.getPrefix() + ".form")); form.add(new SortLink(type, true)); form.add(new SortLink(type, false)); form.add(new SaveLink(type)); form.add(new RevertLink(type)); form.add(new DownloadLink(type)); form.add(new UploadLink(type)); form.add(fileUploadField = new FileUploadField(type.getPrefix() + ".upload.browse")); form.add(cimg = new ContextImage(type.getPrefix() + ".upload.img", "images/toolbar/upload.png")); form.add(config = new TextArea<>(type.getPrefix() + ".properties.field", Model.of(JPPFWebConsoleApplication.get().getConfig(type).getProperties().asString()))); }
Example #4
Source File: LicenseErrorPage.java From nextreports-server with Apache License 2.0 | 5 votes |
public UploadLicenseForm(String id) { super(id); // set this form to multipart mode (allways needed for uploads!) setMultiPart(true); // add one file input field add(fileUploadField = new FileUploadField("fileInput")); // set maximum size to 100K setMaxSize(Bytes.kilobytes(100)); }
Example #5
Source File: ImageValidator.java From nextreports-server with Apache License 2.0 | 5 votes |
/** * Create a validator with width and height constraints. */ public ImageValidator(FileUploadField fileUpload, int width, int height) { if (fileUpload == null) { throw new IllegalArgumentException("argument formComponent cannot be null"); } this.fileUpload = fileUpload; this.width = width; this.height = height; }
Example #6
Source File: UserOArtifactPanel.java From Orienteer with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private File getJarFile(FileUploadField fileUploadField) { FileUpload fileUpload = fileUploadField.getFileUpload(); if (fileUpload == null) return null; String clientFileName = fileUpload.getClientFileName(); if (!fileUpload.getClientFileName().endsWith(".jar")) return null; return OrienteerClassLoaderUtil.createJarTempFile(clientFileName, fileUpload); }
Example #7
Source File: SetupImportForm.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@Override @SuppressWarnings("serial") protected void init() { add(createFeedbackPanel()); final GridBuilder gridBuilder = newGridBuilder(this, "flowform"); gridBuilder.newFormHeading(getString("import")); { // Upload dump file final FieldsetPanel fs = gridBuilder.newFieldset(getString("administration.setup.dumpFile")); fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID); fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField)); } final RepeatingView actionButtons = new RepeatingView("buttons"); add(actionButtons); { final Button importButton = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("import")) { @Override public final void onSubmit() { parentPage.upload(); } }; final SingleButtonPanel importButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), importButton, getString("import"), SingleButtonPanel.DEFAULT_SUBMIT); actionButtons.add(importButtonPanel); } }
Example #8
Source File: AddressImportForm.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @see org.apache.wicket.Component#onInitialize() */ @Override protected void onInitialize() { super.onInitialize(); gridBuilder.newSplitPanel(GridSize.COL50); final FieldsetPanel newFieldset = gridBuilder.newFieldset(getString("address.book.vCardImport.fileUploadPanel")); final FileUploadField uploadField = new FileUploadField(FileUploadPanel.WICKET_ID, new PropertyModel<List<FileUpload>>(this, "uploads")); newFieldset.add(new FileUploadPanel(newFieldset.newChildId(), uploadField)); }
Example #9
Source File: ConsoleImportProjectPage.java From artifact-listener with Apache License 2.0 | 4 votes |
public ConsoleImportProjectPage(PageParameters parameters) { super(parameters); addHeadPageTitleKey("console.import.project"); // File select form final FileUploadField fileSelect = new FileUploadField("fileSelectInput", this.fileUploadsModel); fileSelect.setLabel(new ResourceModel("console.import.project.file")); fileSelect.add(AttributeModifier.replace("accept", getAcceptAttribute())); Form<Void> form = new Form<Void>("fileSelectForm") { private static final long serialVersionUID = 1L; @Override protected void onSubmit() { File file = null; try { FileUpload fileUpload = fileSelect.getFileUpload(); if (fileUpload == null) { getSession().error(getString("console.import.project.error.noFile")); return; } file = File.createTempFile("uploaded-", ".xls", configurer.getTmpDirectory()); fileUpload.writeTo(file); projectImportDataService.importProjects(file); Session.get().success(getString("console.import.project.success")); } catch (Exception e) { LOGGER.error("Unable to parse " + fileSelect.getFileUpload().getClientFileName() + " file", e); Session.get().error(getString("console.import.project.error")); } finally { FileUtils.deleteQuietly(file); } } }; form.add(fileSelect); // Example excel file download link form.add(new ResourceLink<Void>("downloadTemplate", ProjectImportModelResourceReference.get())); form.add(new SubmitLink("importButton")); add(form); }
Example #10
Source File: FileUploadPanel.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
/** * @return the field */ public FileUploadField getFileUploadField() { return fileUploadField; }
Example #11
Source File: FileUploadPanel.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
public FileUploadPanel(final String id, final FileUploadField fileUploadField) { super(id); add(main = new WebMarkupContainer("main")); main.add(this.fileUploadField = fileUploadField); main.add(this.removeFileSelection = new Label("removeFileSelection", REMOVE_FILE_SELECTION_LABEL)); }
Example #12
Source File: FileUploadPanel.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
public FileUploadPanel(final String id) { this(id, new FileUploadField(FileUploadPanel.WICKET_ID)); }
Example #13
Source File: DatevImportForm.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("serial") @Override protected void init() { super.init(); gridBuilder.newGridPanel(); { final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), "*.xls"); fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID); fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField)); fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("uploadAccounts")) { @Override public final void onSubmit() { parentPage.importAccountList(); } }, getString("finance.datev.uploadAccountList"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip"))); fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("uloadRecords")) { @Override public final void onSubmit() { parentPage.importAccountRecords(); } }, getString("finance.datev.uploadAccountingRecords"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip"))); addClearButton(fs); } { addImportFilterRadio(gridBuilder); } { // Statistics new BusinessAssessment4Fieldset(gridBuilder) { /** * @see org.projectforge.web.fibu.BusinessAssessment4Fieldset#getBusinessAssessment() */ @Override protected BusinessAssessment getBusinessAssessment() { return storagePanel.businessAssessment; } @Override public boolean isVisible() { return storagePanel.businessAssessment != null; }; }; } gridBuilder.newGridPanel(); final DivPanel panel = gridBuilder.getPanel(); storagePanel = new DatevImportStoragePanel(panel.newChildId(), parentPage, importFilter); panel.add(storagePanel); }
Example #14
Source File: AbstractFileUploadPanel.java From Orienteer with Apache License 2.0 | 4 votes |
public AbstractFileUploadPanel(String id) { super(id); FileUploadField uploadField = new FileUploadField("uploadFile"); configureFileUploadField(uploadField); add(uploadField); }
Example #15
Source File: UploadIFrame.java From ontopia with Apache License 2.0 | 4 votes |
public UploadForm(String id, final WebMarkupContainer container) { super(id); uploadField = new FileUploadField("file"); add(uploadField); }
Example #16
Source File: NodeFilterPage.java From JPPF with Apache License 2.0 | 4 votes |
/** * @return the field that handles the file to upload. */ public FileUploadField getFileUploadField() { return fileUploadField; }
Example #17
Source File: AbstractConfigPanel.java From JPPF with Apache License 2.0 | 4 votes |
/** * @return the field that handles the file to upload. */ public FileUploadField getFileUploadField() { return fileUploadField; }
Example #18
Source File: AbstractFileUploadPanel.java From Orienteer with Apache License 2.0 | 2 votes |
/** * Configure behavior of file upload field * @param uploadField - field for configure */ protected abstract void configureFileUploadField(FileUploadField uploadField);
Example #19
Source File: ImageValidator.java From nextreports-server with Apache License 2.0 | 2 votes |
/** * Create a validator with width,height and extension constraints. * @param width required width in pixels * @param height required height in pixels * @param extension required extension (without period) */ public ImageValidator(FileUploadField fileUpload, int width, int height, String extension) { this(fileUpload, width, height); this.extension = "." + extension.toLowerCase(); }
Example #20
Source File: OArtifactMetaPanel.java From Orienteer with Apache License 2.0 | votes |
/** * Config jar file upload field if its need * @param uploadField - jar file upload field */ protected void configureJarFileUploadField(final FileUploadField uploadField) { }