站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

MarkChain (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor
Class MarkChain

java.lang.Object
  extended by org.netbeans.editor.MarkChain

public class MarkChain
extends Object

Support class for chain of MarkBlocks


Field Summary
protected  MarkFactory.ChainDrawMark chain
          Chain of all marks
protected  MarkFactory.ChainDrawMark curMark
          Current mark to make checks faster
protected  BaseDocument doc
          Document for this mark
protected  String layerName
          If this chain uses draw marks, then this is the name for the draw layer that will be used for the marks
 
Constructor Summary
MarkChain(BaseDocument doc, String layerName)
          Construct chain using draw marks
 
Method Summary
 boolean addMark(int pos)
           
 boolean addMark(int pos, boolean forceAdd)
          Add mark to the chain
 int compareMark(int pos)
          Tests whether the position range is partly or fully inside some mark block from the chain.
protected  MarkFactory.ChainDrawMark createAndInsertNewMark(int pos)
           
protected  MarkFactory.ChainDrawMark createMark()
           
 MarkFactory.ChainDrawMark getAddedMark()
          The mark created by addMark() method is returned by this method.
 MarkFactory.ChainDrawMark getChain()
           
 MarkFactory.ChainDrawMark getCurMark()
           
 boolean isMark(int pos)
          Is there mark at given position?
 boolean removeMark(int pos)
          Remove non-empty block from area covered by blocks from chain
 boolean removeMark(MarkFactory.ChainDrawMark mark)
           
 boolean toggleMark(int pos)
          Toggle the mark so that if it didn't exist it is created and if it existed it's removed
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

chain

protected MarkFactory.ChainDrawMark chain
Chain of all marks


curMark

protected MarkFactory.ChainDrawMark curMark
Current mark to make checks faster


doc

protected BaseDocument doc
Document for this mark


layerName

protected String layerName
If this chain uses draw marks, then this is the name for the draw layer that will be used for the marks

Constructor Detail

MarkChain

public MarkChain(BaseDocument doc,
                 String layerName)
Construct chain using draw marks

Method Detail

getChain

public final MarkFactory.ChainDrawMark getChain()

getCurMark

public final MarkFactory.ChainDrawMark getCurMark()

compareMark

public int compareMark(int pos)
Tests whether the position range is partly or fully inside some mark block from the chain.

Parameters:
pos - compared position
Returns:
relation of curMark to the given position

createAndInsertNewMark

protected MarkFactory.ChainDrawMark createAndInsertNewMark(int pos)
                                                    throws BadLocationException
Throws:
BadLocationException

createMark

protected MarkFactory.ChainDrawMark createMark()

addMark

public boolean addMark(int pos)
                throws BadLocationException
Throws:
BadLocationException

addMark

public boolean addMark(int pos,
                       boolean forceAdd)
                throws BadLocationException
Add mark to the chain

Parameters:
pos - position at which the mark should be added
forceAdd - force adding of a fresh mark even if the mark at the same position already exists
Returns:
true if the mark was added false if there's already mark at that pos
Throws:
BadLocationException

getAddedMark

public MarkFactory.ChainDrawMark getAddedMark()
The mark created by addMark() method is returned by this method. In case the mark was not created, because there already was some on requested position, the already existing mark is returned.


removeMark

public boolean removeMark(int pos)
Remove non-empty block from area covered by blocks from chain


removeMark

public boolean removeMark(MarkFactory.ChainDrawMark mark)

isMark

public boolean isMark(int pos)
Is there mark at given position?


toggleMark

public boolean toggleMark(int pos)
                   throws BadLocationException
Toggle the mark so that if it didn't exist it is created and if it existed it's removed

Returns:
true if the new mark was added false if the existing mark was removed
Throws:
BadLocationException

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.editor.lib/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.