01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.harmony.beans.tests.support.mock;
19:
20: import java.awt.Image;
21: import java.awt.image.BufferedImage;
22: import java.beans.BeanDescriptor;
23: import java.beans.EventSetDescriptor;
24: import java.beans.PropertyDescriptor;
25: import java.beans.SimpleBeanInfo;
26:
27: public class FakeFox03BeanInfo extends SimpleBeanInfo {
28:
29: PropertyDescriptor propdescr[];
30:
31: EventSetDescriptor eventdescr[];
32:
33: public FakeFox03BeanInfo() {
34: super ();
35: try {
36: propdescr = new PropertyDescriptor[] { new PropertyDescriptor(
37: "Other", FakeFox03.class) };
38: eventdescr = new EventSetDescriptor[] { new EventSetDescriptor(
39: SomeOtherObject.class, "SomeOther",
40: SomeOtherListener.class, "aMethod") };
41: } catch (Exception e) {
42: e.printStackTrace();
43: }
44: }
45:
46: public BeanDescriptor getBeanDescriptor() {
47: BeanDescriptor descriptor = new BeanDescriptor(FakeFox03.class);
48: descriptor.setName("SomeOtherBean Descriptor");
49: return descriptor;
50: }
51:
52: public static final Image someOtherImage = new BufferedImage(1, 1,
53: BufferedImage.TYPE_3BYTE_BGR);
54:
55: public Image getIcon(int iconKind) {
56: return someOtherImage;
57:
58: }
59:
60: public int getDefaultPropertyIndex() {
61: System.out
62: .println("SomeOtherBeanBeanInfo.getDefaultPropertyIndex() called...");
63: return propdescr.length - 1;
64: }
65:
66: public PropertyDescriptor[] getPropertyDescriptors() {
67: return propdescr;
68: }
69:
70: public int getDefaultEventIndex() {
71: return eventdescr.length - 1;
72: }
73:
74: public EventSetDescriptor[] getEventSetDescriptors() {
75: return eventdescr;
76: }
77:
78: private interface SomeOtherListener {
79: public void aMethod(SomeOtherEvent s);
80: }
81:
82: private class SomeOtherObject {
83: public void addFakeFox03BeanInfo$SomeOtherListener(
84: SomeOtherListener l) {
85: }
86:
87: public void removeFakeFox03BeanInfo$SomeOtherListener(
88: SomeOtherListener l) {
89: }
90: }
91:
92: private class SomeOtherEvent {
93: }
94: }
|