KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > treeeditor > MixedContentFinderVisitor


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 package org.netbeans.modules.xml.wsdl.ui.view.treeeditor;
21
22 import org.netbeans.modules.xml.schema.model.ComplexContent;
23 import org.netbeans.modules.xml.schema.model.Element;
24 import org.netbeans.modules.xml.schema.model.GlobalComplexType;
25 import org.netbeans.modules.xml.schema.model.GlobalElement;
26 import org.netbeans.modules.xml.schema.model.LocalComplexType;
27 import org.netbeans.modules.xml.schema.model.LocalElement;
28 import org.netbeans.modules.xml.wsdl.ui.schema.visitor.AbstractXSDVisitor;
29
30
31 public class MixedContentFinderVisitor extends AbstractXSDVisitor {
32     
33     private boolean isMixed = false;
34     private Element element;
35     
36     public MixedContentFinderVisitor(Element element) {
37         this.element = element;
38     }
39
40     public boolean hasMixedContent() {
41         return isMixed;
42     }
43
44     
45     @Override JavaDoc
46     public void visit(GlobalElement ge) {
47         if (ge != element) {
48             return;
49         }
50         super.visit(ge);
51     }
52
53     @Override JavaDoc
54     public void visit(LocalElement le) {
55         if (element != le) {
56             return;
57         }
58         super.visit(le);
59     }
60
61     @Override JavaDoc
62     public void visit(GlobalComplexType gct) {
63         if (gct.isMixed() != null && gct.isMixed().booleanValue()) {
64             isMixed = true;
65         }
66             
67         super.visit(gct);
68
69     }
70
71     @Override JavaDoc
72     public void visit(LocalComplexType type) {
73         if (type.isMixed() != null && type.isMixed().booleanValue()){
74             isMixed = true;
75         }
76         super.visit(type);
77         
78     }
79
80     @Override JavaDoc
81     public void visit(ComplexContent cc) {
82         if (cc.isMixed() != null && cc.isMixed().booleanValue()){
83             isMixed = true;
84         }
85         super.visit(cc);
86     }
87
88     
89     
90     
91     
92     
93
94 }
95
Popular Tags