Source Code Cross Referenced for TextUI.java in  » 6.0-JDK-Core » swing » javax » swing » plaf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.plaf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025        package javax.swing.plaf;
026
027        import javax.swing.Action;
028        import javax.swing.BoundedRangeModel;
029        import java.awt.Point;
030        import java.awt.Rectangle;
031        import java.awt.Insets;
032        import javax.swing.text.*;
033
034        /**
035         * Text editor user interface
036         *
037         * @author  Timothy Prinzing
038         * @version 1.40 05/05/07
039         */
040        public abstract class TextUI extends ComponentUI {
041            /**
042             * Converts the given location in the model to a place in
043             * the view coordinate system.
044             *
045             * @param pos  the local location in the model to translate >= 0
046             * @return the coordinates as a rectangle
047             * @exception BadLocationException  if the given position does not
048             *   represent a valid location in the associated document
049             */
050            public abstract Rectangle modelToView(JTextComponent t, int pos)
051                    throws BadLocationException;
052
053            /**
054             * Converts the given location in the model to a place in
055             * the view coordinate system.
056             *
057             * @param pos  the local location in the model to translate >= 0
058             * @return the coordinates as a rectangle
059             * @exception BadLocationException  if the given position does not
060             *   represent a valid location in the associated document
061             */
062            public abstract Rectangle modelToView(JTextComponent t, int pos,
063                    Position.Bias bias) throws BadLocationException;
064
065            /**
066             * Converts the given place in the view coordinate system
067             * to the nearest representative location in the model.
068             *
069             * @param pt  the location in the view to translate.  This
070             *   should be in the same coordinate system as the mouse
071             *   events.
072             * @return the offset from the start of the document >= 0
073             */
074            public abstract int viewToModel(JTextComponent t, Point pt);
075
076            /**
077             * Provides a mapping from the view coordinate space to the logical
078             * coordinate space of the model.
079             *
080             * @param pt the location in the view to translate.
081             *           This should be in the same coordinate system
082             *           as the mouse events.
083             * @param biasReturn
084             *           filled in by this method to indicate whether
085             *           the point given is closer to the previous or the next
086             *           character in the model
087             *
088             * @return the location within the model that best represents the
089             *         given point in the view >= 0
090             */
091            public abstract int viewToModel(JTextComponent t, Point pt,
092                    Position.Bias[] biasReturn);
093
094            /**
095             * Provides a way to determine the next visually represented model 
096             * location that one might place a caret.  Some views may not be visible,
097             * they might not be in the same order found in the model, or they just
098             * might not allow access to some of the locations in the model.
099             *
100             * @param t the text component for which this UI is installed
101             * @param pos the position to convert >= 0
102             * @param b the bias for the position
103             * @param direction the direction from the current position that can
104             *  be thought of as the arrow keys typically found on a keyboard.
105             *  This may be SwingConstants.WEST, SwingConstants.EAST,
106             *  SwingConstants.NORTH, or SwingConstants.SOUTH
107             * @param biasRet an array to contain the bias for the returned position
108             * @return the location within the model that best represents the next
109             *  location visual position
110             * @exception BadLocationException
111             * @exception IllegalArgumentException for an invalid direction
112             */
113            public abstract int getNextVisualPositionFrom(JTextComponent t,
114                    int pos, Position.Bias b, int direction,
115                    Position.Bias[] biasRet) throws BadLocationException;
116
117            /**
118             * Causes the portion of the view responsible for the
119             * given part of the model to be repainted.
120             *
121             * @param p0 the beginning of the range >= 0
122             * @param p1 the end of the range >= p0
123             */
124            public abstract void damageRange(JTextComponent t, int p0, int p1);
125
126            /**
127             * Causes the portion of the view responsible for the 
128             * given part of the model to be repainted.
129             *
130             * @param p0 the beginning of the range >= 0
131             * @param p1 the end of the range >= p0
132             */
133            public abstract void damageRange(JTextComponent t, int p0, int p1,
134                    Position.Bias firstBias, Position.Bias secondBias);
135
136            /**
137             * Fetches the binding of services that set a policy
138             * for the type of document being edited.  This contains
139             * things like the commands available, stream readers and
140             * writers, etc.
141             *
142             * @return the editor kit binding
143             */
144            public abstract EditorKit getEditorKit(JTextComponent t);
145
146            /**
147             * Fetches a View with the allocation of the associated
148             * text component (i.e. the root of the hierarchy) that
149             * can be traversed to determine how the model is being
150             * represented spatially.
151             *
152             * @return the view
153             */
154            public abstract View getRootView(JTextComponent t);
155
156            /**
157             * Returns the string to be used as the tooltip at the passed in location.
158             *
159             * @see javax.swing.text.JTextComponent#getToolTipText
160             * @since 1.4
161             */
162            public String getToolTipText(JTextComponent t, Point pt) {
163                return null;
164            }
165        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.