public class CodeFoldingMargin<B>
extends javax.swing.JComponent
BasicEditorPane
.javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected BasicEditorPane |
editorPane |
protected CodeFoldingModel<B> |
model |
protected CodeFoldingProvider<B> |
provider |
protected int[] |
TEMP_OFFSETS |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
CodeFoldingMargin(CodeFoldingProvider<B> provider) |
Modifier and Type | Method and Description |
---|---|
void |
addCodeExpansionListener(CodeExpansionListener listener) |
void |
addCodeWillExpandListener(CodeWillExpandListener listener) |
protected void |
attach(BasicEditorPane editorPane) |
void |
beginCompoundFold()
Start a compound operation, events for folding operations will not be sent until after
the compound fold has ended.
|
protected boolean |
blockContainsOffset(CodeFoldingModel model,
java.lang.Object block,
int offset) |
protected javax.swing.border.Border |
createBorder() |
protected CodeFoldingModel |
createCodeFoldingModel(BasicEditorPane editorPane) |
protected javax.swing.Icon |
createCollapsedIcon() |
protected javax.swing.Icon |
createExpandedIcon() |
protected void |
detach(BasicEditorPane editorPane) |
void |
endCompoundFold()
End a compound folding operation.
|
protected void |
ensurePositionVisible(int position) |
boolean |
expandEnclosingBlocks(int position) |
protected boolean |
expandEnclosingChild(CodeFoldingModel<B> model,
B block,
int offset) |
protected void |
fireCodeCollapsed(B block) |
protected void |
fireCodeExpanded(B block) |
protected void |
fireCodeWillCollapse(B block) |
protected void |
fireCodeWillExpand(B block) |
protected int |
getBlankLines() |
protected int |
getCaretPosition() |
protected int |
getClosestLineFromCoordinate(int y) |
CodeExpansionListener[] |
getCodeExpansionListeners() |
CodeWillExpandListener[] |
getCodeWillExpandListeners() |
protected javax.swing.Icon |
getCollapsedIcon() |
protected BasicDocument |
getDocument() |
protected BasicEditorPane |
getEditorPane() |
protected javax.swing.Icon |
getExpandedIcon() |
protected B |
getFirstBlockAtLine(int line) |
protected CodeFoldingProvider<B> |
getFoldingProvider() |
protected int |
getFontHeight() |
B |
getLargestCollapsedBlock(CodeFoldingModel<B> model,
B block,
int offset)
Returns the largest (outermost) block that is currently collapsed and
contains the given offset.
|
protected int |
getLineCount() |
protected int |
getLineFromOffset(int offset) |
protected int |
getLineFromRow(int row) |
protected int |
getLineStartOffset(int line) |
CodeFoldingModel<B> |
getModel() |
protected int |
getPreferredHeight() |
java.awt.Dimension |
getPreferredSize() |
protected int |
getPreferredWidth() |
CodeFoldingProvider<B> |
getProvider() |
protected int |
getRowCount()
Get the count of rows in the editor.
|
protected B |
getSmallestEnclosingBlock(int offset) |
protected int |
getTopPadding() |
protected int |
getYCoordinateFromOffset(int offset) |
protected void |
hideHover() |
protected boolean |
isCodeFoldingEnabled() |
protected boolean |
isCodeFoldingHighlight() |
protected boolean |
isTurnerDamaged(java.awt.Rectangle clipBounds,
CodeFoldingModel model,
java.lang.Object block) |
protected void |
paintChildTurners(java.awt.Graphics g,
java.awt.Rectangle clipBounds,
CodeFoldingModel model,
java.lang.Object block) |
protected void |
paintComponent(java.awt.Graphics g) |
protected void |
paintTurner(java.awt.Graphics g,
CodeFoldingModel model,
java.lang.Object block) |
void |
removeCodeExpansionListener(CodeExpansionListener listener) |
void |
removeCodeWillExpandListener(CodeWillExpandListener listener) |
void |
setExpansionState(B block,
boolean expand)
Expand or collapse a block.
|
void |
setExpansionState(B block,
boolean expand,
boolean fadeBlock)
Expand or collapse a block.
|
void |
setModel(CodeFoldingModel<B> model) |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected BasicEditorPane editorPane
protected CodeFoldingProvider<B> provider
protected CodeFoldingModel<B> model
protected final int[] TEMP_OFFSETS
public CodeFoldingMargin(CodeFoldingProvider<B> provider)
public void beginCompoundFold()
public void endCompoundFold()
Listeners that implement CompoundCodeExpansionListener will receive these events in one call to compoundCodeFolds.
public CodeFoldingModel<B> getModel()
public CodeFoldingProvider<B> getProvider()
public void setModel(CodeFoldingModel<B> model)
public void setExpansionState(B block, boolean expand)
block
- The block to expand or collapseexpand
- true to expand the block, false to collpase itpublic void setExpansionState(B block, boolean expand, boolean fadeBlock)
block
- The block to expand or collapseexpand
- true to expand the block, false to collpase itfadeBlock
- true to visually animate the state changepublic boolean expandEnclosingBlocks(int position)
public void addCodeWillExpandListener(CodeWillExpandListener listener)
public void removeCodeWillExpandListener(CodeWillExpandListener listener)
public CodeWillExpandListener[] getCodeWillExpandListeners()
public void addCodeExpansionListener(CodeExpansionListener listener)
public void removeCodeExpansionListener(CodeExpansionListener listener)
public CodeExpansionListener[] getCodeExpansionListeners()
protected void attach(BasicEditorPane editorPane)
protected void detach(BasicEditorPane editorPane)
protected void hideHover()
protected CodeFoldingModel createCodeFoldingModel(BasicEditorPane editorPane)
protected javax.swing.border.Border createBorder()
protected int getPreferredWidth()
protected int getPreferredHeight()
protected BasicEditorPane getEditorPane()
protected BasicDocument getDocument()
protected CodeFoldingProvider<B> getFoldingProvider()
protected boolean blockContainsOffset(CodeFoldingModel model, java.lang.Object block, int offset)
protected boolean expandEnclosingChild(CodeFoldingModel<B> model, B block, int offset)
public B getLargestCollapsedBlock(CodeFoldingModel<B> model, B block, int offset)
model
- block
- - the block to start examining for (usually model.getRoot())offset
- protected B getSmallestEnclosingBlock(int offset)
protected B getFirstBlockAtLine(int line)
protected javax.swing.Icon getExpandedIcon()
protected javax.swing.Icon getCollapsedIcon()
protected javax.swing.Icon createExpandedIcon()
protected javax.swing.Icon createCollapsedIcon()
protected int getYCoordinateFromOffset(int offset)
protected int getLineFromRow(int row)
protected int getRowCount()
protected int getClosestLineFromCoordinate(int y)
protected int getLineFromOffset(int offset)
protected int getLineStartOffset(int line)
protected int getTopPadding()
protected int getFontHeight()
protected int getLineCount()
protected int getCaretPosition()
protected void ensurePositionVisible(int position)
protected int getBlankLines()
protected boolean isCodeFoldingHighlight()
protected boolean isCodeFoldingEnabled()
protected void fireCodeWillExpand(B block) throws CodeExpansionVetoException
CodeExpansionVetoException
protected void fireCodeExpanded(B block)
protected void fireCodeWillCollapse(B block) throws CodeExpansionVetoException
CodeExpansionVetoException
protected void fireCodeCollapsed(B block)
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
protected void paintChildTurners(java.awt.Graphics g, java.awt.Rectangle clipBounds, CodeFoldingModel model, java.lang.Object block)
protected void paintTurner(java.awt.Graphics g, CodeFoldingModel model, java.lang.Object block)
protected boolean isTurnerDamaged(java.awt.Rectangle clipBounds, CodeFoldingModel model, java.lang.Object block)