JIDE 3.5.15

com.jidesoft.editor.folding
Interface FoldingModel

All Known Implementing Classes:
DefaultFoldingModel

public interface FoldingModel

The interface to represent the code folding information.

There is an assumption that we don't have overlapped folding spans although nested folding spans are allowed.


Method Summary
 FoldingSpan addFoldingSpan(int startOffset, int endOffset, String description)
          Adds a folding span to FoldingModel.
 void addFoldingSpanListener(FoldingSpanListener l)
          Add a listener to the list that's notified each time a change to the line marker occurs.
 void collapseAll()
          Collapses all the foldings.
 void collapseFoldingSpan(FoldingSpan span)
          Collapses the folding span.
 void expandAll()
          Expands all the foldings.
 void expandFoldingSpan(FoldingSpan span)
          Expands the folding span.
 void foldingSpanUpdated(FoldingSpan span)
          When a folding span start or end offset, call this method to tell the folding model.
 FoldingSpanListener[] getFoldingSpanListeners()
          Returns an array of all the FoldingSpanListeners added to this FoldingModel with addFoldingSpanListener().
 FoldingSpan[] getFoldingSpans()
          Gets all the folding spans.
 boolean isAdjusting()
          Checks if the folding model is in adjusting model.
 boolean isEnabled()
          Checks if the folding model is enabled.
 void removeAllFoldingSpans()
          Removes all folding spans that were added before.
 boolean removeFoldingSpan(FoldingSpan span)
          Removes a folding span that was added before.
 void removeFoldingSpanListener(FoldingSpanListener l)
          Remove a listener from the list that's notified each time a change to the line marker occurs.
 void setAdjusting(boolean adjusting)
          Sets the folding model to or from the adjusting mode.
 void setEnabled(boolean flag)
          Enables or disables this folding model.
 

Method Detail

addFoldingSpan

FoldingSpan addFoldingSpan(int startOffset,
                           int endOffset,
                           String description)
Adds a folding span to FoldingModel. FoldingSpanEvent.FOLDING_SPAN_ADDED will be fired.

Parameters:
startOffset - the start offset, inclusive
endOffset - the end offset, exclusive
description - the description of the folding span
Returns:
the folding span that is just added.

removeFoldingSpan

boolean removeFoldingSpan(FoldingSpan span)
Removes a folding span that was added before. FoldingSpanEvent.FOLDING_SPAN_REMOVED will be fired if the folding span is removed successfully.

Parameters:
span - the folding span
Returns:
true if the folding span is removed. If the folding span doesn't exist, it will return false.

removeAllFoldingSpans

void removeAllFoldingSpans()
Removes all folding spans that were added before. No events will be fired.


isAdjusting

boolean isAdjusting()
Checks if the folding model is in adjusting model.

Returns:
true if the folding model is in adjusting mode. Otherwise false.

setAdjusting

void setAdjusting(boolean adjusting)
Sets the folding model to or from the adjusting mode.

Parameters:
adjusting - the flag

foldingSpanUpdated

void foldingSpanUpdated(FoldingSpan span)
When a folding span start or end offset, call this method to tell the folding model. However if you are using DefaultFoldingSpan, there is no need for calling it because DefaultFoldingSpan will call it automatically.

Parameters:
span - the folding span

getFoldingSpans

FoldingSpan[] getFoldingSpans()
Gets all the folding spans.

Returns:
all the folding spans.

setEnabled

void setEnabled(boolean flag)
Enables or disables this folding model.

Parameters:
flag - the flag

isEnabled

boolean isEnabled()
Checks if the folding model is enabled.

Returns:
true if the folding model is enabled. Otherwise false.

expandFoldingSpan

void expandFoldingSpan(FoldingSpan span)
Expands the folding span.

Parameters:
span - the folding span

collapseFoldingSpan

void collapseFoldingSpan(FoldingSpan span)
Collapses the folding span.

Parameters:
span - the folding span

expandAll

void expandAll()
Expands all the foldings.


collapseAll

void collapseAll()
Collapses all the foldings.


addFoldingSpanListener

void addFoldingSpanListener(FoldingSpanListener l)
Add a listener to the list that's notified each time a change to the line marker occurs.

Parameters:
l - the FoldingSpanListener

removeFoldingSpanListener

void removeFoldingSpanListener(FoldingSpanListener l)
Remove a listener from the list that's notified each time a change to the line marker occurs.

Parameters:
l - the FoldingSpanListener
See Also:
addFoldingSpanListener(com.jidesoft.editor.folding.FoldingSpanListener)

getFoldingSpanListeners

FoldingSpanListener[] getFoldingSpanListeners()
Returns an array of all the FoldingSpanListeners added to this FoldingModel with addFoldingSpanListener().

Returns:
all of the FoldingSpanListeners added or an empty array if no listeners have been added

JIDE 3.5.15