public ButtonsForm(String id, final ModalWindow modalWindow) { super(id); add(new LambdaAjaxLink("openButton", OpenDocumentDialogPanel.this::actionOpenDocument) .add(enabledWhen(() -> selectedDocument != null))); add(new LambdaAjaxLink("cancelButton", OpenDocumentDialogPanel.this::actionCancel)); } }
LambdaAjaxLink editLink = new LambdaAjaxLink("edit", StatementEditor.this::actionEdit) .onConfigure((_this) -> _this.setVisible(!statement.getObject().isInferred())); editLink.add(new WriteProtectionBehavior(kbModel)); add(editLink); LambdaAjaxLink addQualifierLink = new LambdaAjaxLink("addQualifier", t -> actionAddQualifier(t, aStatement.getObject())) .onConfigure((_this) -> _this.setVisible(!statement.getObject().isInferred() && kbModel.getObject().getReification().supportsQualifier())); addQualifierLink.add(new Label("label", new ResourceModel("qualifier.add"))); addQualifierLink.add(new WriteProtectionBehavior(kbModel)); add(addQualifierLink); LambdaAjaxLink makeExplicitLink = new LambdaAjaxLink("makeExplicit", StatementEditor.this::actionMakeExplicit).onConfigure( (_this) -> _this.setVisible(statement.getObject().isInferred())); makeExplicitLink.add(new WriteProtectionBehavior(kbModel)); add(makeExplicitLink);
@Override protected void populateItem(ListItem<KnowledgeBaseProfile> item) LambdaAjaxLink link = new LambdaAjaxLink("suggestionLink", _target -> actionSelectPredefinedKB(_target, item.getModel())); link.setEnabled(!isImported); link.add(new Label("suggestionLabel", itemLabel)); link.add(new ClassAttributeModifier() { private static final long serialVersionUID = -3985182168502826951L; link.add(AttributeModifier.append("title", new StringResourceModel("kb.wizard.steps.local.schemaOnMouseOver", this) .setParameters(
private LambdaAjaxLink createSelectedTextLabel() { LambdaAjaxLink link = new LambdaAjaxLink("jumpToAnnotation", this::actionJumpToAnnotation); link.add(new Label("selectedText", PropertyModel.of(getModelObject(), "selection.text")).setOutputMarkupId(true)); link.setOutputMarkupId(true); return link; }
private LambdaAjaxLink createClearButton() { LambdaAjaxLink link = new LambdaAjaxLink("clear", editorPanel::actionClear); link.setOutputMarkupPlaceholderTag(true); link.add(visibleWhen(() -> getModelObject().getSelection().getAnnotation().isSet())); return link; }
private AjaxLink<Void> clearLink(String aId) { AjaxLink<Void> clearLink = new LambdaAjaxLink(aId, this::actionClear) { private static final long serialVersionUID = -6272361381689154558L; @Override public boolean isEnabled() { return !kbService.isEmpty(kbModel.getObject().getKb()); } }; return clearLink; }
public TagEditorPanel(String aId, IModel<TagSet> aTagSet, IModel<Tag> aTag) { super(aId, aTag); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); selectedTagSet = aTagSet; selectedTag = aTag; Form<Tag> form = new Form<>("form", CompoundPropertyModel.of(aTag)); add(form); form.add(new TextField<String>("name") .add(new TagExistsValidator()) .setRequired(true)); form.add(new TextArea<String>("description")); 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)); }
tabContainer.add(new LambdaAjaxLink("cancel", this::actionCancel)); tabContainer.add(new LambdaAjaxLink("delete", this::actionDelete) .onConfigure((_this) -> _this.setEnabled(selectedProject.getObject() != null && selectedProject.getObject().getId() != null)));
@Override protected void onConfigure() { super.onConfigure(); AnnotatorState state = AutomationPage.this.getModelObject(); setEnabled(state.getDocument() != null && !documentService .isAnnotationFinished(state.getDocument(), state.getUser())); } });
/** * Adds behaviors to the embedded link, e.g. to add hot keys. */ @Override public Component add(Behavior... aBehaviors) { link.add(aBehaviors); return this; }
private AjaxLink<Void> clearLink(String aId) { AjaxLink<Void> clearLink = new LambdaAjaxLink(aId, this::actionClear) { private static final long serialVersionUID = -6272361381689154558L; @Override public boolean isEnabled() { return !kbService.isEmpty(kbModel.getObject().getKb()); } }; return clearLink; }
public TagEditorPanel(String aId, IModel<TagSet> aTagSet, IModel<Tag> aTag) { super(aId, aTag); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); selectedTagSet = aTagSet; selectedTag = aTag; Form<Tag> form = new Form<>("form", CompoundPropertyModel.of(aTag)); add(form); form.add(new TextField<String>("name") .add(new TagExistsValidator()) .setRequired(true)); form.add(new TextArea<String>("description")); 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)); }
private LambdaAjaxLink createDeleteButton() { LambdaAjaxLink link = new LambdaAjaxLink("delete", this::actionDelete); link.setOutputMarkupPlaceholderTag(true); link.add(visibleWhen(() -> getModelObject().getSelection().getAnnotation().isSet())); // Avoid deleting in read-only layers link.add(enabledWhen(() -> getModelObject().getSelectedAnnotationLayer() != null && !getModelObject().getSelectedAnnotationLayer().isReadonly())); return link; }
tabContainer.add(new LambdaAjaxLink("cancel", this::actionCancel)); tabContainer.add(new LambdaAjaxLink("delete", this::actionDelete) .onConfigure((_this) -> _this.setEnabled(selectedProject.getObject() != null && selectedProject.getObject().getId() != null)));
@Override protected void onConfigure() { super.onConfigure(); AnnotatorState state = AnnotationPage.this.getModelObject(); setEnabled(state.getDocument() != null && !documentService .isAnnotationFinished(state.getDocument(), state.getUser())); } });
@Override protected void onBeforeRender() { // Defer adding the image until rendering because we need to access the properties from // the embedding component/page if (!hasBeenRendered()) { ResourceReference _imageRes = imageRes; if (_imageRes == null) { _imageRes = new UrlResourceReference(Url.parse(getString("icon"))) .setContextRelative(true); } Image image = new Image("image", _imageRes); try { // The getString method throws an MissingResourceException if the property is // not available. In this case, we simply do not set a tooltip getString("tooltip"); image.add(new AttributeModifier("title", new StringResourceModel("tooltip", ActionBarLink.this))); } catch (MissingResourceException e) { // Nothing to do } link.add(image); } super.onBeforeRender(); }
private LambdaAjaxLink createJumpToSuggestionLink() { LambdaAjaxLink link = new LambdaAjaxLink(CID_RECOMMENDATION_COVERED_TEXT_LINK, this::actionJumpToSuggestion); link.add(new Label("leftContext", LoadableDetachableModel.of(() -> alStateModel.getObject().getLeftContext()))); link.add(new Label("text", LoadableDetachableModel.of(() -> alStateModel.getObject() .getSuggestion().map(AnnotationSuggestion::getCoveredText).orElse("")))); link.add(new Label("rightContext", LoadableDetachableModel.of(() -> alStateModel.getObject().getRightContext()))); return link; }
private LambdaAjaxLink createRemoveLabelIcon() { return new LambdaAjaxLink("removeLabel", this::removeSelectedLabel); }
LambdaAjaxLink editLink = new LambdaAjaxLink("edit", StatementEditor.this::actionEdit) .onConfigure((_this) -> _this.setVisible(!statement.getObject().isInferred())); editLink.add(new WriteProtectionBehavior(kbModel)); add(editLink); LambdaAjaxLink addQualifierLink = new LambdaAjaxLink("addQualifier", t -> actionAddQualifier(t, aStatement.getObject())) .onConfigure((_this) -> _this.setVisible(!statement.getObject().isInferred() && kbModel.getObject().getReification().supportsQualifier())); addQualifierLink.add(new Label("label", new ResourceModel("qualifier.add"))); addQualifierLink.add(new WriteProtectionBehavior(kbModel)); add(addQualifierLink); LambdaAjaxLink makeExplicitLink = new LambdaAjaxLink("makeExplicit", StatementEditor.this::actionMakeExplicit).onConfigure( (_this) -> _this.setVisible(statement.getObject().isInferred())); makeExplicitLink.add(new WriteProtectionBehavior(kbModel)); add(makeExplicitLink);
}; }); form.add(new LambdaAjaxLink("delete", this::actionDelete) .onConfigure(_this -> _this.setVisible(form.getModelObject().getId() != null))); form.add(new LambdaAjaxLink("cancel", this::actionCancel) .onConfigure(_this -> _this.setVisible(form.getModelObject().getId() == null)));