Java Code Examples for org.apache.wicket.model.CompoundPropertyModel#of()
The following examples show how to use
org.apache.wicket.model.CompoundPropertyModel#of() .
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: RecommenderViewPanel.java From inception with Apache License 2.0 | 6 votes |
public RecommenderViewPanel(String aId, IModel<Recommender> aRecommender) { super(aId, aRecommender); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); recommenderModel = aRecommender; Form<Recommender> form = new Form<>(MID_FORM, CompoundPropertyModel.of(aRecommender)); add(form); nameField = new TextField<>(MID_NAME, String.class); form.add(nameField); tool = new TextField<>(MID_TOOL,String.class); form.add(tool); feature = new TextField<AnnotationFeature>(MID_FEATURE ); form.add(feature); layer = new TextField<AnnotationLayer>(MID_LAYER); form.add(layer); }
Example 2
Source File: NamedEntityLinkerTraitsEditor.java From inception with Apache License 2.0 | 6 votes |
public NamedEntityLinkerTraitsEditor(String aId, IModel<Recommender> aRecommender) { super(aId, aRecommender); traits = toolFactory.readTraits(aRecommender.getObject()); Form<NamedEntityLinkerTraits> form = new Form<NamedEntityLinkerTraits>(MID_FORM, CompoundPropertyModel.of(Model.of(traits))) { private static final long serialVersionUID = -3109239605742291123L; @Override protected void onSubmit() { super.onSubmit(); toolFactory.writeTraits(aRecommender.getObject(), traits); } }; add(form); }
Example 3
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 4
Source File: BooleanLiteralValueEditor.java From inception with Apache License 2.0 | 6 votes |
public BooleanLiteralValueEditor(String aId, IModel<KBStatement> aModel) { super(aId, CompoundPropertyModel.of(aModel)); BootstrapCheckBoxPickerConfig config = new BootstrapCheckBoxPickerConfig(); config.withReverse(true); value = new BootstrapCheckBoxPicker("value", config) { private static final long serialVersionUID = -3413189824637877732L; @Override protected void onComponentTag(ComponentTag aTag) { super.onComponentTag(aTag); aTag.put("data-group-cls", "btn-group-justified"); } }; value.setOutputMarkupId(true); value.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> t.add(getParent()))); add(value); }
Example 5
Source File: ExternalRecommenderTraitsEditor.java From inception with Apache License 2.0 | 5 votes |
public ExternalRecommenderTraitsEditor(String aId, IModel<Recommender> aRecommender) { super(aId, aRecommender); traits = toolFactory.readTraits(aRecommender.getObject()); Form<ExternalRecommenderTraits> form = new Form<ExternalRecommenderTraits>(MID_FORM, CompoundPropertyModel.of(Model.of(traits))) { private static final long serialVersionUID = -3109239605742291123L; @Override protected void onSubmit() { super.onSubmit(); toolFactory.writeTraits(aRecommender.getObject(), traits); } }; TextField<String> remoteUrl = new TextField<>("remoteUrl"); remoteUrl.setRequired(true); remoteUrl.add(new UrlValidator()); form.add(remoteUrl); CheckBox trainable = new CheckBox("trainable"); trainable.setOutputMarkupId(true); trainable.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> _target.add(getTrainingStatesChoice()))); form.add(trainable); getTrainingStatesChoice().add(visibleWhen(() -> trainable.getModelObject() == true)); add(form); }
Example 6
Source File: AbstractInfoPanel.java From inception with Apache License 2.0 | 5 votes |
public AbstractInfoPanel(String aId, IModel<KnowledgeBase> aKbModel, IModel<? extends KBObject> aHandleModel, IModel<T> aKbObjectModel) { super(aId, aHandleModel); kbModel = aKbModel; handleModel = aHandleModel; kbObjectModel = aKbObjectModel; setOutputMarkupId(true); // when creating a new KBObject, activate the form and obtain the AjaxRequestTarget to set // the focus to the name field Component content; modal = new SubclassCreationDialog("createSubclass", kbModel, handleModel); add(modal); boolean isNew = kbObjectModel.getObject() != null && isEmpty(kbObjectModel.getObject().getIdentifier()); if (isNew) { EditMode editMode = new EditMode(CONTENT_MARKUP_ID, CompoundPropertyModel.of(kbObjectModel)); // obtain AjaxRequestTarget and set the focus RequestCycle.get() .find(AjaxRequestTarget.class) .ifPresent(target -> target.focusComponent(editMode.getFocusComponent())); content = editMode; } else { content = new ViewMode(CONTENT_MARKUP_ID, CompoundPropertyModel.of(handleModel), getDetailPreference()); } add(content); confirmationDialog = new ConfirmationDialog("confirmationDialog"); add(confirmationDialog); }
Example 7
Source File: SubjectObjectFeatureEditor.java From inception with Apache License 2.0 | 5 votes |
public SubjectObjectFeatureEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, final IModel<AnnotatorState> aStateModel, final IModel<FeatureState> aFeatureStateModel, String role) { super(aId, aOwner, CompoundPropertyModel.of(aFeatureStateModel)); stateModel = aStateModel; actionHandler = aHandler; project = this.getModelObject().feature.getProject(); add(createDisabledKbWarningLabel()); content = new WebMarkupContainer("content"); content.setOutputMarkupId(true); add(content); List<LinkWithRoleModel> links = (List<LinkWithRoleModel>) SubjectObjectFeatureEditor.this .getModelObject().value; roleModel = new LinkWithRoleModel(); roleModel.role = role; if (links.size() == 1) { roleModel = links.get(0); } content.add(createSubjectObjectLabel()); content.add(createRemoveLabelIcon()); content.add(focusComponent = createAutoCompleteTextField()); }
Example 8
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 9
Source File: ProjectDetailPanel.java From webanno with Apache License 2.0 | 5 votes |
public ProjectDetailPanel(String id, IModel<Project> aModel) { super(id, aModel); projectModel = aModel; Form<Project> form = new Form<>("form", CompoundPropertyModel.of(aModel)); add(form); TextField<String> projectNameTextField = new TextField<>("name"); projectNameTextField.setRequired(true); projectNameTextField.add(new ProjectExistsValidator()); projectNameTextField.add(new ProjectNameValidator()); form.add(projectNameTextField); // If we run in development mode, then also show the ID of the project form.add(idLabel = new Label("id")); idLabel.setVisible(RuntimeConfigurationType.DEVELOPMENT .equals(getApplication().getConfigurationType())); form.add(new TextArea<String>("description").setOutputMarkupId(true)); DropDownChoice<ScriptDirection> scriptDirection = new BootstrapSelect<>("scriptDirection"); scriptDirection.setChoiceRenderer(new EnumChoiceRenderer<>(this)); scriptDirection.setChoices(Arrays.asList(ScriptDirection.values())); form.add(scriptDirection); form.add(new CheckBox("disableExport").setOutputMarkupPlaceholderTag(true)); form.add(new CheckBox("anonymousCuration").setOutputMarkupPlaceholderTag(true)); form.add(projectTypes = makeProjectTypeChoice()); form.add(new LambdaAjaxButton<>("save", this::actionSave)); }
Example 10
Source File: NumericLiteralValueEditor.java From inception with Apache License 2.0 | 5 votes |
public NumericLiteralValueEditor(String aId, IModel<KBStatement> aModel) { super(aId, CompoundPropertyModel.of(aModel)); // Clear the value if it is not an instance of number if (! (aModel.getObject().getValue() instanceof Number)) { aModel.getObject().setValue(0); } value = new NumberTextField<>("value", Double.class); value.setOutputMarkupId(true); value.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> t.add(getParent()))); add(value); }
Example 11
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 12
Source File: StringLiteralValueEditor.java From inception with Apache License 2.0 | 5 votes |
public StringLiteralValueEditor(String aId, IModel<KBStatement> aModel) { super(aId, CompoundPropertyModel.of(aModel)); value = new TextArea<>("value"); value.setOutputMarkupId(true); // Statement values cannot be null/empty - well, in theory they could be the empty string, // but we treat the empty string as null value.setRequired(true); add(value); add(new TextField<>("language")); }
Example 13
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 14
Source File: RecommendationSidebar.java From inception with Apache License 2.0 | 4 votes |
public RecommendationSidebar(String aId, IModel<AnnotatorState> aModel, AnnotationActionHandler aActionHandler, CasProvider aCasProvider, AnnotationPage aAnnotationPage) { super(aId, aModel, aActionHandler, aCasProvider, aAnnotationPage); IModel<Preferences> modelPreferences = LambdaModelAdapter.of( () -> recommendationService.getPreferences(aModel.getObject().getUser(), aModel.getObject().getProject()), (v) -> recommendationService.setPreferences(aModel.getObject().getUser(), aModel.getObject().getProject(), v)); warning = new WebMarkupContainer("warning"); warning.setOutputMarkupPlaceholderTag(true); add(warning); tipModel = new StringResourceModel("mismatch", this); TooltipBehavior tip = new TooltipBehavior(tipModel); tip.setOption("width", Options.asString("300px")); warning.add(tip); add(new LambdaAjaxLink("showLog", this::actionShowLog)); add(new LambdaAjaxLink("retrain", this::actionRetrain)); form = new Form<>("form", CompoundPropertyModel.of(modelPreferences)); form.add(new NumberTextField<Integer>("maxPredictions", Integer.class) .setMinimum(1) .setMaximum(10) .setStep(1)); form.add(new CheckBox("showAllPredictions").setOutputMarkupId(true)); form.add(new LambdaAjaxButton<>("save", (_target, _form) -> aAnnotationPage.actionRefreshDocument(_target))); add(form); add(new LearningCurveChartPanel(LEARNING_CURVE, aModel)); recommenderInfos = new RecommenderInfoPanel("recommenders", aModel); add(recommenderInfos); logDialog = new LogDialog("logDialog", Model.of("Recommender Log")); add(logDialog); }
Example 15
Source File: ElasticSearchProviderTraitsEditor.java From inception with Apache License 2.0 | 4 votes |
public ElasticSearchProviderTraitsEditor(String aId, IModel<DocumentRepository> aDocumentRepository) { super(aId, aDocumentRepository); documentRepository = aDocumentRepository.getObject(); properties = externalSearchProviderFactory.readTraits(documentRepository); Form<ElasticSearchProviderTraits> form = new Form<ElasticSearchProviderTraits>( MID_FORM, CompoundPropertyModel.of(Model.of(properties))) { private static final long serialVersionUID = -3109239608742291123L; @Override protected void onSubmit() { super.onSubmit(); externalSearchProviderFactory.writeTraits(documentRepository, properties); } }; TextField<String> remoteUrl = new TextField<>("remoteUrl"); remoteUrl.setRequired(true); remoteUrl.add(new UrlValidator()); form.add(remoteUrl); TextField<String> indexName = new TextField<>("indexName"); indexName.setRequired(true); form.add(indexName); TextField<String> searchPath = new TextField<>("searchPath"); searchPath.setRequired(true); form.add(searchPath); TextField<String> objectType = new TextField<>("objectType"); objectType.setRequired(true); form.add(objectType); TextField<String> defaultField = new TextField<>("defaultField"); objectType.setRequired(true); form.add(defaultField); NumberTextField<Integer> resultSize = new NumberTextField<>("resultSize", Integer.class); resultSize.setMinimum(1); resultSize.setMaximum(10000); resultSize.setRequired(true); form.add(resultSize); NumberTextField<Integer> seed = new NumberTextField<Integer>("seed", Integer.class); seed.setMinimum(0); seed.setMaximum(Integer.MAX_VALUE); seed.add(visibleWhen(() -> properties.isRandomOrder())); seed.add(new AttributeModifier("title", new ResourceModel("seedTooltip"))); seed.setOutputMarkupPlaceholderTag(true); seed.setRequired(true); form.add(seed); CheckBox randomOrder = new CheckBox("randomOrder"); randomOrder.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> t.add(seed, randomOrder))); form.add(randomOrder); add(form); }
Example 16
Source File: LinkFeatureTraitsEditor.java From webanno with Apache License 2.0 | 4 votes |
public LinkFeatureTraitsEditor(String aId, SlotFeatureSupport aFS, IModel<AnnotationFeature> aFeatureModel) { super(aId, aFeatureModel); // We cannot retain a reference to the actual SlotFeatureSupport instance because that // is not serializable, but we can retain its ID and look it up again from the registry // when required. featureSupportId = aFS.getId(); feature = aFeatureModel; traits = Model.of(readTraits()); Form<Traits> form = new Form<Traits>(MID_FORM, CompoundPropertyModel.of(traits)) { private static final long serialVersionUID = -3109239605783291123L; @Override protected void onSubmit() { super.onSubmit(); // when saving reset the selected tagset if role labels are not enabled if (!traits.getObject().isEnableRoleLabels()) { feature.getObject().setTagset(null); } writeTraits(); } }; form.setOutputMarkupPlaceholderTag(true); add(form); MultiSelect<Tag> defaultSlots = new MultiSelect<Tag>("defaultSlots") { private static final long serialVersionUID = 8231304829756188352L; @Override public void onConfigure(JQueryBehavior aBehavior) { super.onConfigure(aBehavior); //aBehavior.setOption("placeholder", Options.asString(getString("placeholder"))); aBehavior.setOption("filter", Options.asString("contains")); aBehavior.setOption("autoClose", false); } }; defaultSlots.setChoices(LambdaModel.of(this::listTags)); defaultSlots.setChoiceRenderer(new ChoiceRenderer<>("name")); defaultSlots.add(visibleWhen(() -> traits.getObject().isEnableRoleLabels() && feature.getObject().getTagset() != null)); form.add(defaultSlots); CheckBox enableRoleLabels = new CheckBox("enableRoleLabels"); enableRoleLabels.setModel(PropertyModel.of(traits, "enableRoleLabels")); enableRoleLabels.add(new LambdaAjaxFormComponentUpdatingBehavior("change", target -> target.add(form) )); form.add(enableRoleLabels); DropDownChoice<TagSet> tagset = new BootstrapSelect<>("tagset"); tagset.setOutputMarkupPlaceholderTag(true); tagset.setOutputMarkupId(true); tagset.setChoiceRenderer(new ChoiceRenderer<>("name")); tagset.setNullValid(true); tagset.setModel(PropertyModel.of(aFeatureModel, "tagset")); tagset.setChoices(LambdaModel.of(() -> annotationService .listTagSets(aFeatureModel.getObject().getProject()))); tagset.add(new LambdaAjaxFormComponentUpdatingBehavior("change", target -> { traits.getObject().setDefaultSlots(new ArrayList<>()); target.add(form); })); tagset.add(visibleWhen(() -> traits.getObject().isEnableRoleLabels())); form.add(tagset); }
Example 17
Source File: NumericLiteralValuePresenter.java From inception with Apache License 2.0 | 4 votes |
public NumericLiteralValuePresenter(String aId, IModel<KBStatement> aModel) { super(aId, CompoundPropertyModel.of(aModel)); add(new Label("value")); }
Example 18
Source File: StatementEditor.java From inception with Apache License 2.0 | 4 votes |
/** * Creates a new fragement for editing a statement.<br> * The editor has two slightly different behaviors, depending on the value of * {@code isNewStatement}: * <ul> * <li>{@code !isNewStatement}: Save button commits changes, cancel button discards unsaved * changes, delete button removes the statement from the KB.</li> * <li>{@code isNewStatement}: Save button commits changes (creates a new statement in the * KB), cancel button removes the statement from the UI, delete button is not visible.</li> * </ul> * * @param aId * markup ID * @param aStatement * statement model * @param isNewStatement * whether the statement being edited is new, meaning it has no corresponding * statement in the KB backend */ public EditMode(String aId, IModel<KBStatement> aStatement, boolean isNewStatement) { super(aId, "editMode", StatementEditor.this, aStatement); CompoundPropertyModel<KBStatement> model = CompoundPropertyModel.of(aStatement); Form<KBStatement> form = new Form<>("form", model); // Set property to the property of the current statement if (property.getObject() == null) { Optional<KBProperty> prop = kbService.readProperty(kbModel.getObject(), aStatement.getObject().getProperty().getIdentifier()); if (prop.isPresent()) { property.setObject(prop.get()); } } String rangeValue = null; if (property.getObject() != null) { rangeValue = property.getObject().getRange(); } List<ValueType> valueTypes; if (rangeValue != null) { Optional<KBObject> rangeKBHandle = kbService.readItem(kbModel.getObject(), rangeValue); valueTypes = valueTypeRegistry.getRangeTypes(rangeValue, rangeKBHandle); } else { valueTypes = valueTypeRegistry.getAllTypes(); } valueType = new BootstrapSelect<>("valueType", valueTypes); valueType.setChoiceRenderer(new ChoiceRenderer<>("uiName")); valueType.setModel(Model.of( valueTypeRegistry.getValueType(aStatement.getObject(), property.getObject()))); // replace the editor when the choice is changed valueType.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> { ValueEditor newEditor = valueTypeRegistry .getValueSupport(valueType.getModelObject()) .createEditor("value", model, property, kbModel); editor.setOutputMarkupId(true); editor = (ValueEditor) editor.replaceWith(newEditor); t.add(editor); })); form.add(valueType); // use the IRI to obtain the appropriate value editor try { editor = valueTypeRegistry .getValueSupport(aStatement.getObject(), property.getObject()) .createEditor("value", model, property, kbModel); } catch (IllegalArgumentException e) { LOG.warn("Unable to find an editor that supports the value type. " + "String Editor is used as default: {}", e.getLocalizedMessage()); editor = new StringLiteralValueEditor("value", model); } editor.setOutputMarkupId(true); form.add(editor); form.add(new LambdaAjaxButton<>("save", StatementEditor.this::actionSave)); form.add(new LambdaAjaxLink("cancel", t -> { if (isNewStatement) { StatementEditor.this.actionCancelNewStatement(t); } else { StatementEditor.this.actionCancelExistingStatement(t); } })); form.add(new LambdaAjaxLink("delete", StatementEditor.this::actionDelete) .setVisibilityAllowed(!isNewStatement)); add(form); }
Example 19
Source File: TagSetEditorPanel.java From webanno with Apache License 2.0 | 4 votes |
public TagSetEditorPanel(String aId, IModel<Project> aProject, IModel<TagSet> aTagSet, IModel<Tag> aSelectedTag) { super(aId, aTagSet); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); selectedProject = aProject; selectedTagSet = aTagSet; selectedTag = aSelectedTag; exportFormat = Model.of(supportedFormats().get(0)); Form<TagSet> form = new Form<>("form", CompoundPropertyModel.of(aTagSet)); add(form); form.add(new TextField<String>("name") .add(new TagSetExistsValidator()) .setRequired(true)); form.add(new TextField<String>("language")); form.add(new TextArea<String>("description")); form.add(new CheckBox("createTag")); form.add(new LambdaAjaxButton<>("save", this::actionSave)); form.add(new LambdaAjaxLink("delete", this::actionDelete) .onConfigure(_this -> _this.setVisible(form.getModelObject().getId() != null))); form.add(new LambdaAjaxLink("cancel", this::actionCancel)); BootstrapRadioChoice<String> format = new BootstrapRadioChoice<>("format", exportFormat, LoadableDetachableModel.of(this::supportedFormats)); // The AjaxDownloadLink does not submit the form, so the format radio-buttons need to // submit themselves so their value is available when the export button is pressed format.add(onUpdateChoice(_target -> { /*NO-OP*/ })); form.add(format); form.add(new AjaxDownloadLink("export", LoadableDetachableModel.of(this::export))); confirmationDialog = new ConfirmationDialog("confirmationDialog"); confirmationDialog.setTitleModel(new StringResourceModel("DeleteDialog.title", this)); add(confirmationDialog); }
Example 20
Source File: ConceptFeatureTraitsEditor.java From inception with Apache License 2.0 | 4 votes |
public ConceptFeatureTraitsEditor(String aId, ConceptFeatureSupport aFS, IModel<AnnotationFeature> aFeatureModel) { super(aId, aFeatureModel); // We cannot retain a reference to the actual ConceptFeatureSupport instance because that // is not serializable, but we can retain its ID and look it up again from the registry // when required. featureSupportId = aFS.getId(); feature = aFeatureModel; traits = CompoundPropertyModel.of(readTraits()); Form<Traits> form = new Form<Traits>(MID_FORM, traits) { private static final long serialVersionUID = -3109239605783291123L; @Override protected void onSubmit() { super.onSubmit(); writeTraits(); } }; form.add(new KnowledgeBaseItemAutoCompleteField(MID_SCOPE, _query -> listSearchResults(_query, CONCEPT)).setOutputMarkupPlaceholderTag(true)); form.add( new BootstrapSelect<>(MID_KNOWLEDGE_BASE, LambdaModel.of(this::listKnowledgeBases), new LambdaChoiceRenderer<>(KnowledgeBase::getName)) .setNullValid(true) .add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::refresh))); form.add( new BootstrapSelect<>(MID_ALLOWED_VALUE_TYPE, LambdaModel.of(this::listAllowedTypes)) .add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::refresh))); form.add(new DisabledKBWarning("disabledKBWarning", feature)); add(form); add(new KeyBindingsConfigurationPanel("keyBindings", aFeatureModel, traits.bind("keyBindings"))); }