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

Method init

src/figtree/applet/FigTreeApplet.java:65–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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("");
112 statusBar.setStatusProvider(treeViewer);
113 statusBar.add(filterPanel, BorderLayout.EAST);
114
115 if (style != FigTreePanel.Style.ICARUS_SMALL) {
116 getContentPane().add(statusBar, BorderLayout.NORTH);
117 }
118
119 getContentPane().add(figTreePanel, BorderLayout.CENTER);
120
121 }
122

Callers

nothing calls this directly

Calls 3

addMethod · 0.45
toStringMethod · 0.45
getContentPaneMethod · 0.45

Tested by

no test coverage detected