001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * Portions Copyrighted 2007 Sun Microsystems, Inc.
027: */
028: package org.netbeans.modules.visualweb.dataconnectivity.explorer;
029:
030: import java.awt.Component;
031: import java.awt.Font;
032: import java.awt.Graphics;
033: import java.awt.Rectangle;
034: import java.beans.PropertyChangeListener;
035: import java.beans.PropertyEditor;
036: import java.util.ArrayList;
037: import java.util.Collections;
038: import java.util.List;
039: import javax.swing.JLabel;
040: import javax.swing.SwingConstants;
041: import org.openide.util.NbBundle;
042:
043: /**
044: *
045: * @author JohnBaker
046: */
047: public class DataSourcePropertyEditor implements PropertyEditor {
048: private String url;
049:
050: DataSourcePropertyEditor(String jdbcUrl) {
051: url = jdbcUrl;
052: }
053:
054: public void setValue(Object value) {
055: url = (String) value;
056: }
057:
058: public Object getValue() {
059: return url;
060: }
061:
062: public boolean isPaintable() {
063: return false;
064: }
065:
066: public void paintValue(Graphics gfx, Rectangle box) {
067:
068: }
069:
070: public String getJavaInitializationString() {
071: return "";
072: }
073:
074: public String getAsText() {
075: return url == null ? NbBundle.getMessage(
076: DataSourcePropertyEditor.class, "JDBC_URL") : url; //NOI18N
077: }
078:
079: public void setAsText(String text) throws IllegalArgumentException {
080: throw new IllegalArgumentException();
081: }
082:
083: public String[] getTags() {
084: return null;
085: }
086:
087: public Component getCustomEditor() {
088: return null;
089: }
090:
091: public boolean supportsCustomEditor() {
092: return false;
093: }
094:
095: private final List<PropertyChangeListener> listeners = Collections
096: .<PropertyChangeListener> synchronizedList(new ArrayList<PropertyChangeListener>());
097:
098: public void addPropertyChangeListener(
099: PropertyChangeListener listener) {
100: listeners.add(listener);
101: }
102:
103: public void removePropertyChangeListener(
104: PropertyChangeListener listener) {
105: listeners.remove(listener);
106: }
107:
108: }
|