Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


oracle.javatools.editor.folding
Class CodeFoldingMargin

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by oracle.javatools.editor.folding.CodeFoldingMargin

All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class CodeFoldingMargin
extends javax.swing.JComponent

A control that allows manipulation of collapsible source code blocks. The code folding margin is attached to a BasicEditorPane.

Since:
10.1.3
See Also:
Serialized Form

Nested Class Summary

 

Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent

 

Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer

 

Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy

 

Field Summary
protected  BasicEditorPane editorPane
           
protected  CodeFoldingModel model
           
protected  CodeFoldingProvider provider
           
protected  int[] TEMP_OFFSETS
           

 

Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW

 

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT

 

Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH

 

Constructor Summary
CodeFoldingMargin(CodeFoldingProvider provider)
           

 

Method Summary
 void addCodeExpansionListener(CodeExpansionListener listener)
           
 void addCodeWillExpandListener(CodeWillExpandListener listener)
           
protected  void attach(BasicEditorPane editorPane)
           
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)
           
protected  void ensurePositionVisible(int position)
           
 boolean expandEnclosingBlocks(int position)
           
protected  boolean expandEnclosingChild(CodeFoldingModel model, java.lang.Object block, int offset)
           
protected  void fireCodeCollapsed(java.lang.Object block)
           
protected  void fireCodeExpanded(java.lang.Object block)
           
protected  void fireCodeWillCollapse(java.lang.Object block)
           
protected  void fireCodeWillExpand(java.lang.Object 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  java.lang.Object getFirstBlockAtLine(int line)
           
protected  CodeFoldingProvider getFoldingProvider()
           
protected  int getFontHeight()
           
 java.lang.Object getLargestCollapsedBlock(CodeFoldingModel model, java.lang.Object 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 getModel()
           
protected  int getPreferredHeight()
           
 java.awt.Dimension getPreferredSize()
           
protected  int getPreferredWidth()
           
 CodeFoldingProvider getProvider()
           
protected  int getRowCount()
          Get the count of rows in the editor.
protected  java.lang.Object getSmallestEnclosingBlock(int offset)
           
protected  int getTopPadding()
           
protected  int getYCoordinateFromOffset(int offset)
           
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(java.lang.Object block, boolean expand)
          Expand or collapse a block.
 void setExpansionState(java.lang.Object block, boolean expand, boolean fadeBlock)
          Expand or collapse a block.
 void setModel(CodeFoldingModel model)
           

 

Methods inherited from class javax.swing.JComponent
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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

 

Methods inherited from class java.awt.Container
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree

 

Methods inherited from class java.awt.Component
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, hide, 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, transferFocusUpCycle

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

editorPane

protected BasicEditorPane editorPane

provider

protected CodeFoldingProvider provider

model

protected CodeFoldingModel model

TEMP_OFFSETS

protected final int[] TEMP_OFFSETS

Constructor Detail

CodeFoldingMargin

public CodeFoldingMargin(CodeFoldingProvider provider)

Method Detail

getModel

public CodeFoldingModel getModel()

getProvider

public CodeFoldingProvider getProvider()

setModel

public void setModel(CodeFoldingModel model)

setExpansionState

public void setExpansionState(java.lang.Object block,
                              boolean expand)
Expand or collapse a block. No animation of state change is done.
Parameters:
block - The block to expand or collapse
expand - true to expand the block, false to collpase it

setExpansionState

public void setExpansionState(java.lang.Object block,
                              boolean expand,
                              boolean fadeBlock)
Expand or collapse a block.
Parameters:
block - The block to expand or collapse
expand - true to expand the block, false to collpase it
fadeBlock - true to visually animate the state change

expandEnclosingBlocks

public boolean expandEnclosingBlocks(int position)

addCodeWillExpandListener

public void addCodeWillExpandListener(CodeWillExpandListener listener)

removeCodeWillExpandListener

public void removeCodeWillExpandListener(CodeWillExpandListener listener)

getCodeWillExpandListeners

public CodeWillExpandListener[] getCodeWillExpandListeners()

addCodeExpansionListener

public void addCodeExpansionListener(CodeExpansionListener listener)

removeCodeExpansionListener

public void removeCodeExpansionListener(CodeExpansionListener listener)

getCodeExpansionListeners

public CodeExpansionListener[] getCodeExpansionListeners()

attach

protected void attach(BasicEditorPane editorPane)

detach

protected void detach(BasicEditorPane editorPane)

createCodeFoldingModel

protected CodeFoldingModel createCodeFoldingModel(BasicEditorPane editorPane)

createBorder

protected javax.swing.border.Border createBorder()

getPreferredWidth

protected int getPreferredWidth()

getPreferredHeight

protected int getPreferredHeight()

getEditorPane

protected BasicEditorPane getEditorPane()

getDocument

protected BasicDocument getDocument()

getFoldingProvider

protected CodeFoldingProvider getFoldingProvider()

blockContainsOffset

protected boolean blockContainsOffset(CodeFoldingModel model,
                                      java.lang.Object block,
                                      int offset)

expandEnclosingChild

protected boolean expandEnclosingChild(CodeFoldingModel model,
                                       java.lang.Object block,
                                       int offset)

getLargestCollapsedBlock

public java.lang.Object getLargestCollapsedBlock(CodeFoldingModel model,
                                                 java.lang.Object block,
                                                 int offset)
Returns the largest (outermost) block that is currently collapsed and contains the given offset. Will return null if the offset is currently not in any collapsed blocks
Parameters:
model -
block - - the block to start examining for (usually model.getRoot())
offset -
Returns:

getSmallestEnclosingBlock

protected java.lang.Object getSmallestEnclosingBlock(int offset)

getFirstBlockAtLine

protected java.lang.Object getFirstBlockAtLine(int line)

getExpandedIcon

protected javax.swing.Icon getExpandedIcon()

getCollapsedIcon

protected javax.swing.Icon getCollapsedIcon()

createExpandedIcon

protected javax.swing.Icon createExpandedIcon()

createCollapsedIcon

protected javax.swing.Icon createCollapsedIcon()

getYCoordinateFromOffset

protected int getYCoordinateFromOffset(int offset)

getLineFromRow

protected int getLineFromRow(int row)

getRowCount

protected int getRowCount()
Get the count of rows in the editor.
Returns:
the count of rows in the editor

getClosestLineFromCoordinate

protected int getClosestLineFromCoordinate(int y)

getLineFromOffset

protected int getLineFromOffset(int offset)
Returns:
the zero-based line number containing the specified character offset

getLineStartOffset

protected int getLineStartOffset(int line)

getTopPadding

protected int getTopPadding()

getFontHeight

protected int getFontHeight()

getLineCount

protected int getLineCount()

getCaretPosition

protected int getCaretPosition()

ensurePositionVisible

protected void ensurePositionVisible(int position)

getBlankLines

protected int getBlankLines()

isCodeFoldingHighlight

protected boolean isCodeFoldingHighlight()

isCodeFoldingEnabled

protected boolean isCodeFoldingEnabled()

fireCodeWillExpand

protected void fireCodeWillExpand(java.lang.Object block)
                           throws CodeExpansionVetoException
Throws:
CodeExpansionVetoException

fireCodeExpanded

protected void fireCodeExpanded(java.lang.Object block)

fireCodeWillCollapse

protected void fireCodeWillCollapse(java.lang.Object block)
                             throws CodeExpansionVetoException
Throws:
CodeExpansionVetoException

fireCodeCollapsed

protected void fireCodeCollapsed(java.lang.Object block)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

paintChildTurners

protected void paintChildTurners(java.awt.Graphics g,
                                 java.awt.Rectangle clipBounds,
                                 CodeFoldingModel model,
                                 java.lang.Object block)

paintTurner

protected void paintTurner(java.awt.Graphics g,
                           CodeFoldingModel model,
                           java.lang.Object block)

isTurnerDamaged

protected boolean isTurnerDamaged(java.awt.Rectangle clipBounds,
                                  CodeFoldingModel model,
                                  java.lang.Object block)

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


Copyright © 1997, 2012, Oracle. All rights reserved.