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

Method FindPanel

src/figtree/treeviewer/FindPanel.java:77–170  ·  view source on GitHub ↗
(Action findAllAction, Action findNextAction)

Source from the content-addressed store, hash-verified

75 private int selectedTargetIndex = 0;
76
77 public FindPanel(Action findAllAction, Action findNextAction) {
78 setLayout(new BorderLayout(0,0));
79
80 Font font = UIManager.getFont("SmallSystemFont");
81 if (font != null) {
82 searchText.setFont(font);
83 }
84 searchText.setColumns(18);
85
86 final JPanel panel = new JPanel();
87 panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
88 panel.setOpaque(false);
89 targetCombo = new JComboBox();
90 targetCombo.addItem(Target.TAXON_LABEL);
91 targetCombo.addItem(Target.BRANCH_LENGTH);
92 targetCombo.addItem(Target.NODE_AGE);
93 targetCombo.addItem(Target.ANY_ANNOTATION);
94
95 adjustComponent(targetCombo);
96 adjustComponent(textSearchCombo);
97 adjustComponent(numberSearchCombo);
98 adjustComponent(caseSensitiveCheck);
99 panel.add(targetCombo);
100 panel.add(textSearchCombo);
101 panel.add(searchText);
102 panel.add(caseSensitiveCheck);
103
104 add(panel, BorderLayout.CENTER);
105
106 if (findNextAction != null) {
107 JButton nextButton = new JButton(findNextAction);
108 adjustComponent(nextButton);
109 panel.add(nextButton);
110 }
111 findAllButton = new JButton(findAllAction);
112 adjustComponent(findAllButton);
113
114 getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "doFind");
115 getActionMap().put("doFind", new AbstractAction() {
116 public void actionPerformed(ActionEvent e) {
117 findAllButton.doClick();
118 }
119 });
120
121 final JPanel panel2 = new JPanel();
122 panel2.setLayout(new BoxLayout(panel2, BoxLayout.LINE_AXIS));
123 panel2.setOpaque(false);
124 panel2.add(findAllButton);
125
126 add(panel2, BorderLayout.EAST);
127
128 targetCombo.addActionListener(new ActionListener() {
129 public void actionPerformed(ActionEvent event) {
130 Object item = targetCombo.getSelectedItem();
131 if (item != null) {
132 if (item.equals(Target.BRANCH_LENGTH) || item.equals(Target.NODE_AGE)) {
133 type = AnnotationDefinition.Type.REAL;
134 } else if (item instanceof AnnotationDefinition) {

Callers

nothing calls this directly

Calls 5

adjustComponentMethod · 0.95
setFontMethod · 0.80
getFontMethod · 0.65
putMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected