public abstract class AnnotationsModule<P> extends Object implements TreeContentProvider, TreeLabelProvider, TreeIconProvider, DynamicTreeModule, TreeSelectionHandler, PageViewModule, TreeContextMenuContributor
Modifier and Type | Class and Description |
---|---|
static class |
AnnotationsModule.AnnoSelectionMode
Specifies what to do with a selected annotation.
|
static class |
AnnotationsModule.AnnotationIcon |
static class |
AnnotationsModule.DefaultLabelProvider |
static class |
AnnotationsModule.PresentationMode |
DynamicTreeModule.TreeCallback
Modifier and Type | Field and Description |
---|---|
protected Matcher<Annotation> |
annotationMatcher |
protected CompositeMatcherEditor<Annotation> |
annotationMatcherEditor |
protected Icon |
groupIcon |
protected Object |
groupNodeToken
A token used to represent the group node.
|
protected static Logger |
LOGGER |
Constructor and Description |
---|
AnnotationsModule(Class<P> parentType,
String groupNodeTitle,
Icon groupIcon) |
AnnotationsModule(Class<P> parentType,
String groupNodeTitle,
Icon groupIcon,
AnnotationsModule.AnnoSelectionMode annoSelectionMode) |
Modifier and Type | Method and Description |
---|---|
void |
contribute(TreeContributionContext context,
MenuBuilder menuBuilder)
This method is called in order to give the menu contributor a chance to contribute context menu
entries via the supplied
MenuBuilder . |
protected FilterList<Annotation> |
createMatcherFilteredList(EventList<Annotation> list) |
protected Document |
findDocumentForAnnotation(TreePath path,
Annotation a)
|
protected Page |
findPageForAnnotation(TreePath path,
Document doc,
Annotation a) |
FunctionList.Function<Annotation,String> |
getAnnotationLabelProvider() |
DocumentLayer |
getAnnotationLayer() |
Matcher<Annotation> |
getAnnotationMatcher() |
protected EventList<Object> |
getGroupingNodeList(Object parent,
Object groupNodeToken,
EventList<Annotation> annotationList)
Return a list where the existence of the group node stand-in token in the child list is
synchronised to emptiness of the given annotation list.
|
Icon |
getIcon(TreePath treePath) |
PageView |
getPageView() |
AnnotationsModule.PresentationMode |
getPresentationMode() |
boolean |
hasChildren(TreePath treePath)
Determines whether the last tree path component can have children.
|
void |
pathDeselected(TreePath path,
FlexibleTree flexTree,
boolean wasLeadSelectionPath) |
void |
pathSelected(TreePath path,
FlexibleTree flexTree,
boolean isLeadSelection) |
void |
setAnnotationLabelFilterator(FunctionList.Function<Annotation,String> annotationLabelProvider)
Set the
Filterator used to turn Annotation instances into the descriptive
string used to render the node label. |
void |
setAnnotationLayer(DocumentLayer annotationsLayer)
Set the
DocumentLayer for which this module presents annotations. |
void |
setAnnotationMatcher(Matcher<Annotation> pageAnnotationMatcher) |
void |
setPageView(PageView view) |
void |
setPresentationMode(AnnotationsModule.PresentationMode presentationMode)
Set the presentation mode.
|
void |
updateLabel(TreePath treePath,
StyledDocument doc) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildren
registerTreeCallback
protected static final Logger LOGGER
protected final Object groupNodeToken
protected Matcher<Annotation> annotationMatcher
protected final CompositeMatcherEditor<Annotation> annotationMatcherEditor
protected final Icon groupIcon
public AnnotationsModule(Class<P> parentType, String groupNodeTitle, Icon groupIcon)
public AnnotationsModule(Class<P> parentType, String groupNodeTitle, Icon groupIcon, AnnotationsModule.AnnoSelectionMode annoSelectionMode)
public void updateLabel(TreePath treePath, StyledDocument doc) throws BadLocationException
updateLabel
in interface TreeLabelProvider
BadLocationException
public Icon getIcon(TreePath treePath)
getIcon
in interface TreeIconProvider
public boolean hasChildren(TreePath treePath)
TreeContentProvider
true
is returned from a call to this method, it is still
allowed to return null
or an empty list from calls to
TreeContentProvider.getChildren(TreePath)
.hasChildren
in interface TreeContentProvider
treePath
- to analysetrue
if the last tree path component can have children, otherwise
false
.public void contribute(TreeContributionContext context, MenuBuilder menuBuilder)
TreeContextMenuContributor
MenuBuilder
.contribute
in interface TreeContextMenuContributor
context
- the TreeContributionContext
which provides contribution context
informationmenuBuilder
- the MenuBuilder
to which the tool may contribute entries.public void setAnnotationLayer(DocumentLayer annotationsLayer)
DocumentLayer
for which this module presents annotations. Please note that if a
page contains more than one AnnotationPageSegment
, not all of those annotations are
automatically presented, but only those from the page segment residing at the layer chosen
using this setter.public DocumentLayer getAnnotationLayer()
public void setAnnotationLabelFilterator(FunctionList.Function<Annotation,String> annotationLabelProvider)
Filterator
used to turn Annotation
instances into the descriptive
string used to render the node label.public FunctionList.Function<Annotation,String> getAnnotationLabelProvider()
public void pathSelected(TreePath path, FlexibleTree flexTree, boolean isLeadSelection)
pathSelected
in interface TreeSelectionHandler
public void pathDeselected(TreePath path, FlexibleTree flexTree, boolean wasLeadSelectionPath)
pathDeselected
in interface TreeSelectionHandler
protected Document findDocumentForAnnotation(TreePath path, Annotation a)
TreePath
for an instance of Document
. If none is found, the
PageView
's current Document
is returned. If there is none, null
is
returned.path
- path to search for Document
instancea
- the Annotation
to find the Document
forDocument
or null
protected Page findPageForAnnotation(TreePath path, Document doc, Annotation a)
public void setPageView(PageView view)
setPageView
in interface PageViewModule
public PageView getPageView()
public void setPresentationMode(AnnotationsModule.PresentationMode presentationMode)
public AnnotationsModule.PresentationMode getPresentationMode()
public Matcher<Annotation> getAnnotationMatcher()
public void setAnnotationMatcher(Matcher<Annotation> pageAnnotationMatcher)
protected FilterList<Annotation> createMatcherFilteredList(EventList<Annotation> list)
Copyright © 2024 levigo holding gmbh. All rights reserved.