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

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

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

org.netbeans.lib.editor.view
Class GapDocumentView

java.lang.Object
  extended by javax.swing.text.View
      extended by org.netbeans.lib.editor.view.GapBoxView
          extended by org.netbeans.lib.editor.view.GapDocumentView
All Implemented Interfaces:
SwingConstants, EstimatedSpanView, ViewLayoutState, ViewLayoutState.Parent
Direct Known Subclasses:
DrawEngineFakeDocView

public class GapDocumentView
extends GapBoxView

View responsible for holding all line views for a particular document.
There is one instance of this view per document.

It is expected that this view will not act as an active layout state i.e. that it will not be hosted by a view implementing ViewLayoutState.Parent.
The implementation tries to optimize calls to updateLayout() so that if there are multiple changes in children then they will all be serviced at once.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.netbeans.editor.view.spi.ViewLayoutState
ViewLayoutState.Parent
 
Field Summary
 
Fields inherited from class org.netbeans.lib.editor.view.GapBoxView
GAP_BOX_VIEW_LAST_USED_STATUS_BIT
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
GapDocumentView(Element elem)
          Construct a view intended to cover the whole document.
 
Method Summary
 void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
           
protected  org.netbeans.lib.editor.view.GapBoxViewChildren createChildren()
          Can be overriden by subclasses to return a different children implementation.
protected  void directUpdateLayout()
          This method is called when this view is not acting as active layout state and its layout becomes invalid.
protected  int getLastAllocationHeight()
           
protected  int getLastAllocationWidth()
           
protected  int getLastAllocationX()
           
protected  int getLastAllocationY()
           
protected  ViewLayoutQueue getLayoutQueue()
          Fetch the queue to use for layout.
 void insertUpdate(DocumentEvent evt, Shape a, ViewFactory f)
           
protected  void layoutLock()
           
protected  void layoutUnlock()
           
protected  boolean markRepaint(int childIndex, boolean repaintTillEnd)
          Mark that the child with the given index should be repainted.
protected  void markSizeInvalid(int childIndex, int count)
          This method marks sizes of all the children as invalid so the next layout update will resize each children.
 void paint(Graphics g, Shape a)
          Render the view using the given allocation and rendering surface.
protected  void processRepaint(ViewLayoutState.Parent lsParent)
          Process pending repaint requests from children.
protected  Rectangle reallocate(Shape a)
          Reallocate the view to the new size given by the passed shape.
 void removeUpdate(DocumentEvent evt, Shape a, ViewFactory f)
           
 void renderWithUpdateLayout(Runnable r)
           
 void repaint(ViewLayoutState child, double majorAxisOffset, double majorAxisSpan, float minorAxisOffset, float minorAxisSpan)
          Inform the parent that the child layout state needs a repaint.
protected  void resetEstimatedSpan(int childIndex, int count)
          Set estimated span flag to false on the given children views.
 void setParent(View parent)
          Sets the parent of the view.
 void setSize(float width, float height)
          Sets the size of the view.
 
Methods inherited from class org.netbeans.lib.editor.view.GapBoxView
appendChildToStringBuffer, childrenToString, childrenToString, childToString, clearStatusBits, createChild, createCustomView, createDefaultChild, customInsertUpdate, customReloadChildren, customRemoveUpdate, elementReloadChildren, getAlignment, getChild, getChildAllocation, getChildIndex, getChildIndexNoCheck, getChildren, getChildrenNull, getEndOffset, getInsertUpdateRebuildOffsetRange, getInsets, getInsetSpan, getLayoutMajorAxisPreferredSpan, getLayoutMajorAxisRawOffset, getLayoutMinorAxisAlignment, getLayoutMinorAxisMaximumSpan, getLayoutMinorAxisMinimumSpan, getLayoutMinorAxisPreferredSpan, getLayoutStateMajorAxis, getLayoutStateMinorAxis, getLayoutStateParent, getMajorAxis, getMajorAxisInsetSpan, getMaximumSpan, getMinimumSpan, getMinorAxis, getMinorAxisInsetSpan, getMinorAxisSpan, getNextVisualPositionFrom, getPreferredSpan, getRemoveUpdateRebuildOffsetRange, getReplaceEstimatedThreshold, getStartOffset, getStatusBits, getView, getView, getViewCount, getViewIndex, getViewIndex, getViewIndexAtPoint, getViewRawIndex, isActiveLayoutState, isChildrenLayoutNecessary, isChildrenResizeDisabled, isEstimatedSpan, isFlyweight, isLayoutMinorAxisPreferenceChanged, isLayoutValid, isMajorAxisPreferenceChanged, isMinorAxisPreferenceChanged, isRepaintPending, isRepaintTillEnd, isStatusBitsNonZero, isXLayoutStateMajorAxis, layoutInvalid, majorAxisPreferenceChanged, markChildrenLayoutNecessary, markLayoutInvalid, markMajorAxisPreferenceChanged, markMinorAxisPreferenceChanged, markRepaintPending, markViewSizeInvalid, minorAxisPreferenceChanged, modelToView, offsetRebuild, preferenceChanged, rebuild, releaseChildren, reloadChildren, replace, resetAxesPreferenceChanged, resetRepaintPending, selectLayoutMajorAxis, setEstimatedSpan, setLayoutMajorAxisRawOffset, setSpanOnMajorAxis, setSpanOnMinorAxis, setStatusBits, setViewRawIndex, toString, unloadChildren, updateLayout, updateLayout, useCustomReloadChildren, viewPreferenceChanged, viewToModel
 
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getResizeWeight, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, modelToView, remove, removeAll, updateChildren, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GapDocumentView

public GapDocumentView(Element elem)
Construct a view intended to cover the whole document.

Parameters:
elem - the element of the model to represent.
majorAxis - the axis to tile along. This can be either X_AXIS or Y_AXIS.
baselineLayout - whether baseline layout should be used instead of default layout.
Method Detail

createChildren

protected org.netbeans.lib.editor.view.GapBoxViewChildren createChildren()
Description copied from class: GapBoxView
Can be overriden by subclasses to return a different children implementation.

Overrides:
createChildren in class GapBoxView

reallocate

protected Rectangle reallocate(Shape a)
Description copied from class: GapBoxView
Reallocate the view to the new size given by the passed shape.

Overrides:
reallocate in class GapBoxView
Parameters:
a - shape to which to reallocate the view.
Returns:
rectangle bounding the shape. The returned rectangle can be mutated.

directUpdateLayout

protected void directUpdateLayout()
Description copied from class: GapBoxView
This method is called when this view is not acting as active layout state and its layout becomes invalid.
By default the layout is updated immediately but subclasses may change that but they must ensure that the layout will be updated later.

Overrides:
directUpdateLayout in class GapBoxView

layoutLock

protected final void layoutLock()

layoutUnlock

protected final void layoutUnlock()

renderWithUpdateLayout

public void renderWithUpdateLayout(Runnable r)

setParent

public void setParent(View parent)
Description copied from class: GapBoxView
Sets the parent of the view. The children are only initialized if someone has previously asked for information related to children (e.g. getViewCount()) or for preferred, minimum or maximum span of this view.

Overrides:
setParent in class GapBoxView
Parameters:
parent - the parent of the view, null if none

setSize

public void setSize(float width,
                    float height)
Description copied from class: GapBoxView
Sets the size of the view. This should cause layout of the view if the view caches any layout information.

The propagation of this operation to child views can be done asynchronously if appropriate.

Overrides:
setSize in class GapBoxView
Parameters:
width - the width >= 0
height - the height >= 0

insertUpdate

public void insertUpdate(DocumentEvent evt,
                         Shape a,
                         ViewFactory f)
Overrides:
insertUpdate in class GapBoxView

removeUpdate

public void removeUpdate(DocumentEvent evt,
                         Shape a,
                         ViewFactory f)
Overrides:
removeUpdate in class GapBoxView

changedUpdate

public void changedUpdate(DocumentEvent e,
                          Shape a,
                          ViewFactory f)
Overrides:
changedUpdate in class GapBoxView

paint

public void paint(Graphics g,
                  Shape a)
Description copied from class: GapBoxView
Render the view using the given allocation and rendering surface.

Overrides:
paint in class GapBoxView
Parameters:
g - the rendering surface to use
a - the allocated region to render into
See Also:
View.paint(java.awt.Graphics, java.awt.Shape)

repaint

public void repaint(ViewLayoutState child,
                    double majorAxisOffset,
                    double majorAxisSpan,
                    float minorAxisOffset,
                    float minorAxisSpan)
Description copied from interface: ViewLayoutState.Parent
Inform the parent that the child layout state needs a repaint.
This method can be called anytime although usually it's called during the layout state's updateLayout().
This method can be called repetively. The lowest offsets should finally be used by the parent.

Specified by:
repaint in interface ViewLayoutState.Parent
Overrides:
repaint in class GapBoxView
Parameters:
child - child that needs its area to be repainted.
majorAxisOffset - offset along the major axis defining the begining of the repaint region. If the allocation has changed along the major axis the view is fully repainted (see majorAxisPreferenceChanged()).
This parameter is typically zero but can be used e.g. for line-wrapping views when typing on the last line.
majorAxisSpan - span along the major axis that should be repainted. If it is set to zero then it means that the end of the repaint region along the major axis span is determined by the span allocated for the child in this parent.
minorAxisOffset - offset along the minor axis defining the begining of the repaint region.
minorAxisSpan - span along the minor axis that should be repainted. If it is set to zero then it means that the end of the repaint region along the minor axis span is determined by the span of this parent.

markRepaint

protected boolean markRepaint(int childIndex,
                              boolean repaintTillEnd)
Description copied from class: GapBoxView
Mark that the child with the given index should be repainted.

Overrides:
markRepaint in class GapBoxView
Parameters:
childIndex - index of child that should be marked for repaint.
repaintTillEnd - if set to true then all children following the child should be repainted as well.
Returns:
true if lower child index was marked for repaint by this method than there was before.

processRepaint

protected void processRepaint(ViewLayoutState.Parent lsParent)
Description copied from class: GapBoxView
Process pending repaint requests from children.
Children are guaranteed to be non-null once this method gets called.

Overrides:
processRepaint in class GapBoxView

resetEstimatedSpan

protected void resetEstimatedSpan(int childIndex,
                                  int count)
Description copied from class: GapBoxView
Set estimated span flag to false on the given children views.
This method is called from both setEstimatedSpan() and from children.replace() if the number of added children exceeds threshold count.
Subclasses may want to do this on the background.

Overrides:
resetEstimatedSpan in class GapBoxView

markSizeInvalid

protected void markSizeInvalid(int childIndex,
                               int count)
Description copied from class: GapBoxView
This method marks sizes of all the children as invalid so the next layout update will resize each children.
This is made as protected method since large complex views may consider this operation lengthy with certain amount of children so they may need to do this operation in background and delegate to this implementation for small amount of children only.

Overrides:
markSizeInvalid in class GapBoxView

getLastAllocationX

protected final int getLastAllocationX()

getLastAllocationY

protected final int getLastAllocationY()

getLastAllocationWidth

protected final int getLastAllocationWidth()

getLastAllocationHeight

protected final int getLastAllocationHeight()

getLayoutQueue

protected ViewLayoutQueue getLayoutQueue()
Fetch the queue to use for layout.


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.