001: package net.sourceforge.squirrel_sql.fw.sql.dbobj.adapter;
002:
003: /*
004: * Copyright (C) 2004 Colin Bell
005: * colbell@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: import java.beans.IntrospectionException;
022: import java.beans.PropertyDescriptor;
023:
024: import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectInfoBeanInfo;
025: import net.sourceforge.squirrel_sql.fw.util.StringManager;
026: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
027:
028: /**
029: * <tt>BeanInfo</tt> class for <tt>BestRowIdentifierAdapter</tt>
030: *
031: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
032: */
033: public class BestRowIdentifierAdapterBeanInfo extends
034: DatabaseObjectInfoBeanInfo implements
035: BestRowIdentifierAdapter.IPropertyNames {
036: /** Internationalized strings for this class. */
037: private static final StringManager s_stringMgr = StringManagerFactory
038: .getStringManager(BestRowIdentifierAdapterBeanInfo.class);
039:
040: private static PropertyDescriptor[] s_dscrs;
041:
042: public BestRowIdentifierAdapterBeanInfo()
043: throws IntrospectionException {
044: super ();
045: synchronized (getClass()) {
046: if (s_dscrs == null) {
047: final Class<BestRowIdentifierAdapter> clazz = BestRowIdentifierAdapter.class;
048: final PropertyDescriptor[] sub = new PropertyDescriptor[7];
049: sub[0] = new PropertyDescriptor(COLUMN_NAME, clazz,
050: "getColumnName", null);
051: sub[0]
052: .setDisplayName(s_stringMgr
053: .getString("BestRowIdentifierAdapterBeanInfo.columnName"));
054: sub[1] = new PropertyDescriptor(SQL_DATA_TYPE, clazz,
055: "getSQLDataType", null);
056: sub[1]
057: .setDisplayName(s_stringMgr
058: .getString("BestRowIdentifierAdapterBeanInfo.sqlDataType"));
059: sub[2] = new PropertyDescriptor(TYPE_NAME, clazz,
060: "getTypeName", null);
061: sub[2]
062: .setDisplayName(s_stringMgr
063: .getString("BestRowIdentifierAdapterBeanInfo.typeName"));
064: sub[3] = new PropertyDescriptor(PRECISION, clazz,
065: "getPrecision", null);
066: sub[3]
067: .setDisplayName(s_stringMgr
068: .getString("BestRowIdentifierAdapterBeanInfo.precision"));
069: sub[4] = new PropertyDescriptor(SCALE, clazz,
070: "getScale", null);
071: sub[4]
072: .setDisplayName(s_stringMgr
073: .getString("BestRowIdentifierAdapterBeanInfo.scale"));
074: sub[5] = new PropertyDescriptor(SCOPE, clazz,
075: "getScope", null);
076: sub[5]
077: .setDisplayName(s_stringMgr
078: .getString("BestRowIdentifierAdapterBeanInfo.scope"));
079: sub[6] = new PropertyDescriptor(PSEUDO, clazz,
080: "getPseudoColumn", null);
081: sub[6]
082: .setDisplayName(s_stringMgr
083: .getString("BestRowIdentifierAdapterBeanInfo.pseudo"));
084: // PropertyDescriptor[] base = super.getPropertyDescriptors();
085: PropertyDescriptor[] base = new PropertyDescriptor[0];
086: if (base == null) {
087: base = new PropertyDescriptor[0];
088: }
089: s_dscrs = new PropertyDescriptor[base.length
090: + sub.length];
091: System.arraycopy(base, 0, s_dscrs, 0, base.length);
092: System.arraycopy(sub, 0, s_dscrs, base.length,
093: sub.length);
094: }
095: }
096: }
097:
098: public PropertyDescriptor[] getPropertyDescriptors() {
099: return s_dscrs;
100: }
101: }
|