001: /*
002: * Copyright (c) 2002-2007 JGoodies Karsten Lentzsch. All Rights Reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * o Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * o Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * o Neither the name of JGoodies Karsten Lentzsch nor the names of
015: * its contributors may be used to endorse or promote products derived
016: * from this software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
022: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
027: * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
028: * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029: */
030:
031: package com.jgoodies.binding.tests.beans;
032:
033: import com.jgoodies.binding.beans.Model;
034:
035: /**
036: * A Java Bean that provides a bunch of properties that
037: * are accessed via custom accessors that do not follow the
038: * Java Bean naming conventions.
039: * This class is intended to be used by the Binding unit test suite.
040: *
041: * @author Karsten Lentzsch
042: * @version $Revision: 1.9 $
043: */
044: public final class CustomAccessBean extends Model {
045:
046: public Object readWriteObjectProperty;
047: public boolean readWriteBooleanProperty;
048: public int readWriteIntProperty;
049:
050: public Object readOnlyObjectProperty;
051: public boolean readOnlyBooleanProperty;
052: public int readOnlyIntProperty;
053:
054: public Object writeOnlyObjectProperty;
055: public boolean writeOnlyBooleanProperty;
056: public int writeOnlyIntProperty;
057:
058: // Getters and Setters for the Read/Write Properties **********************
059:
060: public Object readRWObjectProperty() {
061: return readWriteObjectProperty;
062: }
063:
064: public void writeRWObjectProperty(Object newValue) {
065: Object oldValue = readRWObjectProperty();
066: readWriteObjectProperty = newValue;
067: firePropertyChange("readWriteObjectProperty", oldValue,
068: newValue);
069: }
070:
071: public boolean readRWBooleanProperty() {
072: return readWriteBooleanProperty;
073: }
074:
075: public void writeRWBooleanProperty(boolean newValue) {
076: boolean oldValue = readRWBooleanProperty();
077: readWriteBooleanProperty = newValue;
078: firePropertyChange("readWriteBooleanProperty", oldValue,
079: newValue);
080: }
081:
082: public int readRWIntProperty() {
083: return readWriteIntProperty;
084: }
085:
086: public void writeRWIntProperty(int newValue) {
087: int oldValue = readRWIntProperty();
088: readWriteIntProperty = newValue;
089: firePropertyChange("readWriteIntProperty", oldValue, newValue);
090: }
091:
092: public Object readROObjectProperty() {
093: return readOnlyObjectProperty;
094: }
095:
096: public boolean readROBooleanProperty() {
097: return readOnlyBooleanProperty;
098: }
099:
100: public int readROIntProperty() {
101: return readOnlyIntProperty;
102: }
103:
104: // Setters for the Write-Only Properties **********************************
105:
106: public void writeWOObjectProperty(Object newValue) {
107: writeOnlyObjectProperty = newValue;
108: firePropertyChange("writeOnlyObjectProperty", null, newValue);
109: }
110:
111: public void writeWOBooleanProperty(boolean newValue) {
112: writeOnlyBooleanProperty = newValue;
113: firePropertyChange("writeOnlyBooleanProperty", null, Boolean
114: .valueOf(newValue));
115: }
116:
117: public void writeWOIntProperty(int newValue) {
118: writeOnlyIntProperty = newValue;
119: firePropertyChange("writeOnlyIntProperty", null, new Integer(
120: newValue));
121: }
122:
123: // Getters and Setters that Throw Runtime Exceptions **********************
124:
125: public void setReadWriteObjectProperties(Object object, boolean b,
126: int i) {
127: readWriteObjectProperty = object;
128: readWriteBooleanProperty = b;
129: readWriteIntProperty = i;
130: fireMultiplePropertiesChanged();
131: }
132:
133: }
|