List of usage examples for org.apache.wicket.markup.html.form Form setDefaultButton
public final void setDefaultButton(IFormSubmittingComponent submittingComponent)
From source file:com.axway.ats.testexplorer.pages.reports.compare.CompareRunsPage.java
License:Apache License
public CompareRunsPage(PageParameters parameters) { super(parameters); final String runIds = extractParameter(parameters, "runIds").replace("_", ","); final WebMarkupContainer testsComparisonContainer = new WebMarkupContainer("testsComparison"); testsComparisonContainer.setOutputMarkupId(true); add(testsComparisonContainer);//from w w w. j av a2s .com Form<Object> testsComparisonForm = new Form<Object>("testsComparisonForm"); testsComparisonForm.setOutputMarkupId(true); testsComparisonForm.setMarkupId("testsComparisonForm"); List<List<TestcasesTableCell>> testcasesTableModel = getTestcasesTableModel(runIds); final ListView<List<TestcasesTableCell>> testcasesTable = getTestcasesTable(testcasesTableModel); testsComparisonForm.add(testcasesTable); testsComparisonContainer.add(testsComparisonForm); AjaxButton applyFilterButton = new AjaxButton("applyFilterButton") { private static final long serialVersionUID = 1L; @Override public void onSubmit(AjaxRequestTarget target, Form<?> form) { List<List<TestcasesTableCell>> testcasesTableModel = getTestcasesTableModel(runIds); testcasesTable.setDefaultModelObject(testcasesTableModel); target.add(testsComparisonContainer); } }; applyFilterButton.setOutputMarkupId(true); applyFilterButton.setMarkupId("applyFilterButton"); testsComparisonForm.add(applyFilterButton); testsComparisonForm.setDefaultButton(applyFilterButton); }
From source file:com.evolveum.midpoint.web.page.forgetpassword.PageForgotPassword.java
License:Apache License
private void initButtons(Form<?> form) { AjaxSubmitButton submit = new AjaxSubmitButton(ID_SUBMIT, createStringResource("PageForgetPassword.resetPassword")) { private static final long serialVersionUID = 1L; @Override//from w ww . j a v a2s .co m protected void onSubmit(AjaxRequestTarget target) { processResetPassword(target, form); } @Override protected void onError(AjaxRequestTarget target) { target.add(getFeedbackPanel()); } }; submit.setOutputMarkupId(true); form.add(submit); form.setDefaultButton(submit); AjaxButton backButton = new AjaxButton(ID_BACK, createStringResource("PageForgetPassword.back")) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { setResponsePage(PageLogin.class); } }; backButton.setOutputMarkupId(true); form.add(backButton); add(form); MultiLineLabel label = new MultiLineLabel(ID_PASSWORD_RESET_SUBMITED, createStringResource("PageForgotPassword.form.submited.message")); add(label); label.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return submited; } @Override public boolean isEnabled() { return submited; } }); }
From source file:com.evolveum.midpoint.web.page.self.PageAbstractSelfCredentials.java
License:Apache License
private void initButtons(Form<?> mainForm) { AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE_BUTTON, createStringResource("PageBase.button.save")) { private static final long serialVersionUID = 1L; @Override/*from w w w .j av a 2s . c o m*/ protected void onError(AjaxRequestTarget target) { target.add(getFeedbackPanel()); } @Override protected void onSubmit(AjaxRequestTarget target) { onSavePerformed(target); } }; mainForm.setDefaultButton(save); mainForm.add(save); AjaxSubmitButton cancel = new AjaxSubmitButton(ID_CANCEL_BUTTON, createStringResource("PageBase.button.back")) { private static final long serialVersionUID = 1L; @Override protected void onError(AjaxRequestTarget target) { onCancelPerformed(target); } @Override protected void onSubmit(AjaxRequestTarget target) { onCancelPerformed(target); } }; mainForm.add(cancel); }
From source file:com.evolveum.midpoint.web.page.self.PageRequestRole.java
License:Apache License
private void initButtons(Form mainForm) { AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE_BUTTON, createStringResource("PageBase.button.save")) { @Override/*from w w w . ja v a 2 s. co m*/ protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) { target.add(getFeedbackPanel()); } @Override protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) { onSavePerformed(target); } }; mainForm.setDefaultButton(save); mainForm.add(save); AjaxSubmitButton cancel = new AjaxSubmitButton(ID_CANCEL_BUTTON, createStringResource("PageBase.button.back")) { @Override protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) { target.add(getFeedbackPanel()); } @Override protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) { // onCancelPerformed(target); } }; mainForm.add(cancel); }
From source file:com.evolveum.midpoint.web.page.self.PageSelfCredentials.java
License:Apache License
private void initButtons(Form mainForm) { AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE_BUTTON, createStringResource("PageBase.button.save")) { @Override/* w ww . j av a 2s . c o m*/ protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(getFeedbackPanel()); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { onSavePerformed(target); } }; mainForm.setDefaultButton(save); mainForm.add(save); AjaxSubmitButton cancel = new AjaxSubmitButton(ID_CANCEL_BUTTON, createStringResource("PageBase.button.back")) { @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(getFeedbackPanel()); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { onCancelPerformed(target); } }; mainForm.add(cancel); }
From source file:com.madalla.webapp.login.LoginPanel.java
License:Apache License
/** * @param id/* w ww .j av a 2 s.c o m*/ * See Component constructor * @see org.apache.wicket.Component#Component(String) */ public LoginPanel(final String id, final ICredentialHolder credentials, Class<? extends Page> destination) { super(id); if (destination == null) { this.destination = getApplication().getHomePage(); } else { this.destination = destination; } // if we have a valid populated credential then validate if (StringUtils.isNotEmpty(credentials.getUsername()) && StringUtils.isNotEmpty(credentials.getPassword()) && signIn(credentials.getUsername(), credentials.getPassword())) { throw new RestartResponseAtInterceptPageException(destination); } final Form<Void> form = new SignInForm("signInForm", credentials); add(form); final FeedbackPanel feedback = new FeedbackPanel("loginFeedback"); feedback.setOutputMarkupId(true); form.add(feedback); lockedLabel = new Label("lockedLabel", new StringResourceModel("label.locked", this, new Model<ICredentialHolder>(credentials))); lockedLabel.setVisibilityAllowed(true); lockedLabel.setVisible(false); form.add(lockedLabel); unlockUser = new AjaxLink<String>("unlockUser") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { target.add(form); lockUserName(false); credentials.setUsername(""); } }; unlockUser.setVisibilityAllowed(true); form.add(unlockUser); // set up depending on if we have a username or not lockUserName(StringUtils.isNotEmpty(credentials.getUsername())); AjaxButton submit = new IndicatingAjaxButton("submitLink", form) { private static final long serialVersionUID = 1L; @Override protected void onError(AjaxRequestTarget target, Form<?> form) { log.debug("Ajax onError called"); target.add(feedback); target.add(form); onSignInFailed(getUsername()); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { log.debug("Ajax onSubmit. userName=" + getUsername()); target.add(form); preSignIn(getUsername()); if (!isUserLocked()) { lockUserName(true); } else { if (signIn(getUsername(), getPassword())) { feedback.info(getLocalizer().getString("signInFailed", this, "Success")); onSignInSucceeded(target); } else { feedback.error(getLocalizer().getString("signInFailed", this, "Sign in failed")); target.add(feedback); onSignInFailed(getUsername()); } } } }; submit.setEnabled(true); form.setDefaultButton(submit); // submit.setVisibilityAllowed(true); form.add(submit); form.add(new AttributeModifier("onSubmit", new Model<String>( "document.getElementById('" + submit.getMarkupId() + "').onclick();return false;"))); }
From source file:com.modusoperandi.dragonfly.widgets.chart.ScatterChartPage.java
License:Open Source License
/** * Instantiates a new portal page./*from w ww .j a va 2s. c o m*/ * * @param parameters */ public ScatterChartPage(final PageParameters parameters) { LOGGER.info("parameters = " + parameters.toString()); add(new TsvXyAjaxBehavior()); add(new TsvYCountAjaxBehavior()); add(new TsvLabelCountAjaxBehavior()); add(new TsvPercentCountAjaxBehavior()); add(new JsonTimewheelAjaxBehavior()); add(new JsonHeatMapRingMapAjaxBehavior()); // ///////////////////////////// // Elasticsearch getEsClient(); // ///////////////////////////// // UI final Form<?> queryForm = new Form<Void>("queryForm"); add(queryForm); queryForm.add(new AddAjaxButton()); final RefreshAjaxButton refreshButton = new RefreshAjaxButton(); queryForm.add(refreshButton); queryForm.setDefaultButton(refreshButton); termFilterField = new TextField<String>("termFilter", new PropertyModel<String>(this, "filterTerm")); queryForm.add(termFilterField); hitsField = new Label("hits", new PropertyModel<String>(this, "hits")); hitsField.setOutputMarkupId(true); queryForm.add(hitsField); // ///////////////////////////// // Add Panel addWindow = new ModalWindow("dataPanel"); d3SettingsPanel = new SettingsPanel(addWindow.getContentId(), addWindow); addWindow.setContent(d3SettingsPanel); addWindow.setCookieName(null); addWindow.setInitialHeight(400); addWindow.setHeightUnit("px"); addWindow.setInitialWidth(620); addWindow.setWidthUnit("px"); addWindow.setResizable(false); addWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8118424010410661292L; @Override public void onClose(final AjaxRequestTarget target) { if (d3SettingsPanel.isOk()) { configuration = d3SettingsPanel.getConfiguration(); if (configuration.get("Type").equals(SettingsPanel.XY)) { target.appendJavaScript("drawScatterChart(\"" + configuration.get("X") + "\",\"" + configuration.get("Y") + "\");"); } else if (configuration.get("Type").equals(SettingsPanel.FACET_BAR)) { target.appendJavaScript("drawBarChart(\"" + configuration.get("CountField") + "\");"); } else if (configuration.get("Type").equals(SettingsPanel.SERIES_LINE)) { target.appendJavaScript("drawLineChart(\"" + configuration.get("X") + "\",\"" + configuration.get("Y") + "\");"); } else if (configuration.get("Type").equals(SettingsPanel.FACET_PIE)) { target.appendJavaScript("drawPieChart(\"" + configuration.get("CountField") + "\");"); } else if (configuration.get("Type").equals(SettingsPanel.TIMEWHEEL)) { target.appendJavaScript("drawTimewheelChart();"); } else if (configuration.get("Type").equals(SettingsPanel.HEAT_MAP_RING_MAP)) { target.appendJavaScript("drawHeatMapRingMap(" + Integer.toString(chartId) + ", " + jsString(configuration.get("Index")) + ", " + jsString(configuration.get("LocationField")) + ", " + jsString(configuration.get("TimeField")) + ", " + jsString(configuration.get("TimeScale")) + ", " + jsString(configuration.get("LabelField")) + ", " + jsString(filterTerm) + ");"); } chartId++; } } }); add(addWindow); }
From source file:com.modusoperandi.dragonfly.widgets.map.MapWidgetPage.java
License:Open Source License
/** * Instantiates a new map widget page.// w w w. j a v a 2 s . c o m * * @param parameters */ public MapWidgetPage(final PageParameters parameters) { initializeFromSettingsFile(); // ///////////////////////////// // Elasticsearch getEsClient(); // ///////////////////////////// // // Main panel controlBar = new WebMarkupContainer("controlBar"); controlBar.setOutputMarkupId(true); add(controlBar); final Form<?> queryForm = new Form<>("queryForm"); controlBar.add(queryForm); queryForm.add(new AddAjaxButton()); queryForm.add(new PermalinkAjaxButton()); final RefreshAjaxButton refreshButton = new RefreshAjaxButton(); queryForm.add(refreshButton); queryForm.setDefaultButton(refreshButton); termFilterField = new TextField<>("termFilter", new PropertyModel<String>(this, "filterTerm")); queryForm.add(termFilterField); hitsField = new Label("hits", new PropertyModel<>(this, "hits")); hitsField.setOutputMarkupId(true); queryForm.add(hitsField); // ///////////////////////////// // Map // mapDiv = new WebMarkupContainer("heatmapDiv"); // mapDiv.setOutputMarkupId(true); // add(mapDiv); add(new HandleOnZoomLeafletCallbackAjaxBehavior()); // Add Panel addWindow = new ModalWindow("dataPanel"); heatMapSettingsPanel = new MapSettingsPanel(addWindow.getContentId(), addWindow); addWindow.setContent(heatMapSettingsPanel); addWindow.setCookieName(null); addWindow.setInitialHeight(400); addWindow.setHeightUnit("px"); addWindow.setInitialWidth(572); addWindow.setWidthUnit("px"); addWindow.setResizable(false); addWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8118424010410661292L; @Override public void onClose(final AjaxRequestTarget target) { if (heatMapSettingsPanel.isOk()) { addDataToMap(heatMapSettingsPanel.getConfiguration(), target); } } }); add(addWindow); // Information Panel informationWindow = new ModalWindow("informationPanel"); informationPanel = new InformationPanel(informationWindow.getContentId()); informationWindow.setContent(informationPanel); informationWindow.setCookieName(null); informationWindow.setInitialHeight(200); informationWindow.setHeightUnit("px"); informationWindow.setInitialWidth(574); informationWindow.setWidthUnit("px"); informationWindow.setResizable(false); add(informationWindow); }
From source file:com.norconex.jefmon.settings.initial.InitialSetupPage.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); add(new JEFMonHeaderPanel("header")); steps.addAll(buildSteps());/*from w w w. j a va2 s . co m*/ currentStep = steps.remove().createStep("step"); initialStepCount = steps.size(); final Form<Void> setupForm = new Form<Void>("form") { private static final long serialVersionUID = 6003112987882939981L; @Override protected void onBeforeRender() { addOrReplace(currentStep); super.onBeforeRender(); } }; setupForm.setOutputMarkupId(true); add(setupForm); final FeedbackPanel feedback = new FeedbackPanel("feedback"); feedback.setOutputMarkupId(true); setupForm.add(feedback); final AjaxButton continueButton = new AjaxButton("continue") { private static final long serialVersionUID = 1L; @Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { boolean done = true; if (!steps.isEmpty()) { IStep step = steps.remove(); if (step != null) { done = false; currentStep = step.createStep("step"); target.add(form); } } if (done) { setResponsePage(HomePage.class); } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(feedback); } }; continueButton.add(new Label("continueLabel", new Model<String>() { private static final long serialVersionUID = -7480334927080818811L; @Override public String getObject() { if (!isStarted()) { return getString("btn.start"); } return getString("btn.continue"); } })); setupForm.add(continueButton); setupForm.setDefaultButton(continueButton); }
From source file:com.norconex.jefmon.settings.update.SettingsPage.java
License:Apache License
private void initializeComponents() { try {/*from www.j a va 2 s. co m*/ PropertyUtils.copyProperties(dirtyConfig, getJEFMonConfig()); } catch (Exception e) { throw new WicketRuntimeException(e); } AjaxLink<String> nameBack = new AjaxLink<String>("nameBack") { private static final long serialVersionUID = -7790485617549321158L; @Override public void onClick(AjaxRequestTarget target) { setResponsePage(InstancePage.class); } }; nameBack.add(new Label("name", getJEFMonConfig().getInstanceName())); add(nameBack); Form<Void> form = new Form<Void>("form"); form.setOutputMarkupId(true); add(form); final FeedbackPanel feedback = new FeedbackPanel("feedback"); feedback.setOutputMarkupId(true); form.add(feedback); form.add(createConfigPanel("configPanel", dirtyConfig)); final AjaxButton saveButton = new AjaxButton("save") { private static final long serialVersionUID = 8835758195954072646L; @Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> theform) { try { ConfigurationDAO.saveConfig(dirtyConfig); PropertyUtils.copyProperties(getJEFMonConfig(), dirtyConfig); } catch (IOException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw new WicketRuntimeException("Cannot save configuration.", e); } success(getString("success")); setResponsePage(InstancePage.class); } @Override protected void onError(AjaxRequestTarget target, Form<?> theForm) { target.add(feedback); } }; form.add(saveButton); form.setDefaultButton(saveButton); AjaxLink<String> closeButton = new AjaxLink<String>("close") { private static final long serialVersionUID = 6062171472516887030L; @Override public void onClick(AjaxRequestTarget target) { setResponsePage(InstancePage.class); } }; form.add(closeButton); }