MCPcopy Create free account
hub / github.com/rambaut/figtree / FigTreeApplet

Class FigTreeApplet

src/figtree/applet/FigTreeApplet.java:54–207  ·  view source on GitHub ↗

@author Andrew Rambaut @author Alexei Drummond @version $Id$ $HeadURL$ $LastChangedBy$ $LastChangedDate$ $LastChangedRevision$

Source from the content-addressed store, hash-verified

52 * $LastChangedRevision$
53 */
54public class FigTreeApplet extends JApplet {
55 private SimpleTreeViewer treeViewer;
56 private ControlPalette controlPalette1;
57 private ControlPalette controlPalette2;
58 private FigTreePanel figTreePanel;
59
60 private StatusBar statusBar;
61
62 private SearchPanel filterPanel;
63 private JPopupMenu filterPopup;
64
65 public void init() {
66 FigTreePanel.Style style = FigTreePanel.Style.DEFAULT;
67
68 String styleParam = getParameter("style");
69 if (styleParam != null) {
70 style = FigTreePanel.Style.valueOf(styleParam.trim().toUpperCase());
71 }
72
73 treeViewer = new SimpleTreeViewer();
74 controlPalette1 = new SimpleControlPalette();
75 controlPalette2 = new SimpleControlPalette();
76
77 figTreePanel = new FigTreePanel(treeViewer, controlPalette1, controlPalette2, style);
78
79 filterPopup = new JPopupMenu();
80 for (TreeViewer.TextSearchType searchType : TreeViewer.TextSearchType.values()) {
81 filterPopup.add(searchType.toString());
82 }
83 filterPanel = new SearchPanel("Filter", filterPopup, true);
84 filterPanel.setOpaque(false);
85 filterPanel.addSearchPanelListener(new SearchPanelListener() {
86
87 /**
88 * Called when the user requests a search by pressing return having
89 * typed a search string into the text field. If the continuousUpdate
90 * flag is true then this method is called when the user types into
91 * the text field.
92 *
93 * @param searchString the user's search string
94 */
95 public void searchStarted(String searchString) {
96 int index = filterPopup.getSelectionModel().getSelectedIndex();
97 if (index == -1) index = 0;
98 TreeViewer.TextSearchType searchType = TreeViewer.TextSearchType.values()[index];
99 treeViewer.selectTaxa("!name", searchType, searchString, false);
100 }
101
102 /**
103 * Called when the user presses the cancel search button or presses
104 * escape while the search is in focus.
105 */
106 public void searchStopped() {
107 treeViewer.clearSelectedTaxa();
108 }
109 });
110
111 statusBar = new StatusBar("");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…