protected ActionBarLink createOrGetResetDocumentLink() { if (resetDocumentLink == null) { resetDocumentLink = new ActionBarLink("showResetDocumentDialog", t -> resetDocumentDialog.show(t)); resetDocumentLink.onConfigure(_this -> { AnnotatorState state = AnnotationPageBase.this.getModelObject(); _this.setEnabled(state.getDocument() != null && !documentService .isAnnotationFinished(state.getDocument(), state.getUser())); }); } return resetDocumentLink; }
public ActionBarLink(String aId, IModel<String> aLabel, ResourceReference aImageRes, AjaxCallback aAction) { super(aId); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); imageRes = aImageRes; action = aAction; IModel<String> label = aLabel; if (label == null) { label = new StringResourceModel("label", this); } link = new LambdaAjaxLink("link", action); link.add(new Label("label", label)); add(link); }
@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(); }
add(new ActionBarLink("showPreferencesDialog", this::actionShowPreferencesDialog)); add(new ActionBarLink("showGuidelinesDialog", guidelinesDialog::show)); add(new ActionBarLink("showExportDialog", exportDialog::show).onConfigure(_this -> { AnnotatorState state = AnnotationPage.this.getModelObject(); _this.setVisible(state.getProject() != null && (projectService.isAdmin(state.getProject(), state.getUser()) || !state.getProject().isDisableExport())); })); add(new ActionBarLink("showPreviousDocument", t -> actionShowPreviousDocument(t)) .add(new InputBehavior(new KeyType[] { KeyType.Shift, KeyType.Page_up }, EventType.click))); add(new ActionBarLink("showNextDocument", t -> actionShowNextDocument(t)) .add(new InputBehavior(new KeyType[] { KeyType.Shift, KeyType.Page_down }, EventType.click))); add(new ActionBarLink("showNext", t -> actionShowNextPage(t)) .add(new InputBehavior(new KeyType[] { KeyType.Page_down }, EventType.click))); add(new ActionBarLink("showPrevious", t -> actionShowPreviousPage(t)) .add(new InputBehavior(new KeyType[] { KeyType.Page_up }, EventType.click))); add(new ActionBarLink("showFirst", t -> actionShowFirstPage(t)) .add(new InputBehavior(new KeyType[] { KeyType.Home }, EventType.click))); add(new ActionBarLink("showLast", t -> actionShowLastPage(t))
add(new ActionBarLink("showGuidelinesDialog", guidelinesDialog::show));
add(new ActionBarLink("showGuidelinesDialog", guidelinesDialog::show));
remergeDocumentDialog.setConfirmAction(this::actionRemergeDocument); add(remergeDocumentDialog); remergeDocumentLink = new ActionBarLink("showRemergeDocumentDialog", t -> remergeDocumentDialog.show(t)); remergeDocumentLink.onConfigure(_this -> { AnnotatorState state = CurationPage.this.getModelObject(); _this.setEnabled(state.getDocument() != null && !state.getDocument().getState() .equals(SourceDocumentState.CURATION_FINISHED)); }); add(new ActionBarLink("showGuidelinesDialog", guidelinesDialog::show));
add(new ActionBarLink("showGuidelinesDialog", guidelinesDialog::show));
remergeDocumentDialog.setConfirmAction(this::actionRemergeDocument); add(remergeDocumentDialog); remergeDocumentLink = new ActionBarLink("showRemergeDocumentDialog", t -> remergeDocumentDialog.show(t)); remergeDocumentLink.onConfigure(_this -> { AnnotatorState state = CurationPage.this.getModelObject(); _this.setEnabled(state.getDocument() != null && !state.getDocument().getState() .equals(SourceDocumentState.CURATION_FINISHED)); }); add(new ActionBarLink("showGuidelinesDialog", guidelinesDialog::show));