KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > abe > ContentModelPanel


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 package org.netbeans.modules.xml.schema.abe;
20
21 import java.awt.BasicStroke JavaDoc;
22 import java.awt.Color JavaDoc;
23 import java.awt.Graphics JavaDoc;
24 import java.awt.Graphics2D JavaDoc;
25 import java.awt.Stroke JavaDoc;
26 import javax.swing.JPanel JavaDoc;
27 import org.netbeans.modules.xml.axi.AbstractElement;
28 import org.netbeans.modules.xml.axi.ContentModel;
29 import org.netbeans.modules.xml.schema.abe.nodes.ABEAbstractNode;
30 import org.netbeans.modules.xml.schema.abe.nodes.ContentModelNode;
31 import org.openide.nodes.Node;
32
33 /**
34  *
35  * @author girix
36  */

37 public class ContentModelPanel extends ElementPanel{
38     private static final long serialVersionUID = 7526472295622776147L;
39     /**
40      * Creates a new instance of ContentModelPanel
41      */

42     public ContentModelPanel(InstanceUIContext context,
43             ContentModel contentModel, ContainerPanel parentCompositorPanel) {
44         super(context, contentModel, parentCompositorPanel);
45     }
46     
47     protected StartTagPanel getNewStartTagPanel(ElementPanel elementPanel, InstanceUIContext context) {
48         return new StartTagPanel(elementPanel, context){
49             private static final long serialVersionUID = 7526472295622776147L;
50             public void paintComponent(Graphics JavaDoc g) {
51                 Graphics2D JavaDoc g2d = (Graphics2D JavaDoc) g;
52                 Stroke JavaDoc oldStroke = g2d.getStroke();
53                 //Color oldColor = g2d.getColor();
54
Stroke JavaDoc drawingStroke2 =
55                         new BasicStroke JavaDoc(
56                         2,
57                         BasicStroke.CAP_BUTT,
58                         BasicStroke.JOIN_MITER,
59                         10,
60                         new float[] {2},
61                         0
62                         );
63                 
64                 g2d.setStroke((drawingStroke2));
65                 super.paintComponent(g);
66                 g2d.setStroke(oldStroke);
67             }
68             
69             public JPanel JavaDoc getNewAXIContainerPropertiesPanel(){
70                 JPanel JavaDoc jp = new JPanel JavaDoc();
71                 jp.setOpaque(false);
72                 return jp;
73             }
74         };
75     }
76     
77     protected void makeNBNode() {
78         contentModelNode = new ContentModelNode((ContentModel) getAXIContainer(), context);
79         if(getAXIContainer().isReadOnly())
80             ((ABEAbstractNode)contentModelNode).setReadOnly(true);
81     }
82     
83     public ABEAbstractNode getNBNode() {
84         return contentModelNode;
85     }
86     
87 ////////////////////////////////////////////////////////////////////////////
88
// Instance members
89
////////////////////////////////////////////////////////////////////////////
90

91     private ABEAbstractNode contentModelNode;
92 }
93
Popular Tags