Java Doc for OffsetsBag.java in  » IDE-Netbeans » editor » org » netbeans » spi » editor » highlighting » support » 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 » IDE Netbeans » editor » org.netbeans.spi.editor.highlighting.support 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer
      org.netbeans.spi.editor.highlighting.support.OffsetsBag

OffsetsBag
final public class OffsetsBag extends AbstractHighlightsContainer (Code)
A bag of highlighted areas specified by their offsets in a document.

The highlighted areas (highlights) are determined by their starting and ending offsets in a document and the set of attributes that should be used for rendering that area. The highlights can be arbitrarily added to and remove from this bag.

The OffsetsBag is designed to work over a single document, which is passed in to the constructor. All offsets accepted by various methods in this class must refer to positions within this document. Therefore any offsets passed in to the methods in this class have to be equal to or greater than zero and less than or equal to the document size.

The OffsetsBag can operate in two modes depending on a value passed in its construtor. The mode determines how the bag will treat newly added highlights that overlap with existing highlights in the bag.

Trimming mode: In the trimming mode the bag will trim any existing highlights that would overlap with a newly added highlight. In this mode the newly added highlights always replace the existing highlights if they overlap.

Merging mode: In the merging mode the bag will merge attributes of the overlapping highlights. The area where the new highlight overlaps with some existing highlights will then constitute a new highlight, which attributes will be a composition of the attributes of both the new and existing highlight. Should there be attributes with the same name the attribute values from the newly added highlight will take precedence.
author:
   Vita Stejskal


Inner Class :final static class Mark extends OffsetGapList.Offset


Constructor Summary
public  OffsetsBag(Document document)
     Creates a new instance of OffsetsBag, which trims highlights as they are added.
public  OffsetsBag(Document document, boolean mergeHighlights)
     Creates a new instance of OffsetsBag.

Method Summary
public  voidaddAllHighlights(HighlightsSequence bag)
     Adds all highlights from the bag passed in.
public  voidaddHighlight(int startOffset, int endOffset, AttributeSet attributes)
     Adds a highlight to this bag.
public  voidclear()
     Removes all highlights previously added to this bag.
public  voiddiscard()
     Discards this OffsetsBag.
 DocumentgetDocument()
    
public  HighlightsSequencegetHighlights(int startOffset, int endOffset)
     Gets highlights from an area of a document.
 OffsetGapList<Mark>getMarks()
    
public  voidremoveHighlights(int startOffset, int endOffset, boolean clip)
     Removes highlights in a specific area of the document.
public  voidsetHighlights(HighlightsSequence seq)
     Resets this bag to use the new set of highlights.
public  voidsetHighlights(OffsetsBag bag)
     Resets this bag to use the new set of highlights.


Constructor Detail
OffsetsBag
public OffsetsBag(Document document)(Code)
Creates a new instance of OffsetsBag, which trims highlights as they are added. It calls the OffsetsBag.OffsetsBag(Document,boolean) constructor passing false as a parameter.
Parameters:
  document - The document that should be highlighted.



OffsetsBag
public OffsetsBag(Document document, boolean mergeHighlights)(Code)
Creates a new instance of OffsetsBag.
Parameters:
  document - The document that should be highlighted.
Parameters:
  mergeHighlights - Determines whether highlights should be mergedor trimmed.




Method Detail
addAllHighlights
public void addAllHighlights(HighlightsSequence bag)(Code)
Adds all highlights from the bag passed in. This method is equivalent to calling addHighlight for all the highlights in the bag except that the changes are done atomically.
Parameters:
  bag - The bag of highlights that will be atomicallyadded to this bag.



addHighlight
public void addHighlight(int startOffset, int endOffset, AttributeSet attributes)(Code)
Adds a highlight to this bag. The highlight is specified by its staring and ending offset and by its attributes. Adding a highlight that overlaps with one or more existing highlights can have a different result depending on the value of the mergingHighlights parameter used for constructing this bag.
Parameters:
  startOffset - The beginning of the highlighted area.
Parameters:
  endOffset - The end of the highlighted area.
Parameters:
  attributes - The attributes to use for highlighting.



clear
public void clear()(Code)
Removes all highlights previously added to this bag.



discard
public void discard()(Code)
Discards this OffsetsBag. This method should be called when a client stops using the bag. After calling this method no other methods should be called. The bag is effectively empty and it is not possible to modify it.



getDocument
Document getDocument()(Code)



getHighlights
public HighlightsSequence getHighlights(int startOffset, int endOffset)(Code)
Gets highlights from an area of a document. The HighlightsSequence is computed using all the highlights present in this bag between the startOffset and endOffset.
Parameters:
  startOffset - The beginning of the area.
Parameters:
  endOffset - The end of the area. The HighlightsSequence which iterates through thehighlights in the given area of this bag.



getMarks
OffsetGapList<Mark> getMarks()(Code)



removeHighlights
public void removeHighlights(int startOffset, int endOffset, boolean clip)(Code)
Removes highlights in a specific area of the document. All existing highlights that are positioned within the area specified by the startOffset and endOffset parameters are removed from this bag. The highlights that only partialy overlap with the area are treated according to the value of the clip parameter.
  • If clip == true : the overlapping highlights will remain in this sequence but will be clipped so that they do not overlap anymore
  • If clip == false : the overlapping highlights will be removed from this sequence

Parameters:
  startOffset - The beginning of the area to clear.
Parameters:
  endOffset - The end of the area to clear.
Parameters:
  clip - Whether to clip the partially overlapping highlights.



setHighlights
public void setHighlights(HighlightsSequence seq)(Code)
Resets this bag to use the new set of highlights. This method drops all the existing highlights in this bag and adds all highlights from the sequence passed in as a parameter. The changes are made atomically. The sequence passed in has to be acting on the same Document as this bag.
Parameters:
  seq - New highlights to add.



setHighlights
public void setHighlights(OffsetsBag bag)(Code)
Resets this bag to use the new set of highlights. This method drops all the existing highlights in this bag and adds all highlights from the bag passed in as a parameter. The changes are made atomically. Both bags have to be acting on the same Document.
Parameters:
  bag - New highlights to add.



Methods inherited from org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer
final public void addHighlightsChangeListener(HighlightsChangeListener listener)(Code)(Java Doc)
final protected void fireHighlightsChange(int changeStartOffset, int changeEndOffset)(Code)(Java Doc)
abstract public HighlightsSequence getHighlights(int startOffset, int endOffset)(Code)(Java Doc)
final public void removeHighlightsChangeListener(HighlightsChangeListener listener)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.