001: /*
002: * Copyright (C) 2007 Jared Alexander Spigner
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: * jspigner@openjx.org
019: *
020: * JXMeta.java
021: *
022: * Created on June 10, 2007, 8:44 PSM
023: *
024: */
025:
026: package org.openjx.jx;
027:
028: import javax.swing.JComponent;
029:
030: import java.beans.PropertyChangeListener;
031: import java.beans.PropertyChangeSupport;
032:
033: /**
034: * This class represents meta data for use in OpenJX.
035: * @author Jared Spigner
036: */
037: public class JXMeta extends JComponent {
038: /** This is the identifier of the class. */
039: private static final long serialVersionUID = 1998L;
040:
041: /** This is the name associated with the meta property. */
042: String metaName = "";
043:
044: /** This is the value associated with the meta property. */
045: String metaValue = "";
046:
047: /** This is used to make the class's properties available. */
048: private final PropertyChangeSupport pcs = new PropertyChangeSupport(
049: this );
050:
051: /**
052: * This the constructor for the JXMeta class. It creates a new instance
053: * of JXMeta.
054: */
055: public JXMeta() {
056: }
057:
058: /**
059: * This method returns the name of the meta property.
060: *
061: * @return the name of the property.
062: */
063: public String getMetaName() {
064: return this .metaName;
065: }
066:
067: /**
068: * This method returns the value of the meta property.
069: *
070: * @return the value of the property.
071: */
072: public String getMetaValue() {
073: return this .metaValue;
074: }
075:
076: public void setMetaName(String newName) {
077: String oldName = this .metaName;
078: this .metaName = newName;
079: this .pcs.firePropertyChange("name", oldName, newName);
080: }
081:
082: public void setMetaValue(String newValue) {
083: String oldValue = this .metaValue;
084: this .metaValue = newValue;
085: this .pcs.firePropertyChange("value", oldValue, newValue);
086: }
087:
088: /**
089: * This method is required to make this a bean.
090: *
091: * @param listener is the listener we want to add.
092: */
093: public void addPropertyChangeListener(
094: PropertyChangeListener listener) {
095: this .pcs.addPropertyChangeListener(listener);
096: }
097:
098: /**
099: * This method is required to make this a bean.
100: *
101: * @param listener is the listener we want to remove.
102: */
103: public void removePropertyChangeListener(
104: PropertyChangeListener listener) {
105: this.pcs.removePropertyChangeListener(listener);
106: }
107:
108: }
|