01: package abbot.finder;
02:
03: import java.awt.Component;
04: import abbot.tester.Robot;
05:
06: /** Indicates more than one component was found (usually where only one was
07: * desired).
08: */
09:
10: public class MultipleComponentsFoundException extends
11: ComponentSearchException {
12: Component[] components;
13:
14: public MultipleComponentsFoundException(Component[] list) {
15: components = list;
16: }
17:
18: public MultipleComponentsFoundException(String msg, Component[] list) {
19: super (msg);
20: components = list;
21: }
22:
23: public Component[] getComponents() {
24: return components;
25: }
26:
27: public String toString() {
28: StringBuffer buf = new StringBuffer(super .toString());
29: buf.append(": ");
30: for (int i = 0; i < components.length; i++) {
31: buf.append("\n (");
32: buf.append(String.valueOf(i));
33: buf.append(") ");
34: buf.append(Robot.toHierarchyPath(components[i]));
35: buf.append(": ");
36: buf.append(components[i].toString());
37: }
38: return buf.toString();
39: }
40: }
|