001: /*
002: * Copyright (c) 2004 JETA Software, Inc. All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without modification,
005: * 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 JETA Software nor the names of its contributors may
015: * be used to endorse or promote products derived from this software without
016: * 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, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
021: * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
022: * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
023: * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
024: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
025: * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
026: * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028: */
029:
030: package com.jeta.forms.store.properties;
031:
032: import java.awt.Component;
033: import java.io.IOException;
034:
035: import javax.swing.JComponent;
036: import javax.swing.border.Border;
037:
038: import com.jeta.forms.components.border.BorderManager;
039: import com.jeta.forms.store.JETAObjectInput;
040: import com.jeta.forms.store.JETAObjectOutput;
041:
042: /**
043: * A <code>DefaultBorderProperty</code> specifies the default border that is
044: * assigned to a component by the current look and feel. The designer allows a
045: * user to specify the default border in combination with custom borders for
046: * most components.
047: *
048: * @author Jeff Tassin
049: */
050: public class DefaultBorderProperty extends BorderProperty {
051: static final long serialVersionUID = 1494794388961888787L;
052:
053: /**
054: * The version for this class.
055: */
056: public static final int VERSION = 1;
057:
058: /**
059: * Creates a <code>DefaultBorderProperty</code> instance.
060: */
061: public DefaultBorderProperty() {
062:
063: }
064:
065: /**
066: * BorderProperty implementation. Creates a default border for the Java bean
067: * associated with this property. The call is merely forwarded to the
068: * BorderManager which is responsible for getting the default border for the
069: * current look and feel.
070: *
071: * @return a newly created border instance.
072: */
073: public Border createBorder(Component comp) {
074: if (comp instanceof JComponent) {
075: return BorderManager.getDefaultBorder((JComponent) comp);
076: } else {
077: return null;
078: }
079: }
080:
081: /**
082: * Object equals implementation.
083: */
084: public boolean equals(Object object) {
085: if (object instanceof DefaultBorderProperty) {
086: DefaultBorderProperty bp = (DefaultBorderProperty) object;
087: return (super .equals(object));
088: } else {
089: return false;
090: }
091: }
092:
093: /**
094: * Sets this property to that of another property. No op for this property.
095: */
096: public void setValue(Object prop) {
097:
098: }
099:
100: /**
101: * JETAPersistable Implementation
102: */
103: public void read(JETAObjectInput in) throws ClassNotFoundException,
104: IOException {
105: super .read(in.getSuperClassInput());
106: int version = in.readVersion();
107: }
108:
109: /**
110: * Externalizable Implementation
111: */
112: public void write(JETAObjectOutput out) throws IOException {
113: super .write(out.getSuperClassOutput(BorderProperty.class));
114: out.writeVersion(VERSION);
115: }
116:
117: public String toString() {
118: return "DEFAULT";
119: }
120: }
|