org.apache.wicket.markup.html.form.ChoiceRenderer Java Examples
The following examples show how to use
org.apache.wicket.markup.html.form.ChoiceRenderer.
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: ProjectSelectionPanel.java From webanno with Apache License 2.0 | 7 votes |
public ProjectSelectionPanel(String id, IModel<Project> aModel) { super(id); overviewList = new OverviewListChoice<>("project"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("name")); overviewList.setModel(aModel); overviewList.setChoices(LambdaModel.of(this::listProjects)); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange)); add(overviewList); add(createLink = new LambdaAjaxLink("create", this::actionCreate)); MetaDataRoleAuthorizationStrategy.authorize(createLink, Component.RENDER, StringUtils.join( new String[] { Role.ROLE_ADMIN.name(), Role.ROLE_PROJECT_CREATOR.name() }, ",")); importProjectPanel = new ProjectImportPanel("importPanel", aModel); add(importProjectPanel); authorize(importProjectPanel, Component.RENDER, String.join(",", ROLE_ADMIN.name(), ROLE_PROJECT_CREATOR.name())); }
Example #2
Source File: KnowledgeBaseListPanel.java From inception with Apache License 2.0 | 6 votes |
public KnowledgeBaseListPanel(String id, IModel<Project> aProjectModel, IModel<KnowledgeBase> aKbModel) { super(id, aProjectModel); setOutputMarkupId(true); kbModel = aKbModel; projectModel = aProjectModel; overviewList = new OverviewListChoice<>("knowledgebases"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("name")); overviewList.setChoices( LambdaModel.of(() -> kbService.getKnowledgeBases(projectModel.getObject()))); overviewList.setModel(kbModel); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange)); add(overviewList); modal = new KnowledgeBaseCreationDialog("modal", projectModel); add(modal); add(new LambdaAjaxLink("new", this::actionCreate)); }
Example #3
Source File: UserSelectionPanel.java From webanno with Apache License 2.0 | 6 votes |
public UserSelectionPanel(String id, IModel<User> aModel) { super(id); setOutputMarkupPlaceholderTag(true); overviewList = new OverviewListChoice<>("user"); overviewList.setChoiceRenderer(new ChoiceRenderer<User>() { private static final long serialVersionUID = 1L; @Override public Object getDisplayValue(User aUser) { return aUser.getUsername() + (aUser.isEnabled() ? "" : " (disabled)"); } }); overviewList.setModel(aModel); overviewList.setChoices(this::listUsers); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange)); add(overviewList); add(new LambdaAjaxLink("create", this::actionCreate)); showDisabled = new CheckBox("showDisabled", Model.of(false)); showDisabled.add( new LambdaAjaxFormComponentUpdatingBehavior("change", this::toggleShowDisabled)); add(showDisabled); }
Example #4
Source File: ProjectCasDoctorPanel.java From webanno with Apache License 2.0 | 6 votes |
public ProjectCasDoctorPanel(String id, IModel<Project> aProjectModel) { super(id, aProjectModel); setOutputMarkupId(true); Form<FormModel> form = new Form<>("casDoctorForm", PropertyModel.of(this, "formModel")); add(form); CheckBoxMultipleChoice<Class<? extends Repair>> repairs = new CheckBoxMultipleChoice<>( "repairs"); repairs.setModel(PropertyModel.of(this, "formModel.repairs")); repairs.setChoices(CasDoctor.scanRepairs()); repairs.setChoiceRenderer(new ChoiceRenderer<>("simpleName")); repairs.setPrefix("<div class=\"checkbox\">"); repairs.setSuffix("</div>"); repairs.setLabelPosition(LabelPosition.WRAP_AFTER); form.add(repairs); form.add(new LambdaAjaxButton<FormModel>("check", this::actionCheck)); form.add(new LambdaAjaxButton<FormModel>("repair", this::actionRepair)); add(createMessageSetsView()); }
Example #5
Source File: DocumentListPanel.java From webanno with Apache License 2.0 | 6 votes |
public DocumentListPanel(String aId, IModel<Project> aProject) { super(aId); setOutputMarkupId(true); project = aProject; selectedDocuments = new CollectionModel<>(); Form<Void> form = new Form<>("form"); add(form); overviewList = new ListMultipleChoice<>("documents"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("name")); overviewList.setModel(selectedDocuments); overviewList.setChoices(LambdaModel.of(this::listSourceDocuments)); form.add(overviewList); confirmationDialog = new ConfirmationDialog("confirmationDialog"); confirmationDialog.setTitleModel(new StringResourceModel("DeleteDialog.title", this)); add(confirmationDialog); form.add(new LambdaAjaxButton<>("delete", this::actionDelete)); }
Example #6
Source File: TypeBrowser.java From oodt with Apache License 2.0 | 6 votes |
/** * @param id * The wicket:id component ID of this form. */ public AddCriteriaForm(String id) { super(id, new CompoundPropertyModel<ElementCrit>(new ElementCrit())); List<Element> ptypeElements = fm.safeGetElementsForProductType(type); Collections.sort(ptypeElements, new Comparator<Element>() { public int compare(Element e1, Element e2) { return e1.getElementName().compareTo(e2.getElementName()); } }); add(new DropDownChoice<Element>("criteria_list", new PropertyModel( getDefaultModelObject(), "elem"), new ListModel<Element>( ptypeElements), new ChoiceRenderer<Element>("elementName", "elementId"))); add(new TextField<TermQueryCriteria>( "criteria_form_add_element_value", new PropertyModel<TermQueryCriteria>(getDefaultModelObject(), "value"))); add(new Button("criteria_elem_add")); }
Example #7
Source File: TagSelectionPanel.java From webanno with Apache License 2.0 | 6 votes |
public TagSelectionPanel(String id, IModel<TagSet> aTagset, IModel<Tag> aTag) { super(id, aTagset); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); selectedTagSet = aTagset; overviewList = new OverviewListChoice<>("tag"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("name")); overviewList.setModel(aTag); overviewList.setChoices(LambdaModel.of(this::listTags)); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange)); add(overviewList); add(new LambdaAjaxLink("create", this::actionCreate)); }
Example #8
Source File: TagSetSelectionPanel.java From webanno with Apache License 2.0 | 6 votes |
public TagSetSelectionPanel(String id, IModel<Project> aProject, IModel<TagSet> aTagset) { super(id, aProject); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); selectedProject = aProject; overviewList = new OverviewListChoice<>("tagset"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("name")); overviewList.setModel(aTagset); overviewList.setChoices(LambdaModel.of(this::listTagSets)); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange)); add(overviewList); add(new LambdaAjaxLink("create", this::actionCreate)); tagSetImportPanel = new TagSetImportPanel("importPanel", selectedProject); tagSetImportPanel.setImportCompleteAction(target -> { target.add(findParent(ProjectTagSetsPanel.class)); }); add(tagSetImportPanel); }
Example #9
Source File: SearchPage.java From inception with Apache License 2.0 | 6 votes |
public SearchForm(String id) { super(id); setModel(CompoundPropertyModel.of(new SearchFormModel())); DropDownChoice<DocumentRepository> repositoryCombo = new BootstrapSelect<DocumentRepository>("repository"); repositoryCombo.setChoices(LoadableDetachableModel .of(() -> externalSearchService.listDocumentRepositories(project))); repositoryCombo.setChoiceRenderer(new ChoiceRenderer<DocumentRepository>("name")); repositoryCombo.setNullValid(false); add(repositoryCombo); if (!repositoryCombo.getChoices().isEmpty()) { repositoryCombo.setModelObject(repositoryCombo.getChoices().get(0)); } add(new TextField<>("query", String.class)); LambdaAjaxSubmitLink searchLink = new LambdaAjaxSubmitLink("submitSearch", this::actionSearch); add(searchLink); setDefaultButton(searchLink); }
Example #10
Source File: ExternalSearchAnnotationSidebar.java From inception with Apache License 2.0 | 6 votes |
public DocumentRepositorySelectionForm(String aId) { super(aId); DropDownChoice<DocumentRepository> repositoryCombo = new BootstrapSelect<DocumentRepository>("repositoryCombo", new PropertyModel<DocumentRepository>(ExternalSearchAnnotationSidebar.this, "currentRepository"), repositoriesModel); repositoryCombo.setChoiceRenderer(new ChoiceRenderer<DocumentRepository>("name")); repositoryCombo.setNullValid(false); // Just update the selection repositoryCombo.add(new LambdaAjaxFormComponentUpdatingBehavior("change")); add(repositoryCombo); }
Example #11
Source File: DocumentRepositoryListPanel.java From inception with Apache License 2.0 | 6 votes |
public DocumentRepositoryListPanel(String id, IModel<Project> aProject, IModel<DocumentRepository> aDocumentRepository) { super(id); setOutputMarkupId(true); projectModel = aProject; selectedDocumentRepository = aDocumentRepository; overviewList = new OverviewListChoice<>("documentRepositories"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("name")); overviewList.setModel(selectedDocumentRepository); overviewList.setChoices(LambdaModel.of(this::listDocumentRepositories)); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange)); add(overviewList); add(new LambdaAjaxLink("create", this::actionCreate)); }
Example #12
Source File: SearchAnnotationSidebar.java From inception with Apache License 2.0 | 6 votes |
private DropDownChoice<AnnotationLayer> createLayerDropDownChoice(String aId, List<AnnotationLayer> aChoices) { DropDownChoice<AnnotationLayer> layerChoice = new BootstrapSelect<>(aId, aChoices, new ChoiceRenderer<>("uiName")); layerChoice.add(new AjaxFormComponentUpdatingBehavior("change") { private static final long serialVersionUID = -6095969211884063787L; @Override protected void onUpdate(AjaxRequestTarget aTarget) { //update the choices for the feature selection dropdown groupingFeature.setChoices(annotationService .listAnnotationFeature(searchOptions.getObject().getGroupingLayer())); lowLevelPagingCheckBox.setModelObject(false); aTarget.add(groupingFeature, lowLevelPagingCheckBox); } }); layerChoice.setNullValid(true); return layerChoice; }
Example #13
Source File: RecommenderListPanel.java From inception with Apache License 2.0 | 6 votes |
public RecommenderListPanel(String id, IModel<Project> aProject, IModel<Recommender> aRecommender, boolean showCreateButton) { super(id); setOutputMarkupId(true); projectModel = aProject; selectedRecommender = aRecommender; overviewList = new OverviewListChoice<>("recommenders"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("name")); overviewList.setModel(selectedRecommender); overviewList.setChoices(LambdaModel.of(this::listRecommenders)); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange)); add(overviewList); LambdaAjaxLink lambdaAjaxLink = new LambdaAjaxLink("create", this::actionCreate); add(lambdaAjaxLink); if (!showCreateButton) { lambdaAjaxLink.setVisible(false); } }
Example #14
Source File: StatementGroupPanel.java From inception with Apache License 2.0 | 6 votes |
public NewStatementGroupFragment(String aId) { super(aId, "newStatementGroup", StatementGroupPanel.this, groupModel); IModel<KBProperty> property = Model.of(); Form<KBProperty> form = new Form<>("form", property); DropDownChoice<KBProperty> type = new BootstrapSelect<>("property"); type.setModel(property); type.setChoiceRenderer(new ChoiceRenderer<>("uiLabel")); type.setChoices(getUnusedProperties()); type.setRequired(true); type.setOutputMarkupId(true); form.add(type); focusComponent = type; form.add(new LambdaAjaxButton<>("create", this::actionNewProperty)); form.add(new LambdaAjaxLink("cancel", this::actionCancelNewProperty)); add(form); }
Example #15
Source File: LappsGridRecommenderTraitsEditor.java From inception with Apache License 2.0 | 5 votes |
public LappsGridRecommenderTraitsEditor(String aId, IModel<Recommender> aRecommender) { super(aId, aRecommender); traits = toolFactory.readTraits(aRecommender.getObject()); traitsModel = CompoundPropertyModel.of(traits); Form<LappsGridRecommenderTraits> form = new Form<LappsGridRecommenderTraits>(MID_FORM, traitsModel) { private static final long serialVersionUID = -3109239605742291123L; @Override protected void onSubmit() { super.onSubmit(); toolFactory.writeTraits(aRecommender.getObject(), traits); } }; urlField = new TextField<>(MID_URL); urlField.setRequired(true); urlField.add(new UrlValidator()); urlField.setOutputMarkupId(true); form.add(urlField); servicesDropDown = new BootstrapSelect<>(MID_SERVICES); servicesDropDown.setModel(Model.of()); servicesDropDown.setChoices(LoadableDetachableModel.of(this::getPredefinedServicesList)); servicesDropDown.setChoiceRenderer(new ChoiceRenderer<>("description")); servicesDropDown.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> { LappsGridService selection = servicesDropDown.getModelObject(); if (selection != null) { traits.setUrl(selection.getUrl()); } t.add(urlField); })); form.add(servicesDropDown); add(form); }
Example #16
Source File: ProjectConstraintsPanel.java From webanno with Apache License 2.0 | 5 votes |
public SelectionForm(String aId, IModel<ConstraintSet> aModel) { super(aId, aModel); LoadableDetachableModel<List<ConstraintSet>> rulesets = new LoadableDetachableModel<List<ConstraintSet>>() { private static final long serialVersionUID = 1L; @Override protected List<ConstraintSet> load() { return constraintsService .listConstraintSets(ProjectConstraintsPanel.this.getModelObject()); } }; add(new ListChoice<ConstraintSet>("ruleset", SelectionForm.this.getModel(), rulesets) { private static final long serialVersionUID = 1L; { setChoiceRenderer(new ChoiceRenderer<>("name")); setNullValid(false); add(new FormComponentUpdatingBehavior()); } @Override protected CharSequence getDefaultChoice(String aSelectedValue) { return ""; } }); }
Example #17
Source File: LayerSelectionPanel.java From webanno with Apache License 2.0 | 5 votes |
private DropDownChoice<AnnotationLayer> createDefaultAnnotationLayerSelector() { DropDownChoice<AnnotationLayer> selector = new BootstrapSelect<>("defaultAnnotationLayer"); selector.setChoices(LoadableDetachableModel.of(this::getSelectableLayers)); selector.setChoiceRenderer(new ChoiceRenderer<>("uiName")); selector.setOutputMarkupId(true); selector.add(LambdaAjaxFormComponentUpdatingBehavior.onUpdate("change", this::actionChangeDefaultLayer)); return selector; }
Example #18
Source File: QualifierEditor.java From inception with Apache License 2.0 | 5 votes |
/** * Creates a new fragement for editing a qualifier.<br> * The editor has two slightly different behaviors, depending on the value of * {@code isNewQualifier}: * <ul> * <li>{@code !isNewQualifier}: Save button commits changes, cancel button discards unsaved * changes, delete button removes the qualifier from the statement.</li> * <li>{@code isNewQualifier}: Save button commits changes (creates a new qualifier in the * statement), cancel button removes the qualifier from the UI, delete button is not visible * .</li> * </ul> * * @param aId * markup ID * @param aQualifier * qualifier model * @param isNewQualifier * whether the qualifier being edited is new, meaning it has no corresponding * qualifier in the KB backend */ public EditMode(String aId, IModel<KBQualifier> aQualifier, boolean isNewQualifier) { super(aId, "editMode", QualifierEditor.this, aQualifier); IModel<KBQualifier> compoundModel = CompoundPropertyModel.of(aQualifier); Form<KBQualifier> form = new Form<>("form", compoundModel); DropDownChoice<KBProperty> type = new BootstrapSelect<>("property"); type.setChoiceRenderer(new ChoiceRenderer<>("uiLabel")); type.setChoices(kbService.listProperties(kbModel.getObject(), false)); type.setRequired(true); type.setOutputMarkupId(true); form.add(type); initialFocusComponent = type; form.add(new TextField<>("language")); Component valueTextArea = new TextArea<String>("value"); form.add(valueTextArea); form.add(new LambdaAjaxButton<>("create", QualifierEditor.this::actionSave)); form.add(new LambdaAjaxLink("cancel", t -> { if (isNewQualifier) { QualifierEditor.this.actionCancelNewQualifier(t); } else { QualifierEditor.this.actionCancelExistingQualifier(t); } })); form.add(new LambdaAjaxLink("delete", QualifierEditor.this::actionDelete) .setVisibilityAllowed(!isNewQualifier)); add(form); }
Example #19
Source File: AgreementPage.java From webanno with Apache License 2.0 | 5 votes |
public ProjectSelectionForm(String id) { super(id, new CompoundPropertyModel<>(new ProjectSelectionModel())); ListChoice<Project> projectList = new OverviewListChoice<>("project"); projectList.setChoiceRenderer(new ChoiceRenderer<>("name")); projectList.setChoices(LoadableDetachableModel.of(this::listAllowedProjects)); projectList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onSelectionChanged)); add(projectList); }
Example #20
Source File: OpenDocumentDialogPanel.java From webanno with Apache License 2.0 | 5 votes |
private OverviewListChoice<DecoratedObject<SourceDocument>> createDocListChoice() { docListChoice = new OverviewListChoice<>("documents", Model.of(), listDocuments()); docListChoice.setChoiceRenderer(new ChoiceRenderer<DecoratedObject<SourceDocument>>() { private static final long serialVersionUID = 1L; @Override public Object getDisplayValue(DecoratedObject<SourceDocument> aDoc) { return defaultIfEmpty(aDoc.getLabel(), aDoc.get().getName()); } }); docListChoice.setOutputMarkupId(true); docListChoice.add(new OnChangeAjaxBehavior() { private static final long serialVersionUID = -8232688660762056913L; @Override protected void onUpdate(AjaxRequestTarget aTarget) { aTarget.add(buttonsContainer); } }).add(AjaxEventBehavior.onEvent("dblclick", _target -> actionOpenDocument(_target, null))); if (!docListChoice.getChoices().isEmpty()) { docListChoice.setModelObject(docListChoice.getChoices().get(0)); } return docListChoice; }
Example #21
Source File: AddRuleDialog.java From Orienteer with Apache License 2.0 | 5 votes |
public AddRuleDialog(ModalWindow modal) { super(modal); form.add(new DropDownChoice<ORule.ResourceGeneric>("resource", resourceModel, Arrays.asList(ORule.ResourceGeneric.values()), new ChoiceRenderer<ORule.ResourceGeneric>("name")) .setNullValid(true)); form.add(new TextField<String>("specific", specificModel)); addCommand(new AjaxFormCommand<Void>(newCommandId(), "command.submit") { @Override public void onSubmit(AjaxRequestTarget target) { onRuleEntered(target, resourceModel.getObject(), specificModel.getObject()); } }.setBootstrapType(BootstrapType.PRIMARY)); }
Example #22
Source File: ConceptListPanel.java From inception with Apache License 2.0 | 5 votes |
public ConceptListPanel(String aId, IModel<KnowledgeBase> aKbModel, IModel<KBHandle> selectedConceptModel) { super(aId, selectedConceptModel); setOutputMarkupId(true); selectedConcept = selectedConceptModel; kbModel = aKbModel; preferences = Model.of(new Preferences()); OverviewListChoice<KBHandle> overviewList = new OverviewListChoice<>("concepts"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("uiLabel")); overviewList.setModel(selectedConceptModel); overviewList.setChoices(LambdaModel.of(this::getConcepts)); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::actionSelectionChanged)); overviewList.setMaxRows(LIST_MAX_ROWS); add(overviewList); add(new Label("count", LambdaModel.of(() -> overviewList.getChoices().size()))); LambdaAjaxLink addLink = new LambdaAjaxLink("add", target -> send(getPage(), Broadcast.BREADTH, new AjaxNewConceptEvent(target))); addLink.add(new Label("label", new ResourceModel("concept.list.add"))); addLink.add(new WriteProtectionBehavior(kbModel)); add(addLink); Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences)); form.add(new CheckBox("showAllConcepts").add( new LambdaAjaxFormSubmittingBehavior("change", this::actionPreferenceChanged))); add(form); }
Example #23
Source File: NextRuntimePanel.java From nextreports-server with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public void addWicketComponents() { final DropDownChoice<String> exportChoice = new DropDownChoice<String>("exportType", new PropertyModel<String>(runtimeModel, "exportType"), typeList, new ChoiceRenderer<String>() { @Override public Object getDisplayValue(String name) { if (name.equals(ReportConstants.ETL_FORMAT)) { return getString("Analysis.source"); } else { return name; } } }); exportChoice.add(new AjaxFormComponentUpdatingBehavior("onChange") { @Override protected void onUpdate(AjaxRequestTarget target) { String format = (String) getFormComponent().getConvertedInput(); if (ReportConstants.ETL_FORMAT.equals(format)) { System.out.println("***** ETL selected"); //analysisPanel.setVisible(true); } else { System.out.println("***** " + format); //analysisPanel.setVisible(false); } //target.add(analysisPanel); } }); exportChoice.setRequired(true); add(exportChoice); if (report.isAlarmType() || report.isIndicatorType() || report.isDisplayType()) { exportChoice.setEnabled(false); } else { exportChoice.setRequired(true); } }
Example #24
Source File: PropertyListPanel.java From inception with Apache License 2.0 | 5 votes |
public PropertyListPanel(String aId, IModel<KnowledgeBase> aKbModel, IModel<KBProperty> aModel) { super(aId, aModel); setOutputMarkupId(true); selectedProperty = aModel; kbModel = aKbModel; preferences = Model.of(new Preferences()); OverviewListChoice<KBProperty> overviewList = new OverviewListChoice<>("properties"); overviewList.setChoiceRenderer(new ChoiceRenderer<>("uiLabel")); overviewList.setModel(selectedProperty); overviewList.setChoices(LambdaModel.of(this::getProperties)); overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::actionSelectionChanged)); add(overviewList); add(new Label("count", LambdaModel.of(() -> overviewList.getChoices().size()))); LambdaAjaxLink addLink = new LambdaAjaxLink("add", target -> send(getPage(), Broadcast.BREADTH, new AjaxNewPropertyEvent(target))); addLink.add(new Label("label", new ResourceModel("property.list.add"))); addLink.add(new WriteProtectionBehavior(kbModel)); add(addLink); Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences)); form.add(new CheckBox("showAllProperties").add( new LambdaAjaxFormSubmittingBehavior("change", this::actionPreferenceChanged))); add(form); }
Example #25
Source File: LangForm.java From openmeetings with Apache License 2.0 | 5 votes |
/** * Render Main * * @param id - id of this form * @param listContainer - container holds list of labels * @param langPanel - language panel */ public LangForm(String id, final WebMarkupContainer listContainer, final LangPanel langPanel) { super(id); setOutputMarkupId(true); languages = new DropDownChoice<>("language" , new PropertyModel<Map.Entry<Long, Locale>>(langPanel, "language") , getLanguages() , new ChoiceRenderer<Map.Entry<Long, Locale>>() { private static final long serialVersionUID = 1L; @Override public Object getDisplayValue(Map.Entry<Long, Locale> object) { return object.getValue().getDisplayName(); } @Override public String getIdValue(Map.Entry<Long, Locale> object, int index) { return "" + object.getKey(); } }); languages.add(new OnChangeAjaxBehavior() { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(listContainer); } }); add(languages); // attach an ajax validation behavior to all form component's keydown // event and throttle it down to once per second add(new AjaxFormValidatingBehavior("keydown", Duration.ofSeconds(1))); }
Example #26
Source File: OAuthForm.java From openmeetings with Apache License 2.0 | 5 votes |
@Override protected void onInitialize() { add(new CheckBox("isEnabled")); add(new RequiredTextField<String>("name").setLabel(new ResourceModel("165"))); add(new TextField<String>("iconUrl").setLabel(new ResourceModel("1575"))); add(new RequiredTextField<String>("clientId").setLabel(Model.of("client_id"))); add(new RequiredTextField<String>("clientSecret").setLabel(Model.of("client_secret"))); add(redirectUriText = (TextField<String>) new TextField<>("redirectUri", Model.of("")).setLabel(new ResourceModel("1587"))); add(new RequiredTextField<String>("requestKeyUrl").setLabel(new ResourceModel("1578"))); add(new DropDownChoice<>("requestTokenMethod", List.of(RequestTokenMethod.values()), new ChoiceRenderer<RequestTokenMethod>("name", "name"))); add(new RequiredTextField<String>("requestTokenUrl").setLabel(new ResourceModel("1579"))); add(new RequiredTextField<String>("requestTokenAttributes").setLabel(new ResourceModel("1586"))); add(new RequiredTextField<String>("requestInfoUrl").setLabel(new ResourceModel("1580"))); add(new DropDownChoice<>("requestInfoMethod", List.of(RequestInfoMethod.values()), new ChoiceRenderer<RequestInfoMethod>("name", "name"))); Form<Void> mappingForm = new Form<>("mappingForm"); final TextField<String> omAttr = new TextField<>("omAttr", Model.of("")); final TextField<String> oauthAttr = new TextField<>("oauthAttr", Model.of("")); add(mappingForm.add(omAttr, oauthAttr , new BootstrapAjaxButton("addMapping", new ResourceModel("1261"), mappingForm, Buttons.Type.Outline_Primary) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target) { if (Strings.isEmpty(omAttr.getModelObject()) || Strings.isEmpty(oauthAttr.getModelObject())) { return; } OAuthServer s = OAuthForm.this.getModelObject(); s.addMapping(omAttr.getModelObject(), oauthAttr.getModelObject()); updateMapping(); target.add(attrsContainer, mappingForm); } }).setOutputMarkupId(true)); add(attrsContainer.add(updateMapping()).setOutputMarkupId(true)); super.onInitialize(); }
Example #27
Source File: DocumentMetadataAnnotationSelectionPanel.java From inception with Apache License 2.0 | 5 votes |
public DocumentMetadataAnnotationSelectionPanel(String aId, IModel<Project> aProject, IModel<SourceDocument> aDocument, IModel<String> aUsername, CasProvider aCasProvider, AnnotationPage aAnnotationPage, AnnotationActionHandler aActionHandler, AnnotatorState aState) { super(aId, aProject); setOutputMarkupPlaceholderTag(true); annotationPage = aAnnotationPage; sourceDocument = aDocument; username = aUsername; jcasProvider = aCasProvider; project = aProject; selectedLayer = Model.of(); actionHandler = aActionHandler; state = aState; annotationsContainer = new WebMarkupContainer(CID_ANNOTATIONS_CONTAINER); annotationsContainer.setOutputMarkupId(true); annotationsContainer.add(createAnnotationList()); add(annotationsContainer); DropDownChoice<AnnotationLayer> layer = new BootstrapSelect<>(CID_LAYER); layer.setModel(selectedLayer); layer.setChoices(this::listMetadataLayers); layer.setChoiceRenderer(new ChoiceRenderer<>("uiName")); layer.add(new LambdaAjaxFormComponentUpdatingBehavior("change")); add(layer); add(new LambdaAjaxLink(CID_CREATE, this::actionCreate)); }
Example #28
Source File: SearchClausePanel.java From syncope with Apache License 2.0 | 4 votes |
default IChoiceRenderer<SearchClause.Type> typeRenderer() { return new ChoiceRenderer<>(); }
Example #29
Source File: CreateNewTopicMapPanel.java From ontopia with Apache License 2.0 | 4 votes |
public CreateNewTopicMapPanel(String id) { super(id); IModel<List<TopicMapSource>> sourcesChoicesModel = new LoadableDetachableModel<List<TopicMapSource>>() { @Override protected List<TopicMapSource> load() { List<TopicMapSource> result = OntopolyContext.getOntopolyRepository().getEditableSources(); numberOfSources = result.size(); return result; } }; List<TopicMapSource> sources = sourcesChoicesModel.getObject(); TopicMapSourceModel topicMapSourceModel = null; if (numberOfSources > 0) { topicMapSourceModel = new TopicMapSourceModel((TopicMapSource)sources.get(0)); } WebMarkupContainer sourcesDropDownContainer = new WebMarkupContainer("sourcesDropDownContainer") { @Override public boolean isVisible() { return numberOfSources > 1 ? true : false; } }; sourcesDropDownContainer.setOutputMarkupPlaceholderTag(true); add(sourcesDropDownContainer); final AjaxOntopolyDropDownChoice<TopicMapSource> sourcesDropDown = new AjaxOntopolyDropDownChoice<TopicMapSource>("sourcesDropDown", topicMapSourceModel, sourcesChoicesModel, new ChoiceRenderer<TopicMapSource>("title", "id")); sourcesDropDownContainer.add(sourcesDropDown); final AjaxOntopolyTextField nameField = new AjaxOntopolyTextField("content", new Model<String>("")); add(nameField); final Button button = new Button("button", new ResourceModel("create")); button.setOutputMarkupId(true); button.add(new AjaxFormComponentUpdatingBehavior("onclick") { @Override protected void onUpdate(AjaxRequestTarget target) { String name = nameField.getModel().getObject(); if(!name.isEmpty()) { TopicMapSource topicMapSource = (TopicMapSource) sourcesDropDown.getModelObject(); String referenceId = OntopolyContext.getOntopolyRepository().createOntopolyTopicMap(topicMapSource.getId(), name); Map<String,String> pageParametersMap = new HashMap<String,String>(); pageParametersMap.put("topicMapId", referenceId); setResponsePage(TopicTypesPage.class, new PageParameters(pageParametersMap)); } } }); add(button); }
Example #30
Source File: ChartRuntimePanel.java From nextreports-server with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") public void addWicketComponents() { ChoiceRenderer<String> typeRenderer = new ChoiceRenderer<String>() { @Override public Object getDisplayValue(String chartType) { if (chartType == null) { return ChartUtil.CHART_NONE; } else if (chartType.equals(ChartUtil.CHART_BAR)) { return getString("chart.bar"); } else if (chartType.equals(ChartUtil.CHART_NEGATIVE_BAR)) { return getString("chart.negativebar"); } else if (chartType.equals(ChartUtil.CHART_BAR_COMBO)) { return getString("chart.barcombo"); } else if (chartType.equals(ChartUtil.CHART_HORIZONTAL_BAR)) { return getString("chart.horizontalbar"); } else if (chartType.equals(ChartUtil.CHART_STACKED_BAR)) { return getString("chart.stackedbar"); } else if (chartType.equals(ChartUtil.CHART_STACKED_BAR_COMBO)) { return getString("chart.stackedbarcombo"); } else if (chartType.equals(ChartUtil.CHART_HORIZONTAL_STACKED_BAR)) { return getString("chart.horizontalstackedbar"); } else if (chartType.equals(ChartUtil.CHART_PIE)) { return getString("chart.pie"); } else if (chartType.equals(ChartUtil.CHART_LINE)) { return getString("chart.line"); } else if (chartType.equals(ChartUtil.CHART_AREA)) { return getString("chart.area"); } else if (chartType.equals(ChartUtil.CHART_BUBBLE)) { return getString("chart.bubble"); } else { return ChartUtil.CHART_NONE; } } }; DropDownChoice exportChoice = new DropDownChoice("chartType", new PropertyModel(runtimeModel, "chartType"), ChartUtil.CHART_TYPES, typeRenderer); exportChoice.setRequired(true); add(exportChoice); TextField<Integer> refreshText = new TextField<Integer>("refreshTime", new PropertyModel(runtimeModel, "refreshTime")); refreshText.add(new ZeroRangeValidator(10, 3600)); refreshText.setRequired(true); add(refreshText); TextField<Integer> timeoutText = new TextField<Integer>("timeout", new PropertyModel(runtimeModel, "timeout")); timeoutText.add(new RangeValidator<Integer>(5, 600)); timeoutText.setLabel(new Model<String>("Timeout")); timeoutText.setRequired(true); add(timeoutText); }