private void initDebugUtilForm() { Form form = new Form(ID_DEBUG_UTIL_FORM); form.setOutputMarkupId(true); add(form); CheckFormGroup detailed = new CheckFormGroup( ID_DETAILED_DEBUG_DUMP, new PropertyModel<Boolean>(internalsModel, InternalsConfigDto.F_DETAILED_DEBUG_DUMP), createStringResource("PageInternals.detailedDebugDump"), LABEL_SIZE, INPUT_SIZE); form.add(detailed); AjaxSubmitButton update = new AjaxSubmitButton(ID_SAVE_DEBUG_UTIL, createStringResource("PageBase.button.update")) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { updateDebugPerformed(target); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(getFeedbackPanel()); } }; form.add(update); }
private void setUpPage(IModel<AssignmentAdminBackingBean> model) { Border greyBorder = new GreySquaredRoundedBorder("border", WebGeo.W_CONTENT_SMALL); add(greyBorder); final Form<AssignmentAdminBackingBean> form = new Form<AssignmentAdminBackingBean>("assignmentForm", model); greyBorder.add(form); // add submit form boolean deletable = ((AssignmentAdminBackingBean) getDefaultModelObject()).getProjectAssignment().isDeletable(); FormConfig formConfig = new FormConfig() .forForm(form) .withDelete(deletable) .withSubmitTarget(this) .withDeleteEventType(AssignmentAjaxEventType.ASSIGNMENT_DELETED) .withSubmitEventType(AssignmentAjaxEventType.ASSIGNMENT_UPDATED); FormUtil.setSubmitActions(formConfig); form.add( new AssignmentFormComponentContainerPanel( "formComponents", form, model, DisplayOption.SHOW_PROJECT_SELECTION, DisplayOption.SHOW_SAVE_BUTTON, DisplayOption.SHOW_DELETE_BUTTON)); form.add(new ServerMessageLabel("serverMessage", "formValidationError")); }
@Override protected void onInitialize() { super.onInitialize(); Form<Void> form = new Form<Void>("form"); form.add(createMonetaryField("amount")); add(form); }
private void initGui() { Form<Location> addLocationForm = new Form<Location>( "addLocationForm", new CompoundPropertyModel<Location>((Model<Location>) getDefaultModel())); add(addLocationForm); Label nameLabel = new Label("nameLabel", new StringResourceModel("locationName", this, null)); addLocationForm.add(nameLabel); addLocationForm.add(createLabelFieldWithValidation()); Button submitButton = new Button("submitButton") { @Override public void onSubmit() { Location location = getLocationFromPageModel(); if (location.isNew()) { locationService.save(location); getSession().info(new StringResourceModel("locationAdded", this, null).getString()); } else { locationService.update(location); getSession().info(new StringResourceModel("locationUpdated", this, null).getString()); } setResponsePage(LocationsPage.class); } }; addLocationForm.add(submitButton); }
/** Constructor */ public RadioGroupPage2() { final RadioGroup<Person> group = new RadioGroup<>("group", new Model<Person>()); final RadioGroup<Person> group2 = new RadioGroup<>("group2", new Model<Person>()); Form<?> form = new Form<Void>("form") { @Override protected void onSubmit() { info("selection group1: " + group.getDefaultModelObjectAsString()); info("selection group2: " + group2.getDefaultModelObjectAsString()); } }; add(form); form.add(group); group.add(group2); ListView<Person> persons = new ListView<Person>("persons", ComponentReferenceApplication.getPersons()) { @Override protected void populateItem(ListItem<Person> item) { item.add(new Radio<>("radio", item.getModel(), group)); item.add(new Radio<>("radio2", item.getModel(), group2)); item.add(new Label("name", new PropertyModel<>(item.getDefaultModel(), "name"))); item.add( new Label( "lastName", new PropertyModel<String>(item.getDefaultModel(), "lastName"))); } }; group2.add(persons); add(new FeedbackPanel("feedback")); }
protected void addOtherFilters(Form<Object> form) { inAPeriod = new Model<Boolean>(false); form.add(new CheckBox("showNoSite", inAPeriod)); showPermissionUsers = new Model<Boolean>(true); form.add(new CheckBox("showPermissionUsers", showPermissionUsers)); }
public BillingPlots() { long t = getWebadminApplication().getBillingService().getRefreshIntervalInMillis(); Form<?> form = getAutoRefreshingForm("billingForm", t, TimeUnit.MILLISECONDS); form.add(new OptionPanel("optionPanel", this)); form.add(new PlotsPanel("plotsPanel", this)); add(form); }
public LoginPage() { super(); this.add(new FeedbackPanel("login_feedback")); TextField nameField = new TextField("login_name", new PropertyModel(this, "name")); TextField passwordField = new PasswordTextField("login_password", new PropertyModel(this, "password")); Button loginButton = new Button("login_submit") { @Override public void onSubmit() { try { User user = userService.authenticateUser(name, password); PortalSession.get().associateSession(user); setResponsePage(HomePage.class); } catch (AuthenticationException ex) { error("Bitte Überprüfen Sie ihren Namen und Ihr Password"); } } }; Form loginForm = new Form("login_form"); loginForm.add(nameField).add(passwordField).add(loginButton); addLinkToRegistrationPage(loginForm); this.add(loginForm); }
public EditSitAndGo(final PageParameters parameters) { super(parameters); final Integer tournamentId = parameters.get("tournamentId").toInt(); loadFormData(tournamentId); Form<SitAndGoConfiguration> tournamentForm = new Form<SitAndGoConfiguration>( "tournamentForm", new CompoundPropertyModel<SitAndGoConfiguration>(tournament)) { private static final long serialVersionUID = 1L; @Override protected void onSubmit() { SitAndGoConfiguration object = getModel().getObject(); adminDAO.save(object); info("Tournament updated, id = " + tournamentId); setResponsePage(ListSitAndGoTournaments.class); } }; tournamentForm.add( new TournamentConfigurationPanel( "configuration", tournamentForm, new PropertyModel<TournamentConfiguration>(tournament, "configuration"), false)); add(tournamentForm); add(new FeedbackPanel("feedback")); }
/** Constructor */ public RadioChoicePage() { final Input input = new Input(); setDefaultModel(new CompoundPropertyModel<Input>(input)); // Add a FeedbackPanel for displaying our messages final FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setOutputMarkupId(true); add(feedbackPanel); // Add a form with an onSumbit implementation that sets a message Form<?> form = new Form("form") { @Override protected void onSubmit() { info("input: " + input); } }; add(form); // Add a radio choice component that uses Input's 'site' property to // designate the // current selection, and that uses the SITES list for the available // options. RadioChoice<String> sites = new RadioChoice<String>("site", SITES); sites.add( new AjaxFormChoiceComponentUpdatingBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { info("Selected: " + getComponent().getDefaultModelObjectAsString()); target.add(feedbackPanel); } }); form.add(sites); }
private void initButtons(final Form mainForm) { AjaxSubmitButton saveButton = new AjaxSubmitButton(ID_SAVE_BUTTON, createStringResource("PageBase.button.save")) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { savePerformed(target); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(getFeedbackPanel()); } }; mainForm.add(saveButton); AjaxButton backButton = new AjaxButton(ID_BACK_BUTTON, createStringResource("PageBase.button.back")) { @Override public void onClick(AjaxRequestTarget target) { setResponsePage(PageResources.class); } }; mainForm.add(backButton); }
public AjaxDropDownPage() { Form<Void> form = new Form<Void>("form"); this.add(form); // FeedbackPanel // final FeedbackPanel feedback = new JQueryFeedbackPanel("feedback"); form.add(feedback.setOutputMarkupId(true)); // ComboBox // final DropDownList<String> dropdown = new AjaxDropDownList<String>("select", new Model<String>(), new ListModel<String>(GENRES)) { private static final long serialVersionUID = 1L; @Override public void onSelectionChanged(AjaxRequestTarget target, Form<?> form) { String choice = this.getModelObject(); this.info(choice != null ? choice : "no choice"); target.add(feedback); } }; form.add(dropdown); }
@Override protected void onInitialize() { super.onInitialize(); Model<SelectableItem<T>> dropDownSelectedItem = new Model<>(); Form<Void> form = new Form<Void>("form") { @Override protected void onSubmit() { onFormSubmit(getSelectedItems()); super.onSubmit(); } }; add(form); WebMarkupContainer container = new WebMarkupContainer("container"); container.setOutputMarkupPlaceholderTag(true); form.add(container); DropDownChoice<SelectableItem<T>> dropdown = new DropDownChoice<>( "dropdown", dropDownSelectedItem, getDropdownChoices(), getChoiceRenderer()); dropdown.add( new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { selectItem(dropDownSelectedItem); onItemSelected(dropDownSelectedItem); dropDownSelectedItem.setObject(null); target.add(container); } }); container.add(dropdown); container.add( new ListView<SelectableItem<T>>("selectedList", getSelectedItemsModel()) { @SuppressWarnings("unchecked") @Override protected void populateItem(ListItem<SelectableItem<T>> item) { item.add( new Label( "itemLabel", renderer.getDisplayValue((T) item.getModelObject().item).toString())); item.add( new AjaxLink<Void>("deleteLink") { @Override public void onClick(AjaxRequestTarget target) { removeItem(item.getModel()); onItemRemoved(item.getModel()); target.add(container); } }); } }); }
public Example6() { final Form<Data> form = new Form<Data>("form", new CompoundPropertyModel<Data>(dummy)) { private static final long serialVersionUID = 1L; @Override protected void onSubmit() { super.onSubmit(); if (!new BeanValidator(this).isValid(dummy)) { // execute... } else { // stay here... } } }; add(form); form.add(new PropertyValidation()); add(new FeedbackPanel("fb")); add( new WebMarkupContainer("message") { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return form.isSubmitted() && !form.hasError(); } }); form.add(new TextField<String>("field1")); form.add(new TextField<String>("field2")); }
public RadioListPage() { Form<RadioListPage> form = new Form<RadioListPage>("form", new CompoundPropertyModel<RadioListPage>(this)) { @Override protected void onSubmit() { super.onSubmit(); System.out.println("selected:" + selected); } }; add(form); final RadioGroup<Person> personRadioGroup = new RadioGroup<Person>("selected"); ListView<Person> personListView = new ListView<Person>( "persons", new ArrayList<Person>( Arrays.asList( new Person("name 1", "vorname 1"), new Person("name 2", "vorname 2"), new Person("name 3", "vorname 3"), new Person("name 4", "vorname 4")))) { @Override protected void populateItem(ListItem<Person> item) { item.add(new Label("name", Model.of(item.getModelObject().name))); item.add(new Label("vorname", Model.of(item.getModelObject().vorname))); item.add(new Radio<Person>("radio", new Model<Person>(item.getModelObject()))); } }; form.add(personRadioGroup); personRadioGroup.add(personListView); }
private void init() { if (model.getObject() == null) { getFeedbackPanel().error("Process not found"); } queue( new Label( "info", new AbstractReadOnlyModel<Object>() { @Override public Object getObject() { BuildJob object = model.getObject(); return object.toString(); } })); form = new Form("form"); form.add(getLogPanel()); queue(form); kill = new PocessKillButton("kill", model); kill2 = new PocessKillButton("kill2", model); form.add(kill); form.add(kill2); rerun1 = new PocessRerunButton("rerun1", model); form.add(rerun1); rerun2 = new PocessRerunButton("rerun2", model); form.add(rerun2); }
/* * (non-Javadoc) * * @see org.apache.wicket.behavior.Behavior#onComponentTag(org.apache.wicket.Component, * org.apache.wicket.markup.ComponentTag) */ @Override public void onComponentTag(Component component, ComponentTag tag) { super.onComponentTag(component, tag); if (!Form.class.isAssignableFrom(component.getClass())) { throw new WicketRuntimeException("This behavior is only applicable on a Form component"); } Form<?> form = (Form<?>) component; // Retrieve and set form name String formName = verifyFormName(form, tag); tag.put("onsubmit", "return yav.performCheck('" + formName + "', rules);"); // Open the Yav script (inlined JavaScript) AppendingStringBuffer buffer = new AppendingStringBuffer("<script>\n"); buffer.append("var rules=new Array();\n"); // Visit all form components and check for validators (and write the // appropriate Yav rules in the current inlined JavaScript) form.visitFormComponents(new YavFormComponentVisitor(buffer, form)); // Build the call to the yav.init with the proper form name buffer.append("function yavInit() {\n"); buffer.append(" yav.init('" + formName + "', rules);\n"); buffer.append("}\n"); // Close the Yav script buffer.append("</script>\n"); // Write the generated script into the response Response response = RequestCycle.get().getResponse(); response.write(buffer.toString()); }
public EntitlementPurchaseModalPanel( CustomModalWindow purchaseTransactionModal, EntitlementLookup entilement) { super(purchaseTransactionModal.getContentId()); this.purchaseTransactionWindow = purchaseTransactionModal; final Form<Object> purchaseHistoryForm = new Form<Object>("purchaseHistoryForm"); purchaseHistoryForm.setOutputMarkupPlaceholderTag(true); add(purchaseHistoryForm); final FeedbackMessageFilter filter = new FeedbackMessageFilter("PurchaseHistory"); filter.setAcceptAllUnspecifiedComponents(false); filter.addFilterInComponent(purchaseHistoryForm); final FeedbackPanel purchaseHistoryFeedback = new FeedbackPanel("purchaseHistoryFeedback", filter); purchaseHistoryFeedback.setOutputMarkupPlaceholderTag(true); add(purchaseHistoryFeedback); purchaseHistoryForm.add( new PurchaseHistoryTabPanel( "gspPurchaseHistoryTabPanel", purchaseHistoryFeedback, purchaseHistoryForm, filter, TabId.ALL)); PurchaseSelectTabPanel purchaseSelectTabPanel = new PurchaseSelectTabPanel("purchaseSelectTabPanel", entilement); purchaseHistoryForm.add(purchaseSelectTabPanel); }
private void initLayout() { Form mainForm = new Form(ID_MAIN_FORM); add(mainForm); final IModel<Boolean> editable = new LoadableModel<Boolean>(false) { @Override protected Boolean load() { return !isEditing(); } }; mainForm.add( new AjaxCheckBox(ID_EDIT, editable) { @Override protected void onUpdate(AjaxRequestTarget target) { editPerformed(target, editable.getObject()); } }); AceEditor editor = new AceEditor(ID_ACE_EDITOR, new PropertyModel<String>(model, ObjectViewDto.F_XML)); editor.setReadonly( new LoadableModel<Boolean>(false) { @Override protected Boolean load() { return isEditing(); } }); mainForm.add(editor); initButtons(mainForm); }
/** * Defines an {@link AddCommentPanel} object of a file or an album, either album or file must be * null, but not both. * * @param id This panel {@code wicket:id} * @param commentsPanel Comment panel, to reload it on adding comments, it can be {@code null} * @param album The {@link #album}, or {@code null} for a file panel * @param file The {@link #file}, or {@code null} for an album panel */ private AddCommentPanel(String id, ShowCommentsPanel commentsPanel, Album album, File file) { super(id); this.album = album; this.file = file; final ShowCommentsPanel showCommentsPanel = commentsPanel; final TextArea<String> text = new TextArea<String>("text", Model.of("")); text.setRequired(true); Form<Void> form = new Form<Void>("addCommentForm") { @Override protected void onSubmit() { String textString = cleanComment(text.getModelObject()); if (validateComment(textString)) { createComment(textString); if (showCommentsPanel != null) { showCommentsPanel.reload(); } } setResponsePage(this.getPage()); } }; add(form); form.add(text); form.add(new Label("maxLength", String.valueOf(Comment.MAX_TEXT_LENGTH))); }
private void initialize() { final Form<Void> form = new Form<Void>("form"); this.add(form); // FeedbackPanel // final FeedbackPanel feedback = new JQueryFeedbackPanel("feedback"); form.add(feedback.setOutputMarkupId(true)); // Sliders // final Label label = new Label("label", this.model); // the supplied model allows the initial display form.add(label); form.add( new AjaxSlider("slider", this.model, label) { private static final long serialVersionUID = 1L; @Override public void onValueChanged(IPartialPageRequestHandler handler) { AjaxSliderPage.this.info(this); handler.add(feedback); // do never add 'this' or the form here! } }); }
private void makingReport(PageParameters pageParams) { Form form = new Form("nexusAggregationForm"); String aggDate = pageParams.get("aggDate").toString(); form.add(new Label("reportTitle", aggDate)); setLists(ServiceAggregation.accessLogResults); this.resulttable = new WebMarkupContainer("resulttable"); this.resulttable.setVisible(false); form.add(resulttable); HashMap<String, ? extends ArrayList> urlMappingResult = queryApplicationAccessLogGroupByWeek(aggDate); form.add(new NexusAccessLogPanel("NexusAggregation", urlMappingResult.get(aggDate))); if (getLists() != null) { renderPerformanceChartJs(getLists()); } form.add( new AjaxButton("backSummary") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { setResponsePage(CBSSummaryPage.class); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { // TODO Auto-generated method stub } }.setVisible(false)); add(form); }
private void createMailInput(Form<T> form) { TextField<String> emailField = new TextField<String>("user.email"); emailField.add(EmailAddressValidator.getInstance()); emailField.add(new ValidatingFormComponentAjaxBehavior()); form.add(emailField); form.add(new AjaxFormComponentFeedbackIndicator("emailValidationError", emailField)); }
public void initButtons(Form mainForm) { AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE, createStringResource("PageBase.button.save")) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { savePerformed(target); } }; mainForm.add(save); AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageBase.button.back")) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { cancelPerformed(target); } }; mainForm.add(back); }
@Override protected void onInitialize() { super.onInitialize(); TextField<String> userinput = new TextField<String>("userinput", Model.of("")); userinput.add( new AjaxFormSubmitBehavior("onchange") { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target) {} @Override protected void onError(AjaxRequestTarget target) {} @Override protected IAjaxCallDecorator getAjaxCallDecorator() { super.getAjaxCallDecorator(); return new MyAjaxCallDecorator(); } }); Form<Void> form = new Form<Void>("form"); add(form); form.add(userinput); AjaxRequestTarget.get(); getPageParameters(); }
protected void addDateFilter(Form<Object> form) { DateTime currentDateTime = new DateTime(new Date()); toDateM = new Model<Date>(currentDateTime.toDate()); fromDateM = new Model<Date>(currentDateTime.minusMonths(1).toDate()); form.add(new DateTextField("from", fromDateM)); form.add(new DateTextField("to", toDateM)); }
@Override protected void paint() { add(listLabel); tableForm.add(table); tableForm.add(backButton); add(tableForm); add(feedBackPanel); }
/** Constructor. */ public ChoicePage() { modelsMap.put("AUDI", Arrays.asList("A4", "A6", "TT")); modelsMap.put("CADILLAC", Arrays.asList("CTS", "DTS", "ESCALADE", "SRX", "DEVILLE")); modelsMap.put("FORD", Arrays.asList("CROWN", "ESCAPE", "EXPEDITION", "EXPLORER", "F-150")); IModel<List<? extends String>> makeChoices = new AbstractReadOnlyModel<List<? extends String>>() { private static final long serialVersionUID = 3083223353505563226L; @Override public List<String> getObject() { return new ArrayList<String>(modelsMap.keySet()); } }; IModel<List<? extends String>> modelChoices = new AbstractReadOnlyModel<List<? extends String>>() { private static final long serialVersionUID = -582253860769928261L; @Override public List<String> getObject() { List<String> models = modelsMap.get(selectedMake); if (models == null) { models = Collections.emptyList(); } return models; } }; Form<?> form = new Form("formid"); add(form); final DropDownChoice<String> makes = new DropDownChoice<String>( "makes", new PropertyModel<String>(this, "selectedMake"), makeChoices); final DropDownChoice<String> models = new DropDownChoice<String>("models", new Model<String>(), modelChoices); models.setOutputMarkupId(true); final DropDownChoice<String> models2 = new DropDownChoice<String>("models2", new Model<String>(), modelChoices); models2.setOutputMarkupId(true); form.add(makes); form.add(models); form.add(models2); makes.add( new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = -4971073888222316420L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(models); target.add(models2); } }); }
private void createUsernameInput(Form<T> form) { RequiredTextField<String> usernameField = new RequiredTextField<String>("user.username"); form.add(usernameField); usernameField.add(new StringValidator(0, 32)); usernameField.add(new DuplicateUsernameValidator()); usernameField.setLabel(new ResourceModel("admin.user.username")); usernameField.add(new ValidatingFormComponentAjaxBehavior()); form.add(new AjaxFormComponentFeedbackIndicator("userValidationError", usernameField)); }
private void createNameInput(Form<T> form) { TextField<String> firstNameField = new TextField<String>("user.firstName"); form.add(firstNameField); TextField<String> lastNameField = new RequiredTextField<String>("user.lastName"); form.add(lastNameField); lastNameField.setLabel(new ResourceModel("admin.user.lastName")); lastNameField.add(new ValidatingFormComponentAjaxBehavior()); form.add(new AjaxFormComponentFeedbackIndicator("lastNameValidationError", lastNameField)); }