19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.awt.ComponentOrientation;
22 import java.awt.EventQueue;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
25 import java.awt.event.ItemEvent;
26 import java.awt.event.ItemListener;
27 import java.util.ArrayList;
28 import java.util.List;
29 import java.util.concurrent.ExecutionException;
30 import java.util.logging.Level;
32 import org.openide.util.NbBundle;
34 import javax.swing.JMenuItem;
35 import javax.swing.JTextPane;
36 import javax.swing.SizeRequirements;
37 import javax.swing.SwingWorker;
38 import javax.swing.text.Element;
39 import javax.swing.text.View;
40 import javax.swing.text.ViewFactory;
41 import javax.swing.text.html.InlineView;
42 import javax.swing.text.html.ParagraphView;
43 import javax.swing.text.html.HTMLEditorKit;
44 import javax.swing.text.html.HTMLEditorKit.HTMLFactory;
45 import javax.swing.text.html.StyleSheet;
46 import org.netbeans.api.progress.ProgressHandle;
47 import org.netbeans.api.progress.ProgressHandleFactory;
55 class ExtractedContentPanel
extends javax.swing.JPanel {
57 private static Logger logger = Logger.getLogger(ExtractedContentPanel.class.getName());
59 ExtractedContentPanel() {
64 customizeComponents();
68 private void customizeComponents() {
70 HTMLEditorKit editorKit =
new HTMLEditorKit() {
72 public ViewFactory getViewFactory() {
74 return new HTMLFactory() {
76 public View create(Element e) {
77 View v = super.create(e);
78 if (v instanceof InlineView) {
79 return new InlineView(e) {
81 public int getBreakWeight(
int axis,
float pos,
float len) {
82 return GoodBreakWeight;
86 public View breakView(
int axis,
int p0,
float pos,
float len) {
87 if (axis == View.X_AXIS) {
89 int p1 = getGlyphPainter().getBoundedPosition(
this, p0, pos, len);
90 if (p0 == getStartOffset() && p1 == getEndOffset()) {
93 return createFragment(p0, p1);
98 }
else if (v instanceof ParagraphView) {
99 return new ParagraphView(e) {
101 protected SizeRequirements calculateMinorAxisRequirements(
int axis, SizeRequirements r) {
103 r =
new SizeRequirements();
105 float pref = layoutPool.getPreferredSpan(axis);
106 float min = layoutPool.getMinimumSpan(axis);
108 r.minimum = (int) min;
109 r.preferred = Math.max(r.minimum, (
int) pref);
110 r.maximum = Integer.MAX_VALUE;
124 StyleSheet ss = editorKit.getStyleSheet();
125 ss.addRule(
"body {font-size: 8.5px;}");
127 extractedTextPane.setEditorKit(editorKit);
129 sourceComboBox.addItemListener(
new ItemListener() {
131 public void itemStateChanged(ItemEvent e) {
132 if (e.getStateChange() == ItemEvent.SELECTED) {
133 TextMarkup source = (TextMarkup) e.getItem();
140 setSources(
new ArrayList<TextMarkup>());
142 extractedTextPane.setComponentPopupMenu(rightClickMenu);
143 ActionListener actList =
new ActionListener() {
145 public void actionPerformed(ActionEvent e) {
146 JMenuItem jmi = (JMenuItem) e.getSource();
147 if (jmi.equals(copyMenuItem)) {
148 extractedTextPane.copy();
149 }
else if (jmi.equals(selectAllMenuItem)) {
150 extractedTextPane.selectAll();
154 copyMenuItem.addActionListener(actList);
155 selectAllMenuItem.addActionListener(actList);
163 @SuppressWarnings(
"unchecked")
165 private
void initComponents() {
167 rightClickMenu =
new javax.swing.JPopupMenu();
168 copyMenuItem =
new javax.swing.JMenuItem();
169 selectAllMenuItem =
new javax.swing.JMenuItem();
170 jScrollPane1 =
new javax.swing.JScrollPane();
171 extractedTextPane =
new JTextPane(){
172 public boolean getScrollableTracksViewportWidth() {
173 return (getSize().width < 400);
175 sourceComboBox =
new javax.swing.JComboBox<>();
176 hitLabel =
new javax.swing.JLabel();
177 hitCountLabel =
new javax.swing.JLabel();
178 hitOfLabel =
new javax.swing.JLabel();
179 hitTotalLabel =
new javax.swing.JLabel();
180 hitButtonsLabel =
new javax.swing.JLabel();
181 hitPreviousButton =
new javax.swing.JButton();
182 hitNextButton =
new javax.swing.JButton();
183 pageButtonsLabel =
new javax.swing.JLabel();
184 pagePreviousButton =
new javax.swing.JButton();
185 pageNextButton =
new javax.swing.JButton();
186 pagesLabel =
new javax.swing.JLabel();
187 pageCurLabel =
new javax.swing.JLabel();
188 pageOfLabel =
new javax.swing.JLabel();
189 pageTotalLabel =
new javax.swing.JLabel();
191 copyMenuItem.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.copyMenuItem.text"));
192 rightClickMenu.add(copyMenuItem);
194 selectAllMenuItem.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.selectAllMenuItem.text"));
195 rightClickMenu.add(selectAllMenuItem);
197 setPreferredSize(
new java.awt.Dimension(700, 400));
199 jScrollPane1.setBackground(
new java.awt.Color(255, 255, 255));
200 jScrollPane1.setPreferredSize(
new java.awt.Dimension(700, 400));
202 extractedTextPane.setEditable(
false);
203 extractedTextPane.setAutoscrolls(
false);
204 extractedTextPane.setMaximumSize(
new java.awt.Dimension(2000, 2000));
205 extractedTextPane.setPreferredSize(
new java.awt.Dimension(700, 400));
206 jScrollPane1.setViewportView(extractedTextPane);
208 sourceComboBox.setModel(
new javax.swing.DefaultComboBoxModel<TextMarkup>());
210 hitLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitLabel.text"));
211 hitLabel.setToolTipText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitLabel.toolTipText"));
213 hitCountLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
214 hitCountLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitCountLabel.text"));
215 hitCountLabel.setMaximumSize(
new java.awt.Dimension(18, 14));
216 hitCountLabel.setMinimumSize(
new java.awt.Dimension(18, 14));
217 hitCountLabel.setPreferredSize(
new java.awt.Dimension(18, 14));
219 hitOfLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitOfLabel.text"));
221 hitTotalLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
222 hitTotalLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitTotalLabel.text"));
223 hitTotalLabel.setMaximumSize(
new java.awt.Dimension(18, 14));
224 hitTotalLabel.setMinimumSize(
new java.awt.Dimension(18, 14));
225 hitTotalLabel.setPreferredSize(
new java.awt.Dimension(18, 14));
227 hitButtonsLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitButtonsLabel.text"));
229 hitPreviousButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png")));
230 hitPreviousButton.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitPreviousButton.text"));
231 hitPreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
232 hitPreviousButton.setBorderPainted(
false);
233 hitPreviousButton.setContentAreaFilled(
false);
234 hitPreviousButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png")));
235 hitPreviousButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
236 hitPreviousButton.setPreferredSize(
new java.awt.Dimension(23, 23));
237 hitPreviousButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_back_hover.png")));
239 hitNextButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png")));
240 hitNextButton.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitNextButton.text"));
241 hitNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
242 hitNextButton.setBorderPainted(
false);
243 hitNextButton.setContentAreaFilled(
false);
244 hitNextButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png")));
245 hitNextButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
246 hitNextButton.setPreferredSize(
new java.awt.Dimension(23, 23));
247 hitNextButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_hover.png")));
249 pageButtonsLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageButtonsLabel.text"));
251 pagePreviousButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png")));
252 pagePreviousButton.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pagePreviousButton.text"));
253 pagePreviousButton.setActionCommand(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pagePreviousButton.actionCommand"));
254 pagePreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
255 pagePreviousButton.setBorderPainted(
false);
256 pagePreviousButton.setContentAreaFilled(
false);
257 pagePreviousButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png")));
258 pagePreviousButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
260 pageNextButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png")));
261 pageNextButton.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageNextButton.text"));
262 pageNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
263 pageNextButton.setBorderPainted(
false);
264 pageNextButton.setContentAreaFilled(
false);
265 pageNextButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png")));
266 pageNextButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
267 pageNextButton.setPreferredSize(
new java.awt.Dimension(23, 23));
269 pagesLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pagesLabel.text"));
271 pageCurLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
272 pageCurLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageCurLabel.text"));
274 pageOfLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageOfLabel.text"));
276 pageTotalLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
277 pageTotalLabel.setText(
org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageTotalLabel.text"));
279 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
280 this.setLayout(layout);
281 layout.setHorizontalGroup(
282 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
283 .addGroup(layout.createSequentialGroup()
285 .addComponent(hitLabel)
286 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
287 .addComponent(hitCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
288 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
289 .addComponent(hitOfLabel)
290 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
291 .addComponent(hitTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
292 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
293 .addComponent(hitButtonsLabel)
294 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
295 .addComponent(hitPreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
297 .addComponent(hitNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
298 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
299 .addComponent(pagesLabel)
300 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
301 .addComponent(pageCurLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
302 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
303 .addComponent(pageOfLabel)
304 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
305 .addComponent(pageTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
307 .addComponent(pageButtonsLabel)
308 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
309 .addComponent(pagePreviousButton)
311 .addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
312 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
313 .addComponent(sourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
314 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
316 layout.setVerticalGroup(
317 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
318 .addGroup(layout.createSequentialGroup()
319 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
320 .addComponent(sourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
321 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
322 .addComponent(hitCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
323 .addComponent(hitOfLabel)
324 .addComponent(hitTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
325 .addComponent(hitLabel)
326 .addComponent(hitButtonsLabel))
327 .addComponent(hitPreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
328 .addComponent(hitNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
329 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
330 .addComponent(pageButtonsLabel)
331 .addComponent(pageTotalLabel)
332 .addComponent(pagesLabel)
333 .addComponent(pageCurLabel)
334 .addComponent(pageOfLabel))
335 .addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
336 .addComponent(pagePreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
338 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE))
342 private javax.swing.JMenuItem copyMenuItem;
343 private javax.swing.JTextPane extractedTextPane;
344 private javax.swing.JLabel hitButtonsLabel;
345 private javax.swing.JLabel hitCountLabel;
346 private javax.swing.JLabel hitLabel;
347 private javax.swing.JButton hitNextButton;
348 private javax.swing.JLabel hitOfLabel;
349 private javax.swing.JButton hitPreviousButton;
350 private javax.swing.JLabel hitTotalLabel;
351 private javax.swing.JScrollPane jScrollPane1;
352 private javax.swing.JLabel pageButtonsLabel;
353 private javax.swing.JLabel pageCurLabel;
354 private javax.swing.JButton pageNextButton;
355 private javax.swing.JLabel pageOfLabel;
356 private javax.swing.JButton pagePreviousButton;
357 private javax.swing.JLabel pageTotalLabel;
358 private javax.swing.JLabel pagesLabel;
359 private javax.swing.JPopupMenu rightClickMenu;
360 private javax.swing.JMenuItem selectAllMenuItem;
361 private javax.swing.JComboBox<TextMarkup> sourceComboBox;
364 void refreshCurrentMarkup() {
365 TextMarkup ms = (TextMarkup) sourceComboBox.getSelectedItem();
375 void setSources(List<TextMarkup> sources) {
376 sourceComboBox.removeAllItems();
377 setPanelText(null,
false);
379 for (TextMarkup ms : sources) {
380 sourceComboBox.addItem(ms);
383 if (!sources.isEmpty()) {
384 sourceComboBox.setSelectedIndex(0);
394 public List<TextMarkup> getSources() {
395 ArrayList<TextMarkup> sources =
new ArrayList<>();
396 for (
int i = 0; i < sourceComboBox.getItemCount(); ++i) {
397 sources.add(sourceComboBox.getItemAt(i));
406 public TextMarkup getSelectedSource() {
407 return (TextMarkup) sourceComboBox.getSelectedItem();
410 private void setPanelText(String text,
boolean detectDirection) {
415 if (detectDirection) {
418 final int len = text.length();
419 final int prefixLen =
"<pre>".length();
420 if (len > prefixLen) {
421 final int maxOrientChars = Math.min(len, 1024);
422 final String orientDetectText = EscapeUtil.unEscapeHtml(text.substring(prefixLen, maxOrientChars));
423 ComponentOrientation direction = TextUtil.getTextDirection(orientDetectText);
425 extractedTextPane.applyComponentOrientation(direction);
427 extractedTextPane.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
430 extractedTextPane.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
433 extractedTextPane.setText(text);
434 extractedTextPane.setCaretPosition(0);
437 private void initControls() {
438 hitPreviousButton.setEnabled(
false);
439 hitNextButton.setEnabled(
false);
442 void scrollToAnchor(String anchor) {
443 extractedTextPane.scrollToReference(anchor);
450 void updateCurrentMatchDisplay(
int current) {
452 hitCountLabel.setText(
"-");
454 hitCountLabel.setText(Integer.toString(current));
462 void updateTotaMatcheslDisplay(
int total) {
464 hitTotalLabel.setText(
"-");
466 hitTotalLabel.setText(Integer.toString(total));
474 void updateCurrentPageDisplay(
int current) {
475 pageCurLabel.setText(Integer.toString(current));
482 void updateTotalPageslDisplay(
int total) {
483 pageTotalLabel.setText(Integer.toString(total));
486 void resetDisplay() {
494 void resetHitDisplay() {
495 hitTotalLabel.setText(
"-");
496 hitCountLabel.setText(
"-");
502 void resetPagesDisplay() {
503 pageCurLabel.setText(
"-");
504 pageTotalLabel.setText(
"-");
512 void enablePrevMatchControl(
boolean enable) {
513 hitPreviousButton.setEnabled(enable);
521 void enableNextMatchControl(
boolean enable) {
522 hitNextButton.setEnabled(enable);
525 void addPrevMatchControlListener(ActionListener l) {
526 hitPreviousButton.addActionListener(l);
529 void addNextMatchControlListener(ActionListener l) {
530 hitNextButton.addActionListener(l);
538 void enablePrevPageControl(
boolean enable) {
539 pagePreviousButton.setEnabled(enable);
547 void enableNextPageControl(
boolean enable) {
548 pageNextButton.setEnabled(enable);
551 void addPrevPageControlListener(ActionListener l) {
552 pagePreviousButton.addActionListener(l);
555 void addNextPageControlListener(ActionListener l) {
556 pageNextButton.addActionListener(l);
559 void addSourceComboControlListener(ActionListener l) {
560 sourceComboBox.addActionListener(l);
568 void updateControls(TextMarkup source) {
569 updatePageControls(source);
570 updateSearchControls(source);
578 void updatePageControls(TextMarkup source) {
579 if (source == null) {
580 enableNextPageControl(
false);
581 enablePrevPageControl(
false);
582 updateCurrentPageDisplay(0);
583 updateTotalPageslDisplay(0);
587 updateCurrentPageDisplay(source.getCurrentPage());
588 int totalPages = source.getNumberPages();
589 updateTotalPageslDisplay(totalPages);
592 if (totalPages == 1) {
593 enableNextPageControl(
false);
594 enablePrevPageControl(
false);
596 if (source.hasNextPage()) {
597 enableNextPageControl(
true);
599 enableNextPageControl(
false);
602 if (source.hasPreviousPage()) {
603 enablePrevPageControl(
true);
605 enablePrevPageControl(
false);
617 void updateSearchControls(TextMarkup source) {
619 if (source != null && source.isSearchable()) {
621 updateCurrentMatchDisplay(source.currentItem());
622 updateTotaMatcheslDisplay(source.getNumberHits());
624 if (source.hasNextItem() || source.hasNextPage()) {
625 enableNextMatchControl(
true);
627 enableNextMatchControl(
false);
630 if (source.hasPreviousItem() || source.hasPreviousPage()) {
631 enablePrevMatchControl(
true);
633 enablePrevMatchControl(
false);
637 enableNextMatchControl(
false);
638 enablePrevMatchControl(
false);
639 updateCurrentMatchDisplay(0);
640 updateTotaMatcheslDisplay(0);
649 private void scrollToCurrentHit(
final TextMarkup source) {
650 if (source == null || !source.isSearchable()) {
655 EventQueue.invokeLater(
new Runnable() {
658 scrollToAnchor(source.getAnchorPrefix() + Integer.toString(source.currentItem()));
669 private void setMarkup(TextMarkup source) {
670 setPanelText(NbBundle.getMessage(
this.getClass(),
"ExtractedContentPanel.setMarkup.panelTxt"),
false);
671 new SetMarkupWorker(source).execute();
691 progress = ProgressHandleFactory.createHandle(
692 NbBundle.getMessage(
this.getClass(),
"ExtractedContentPanel.SetMarkup.progress.loading"));
693 progress.setDisplayName(
694 NbBundle.getMessage(
this.getClass(),
"ExtractedContentPanel.SetMarkup.progress.displayName"));
696 progress.switchToIndeterminate();
698 markup = source.getMarkup();
711 }
catch (InterruptedException | ExecutionException ex) {
712 logger.log(Level.SEVERE,
"Error getting marked up text" );
715 catch (java.util.concurrent.CancellationException ex ) { }
718 if (markup != null) {
719 setPanelText(markup,
true);
721 setPanelText(
"",
false);
723 updateControls(source);
725 scrollToCurrentHit(source);