private ComboBox<String> basePrefixField(String aId, String aProperty) { // Add textfield and label for basePrefix ComboBox<String> basePrefix = new ComboBox<String>(aId, kbModel.bind(aProperty), Arrays.asList(IriConstants.INCEPTION_NAMESPACE)); basePrefix.add(new LambdaAjaxFormComponentUpdatingBehavior("change")); basePrefix.setConvertEmptyInputStringToNull(false); basePrefix.setOutputMarkupId(true); return basePrefix; }
private ComboBox<String> basePrefixField(String aId, String aProperty) { // Add textfield and label for basePrefix ComboBox<String> basePrefix = new ComboBox<String>(aId, kbModel.bind(aProperty), Arrays.asList(IriConstants.INCEPTION_NAMESPACE)); basePrefix.add(new LambdaAjaxFormComponentUpdatingBehavior("change")); basePrefix.setConvertEmptyInputStringToNull(false); basePrefix.setOutputMarkupId(true); return basePrefix; }
private ComboBox<String> languageComboBox(String id, IModel<String> aModel) { // Only set kbModel object if it has not been initialized yet if (aModel.getObject() == null) { aModel.setObject(languages.get(0)); } IModel<String> adapter = new LambdaModelAdapter<String>(aModel::getObject, aModel::setObject); ComboBox<String> comboBox = new ComboBox<String>(id, adapter, languages); comboBox.setOutputMarkupId(true); comboBox.setRequired(true); comboBox.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> { // Do nothing just update the kbModel values })); return comboBox; }
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); }
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); }
private TextField<String> buildTextField(String id, IModel<IRI> model) { IModel<String> adapter = new LambdaModelAdapter<String>( () -> model.getObject().stringValue(), str -> model.setObject(SimpleValueFactory.getInstance().createIRI(str))); TextField<String> iriTextfield = new TextField<>(id, adapter); iriTextfield.setOutputMarkupId(true); iriTextfield.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> { // Do nothing just update the model values })); iriTextfield.setEnabled(false); return iriTextfield; }
private TextField<String> buildTextField(String id, IModel<IRI> model) { IModel<String> adapter = new LambdaModelAdapter<String>( () -> model.getObject().stringValue(), str -> model.setObject(SimpleValueFactory.getInstance().createIRI(str))); TextField<String> iriTextfield = new TextField<>(id, adapter); iriTextfield.setOutputMarkupId(true); iriTextfield.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> { // Do nothing just update the model values })); iriTextfield.setEnabled(false); return iriTextfield; }
public BooleanLiteralValueEditor(String aId, IModel<KBStatement> aModel) { super(aId, CompoundPropertyModel.of(aModel)); value = new CheckBox("value"); value.setOutputMarkupId(true); value.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> t.add(getParent()))); add(value); }
public BooleanLiteralValueEditor(String aId, IModel<KBStatement> aModel) { super(aId, CompoundPropertyModel.of(aModel)); value = new CheckBox("value"); value.setOutputMarkupId(true); value.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> t.add(getParent()))); add(value); }
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); } }
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() }, ",")); }
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() }, ",")); }
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); }
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)); }
public RecommenderListPanel(String id, IModel<Project> aProject, IModel<Recommender> aRecommender) { 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); add(new LambdaAjaxLink("create", this::actionCreate)); }
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)); }
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)); }
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)); }
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)); }
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)); }