Source Code Cross Referenced for Position.java in  » 6.0-JDK-Core » swing » javax » swing » text » 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.text 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01        /*
02         * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
03         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04         *
05         * This code is free software; you can redistribute it and/or modify it
06         * under the terms of the GNU General Public License version 2 only, as
07         * published by the Free Software Foundation.  Sun designates this
08         * particular file as subject to the "Classpath" exception as provided
09         * by Sun in the LICENSE file that accompanied this code.
10         *
11         * This code is distributed in the hope that it will be useful, but WITHOUT
12         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14         * version 2 for more details (a copy is included in the LICENSE file that
15         * accompanied this code).
16         *
17         * You should have received a copy of the GNU General Public License version
18         * 2 along with this work; if not, write to the Free Software Foundation,
19         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20         *
21         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22         * CA 95054 USA or visit www.sun.com if you need additional information or
23         * have any questions.
24         */
25        package javax.swing.text;
26
27        /**
28         * Represents a location within a document.  It is intended to abstract away
29         * implementation details of the document and enable specification of
30         * positions within the document that are capable of tracking of change as
31         * the document is edited.
32         * <p>
33         * A {@code Position} object points at a location between two characters.
34         * As the surrounding content is altered, the {@code Position} object
35         * adjusts its offset automatically to reflect the changes. If content is
36         * inserted or removed before the {@code Position} object's location, then the
37         * {@code Position} increments or decrements its offset, respectively,
38         * so as to point to the same location. If a portion of the document is removed
39         * that contains a {@code Position}'s offset, then the {@code Position}'s
40         * offset becomes that of the beginning of the removed region. For example, if
41         * a {@code Position} has an offset of 5 and the region 2-10 is removed, then
42         * the {@code Position}'s offset becomes 2.
43         * <p>
44         * {@code Position} with an offset of 0 is a special case. It never changes its
45         * offset while document content is altered.
46         *
47         * @author  Timothy Prinzing
48         * @version 1.26 05/05/07
49         */
50        public interface Position {
51
52            /**
53             * Fetches the current offset within the document.
54             *
55             * @return the offset >= 0
56             */
57            public int getOffset();
58
59            /**
60             * A typesafe enumeration to indicate bias to a position
61             * in the model.  A position indicates a location between
62             * two characters.  The bias can be used to indicate an
63             * interest toward one of the two sides of the position
64             * in boundary conditions where a simple offset is
65             * ambiguous.
66             */
67            public static final class Bias {
68
69                /**
70                 * Indicates to bias toward the next character
71                 * in the model.
72                 */
73                public static final Bias Forward = new Bias("Forward");
74
75                /**
76                 * Indicates a bias toward the previous character
77                 * in the model.
78                 */
79                public static final Bias Backward = new Bias("Backward");
80
81                /**
82                 * string representation
83                 */
84                public String toString() {
85                    return name;
86                }
87
88                private Bias(String name) {
89                    this .name = name;
90                }
91
92                private String name;
93            }
94        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.