use of gate.gui.docview.AnnotationSetsView in project gate-core by GateNLP.
the class AnnotationStackView method initGUI.
@Override
protected void initGUI() {
// get a pointer to the text view used to display
// the selected annotations
Iterator<DocumentView> centralViewsIter = owner.getCentralViews().iterator();
while (textView == null && centralViewsIter.hasNext()) {
DocumentView aView = centralViewsIter.next();
if (aView instanceof TextualDocumentView)
textView = (TextualDocumentView) aView;
}
// find the annotation set view associated with the document
Iterator<DocumentView> verticalViewsIter = owner.getVerticalViews().iterator();
while (annotationSetsView == null && verticalViewsIter.hasNext()) {
DocumentView aView = verticalViewsIter.next();
if (aView instanceof AnnotationSetsView)
annotationSetsView = (AnnotationSetsView) aView;
}
// get a pointer to the list view
Iterator<DocumentView> horizontalViewsIter = owner.getHorizontalViews().iterator();
while (annotationListView == null && horizontalViewsIter.hasNext()) {
DocumentView aView = horizontalViewsIter.next();
if (aView instanceof AnnotationListView)
annotationListView = (AnnotationListView) aView;
}
annotationListView.setOwner(owner);
document = textView.getDocument();
mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
// toolbar with previous and next annotation buttons
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.addSeparator();
toolBar.add(previousAnnotationAction = new PreviousAnnotationAction());
toolBar.add(nextAnnotationAction = new NextAnnotationAction());
overlappingCheckBox = new JCheckBox("Overlapping");
overlappingCheckBox.setToolTipText("Skip non overlapping annotations.");
toolBar.add(overlappingCheckBox);
toolBar.addSeparator();
toolBar.add(targetSetLabel = new JLabel("Target set: Undefined"));
targetSetLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
askTargetSet();
}
});
targetSetLabel.setToolTipText("<html>Target set to copy annotation when double clicked.<br>" + "Click to change it.</html>");
mainPanel.add(toolBar, BorderLayout.NORTH);
stackPanel = new AnnotationStack(100, 30);
scroller = new JScrollPane(stackPanel);
scroller.getViewport().setOpaque(true);
mainPanel.add(scroller, BorderLayout.CENTER);
initListeners();
}
Aggregations