Source Code Cross Referenced for Bookmarks.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-2001 Sun
011:         * Microsystems, Inc. All Rights Reserved.
012:         */
013:
014:        package org.netbeans.editor;
015:
016:        import java.util.ArrayList;
017:
018:        /**
019:         * List of all bookmarks attached to document. This is helper class for storage
020:         * of all bookmarks attached to the document.
021:         * 
022:         * @author David Konecny
023:         * @since 07/2001
024:         */
025:
026:        // TODO: this is first primitive version of storage of bookmark
027:        // it must be rewritten and also persistence must be added
028:        public class Bookmarks {
029:
030:            /** List of bookmarks */
031:            private ArrayList bookmarks;
032:
033:            /** Creates new Bookmarks */
034:            public Bookmarks() {
035:                bookmarks = new ArrayList(15);
036:            }
037:
038:            /** Find bookmark for the given line. */
039:            private Bookmark getInternalBookmark(int line) {
040:                for (int i = 0; i < bookmarks.size()
041:                        && ((Bookmark) bookmarks.get(i)).getLine() <= line; i++) {
042:                    if (((Bookmark) bookmarks.get(i)).getLine() == line)
043:                        return (Bookmark) bookmarks.get(i);
044:                }
045:                return null;
046:            }
047:
048:            /** Find bookmark for the given line. */
049:            public Bookmark getBookmark(int line) {
050:                return getInternalBookmark(line);
051:            }
052:
053:            /** Find next bookmark */
054:            public Bookmark getNextLineBookmark(int line) {
055:                for (int i = 0; i < bookmarks.size(); i++) {
056:                    if (((Bookmark) bookmarks.get(i)).getLine() >= line)
057:                        return (Bookmark) bookmarks.get(i);
058:                }
059:                return null;
060:            }
061:
062:            /** Add new bookmark into array */
063:            public void putBookmark(Bookmark bookmark) {
064:                int line = bookmark.getLine();
065:                boolean inserted = false;
066:                for (int i = 0; i < bookmarks.size(); i++) {
067:                    if (((Bookmark) bookmarks.get(i)).getLine() > line) {
068:                        bookmarks.add(i, bookmark);
069:                        inserted = true;
070:                        break;
071:                    }
072:                }
073:                if (!inserted)
074:                    bookmarks.add(bookmark);
075:            }
076:
077:            /** Remove bookmark from the line */
078:            public Bookmark removeBookmark(int line) {
079:                Bookmark bookmark;
080:                bookmark = getInternalBookmark(line);
081:                if (bookmark == null)
082:                    return null;
083:                bookmarks.remove(bookmark);
084:                return bookmark;
085:            }
086:
087:            /** Remove given bookmark */
088:            public void removeBookmark(Bookmark bookmark) {
089:                bookmarks.remove(bookmark);
090:            }
091:
092:            /** Remove all bookmarks. Usually called when document is going to be closed. */
093:            public void removeAll() {
094:                for (int i = 0; i < bookmarks.size(); i++) {
095:                    ((Bookmark) bookmarks.get(i)).remove();
096:                }
097:                bookmarks = new ArrayList();
098:            }
099:
100:            /** Interface defining bookmark. */
101:            public interface Bookmark {
102:
103:                /** Line number of the bookmark */
104:                public int getLine();
105:
106:                /**
107:                 * Method which is called when document is going to be closed. Bookmark
108:                 * can handle this change of state if necessary.
109:                 */
110:                public void remove();
111:            }
112:
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.