KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > core > wseditor > support > WSDataObject


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * WSDataObject.java
22  *
23  * Created on March 1, 2006, 10:34 AM
24  *
25  * To change this template, choose Tools | Template Manager
26  * and open the template in the editor.
27  */

28
29 package org.netbeans.modules.websvc.core.wseditor.support;
30
31 import org.openide.cookies.SaveCookie;
32 import org.openide.filesystems.FileObject;
33 import org.openide.loaders.DataObjectExistsException;
34 import org.openide.loaders.MultiDataObject;
35 import org.openide.loaders.MultiFileLoader;
36 import org.openide.nodes.AbstractNode;
37 import org.openide.nodes.Children;
38 import org.openide.nodes.FilterNode;
39 import org.openide.nodes.Node;
40
41 /**
42  *
43  * @author Roderico Cruz
44  */

45 public class WSDataObject extends MultiDataObject{
46     private WSFilterNode wsFilterNode;
47     /** Creates a new instance of WSDataObject */
48     public WSDataObject(FileObject file, MultiFileLoader ldr)
49        throws DataObjectExistsException{
50         super(file, ldr);
51     }
52
53     public void changeNode(Node newNode){
54         this.getNodeDelegate();
55         wsFilterNode.switchNode(newNode);
56     }
57     
58     protected Node createNodeDelegate() {
59         wsFilterNode = new WSFilterNode(new AbstractNode(Children.LEAF));
60         return wsFilterNode;
61     }
62
63     public Node.Cookie getCookie(Class JavaDoc type) {
64         if(type.isAssignableFrom(SaveCookie.class)){
65             return this.getNodeDelegate().getCookie(type);
66         }
67         return super.getCookie(type);
68     }
69     
70     
71      class WSFilterNode extends FilterNode{
72         public WSFilterNode(Node original){
73             super(original);
74         }
75         
76         public void switchNode(Node newNode){
77             this.changeOriginal(newNode, false);
78             //System.out.println("after changeOriginal: " +
79
//this.getOriginal().getClass().getName());
80
}
81     }
82    
83
84 }
85
Popular Tags