本文整理汇总了Java中org.apache.wicket.markup.html.form.upload.FileUploadField类的典型用法代码示例。如果您正苦于以下问题:Java FileUploadField类的具体用法?Java FileUploadField怎么用?Java FileUploadField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileUploadField类属于org.apache.wicket.markup.html.form.upload包,在下文中一共展示了FileUploadField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateValidModelsOnValidationError
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
/**
* Synchronize valid model values so that validator utilities have something to work with. This is useful in onError
* calls in submit behaviors
*/
public static boolean updateValidModelsOnValidationError(final Component component) {
final Component root = Components.findRoot(component);
final Form<?> form = Components.findForm(root);
final AtomicBoolean invalidFound = new AtomicBoolean(false);
FormComponent.visitFormComponentsPostOrder(form, new IVisitor<FormComponent<?>, Void>() {
@Override
public void component(final FormComponent<?> object, final IVisit<Void> visit) {
if (object.isEnabledInHierarchy() && object.isVisibleInHierarchy()
//fileUploadField chokes on FileNotFound if synchronized twice in a call!
&& !(object instanceof FileUploadField)) {
try {
object.updateModel(); //fill in values regardless of valid state, since complex validation rules might require all inputs
} catch (final Throwable t) {
//ignore
}
object.validate();
if (!object.isValid()) {
invalidFound.set(true);
}
}
}
});
return invalidFound.get();
}
示例2: ImportDocumentsPanel
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
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()) {
format.setObject(readableFormats.get(0));
}
form.add(fileUpload = new FileUploadField("documents"));
DropDownChoice<String> formats = new DropDownChoice<String>("format");
formats.setModel(format);
formats.setChoices(LambdaModel.of(this::listReadableFormats));
form.add(formats);
form.add(new LambdaAjaxButton<>("import", this::actionImport));
}
示例3: TagSetImportPanel
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
public TagSetImportPanel(String aId, IModel<Project> aModel, IModel<TagSet> aTagSet)
{
super(aId);
setOutputMarkupId(true);
setOutputMarkupPlaceholderTag(true);
preferences = Model.of(new Preferences());
selectedProject = aModel;
selectedTagSet = aTagSet;
Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences));
form.add(new DropDownChoice<>("format", LambdaModel.of(this::supportedFormats)));
form.add(new CheckBox("overwrite"));
form.add(fileUpload = new FileUploadField("content", new ListModel<>()));
fileUpload.setRequired(true);
form.add(new LambdaAjaxButton<>("import", this::actionImport));
add(form);
}
示例4: FileUploadForm
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
/**
* @param id The wicket component id
* @param tempUploadDir Path to a temp upload directory
* @param listener Parent component holding this upload form which will receive events
*/
public FileUploadForm(String id, String tempUploadDir, UploadListener listener) {
super(id);
this.listener = listener;
tempUploadsDir = new File(tempUploadDir);
//Set this form to multi-part mode (always needed for uploads!)
setMultiPart(true);
//Add one file input field
add(fileUploadField = new FileUploadField("fileInput", new ListModel<FileUpload>()));
// Add the progress bar
UploadProgressBar progress = new UploadProgressBar("progress", this);
progress.setOutputMarkupId(true);
progress.setRenderBodyOnly(false);
progress.setMarkupId("uploadProgress");
add(progress);
}
示例5: UploadForm
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
public UploadForm(String id) {
super(id);
setMultiPart(true);
setMaxSize(Bytes.megabytes(2));
fileUploadField = new FileUploadField("upload");
add(fileUploadField);
add(new Button("continuebutton"));
Button cancel = new Button("cancelbutton"){
public void onSubmit() {
// info("Cancel was pressed!");
setResponsePage(new GradebookPage());
}
};
cancel.setDefaultFormProcessing(false);
add(cancel);
}
示例6: doInitialize
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
@Override
protected void doInitialize(Border layout) {
add(layout);
this.form = new Form<>("form");
layout.add(this.form);
this.nameField = new TextField<>("nameField", new PropertyModel<>(this, "name"));
this.nameField.setRequired(true);
this.nameField.setLabel(Model.of("name"));
this.form.add(nameField);
this.nameFeedback = new TextFeedbackPanel("nameFeedback", this.nameField);
this.form.add(nameFeedback);
this.fileField = new FileUploadField("fileField", new PropertyModel<>(this, "file"));
this.fileField.setRequired(true);
this.form.add(this.fileField);
this.fileFeedback = new TextFeedbackPanel("fileFeedback", this.fileField);
this.form.add(fileFeedback);
this.saveButton = new AjaxButton("saveButton");
this.saveButton.setOnError(this::saveButtonOnError);
this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
this.form.add(saveButton);
this.closeButton = new BookmarkablePageLink<>("closeButton", FileBrowsePage.class);
this.form.add(this.closeButton);
}
示例7: ProjectImportPanel
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
public ProjectImportPanel(String aId, IModel<Project> aModel)
{
super(aId);
preferences = Model.of(new Preferences());
selectedModel = aModel;
Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences));
form.add(new CheckBox("generateUsers"));
form.add(fileUpload = new FileUploadField("content", new ListModel<>()));
fileUpload.setRequired(true);
form.add(new LambdaAjaxButton<>("import", this::actionImport));
add(form);
}
示例8: FileUploadForm
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
public FileUploadForm(String name) {
super(name);
setMultiPart(true);
fileUploadField = new FileUploadField("fileInput");
fileUploadField.setOutputMarkupId(true);
add(fileUploadField);
add(new BookmarkablePageLink<HomePage>("cancelar", HomePage.class));
// setMaxSize(Bytes.kilobytes(100));
}
示例9: FileUploadForm
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
public FileUploadForm(String name, ValidatorPage page) {
super(name);
this.page = page;
setMultiPart(true);
add(fileUploadField = new FileUploadField("fileInput"));
setMaxSize(Bytes.kilobytes(100));
}
示例10: FileUploadForm
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
public FileUploadForm(EntityModel<Entry> entry) {
super("uploadForm");
this.entry = entry;
setMultiPart(true);
add(fileUploadField = new FileUploadField("fileInput"));
setMaxSize(Bytes.megabytes(50));
}
示例11: init
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
@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);
}
}
示例12: onInitialize
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
/**
* @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));
}
示例13: FileUploadPanel
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
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));
}
示例14: AddEditPolicyACLPanel
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
public AddEditPolicyACLPanel(String id, PolicyACL policyACL) {
super(id, false);
this.policyACLModel = new ReloadableEntityModel<PolicyACL>(policyACL);
Form form = getForm();
form.setModel(new CompoundPropertyModel(policyACLModel));
form.add(new SetFocusBehavior(form));
fileUploadField = new FileUploadField("file", fileUploadModel);
fileUploadField.setRequired(true);
form.add(fileUploadField);
}
示例15: ImageValidator
import org.apache.wicket.markup.html.form.upload.FileUploadField; //导入依赖的package包/类
/**
* 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;
}