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

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

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

org.netbeans.editor
Class LeafView

java.lang.Object
  extended by javax.swing.text.View
      extended by org.netbeans.editor.BaseView
          extended by org.netbeans.editor.LeafView
All Implemented Interfaces:
SwingConstants

public class LeafView
extends BaseView

Leaf view implementation. This corresponds and requires leaf element to be element for this view. The view has the following structure: +---------------------------------------------------------+ | insets.top area | A | | | insets.top | | V | +--------------------------------------------------+ | | | A | | | | | i | | | | n | | | | s | | | | e | | | | t | | | | s | | | | . | | | | l | | | | e | Main area of this view | | mainHeight | f | | | | t | | | | | | | | a | | | | r | | | | e | | | | a | | | | | | | | | | | | | | | | | | | | | | V | +--------------------------------------------------+ | insets.bottom area | A | | | insets.bottom | | V +---------------------------------------------------------+


Field Summary
protected  int mainHeight
          Height of the area this view manages excluding areas managed by its children and excluding insets.
 
Fields inherited from class org.netbeans.editor.BaseView
helperInd, insets, INSETS_BOTTOM, INSETS_TOP, MAIN_AREA, packed
 
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
LeafView(Element elem)
          Construct new base view
 
Method Summary
 void changedUpdate(DocumentEvent evt, Shape a, ViewFactory f)
          Attributes were changed in the are this view is responsible for.
 int getBaseX(int y)
           
 int getHeight()
          Get total height of this view
 int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          !!! osetrit konec view -> jump na dalsi v branchview
protected  int getPaintAreas(Graphics g, int clipY, int clipHeight)
          Returns binary composition of paint areas
protected  int getPosFromY(int y)
          Get begin of line position from y-coord.
 View getView(int n)
          Gets the n-th child view.
 int getViewCount()
          Returns the number of child views in this view.
protected  int getViewStartY(BaseView view, int helperInd)
          Get child view's y base value.
protected  int getYFromPos(int pos)
          Get y coordinate from position.
 void insertUpdate(DocumentEvent evt, Shape a, ViewFactory f)
          Gives notification that something was inserted into the document in a location that this view is responsible for.
 Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a)
           
 Shape modelToView(int pos, Shape a, Position.Bias b)
           
 void modelToViewDG(int pos, org.netbeans.editor.DrawGraphics dg)
           
protected  void paintAreas(Graphics g, int clipY, int clipHeight, int paintAreas)
          Paint either top insets, main area, or bottom insets depending on paintAreas variable
 void removeUpdate(DocumentEvent evt, Shape a, ViewFactory f)
          Gives notification from the document that attributes were removed in a location that this view is responsible for.
 void setParent(View parent)
           
 void updateMainHeight()
          Compute and update main area height
 int viewToModel(float x, float y, Shape a, Position.Bias[] biasReturn)
          Get position from location on screen.
 
Methods inherited from class org.netbeans.editor.BaseView
displayHierarchy, getAlignment, getComponent, getEditorUI, getInsets, getPreferredSpan, getStartY, invalidateStartY, isPacked, paint, setHelperInd, setPacked, toString
 
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getParent, getResizeWeight, getStartOffset, getToolTipText, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, preferenceChanged, remove, removeAll, replace, setSize, updateChildren, updateLayout, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mainHeight

protected int mainHeight
Height of the area this view manages excluding areas managed by its children and excluding insets.

Constructor Detail

LeafView

public LeafView(Element elem)
Construct new base view

Method Detail

setParent

public void setParent(View parent)
Overrides:
setParent in class View

getPaintAreas

protected int getPaintAreas(Graphics g,
                            int clipY,
                            int clipHeight)
Returns binary composition of paint areas

Specified by:
getPaintAreas in class BaseView
Parameters:
g - Graphics to paint through

paintAreas

protected void paintAreas(Graphics g,
                          int clipY,
                          int clipHeight,
                          int paintAreas)
Paint either top insets, main area, or bottom insets depending on paintAreas variable

Specified by:
paintAreas in class BaseView
Parameters:
g - Graphics to paint through
paintAreas - binary composition of paint areas

getHeight

public int getHeight()
Get total height of this view

Specified by:
getHeight in class BaseView

updateMainHeight

public void updateMainHeight()
Compute and update main area height

Specified by:
updateMainHeight in class BaseView

getPosFromY

protected int getPosFromY(int y)
Get begin of line position from y-coord. If the position is before main area begining it returns start position. If it's beyond the end of view it returns end position.

Specified by:
getPosFromY in class BaseView
Parameters:
y - y-coord to inspect always returns startOffset for y < start of main area
eol - means to return end of specified line instead of begining
Returns:
position in the document

getBaseX

public int getBaseX(int y)
Specified by:
getBaseX in class BaseView

getViewCount

public final int getViewCount()
Returns the number of child views in this view.

Overrides:
getViewCount in class View

getView

public final View getView(int n)
Gets the n-th child view.

Overrides:
getView in class View

getNextVisualPositionFrom

public int getNextVisualPositionFrom(int pos,
                                     Position.Bias b,
                                     Shape a,
                                     int direction,
                                     Position.Bias[] biasRet)
                              throws BadLocationException
!!! osetrit konec view -> jump na dalsi v branchview

Overrides:
getNextVisualPositionFrom in class View
Throws:
BadLocationException

getYFromPos

protected int getYFromPos(int pos)
                   throws BadLocationException
Get y coordinate from position. The position can lay anywhere inside this view.

Specified by:
getYFromPos in class BaseView
Throws:
BadLocationException

modelToView

public Shape modelToView(int pos,
                         Shape a,
                         Position.Bias b)
                  throws BadLocationException
Specified by:
modelToView in class View
Throws:
BadLocationException

modelToView

public Shape modelToView(int p0,
                         Position.Bias b0,
                         int p1,
                         Position.Bias b1,
                         Shape a)
                  throws BadLocationException
Overrides:
modelToView in class View
Throws:
BadLocationException

modelToViewDG

public void modelToViewDG(int pos,
                          org.netbeans.editor.DrawGraphics dg)
                   throws BadLocationException
Specified by:
modelToViewDG in class BaseView
Throws:
BadLocationException

viewToModel

public int viewToModel(float x,
                       float y,
                       Shape a,
                       Position.Bias[] biasReturn)
Get position from location on screen.

Specified by:
viewToModel in class View
Parameters:
x - the X coordinate >= 0
y - the Y coordinate >= 0
a - the allocated region to render into
Returns:
the location within the model that best represents the given point in the view >= 0

insertUpdate

public void insertUpdate(DocumentEvent evt,
                         Shape a,
                         ViewFactory f)
Gives notification that something was inserted into the document in a location that this view is responsible for.

Overrides:
insertUpdate in class View
Parameters:
e - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children

removeUpdate

public void removeUpdate(DocumentEvent evt,
                         Shape a,
                         ViewFactory f)
Gives notification from the document that attributes were removed in a location that this view is responsible for.

Overrides:
removeUpdate in class View
Parameters:
e - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children

changedUpdate

public void changedUpdate(DocumentEvent evt,
                          Shape a,
                          ViewFactory f)
Attributes were changed in the are this view is responsible for.

Overrides:
changedUpdate in class View
Parameters:
e - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children

getViewStartY

protected int getViewStartY(BaseView view,
                            int helperInd)
Get child view's y base value. Invalid in this case.

Specified by:
getViewStartY in class BaseView
Parameters:
view - is child view of this view for which the offset should be computed.
helperInd - is index that child view has cached to ease the parent view to search for it in its children array. If this index is correct, parent uses it. If it's incorrect parent view searches through the whole array of its children to find the child. It then calls children's setParentInd() to correct its location index.

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.