KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > refactoring > query > views > QueryUnusedGlobalsView


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * QueryUnusedGlobalsView.java
21  *
22  * Created on April 10, 2006, 5:38 PM
23  *
24  * To change this template, choose Tools | Template Manager
25  * and open the template in the editor.
26  */

27
28 package org.netbeans.modules.xml.schema.refactoring.query.views;
29
30 import java.beans.PropertyChangeEvent JavaDoc;
31 import org.netbeans.modules.xml.nbprefuse.AnalysisViewer;
32 import org.netbeans.modules.xml.nbprefuse.View;
33 import org.netbeans.modules.xml.refactoring.ui.CancelSignal;
34 import org.netbeans.modules.xml.schema.model.SchemaModel;
35 import org.netbeans.modules.xml.schema.refactoring.query.readers.QueryUnusedGlobalsReader;
36 import org.openide.nodes.Node;
37
38 /**
39  *
40  * @author Jeri Lockhart
41  */

42 public class QueryUnusedGlobalsView implements View{
43     private SchemaModel model;
44     private Node root;
45     private Boolean JavaDoc excludeGEs;
46     
47     /**
48      * Creates a new instance of QueryUnusedGlobalsView
49      */

50     public QueryUnusedGlobalsView(final SchemaModel model,
51             final Boolean JavaDoc excludeGEs) {
52         this.model = model;
53         this.excludeGEs = excludeGEs;
54     }
55     
56     
57     
58     public void usePacer(boolean use) {
59     }
60     
61     
62     /**
63      * Should the SchemaColumnView make the Column
64      * that the View is shown in as wide as possible?
65      * @return boolean true if View should be shown
66      * in a column as wide as the available horizontal space
67      * in the column view
68      */

69     public boolean getMaximizeWidth(){
70         return false;
71     }
72     
73     /**
74      * show a tree view of the global components
75      * that are defined in the current model and are
76      * not used in any of the schemas in the current project
77      *
78      *
79      */

80     public boolean showView(AnalysisViewer viewer) {
81 // GraphUtilities.dumpNode(root);
82
viewer.getPanel().setSize(250,200);
83         viewer.setReshowOnResize(false);
84         viewer.removeToolBar();
85         viewer.addDisplayPanel(new ResultsPanel(root));
86         return true;
87     }
88     
89     
90     /**
91      * Create a tree model with category nodes
92      * for each of the global types for which
93      * there are unused components.
94      * @param cancelSignal createModels() will use this to check if the user
95      * requested a cancel of the query
96      * @return the root Node of a tree containing unused global components
97      * or null if the schema model does not contain any globals
98      * that aren't used
99      *
100      *
101      */

102     public Object JavaDoc[] createModels( ) {
103         return null;
104     }
105     
106     public Object JavaDoc[] createModels(CancelSignal cancelSignal) {
107         QueryUnusedGlobalsReader reader =
108                 new QueryUnusedGlobalsReader();
109         root = reader.findUnusedGlobals(cancelSignal, model,excludeGEs);
110         
111         return new Object JavaDoc[] {root};
112         
113     }
114     
115     /**
116      * This method gets called when a bound property is changed.
117      *
118      * @param evt A PropertyChangeEvent object describing the event source
119      * and the property that has changed.
120      */

121     public void propertyChange(PropertyChangeEvent JavaDoc evt) {
122     }
123     
124    
125 }
126
127
128
Popular Tags