|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| AnnotationEditor.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
package abbot.editor.editors;
|
|
| 2 |
|
|
| 3 |
import java.awt.event.ActionEvent;
|
|
| 4 |
import javax.swing.*;
|
|
| 5 |
import java.util.Collection;
|
|
| 6 |
|
|
| 7 |
import abbot.*;
|
|
| 8 |
import abbot.i18n.Strings;
|
|
| 9 |
import abbot.script.*;
|
|
| 10 |
import abbot.script.Annotation;
|
|
| 11 |
|
|
| 12 |
/** A Annotation only has its description available for editing. */
|
|
| 13 |
|
|
| 14 |
public class AnnotationEditor extends StepEditor { |
|
| 15 |
|
|
| 16 |
private Annotation annotation;
|
|
| 17 |
private JTextArea text;
|
|
| 18 |
private JButton reposition;
|
|
| 19 |
private JCheckBox userDismiss;
|
|
| 20 |
private JComboBox relative;
|
|
| 21 |
|
|
| 22 | 0 |
public AnnotationEditor(Annotation annotation) {
|
| 23 | 0 |
super(annotation);
|
| 24 | 0 |
this.annotation = annotation;
|
| 25 | 0 |
text = addTextArea(Strings.get("AnnotationText"),
|
| 26 |
annotation.getText()); |
|
| 27 | 0 |
relative = addComponentSelector(Strings.get("AnchorComponent"),
|
| 28 |
annotation.getRelativeTo(), |
|
| 29 |
annotation.getResolver(), true);
|
|
| 30 | 0 |
reposition = addButton(Strings.get("Reposition"));
|
| 31 | 0 |
userDismiss = addCheckBox(Strings.get("UserDismiss"),
|
| 32 |
annotation.getUserDismiss()); |
|
| 33 |
} |
|
| 34 |
|
|
| 35 |
/** An editor component changed, respond to it by updating the step. */
|
|
| 36 | 0 |
public void actionPerformed(ActionEvent ev) { |
| 37 | 0 |
Object src = ev.getSource(); |
| 38 | 0 |
if (src == text) {
|
| 39 | 0 |
annotation.setText(text.getText()); |
| 40 | 0 |
fireStepChanged(); |
| 41 |
} |
|
| 42 | 0 |
else if (src == relative) { |
| 43 | 0 |
annotation.setRelativeTo((String)relative.getSelectedItem()); |
| 44 | 0 |
fireStepChanged(); |
| 45 |
} |
|
| 46 | 0 |
else if (src == reposition) { |
| 47 | 0 |
try {
|
| 48 | 0 |
annotation.showAnnotation(); |
| 49 | 0 |
fireStepChanged(); |
| 50 |
} |
|
| 51 |
catch(Exception e) {
|
|
| 52 |
// FIXME show a dialog instead
|
|
| 53 | 0 |
Log.warn(e); |
| 54 |
} |
|
| 55 |
} |
|
| 56 | 0 |
else if (src == userDismiss) { |
| 57 | 0 |
annotation.setUserDismiss(userDismiss.isSelected()); |
| 58 | 0 |
if (annotation.isShowing())
|
| 59 | 0 |
annotation.showAnnotation(); |
| 60 | 0 |
fireStepChanged(); |
| 61 |
} |
|
| 62 |
else {
|
|
| 63 | 0 |
super.actionPerformed(ev);
|
| 64 |
} |
|
| 65 |
} |
|
| 66 |
} |
|
| 67 |
|
|
||||||||||