Java Doc for PositionsBag.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.PositionsBag

PositionsBag
final public class PositionsBag extends AbstractHighlightsContainer (Code)
A bag of highlighted areas specified by their document Positions.

The highlighted areas (highlights) are determined by their starting and ending positions 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 the bag.

The PositionsBag is designed to work over a single document, which is passed in to the constructor. All the Positions accepted by various methods in this class must refer to positions within this document. Since there is no way how this could be checked it is up to the users of this class to make sure that Positions they pass in to the bag are from the same Document, which they used for creating the bag.

The PositionsBag 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 and its 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




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

Method Summary
public  voidaddAllHighlights(PositionsBag bag)
     Adds all highlights from the bag passed in.
public  voidaddHighlight(Position startPosition, Position endPosition, AttributeSet attributes)
     Adds a highlight to this bag.
public  voidclear()
     Removes all highlights previously added to this bag.
 GapList<AttributeSet>getAttributes()
    
public  HighlightsSequencegetHighlights(int startOffset, int endOffset)
     Gets highlights from an area of a document.
 GapList<Position>getMarks()
    
public  voidremoveHighlights(Position startPosition, Position endPosition, boolean clip)
     Removes highlights in the specific area.
public  voidremoveHighlights(int startOffset, int endOffset)
     Removes highlights in the specific area.
public  voidsetHighlights(PositionsBag bag)
     Resets this sequence to use the new set of highlights.


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



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




Method Detail
addAllHighlights
public void addAllHighlights(PositionsBag 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 highlights that will be atomically added to this bag.



addHighlight
public void addHighlight(Position startPosition, Position endPosition, AttributeSet attributes)(Code)
Adds a highlight to this bag. The highlight is specified by its staring and ending Position 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:
  startPosition - The beginning of the highlighted area.
Parameters:
  endPosition - 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.



getAttributes
GapList<AttributeSet> getAttributes()(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
GapList<Position> getMarks()(Code)



removeHighlights
public void removeHighlights(Position startPosition, Position endPosition, boolean clip)(Code)
Removes highlights in the specific area. 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:
  startPosition - The beginning of the area to clear.
Parameters:
  endPosition - The end of the area to clear.
Parameters:
  clip - Whether to clip the partially overlapping highlights.



removeHighlights
public void removeHighlights(int startOffset, int endOffset)(Code)
Removes highlights in the specific area. All existing highlights that are positioned within the area specified by the startOffset and endOffset parameters are removed from this sequence. The highlights that only partialy overlap with the area will be removed as well.
Parameters:
  startOffset - The beginning of the area to clear.
Parameters:
  endOffset - The end of the area to clear.



setHighlights
public void setHighlights(PositionsBag bag)(Code)
Resets this sequence 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 done atomically.
Parameters:
  bag - The new highlights.



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.