Source Code Cross Referenced for DrawLayer.java in  » Swing-Library » abeille-forms-designer » org » netbeans » editor » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » abeille forms designer » org.netbeans.editor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *                 Sun Public License Notice
003:         * 
004:         * The contents of this file are subject to the Sun Public License
005:         * Version 1.0 (the "License"). You may not use this file except in
006:         * compliance with the License. A copy of the License is available at
007:         * http://www.sun.com/
008:         * 
009:         * The Original Code is NetBeans. The Initial Developer of the Original
010:         * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
011:         * Microsystems, Inc. All Rights Reserved.
012:         */
013:
014:        package org.netbeans.editor;
015:
016:        /**
017:         * Draw layer applies changes to draw context during painting process. Each
018:         * extended UI has its own set of layers. It can currently include changes to
019:         * font bold and italic attributes, and foreground and background color (and
020:         * probably more in future). These changes are made by draw layer to draw
021:         * context in <CODE>updateContext()</CODE> method. Draw layers form
022:         * double-linked lists. Renderer goes through this list every time it draws the
023:         * tokens of the text. A layer can work either by returning the
024:         * next-activity-change-offset or by being activated through the draw-marks that
025:         * it places at the appropriate positions or it can mix these two approaches.
026:         * 
027:         * @author Miloslav Metelka
028:         * @version 1.00
029:         */
030:
031:        public interface DrawLayer {
032:
033:            /**
034:             * Get the name of the layer. The layers that should work together over one
035:             * component must have the different names.
036:             */
037:            public String getName();
038:
039:            /**
040:             * Whether the layer wants to use the last context's background till the end
041:             * of the window or not.
042:             */
043:            public boolean extendsEOL();
044:
045:            /**
046:             * Whether the layer marks the empty line with the background by half of the
047:             * character.
048:             */
049:            public boolean extendsEmptyLine();
050:
051:            /**
052:             * Get the next position at which the activity of the layer will change. It
053:             * can return <tt>Integer.MAX_VALUE</tt> to mark that the activity will
054:             * never change or if it will change only by draw-marks. When this position
055:             * will be reached the <tt>isActive</tt> will be called.
056:             */
057:            public int getNextActivityChangeOffset(DrawContext ctx);
058:
059:            /**
060:             * Called each time the paint begins for all layers in the layer chain
061:             * regardless whether they are currently active or not. It is intended to
062:             * prepare the layer. It doesn't need to set the next-activity-change-offset
063:             * because <tt>isActive()</tt> will be called at the begining of the
064:             * drawing when this method finishes.
065:             */
066:            public void init(DrawContext ctx);
067:
068:            /**
069:             * Return whether the layer is active or not. This method is called at the
070:             * begining of the drawing, then each time when the draw-mark is found at
071:             * the current fragment offset or when drawing reaches the
072:             * next-activity-change-offset of this layer (mark parameter is null in this
073:             * case). The layer must return whether it wants to be active for the next
074:             * drawing or not. The layer should also consider changing the
075:             * next-activity-change-offset because the draw-engine will ask for it after
076:             * this method finishes. If the mark is found at the same position like
077:             * next-activity-change-offset is, then this method is called only once with
078:             * the valid <tt>mark</tt> parameter.
079:             * 
080:             * @param ctx
081:             *            current context with the information about the drawing
082:             * @param mark
083:             *            draw-mark at the fragment-offset or null if called because of
084:             *            the next-activity-change-offset.
085:             */
086:            public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark);
087:
088:            /**
089:             * Update draw context by setting colors, fonts and possibly other draw
090:             * properties. The method can use information from the context to find where
091:             * the painting process is currently located. It is called only if the layer
092:             * is active.
093:             */
094:            public void updateContext(DrawContext ctx);
095:
096:            /**
097:             * Update draw context related to the drawing of line number for the given
098:             * line by setting colors, fonts and possibly other draw properties. The
099:             * method can also change the current line number by returning the modified
100:             * line-number than the original one. At the begining the first layer gets
101:             * the line-number <tt>lineOffset + 1</tt> but some layers can change it.
102:             * If the layer doesn't want to change the line-number it should return the
103:             * same value as it gets. The context can be affected to change the font and
104:             * colors for the line-number. The context's <tt>getFragmentOffset()</tt>
105:             * returns the begining of the line. The following methods in the context
106:             * return undefined values:
107:             * <tt>isEOL(), getBuffer(), getTokenID(), getTokenOffset(), getTokenLength()</tt>.
108:             * The process of calling this method is independent of the status of the
109:             * layers and is called for each layer even if it's not active.
110:             * 
111:             * @param lineNumber
112:             *            the number that will be drawn before the line's text. The
113:             *            layer can change it by returning a different value.
114:             * @param ctx
115:             *            the draw context
116:             */
117:            public int updateLineNumberContext(int lineNumber, DrawContext ctx);
118:
119:            /** Abstract implementation of the draw-layer. */
120:            public static abstract class AbstractLayer implements  DrawLayer {
121:
122:                /**
123:                 * Name of this layer. The name of the layer must be unique among layers
124:                 * installed into EditorUI
125:                 */
126:                private String name;
127:
128:                /**
129:                 * Next position where the layer should be notified to update its state.
130:                 */
131:                int nextActivityChangeOffset = Integer.MAX_VALUE;
132:
133:                /** Construct new abstract layer with the known name and visibility. */
134:                public AbstractLayer(String name) {
135:                    this .name = name;
136:                }
137:
138:                public String getName() {
139:                    return name;
140:                }
141:
142:                public boolean extendsEOL() {
143:                    return false;
144:                }
145:
146:                public boolean extendsEmptyLine() {
147:                    return false;
148:                }
149:
150:                public int getNextActivityChangeOffset(DrawContext ctx) {
151:                    return nextActivityChangeOffset;
152:                }
153:
154:                public void setNextActivityChangeOffset(
155:                        int nextActivityChangeOffset) {
156:                    this .nextActivityChangeOffset = nextActivityChangeOffset;
157:                }
158:
159:                public void init(DrawContext ctx) {
160:                }
161:
162:                public int updateLineNumberContext(int lineNumber,
163:                        DrawContext ctx) {
164:                    return lineNumber;
165:                }
166:
167:                public String toString() {
168:                    return "Layer " + getClass() + ", name='" + name; // NOI18N
169:                }
170:
171:            }
172:
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.