List of usage examples for org.apache.wicket.markup.html.form Form findSubmittingButton
public final IFormSubmitter findSubmittingButton()
From source file:com.userweave.components.valueListPanel.ValueListPanel.java
License:Open Source License
private void init(ValueListController<T> cb) { this.controller = cb; final RepeatingView rows = new RepeatingView("repeater"); add(rows);//from w ww .ja v a2 s .co m int index = 0; List<T> values = controller.getValues(); if (values != null) { for (T value : values) { addListRow(rows, value); index++; } } add(new Form("form") { { add(getInputComponent("input")); add(new Button("submit")); } @Override protected void onSubmit() { List<T> input = getInput(); for (T t : input) { controller.addValue(t); addListRow(rows, t); } clearInputComponent(); } @Override // don't submit/validate this form if root form is submitted public boolean isEnabled() { Form rootForm = getRootForm(); if (rootForm != null) { IFormSubmitter submittingButton = rootForm.findSubmittingButton(); if (submittingButton != null) { return submittingButton.getForm() == this; } } ; return true; } }); }
From source file:org.geoserver.security.web.user.AbstractUserPage.java
License:Open Source License
boolean isFinalSubmit(Form form) { if (form == null) { return false; }/*from w ww. jav a2s . co m*/ return form.findSubmittingButton() == form.get("save"); }
From source file:org.geoserver.taskmanager.web.BatchPage.java
License:Open Source License
@Override public void onInitialize() { super.onInitialize(); add(dialog = new GeoServerDialog("dialog")); add(new WebMarkupContainer("notvalidated").setVisible(batchModel.getObject().getConfiguration() != null && !batchModel.getObject().getConfiguration().isValidated())); Form<Batch> form = new Form<Batch>("batchForm", batchModel); add(form);//ww w.ja v a2s . c om AjaxSubmitLink saveButton = saveButton(); form.add(saveButton); form.add(new TextField<String>("name", new PropertyModel<String>(batchModel, "name")) { private static final long serialVersionUID = -3736209422699508894L; @Override public boolean isRequired() { return form.findSubmittingButton() == saveButton; } }); List<String> workspaces = new ArrayList<String>(); for (WorkspaceInfo wi : GeoServerApplication.get().getCatalog().getWorkspaces()) { if (wi.getName().equals(batchModel.getObject().getWorkspace()) || TaskManagerBeans.get().getSecUtil().isAdminable(getSession().getAuthentication(), wi)) { workspaces.add(wi.getName()); } } boolean canBeNull = GeoServerApplication.get().getCatalog().getDefaultWorkspace() != null && TaskManagerBeans.get().getSecUtil().isAdminable(getSession().getAuthentication(), GeoServerApplication.get().getCatalog().getDefaultWorkspace()); form.add(new DropDownChoice<String>("workspace", new PropertyModel<String>(batchModel, "workspace"), workspaces).setNullValid(canBeNull).setRequired(!canBeNull)); form.add(new TextField<String>("description", new PropertyModel<String>(batchModel, "description"))); form.add(new TextField<String>("configuration", new Model<String>(batchModel.getObject().getConfiguration() == null ? "" : batchModel.getObject().getConfiguration().getName())).setEnabled(false)); form.add(new FrequencyPanel("frequency", new PropertyModel<String>(batchModel, "frequency"))); form.add(new CheckBox("enabled", new PropertyModel<Boolean>(batchModel, "enabled"))); form.add(addButton()); // the removal button form.add(remove = removeButton()); remove.setOutputMarkupId(true); remove.setEnabled(false); //the tasks panel form.add(elementsPanel = elementsPanel()); elementsPanel.setFilterVisible(false); elementsPanel.setPageable(false); elementsPanel.setSortable(false); elementsPanel.setOutputMarkupId(true); form.add(new AjaxLink<Object>("cancel") { private static final long serialVersionUID = -6892944747517089296L; @Override public void onClick(AjaxRequestTarget target) { //restore elements batchModel.getObject().getElements().clear(); batchModel.getObject().getElements().addAll(oldElements); doReturn(); } }); if (batchModel.getObject().getId() != null && !TaskManagerBeans.get().getSecUtil() .isAdminable(getSession().getAuthentication(), batchModel.getObject())) { form.get("name").setEnabled(false); form.get("workspace").setEnabled(false); form.get("description").setEnabled(false); form.get("configuration").setEnabled(false); form.get("frequency").setEnabled(false); form.get("enabled").setEnabled(false); form.get("addNew").setEnabled(false); remove.setEnabled(false); saveButton.setEnabled(false); elementsPanel.setEnabled(false); } }
From source file:org.geoserver.taskmanager.web.ConfigurationPage.java
License:Open Source License
@Override public void onInitialize() { super.onInitialize(); add(dialog = new GeoServerDialog("dialog")); add(new WebMarkupContainer("init").setVisible(initMode)); Form<Configuration> form = new Form<Configuration>("configurationForm", configurationModel); add(form);//from w w w . j av a 2 s .c om AjaxSubmitLink saveButton = saveOrApplyButton("save", true); saveButton.setOutputMarkupId(true); form.add(saveButton); AjaxSubmitLink applyButton = saveOrApplyButton("apply", false); form.add(applyButton); form.add(new TextField<String>("name", new PropertyModel<String>(configurationModel, "name")) { private static final long serialVersionUID = -3736209422699508894L; @Override public boolean isRequired() { return form.findSubmittingButton() == saveButton || form.findSubmittingButton() == applyButton; } }); List<String> workspaces = new ArrayList<String>(); for (WorkspaceInfo wi : GeoServerApplication.get().getCatalog().getWorkspaces()) { if (wi.getName().equals(configurationModel.getObject().getWorkspace()) || TaskManagerBeans.get().getSecUtil().isAdminable(getSession().getAuthentication(), wi)) { workspaces.add(wi.getName()); } } boolean canBeNull = GeoServerApplication.get().getCatalog().getDefaultWorkspace() != null && TaskManagerBeans.get().getSecUtil().isAdminable(getSession().getAuthentication(), GeoServerApplication.get().getCatalog().getDefaultWorkspace()); form.add(new DropDownChoice<String>("workspace", new PropertyModel<String>(configurationModel, "workspace"), workspaces).setNullValid(canBeNull).setRequired(!canBeNull)); TextField<String> name = new TextField<String>("description", new PropertyModel<String>(configurationModel, "description")); form.add(name); //the attributes panel attributesModel = new AttributesModel(configurationModel); form.add(attributesPanel = attributesPanel()); attributesPanel.setFilterVisible(false); attributesPanel.setSelectable(false); attributesPanel.setPageable(false); attributesPanel.setSortable(false); attributesPanel.setOutputMarkupId(true); form.add(addButton().setOutputMarkupId(true)); // the removal button form.add(remove = removeButton()); remove.setOutputMarkupId(true); remove.setEnabled(false); //the tasks panel tasksModel = new TasksModel(configurationModel); form.add(tasksPanel = tasksPanel()); tasksPanel.setFilterVisible(false); tasksPanel.setPageable(false); tasksPanel.setSortable(false); tasksPanel.setOutputMarkupId(true); //the batches panel form.add(batchesPanel = new BatchesPanel("batchesPanel", configurationModel)); batchesPanel.setOutputMarkupId(true); form.add(new AjaxLink<Object>("cancel") { private static final long serialVersionUID = -6892944747517089296L; @Override public void onClick(AjaxRequestTarget target) { //restore tasks configurationModel.getObject().getTasks().clear(); configurationModel.getObject().getTasks().putAll(oldTasks); //restore batches configurationModel.getObject().getBatches().clear(); configurationModel.getObject().getBatches().putAll(oldBatches); doReturn(); } }); if (initMode) { form.get("addNew").setEnabled(false); form.get("removeSelected").setEnabled(false); batchesPanel.get("addNew").setEnabled(false); batchesPanel.get("removeSelected").setEnabled(false); saveButton.setVisible(false); } if (configurationModel.getObject().getId() != null && !TaskManagerBeans.get().getSecUtil() .isAdminable(getSession().getAuthentication(), configurationModel.getObject())) { form.get("name").setEnabled(false); form.get("workspace").setEnabled(false); form.get("description").setEnabled(false); attributesPanel.setEnabled(false); form.get("addNew").setEnabled(false); form.get("removeSelected").setEnabled(false); tasksPanel.setEnabled(false); batchesPanel.get("addNew").setEnabled(false); batchesPanel.get("removeSelected").setEnabled(false); saveButton.setEnabled(false); applyButton.setEnabled(false); } }
From source file:org.geoserver.taskmanager.web.panel.FileUploadPanel.java
License:Open Source License
protected boolean hasBeenSubmitted() { Form<?> dialogForm = (Form<?>) getParent(); return dialogForm.findSubmittingButton() == dialogForm.get("submit"); }