KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > editor > view > spi > RenderingContextView


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 package org.netbeans.editor.view.spi;
21
22 import java.awt.Graphics JavaDoc;
23 import java.awt.Shape JavaDoc;
24 import javax.swing.event.DocumentEvent JavaDoc;
25 import javax.swing.text.AttributeSet JavaDoc;
26 import javax.swing.text.BadLocationException JavaDoc;
27 import javax.swing.text.Document JavaDoc;
28 import javax.swing.text.Element JavaDoc;
29 import javax.swing.text.Position JavaDoc;
30 import javax.swing.text.View JavaDoc;
31 import javax.swing.text.ViewFactory JavaDoc;
32
33 /**
34  * View providing an access to the {@link ViewRenderingContext}
35  * in the view hierarchy.
36  *
37  * <p>
38  * Accessing of the <code>ViewRenderingContext</code>
39  * from a <code>view</code> must always be done like this:<pre>
40  *
41  * RenderingContextView rcView = RenderingContextView.get(view);
42  * if (rcView != null) {
43  * rcView.acquireRenderingContext();
44  * try {
45  * ...
46  * } finally {
47  * rcView.releaseRenderingContext();
48  * }
49  * }
50  * </pre>
51  *
52  * <p>
53  * Only one thread at the time can safely access methods
54  * of the <code>RenderingContextView</code>. It does not have
55  * to be event dispatch thread.
56  *
57  * @author Miloslav Metelka
58  * @version 1.00
59  */

60
61 public interface RenderingContextView {
62     
63     /**
64      * Acquire an instance of rendering context.
65      * After use it must be released by {@link #releaseContext()}.
66      * @param v view for which the rendering context is being obtained.
67      */

68     public ViewRenderingContext acquireRenderingContext(View JavaDoc v);
69     
70     /**
71      * Release rendering context previously acquired by
72      * {@link #acquireRenderingContext(javax.swing.text.View)}.
73      * @param vrc rendering context to be released.
74      */

75     public void releaseRenderingContext(ViewRenderingContext vrc);
76
77  }
78
Popular Tags