/** * given an AgentID, find the text span associated with this Agent and highlight the appropriate * areas in the raw text panel * * @param agentRef the AgentID */ public void highlightText(Annotation an, Color highlightTextColor) { if (an != null) { // highlight the annotation // also define color to the highlight tvPanel.highlightSpan( an.getStartOffset(), an.getEndOffset() - an.getStartOffset(), highlightTextColor); } }
public void setDoc(Document document) { predictionPanel.clear(); doc = document; tvPanel.clearHighlights(); displayRawText(); predictionPanel.redraw(); fileNameField.setText(doc.getDocumentId()); }
/** * This constructor sets up much of the functionality of the GUI, including the actual layout of * the components of the GUI, as well as handling the graph implementation. */ public MainWindow(Iterable<Document> corp) { corpus = corp; corpusIndex = corpus.iterator(); doc = corpusIndex.next(); /* * GUI Layout Creation */ // create the OverviewPanel which shows a reduced size snapshot of the entire graph predictionPanel = new PredictionListPanel(this); predictionPanel.setFont(font); tvPanel = new TextViewPanel(this); tvPanel.setFont(font); textSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, predictionPanel, tvPanel); textSplitPane.setDividerLocation(300); buttonPanel = createForwardBackPanel(doc); buttonPanel.setFont(font); editPanel = new PredictionEditPanel(this); editPanel.setFont(font); JSplitPane bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, editPanel, buttonPanel); bottomSplitPane.setDividerLocation(120); mainSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, textSplitPane, bottomSplitPane); mainSplitPane.setDividerLocation(700); getContentPane().add(mainSplitPane); // splitPane1.setDividerLocation(0.8); this.setTitle("Prediction Viewer"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); displayRawText(); pack(); setSize(1200, 900); setVisible(true); }
/** clears the raw text panel of all highlights */ public void clearHighlights() { tvPanel.clearHighlights(); }
/** * highlights text * * @param start the offset at which to start highlighting * @param end the offset at which to finish highlighting */ public void highlightText(int start, int end, Color highlightTextColor) { // also define color to the highlight tvPanel.highlightSpan(start, end - start, highlightTextColor); }
/** * displays the raw text of the document in the text panel * * @param xmlFile the XML Summary File */ public void displayRawText() { tvPanel.clearPanel(); tvPanel.setInitialText(doc.getText()); fileDisplayed = true; }