01: /*******************************************************************************
02: * Copyright (c) 2007 Brad Reynolds and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Brad Reynolds - initial API and implementation
10: ******************************************************************************/package org.eclipse.core.tests.internal.databinding.internal.beans;
11:
12: import java.beans.PropertyChangeListener;
13: import java.beans.PropertyChangeSupport;
14: import java.util.List;
15: import java.util.Set;
16:
17: /**
18: * Simple Java Bean for testing.
19: *
20: * @since 3.3
21: */
22: public class Bean {
23: /* package */PropertyChangeSupport changeSupport = new PropertyChangeSupport(
24: this );
25: private String value;
26: private Object[] list = new Object[0];
27: private Set set;
28:
29: public Bean() {
30: }
31:
32: public Bean(String value) {
33: this .value = value;
34: }
35:
36: public Bean(List list) {
37: this .list = (Bean[]) list.toArray(new Bean[list.size()]);
38: }
39:
40: public Bean(Set set) {
41: this .set = set;
42: }
43:
44: public void addPropertyChangeListener(
45: PropertyChangeListener listener) {
46: changeSupport.addPropertyChangeListener(listener);
47: }
48:
49: public void removePropertyChangeListener(
50: PropertyChangeListener listener) {
51: changeSupport.removePropertyChangeListener(listener);
52: }
53:
54: public String getValue() {
55: return value;
56: }
57:
58: public void setValue(String value) {
59: changeSupport.firePropertyChange("value", this .value,
60: this .value = value);
61: }
62:
63: public Object[] getList() {
64: return list;
65: }
66:
67: public void setList(Object[] elements) {
68: changeSupport.firePropertyChange("list", this .list,
69: this .list = elements);
70: }
71:
72: public Set getSet() {
73: return set;
74: }
75:
76: public void setSet(Set set) {
77: changeSupport.firePropertyChange("set", this.set,
78: this.set = set);
79: }
80: }
|