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

Method showDialog

src/figtree/treeviewer/FindDialog.java:90–176  ·  view source on GitHub ↗
(List<AnnotationDefinition> annotations)

Source from the content-addressed store, hash-verified

88 }
89
90 public int showDialog(List<AnnotationDefinition> annotations) {
91
92 OptionsPanel options = new OptionsPanel(12, 12);
93
94 searchText.setColumns(18);
95
96 final JPanel panel = new JPanel(new BorderLayout(6,6));
97 targetCombo = new JComboBox();
98 targetCombo.addItem(Target.TAXON_LABEL);
99 targetCombo.addItem(Target.BRANCH_LENGTH);
100 targetCombo.addItem(Target.NODE_AGE);
101 targetCombo.addItem(Target.ANY_ANNOTATION);
102 for (AnnotationDefinition annotation : annotations) {
103 targetCombo.addItem(annotation);
104 }
105 panel.add(targetCombo, BorderLayout.WEST);
106 panel.add(textSearchCombo, BorderLayout.CENTER);
107 panel.add(searchText, BorderLayout.EAST);
108 options.addComponent(panel);
109
110 options.addComponent(caseSensitiveCheck);
111
112 // options.addComponent(findAllCheck);
113
114 JOptionPane optionPane = new JOptionPane(options,
115 JOptionPane.QUESTION_MESSAGE,
116 JOptionPane.OK_CANCEL_OPTION,
117 null,
118 null,
119 null);
120 optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
121
122 final JDialog dialog = optionPane.createDialog(frame, "Find");
123 dialog.pack();
124
125 targetCombo.addActionListener(new ActionListener() {
126 public void actionPerformed(ActionEvent event) {
127 Object item = targetCombo.getSelectedItem();
128
129 if (item.equals(Target.BRANCH_LENGTH) || item.equals(Target.NODE_AGE)) {
130 type = AnnotationDefinition.Type.REAL;
131 } else if (item instanceof AnnotationDefinition) {
132 type = ((AnnotationDefinition) item).getType();
133 } else {
134 type = AnnotationDefinition.Type.STRING;
135 }
136
137 panel.removeAll();
138 panel.add(targetCombo, BorderLayout.WEST);
139 switch (type) {
140 case INTEGER:
141 panel.add(numberSearchCombo, BorderLayout.CENTER);
142 panel.add(integerText, BorderLayout.EAST);
143 integerText.setColumns(10);
144 caseSensitiveCheck.setEnabled(false);
145 break;
146 case REAL:
147 panel.add(numberSearchCombo, BorderLayout.CENTER);

Callers 2

actionPerformedMethod · 0.45

Calls 4

addMethod · 0.45
setBorderMethod · 0.45
setVisibleMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected