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.navigation;
029:
030: import com.sun.rave.designtime.DesignBean;
031: import com.sun.rave.designtime.DesignContext;
032: import com.sun.rave.designtime.DesignEvent;
033: import com.sun.rave.designtime.DesignProperty;
034: import com.sun.rave.designtime.Position;
035: import com.sun.rave.designtime.event.DesignContextListener;
036: import java.awt.EventQueue;
037: import java.lang.ref.WeakReference;
038:
039: /**
040: *
041: * @author joelle
042: */
043: public class VWPDesignContextListener implements DesignContextListener {
044:
045: public VWPDesignContextListener(VWPContentModel vwpContentModel) {
046: setVwpContentModel(vwpContentModel);
047: }
048:
049: public void contextActivated(DesignContext context) {
050: //throw new UnsupportedOperationException("Not supported yet.");
051: }
052:
053: public void contextDeactivated(DesignContext context) {
054: //throw new UnsupportedOperationException("Not supported yet.");
055: }
056:
057: public void contextChanged(DesignContext context) {
058: //throw new UnsupportedOperationException("Not supported yet.");
059: }
060:
061: public void beanCreated(DesignBean designBean) {
062: //throw new UnsupportedOperationException("Not supported yet.");
063: }
064:
065: public void beanDeleted(DesignBean designBean) {
066: //throw new UnsupportedOperationException("Not supported yet.");
067: }
068:
069: public void beanMoved(DesignBean designBean, DesignBean oldParent,
070: Position pos) {
071: //throw new UnsupportedOperationException("Not supported yet.");
072: }
073:
074: public void beanContextActivated(DesignBean designBean) {
075: //throw new UnsupportedOperationException("Not supported yet.");
076: }
077:
078: public void beanContextDeactivated(DesignBean designBean) {
079: //throw new UnsupportedOperationException("Not supported yet.");
080: }
081:
082: public void instanceNameChanged(DesignBean designBean,
083: String oldInstanceName) {
084: /* This is what I need tolisten on. */
085: System.out.println("InstanceNameChanged");
086: EventQueue.invokeLater(new Runnable() {
087: public void run() {
088: getVwpContentModel().updateModel();
089: }
090: });
091: }
092:
093: public void beanChanged(DesignBean designBean) {
094: //throw new UnsupportedOperationException("Not supported yet.");
095: }
096:
097: public void propertyChanged(DesignProperty prop, Object oldValue) {
098: //throw new UnsupportedOperationException("Not supported yet.");
099: }
100:
101: public void eventChanged(DesignEvent event) {
102: //throw new UnsupportedOperationException("Not supported yet.");
103: }
104:
105: private WeakReference<VWPContentModel> refVWPContentModel;
106:
107: private VWPContentModel getVwpContentModel() {
108: VWPContentModel vwpContentModel = null;
109: if (refVWPContentModel != null) {
110: vwpContentModel = refVWPContentModel.get();
111: }
112: return vwpContentModel;
113: }
114:
115: private void setVwpContentModel(VWPContentModel vwpContentModel) {
116: refVWPContentModel = new WeakReference<VWPContentModel>(
117: vwpContentModel);
118: }
119: }
|