Java Code Examples for org.apache.wicket.markup.html.form.Form#setDefaultButton()
The following examples show how to use
org.apache.wicket.markup.html.form.Form#setDefaultButton() .
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: SubclassCreationDialog.java From inception with Apache License 2.0 | 6 votes |
public ContentPanel(String aId, IModel<KBConcept> newSubclassConceptModel) { super(aId); // add components for input form RequiredTextField<String> name = new RequiredTextField<>("name"); name.add(AttributeModifier.append("placeholder", new ResourceModel("subclassNamePlaceholder"))); LambdaAjaxButton<KBConcept> createButton = new LambdaAjaxButton<KBConcept>( "createSubclass", SubclassCreationDialog.this::actionCreateSubclass); createButton.add(new Label("createLabel", new ResourceModel("create"))); // initialize input form and add it to the content panel Form<KBConcept> form = new Form<KBConcept>("form", CompoundPropertyModel.of(newSubclassConceptModel)); form.add(name); form.add(createButton); form.setDefaultButton(createButton); add(form); }
Example 2
Source File: AbstractInfoPanel.java From inception with Apache License 2.0 | 5 votes |
public EditMode(String id, CompoundPropertyModel<T> compoundModel) { super(id, "editMode", AbstractInfoPanel.this); // set up form components TextField<String> name = new TextField<>("name", compoundModel.bind("name")); name.add(AttributeModifier.append("placeholder", new ResourceModel(getNamePlaceholderResourceKey()))); name.setOutputMarkupId(true); focusComponent = name; // there exists functionality to cancel the "new KBObject" prompt, but in hindsight, MB // thinks this functionality is not really needed in the UI, so the button is hidden // here LambdaAjaxLink cancelButton = new LambdaAjaxLink("cancel", AbstractInfoPanel.this::actionCancel) .onConfigure((_this) -> _this.setVisible(false)); cancelButton.add(new Label("label", new ResourceModel(getCancelButtonResourceKey()))); LambdaAjaxButton<T> createButton = new LambdaAjaxButton<>("create", AbstractInfoPanel.this::actionCreate); createButton.add(new Label("label", new ResourceModel(getCreateButtonResourceKey()))); Form<T> form = new Form<T>("form", compoundModel); form.add(name); form.add(cancelButton); form.add(createButton); form.setDefaultButton(createButton); add(form); }
Example 3
Source File: LoginModalPanel.java From the-app with Apache License 2.0 | 5 votes |
private Component loginForm() { Form<Void> form = new Form<>("loginForm"); LoginPanel loginPanel = loginPanel(); form.add(loginPanel); AjaxSubmitLink submitLink = submitLink(loginPanel); form.add(submitLink); form.setDefaultButton(submitLink); form.add(closeLink("close")); return form; }
Example 4
Source File: OpenDocumentDialogPanel.java From webanno with Apache License 2.0 | 5 votes |
public OpenDocumentDialogPanel(String aId, AnnotatorState aState, ModalWindow aModalWindow, IModel<List<DecoratedObject<Project>>> aProjects, SerializableBiFunction<Project, User, List<DecoratedObject<SourceDocument>>> aDocListProvider) { super(aId); modalWindow = aModalWindow; state = aState; projects = aProjects; docListProvider = aDocListProvider; projectListChoice = createProjectListChoice(aState); userListChoice = createUserListChoice(aState); docListChoice = createDocListChoice(); Form<Void> form = new Form<>("form"); form.setOutputMarkupId(true); form.add(projectListChoice); form.add(docListChoice); form.add(userListChoice); buttonsContainer = new WebMarkupContainer("buttons"); buttonsContainer.setOutputMarkupId(true); LambdaAjaxSubmitLink openButton = new LambdaAjaxSubmitLink("openButton", OpenDocumentDialogPanel.this::actionOpenDocument); openButton.add(enabledWhen(() -> docListChoice.getModelObject() != null)); buttonsContainer.add(openButton); buttonsContainer.add( new LambdaAjaxLink("cancelButton", OpenDocumentDialogPanel.this::actionCancel)); form.add(buttonsContainer); form.setDefaultButton(openButton); add(form); }
Example 5
Source File: DefaultPagingNavigator.java From webanno with Apache License 2.0 | 5 votes |
public DefaultPagingNavigator(String aId, AnnotationPageBase aPage) { super(aId); setOutputMarkupPlaceholderTag(true); page = aPage; Form<Void> form = new Form<>("form"); gotoPageTextField = new NumberTextField<>("gotoPageText", Model.of(1), Integer.class); // Using a LambdaModel here because the model object in the page may change and we want to // always get the right one gotoPageTextField.setModel( PropertyModel.of(LambdaModel.of(() -> aPage.getModel()), "firstVisibleUnitIndex")); // FIXME minimum and maximum should be obtained from the annotator state gotoPageTextField.setMinimum(1); //gotoPageTextField.setMaximum(LambdaModel.of(() -> aPage.getModelObject().getUnitCount())); gotoPageTextField.setOutputMarkupId(true); form.add(gotoPageTextField); LambdaAjaxSubmitLink gotoPageLink = new LambdaAjaxSubmitLink("gotoPageLink", form, this::actionGotoPage); form.setDefaultButton(gotoPageLink); form.add(gotoPageLink); add(form); form.add(new LambdaAjaxLink("showNext", t -> actionShowNextPage(t)) .add(new InputBehavior(new KeyType[] { KeyType.Page_down }, EventType.click))); form.add(new LambdaAjaxLink("showPrevious", t -> actionShowPreviousPage(t)) .add(new InputBehavior(new KeyType[] { KeyType.Page_up }, EventType.click))); form.add(new LambdaAjaxLink("showFirst", t -> actionShowFirstPage(t)) .add(new InputBehavior(new KeyType[] { KeyType.Home }, EventType.click))); form.add(new LambdaAjaxLink("showLast", t -> actionShowLastPage(t)) .add(new InputBehavior(new KeyType[] { KeyType.End }, EventType.click))); }
Example 6
Source File: LoginModalPanel.java From AppStash with Apache License 2.0 | 5 votes |
private Component loginForm() { Form<Void> form = new Form<>("loginForm"); LoginPanel loginPanel = loginPanel(); form.add(loginPanel); AjaxSubmitLink submitLink = submitLink(loginPanel); form.add(submitLink); form.setDefaultButton(submitLink); form.add(closeLink("close")); return form; }
Example 7
Source File: SchemasPanel.java From syncope with Apache License 2.0 | 5 votes |
public SchemasPanel(final String id, final PageReference pageRef) { super(id); this.pageRef = pageRef; Model<String> keywordModel = new Model<>(StringUtils.EMPTY); WebMarkupContainer searchBoxContainer = new WebMarkupContainer("searchBox"); add(searchBoxContainer); Form<?> form = new Form<>("form"); searchBoxContainer.add(form); AjaxTextFieldPanel filter = new AjaxTextFieldPanel("filter", "filter", keywordModel, true); form.add(filter.hideLabel().setOutputMarkupId(true).setRenderBodyOnly(true)); AjaxButton search = new AjaxButton("search") { private static final long serialVersionUID = 8390605330558248736L; @Override protected void onSubmit(final AjaxRequestTarget target) { send(SchemasPanel.this, Broadcast.DEPTH, new SchemaTypePanel.SchemaSearchEvent(target, keywordModel.getObject())); } }; search.setOutputMarkupId(true); form.add(search); form.setDefaultButton(search); Accordion accordion = new Accordion("accordionPanel", buildTabList()); accordion.setOutputMarkupId(true); add(accordion); }