Source Code Cross Referenced for LayoutInfo.java in  » Internationalization-Localization » icu4j » com » ibm » richtext » textformat » 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 » Internationalization Localization » icu4j » com.ibm.richtext.textformat 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * (C) Copyright IBM Corp. 1998-2004.  All Rights Reserved.
003:         *
004:         * The program is provided "as is" without any warranty express or
005:         * implied, including the warranty of non-infringement and the implied
006:         * warranties of merchantibility and fitness for a particular purpose.
007:         * IBM will not be liable for any damages suffered by you as a result
008:         * of using the Program. In no event will IBM be liable for any
009:         * special, indirect or consequential damages or lost profits even if
010:         * IBM has been advised of the possibility of their occurrence. IBM
011:         * will not be liable for any third party claims against you.
012:         */
013:        // Requires Java2
014:        /** LayoutInfo
015:
016:         A line of text, possibly containing tab-segments.
017:         */package com.ibm.richtext.textformat;
018:
019:        import java.awt.Color;
020:        import java.awt.Rectangle;
021:
022:        ///*JDK12IMPORTS
023:        import java.awt.Graphics2D; //JDK12IMPORTS*/
024:
025:        /*JDK11IMPORTS
026:         import com.ibm.richtext.textlayout.Graphics2D;
027:         JDK11IMPORTS*/
028:
029:        import com.ibm.richtext.styledtext.MConstText;
030:
031:        abstract class LayoutInfo {
032:            static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
033:            private int fCharStart; // offset in text to start of line (was fStart)
034:            // neg. values indicate distance from end of text
035:            private int fGraphicStart; // min pixel offset in fill direction
036:
037:            // negative values indicate distance from bottom of text view
038:
039:            /*
040:                These methods are for storing Layouts in a gap-storage,
041:                relative to either the start of end of text.  See AsyncFormatter.
042:
043:                If you just want absolute (that is, start-relative) char and
044:                graphic starts, don't make them end-relative.
045:             */
046:
047:            public final int getCharStart(int lengthBasis) {
048:
049:                if (fCharStart >= 0) {
050:                    return fCharStart;
051:                } else {
052:                    return lengthBasis + fCharStart;
053:                }
054:            }
055:
056:            public final int getGraphicStart(int graphicBasis) {
057:
058:                if (fGraphicStart >= 0) {
059:                    return fGraphicStart;
060:                } else {
061:                    return graphicBasis + fGraphicStart;
062:                }
063:            }
064:
065:            public final void setCharStart(int beginningRelativeStart) {
066:
067:                if (beginningRelativeStart < 0) {
068:                    throw new IllegalArgumentException(
069:                            "charStart must be nonnegavitve");
070:                }
071:                fCharStart = beginningRelativeStart;
072:            }
073:
074:            public final void setGraphicStart(int beginningRelativeStart) {
075:
076:                if (beginningRelativeStart < 0) {
077:                    throw new IllegalArgumentException(
078:                            "charStart must be nonnegavitve");
079:                }
080:                fGraphicStart = beginningRelativeStart;
081:            }
082:
083:            public final void makeRelativeToBeginning(int lengthBasis,
084:                    int graphicBasis) {
085:
086:                if (lengthBasis < 0 || graphicBasis < 0) {
087:                    throw new IllegalArgumentException(
088:                            "Bases must be positive.");
089:                }
090:                if (fCharStart >= 0 || fGraphicStart >= 0) {
091:                    throw new Error("Already start-relative.");
092:                }
093:
094:                fCharStart += lengthBasis;
095:                fGraphicStart += graphicBasis;
096:            }
097:
098:            public final void makeRelativeToEnd(int lengthBasis,
099:                    int graphicBasis) {
100:
101:                if (lengthBasis < 0 || graphicBasis < 0) {
102:                    throw new IllegalArgumentException(
103:                            "Bases must be positive.");
104:                }
105:                if (fCharStart < 0 || fGraphicStart < 0) {
106:                    throw new Error("Already end-relative.");
107:                }
108:
109:                fCharStart -= lengthBasis;
110:                fGraphicStart -= graphicBasis;
111:            }
112:
113:            public abstract int getCharLength();
114:
115:            public abstract int getAscent();
116:
117:            public abstract int getDescent();
118:
119:            public abstract int getLeading();
120:
121:            public abstract int getVisibleAdvance();
122:
123:            public abstract int getTotalAdvance();
124:
125:            public abstract int getLeadingMargin();
126:
127:            public abstract boolean isLeftToRight();
128:
129:            public int getHeight() {
130:
131:                return getAscent() + getDescent() + getLeading();
132:            }
133:
134:            /**
135:             * Draws text with highlighting.
136:             */
137:            public void renderWithHighlight(int lengthBasis, Graphics2D g,
138:                    int lineBound, int x, int y, TextOffset selStart,
139:                    TextOffset selStop, Color highlightColor) {
140:            }
141:
142:            /** Use layout information to render the line at x, y.*/
143:
144:            public void render(int lengthBasis, Graphics2D g, int lineBound,
145:                    int x, int y) {
146:            }
147:
148:            public void renderCaret(MConstText text, int lengthBasis,
149:                    Graphics2D g, int lineBound, int x, int y, int charOffset,
150:                    Color strongCaretColor, Color weakCaretColor) {
151:            }
152:
153:            /**
154:             * Given a point within this line, return the character offset corresponding to that point.
155:             *
156:             * @param result.  This may be null, in which case a new TextOffset will be allocated.
157:             *        This object is modified in place, and also returned as the function result.
158:             * @param text Text to inspect.
159:             * @param lineX Position on this line relative to top left corner of this line.
160:             * @param lineY Position on this line relative to top left corner of this line.
161:             */
162:            public abstract TextOffset pixelToOffset(int lengthBasis,
163:                    TextOffset result, int lineBound, int x, int y);
164:
165:            public abstract int strongCaretBaselinePosition(int lengthBasis,
166:                    int lineBound, int charOffset);
167:
168:            public abstract Rectangle caretBounds(MConstText text,
169:                    int lengthBasis, int lineBound, int charOffset, int x, int y);
170:
171:            public abstract int getNextOffset(int lengthBasis, int charOffset,
172:                    short dir);
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.