Package docking.widgets.fieldpanel
Class FieldPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- docking.widgets.fieldpanel.FieldPanel
-
- All Implemented Interfaces:
LayoutModelListener
,IndexedScrollable
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.event.ChangeListener
public class FieldPanel extends javax.swing.JPanel implements IndexedScrollable, LayoutModelListener, javax.swing.event.ChangeListener
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
FieldPanel.BigFieldPanelMouseWheelListener
class
FieldPanel.CursorHandler
class
FieldPanel.FieldPanelFocusListener
class
FieldPanel.FieldPanelMouseAdapter
class
FieldPanel.FieldPanelMouseMotionAdapter
class
FieldPanel.MouseHandler
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description protected BackgroundColorModel
backgroundColorModel
static int
MOUSEWHEEL_LINES_TO_SCROLL
protected PaintContext
paintContext
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description FieldPanel(LayoutModel model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFieldInputListener(FieldInputListener listener)
void
addFieldLocationListener(FieldLocationListener listener)
void
addFieldMouseListener(FieldMouseListener listener)
void
addFieldSelectionListener(FieldSelectionListener listener)
void
addHighlightListener(FieldSelectionListener listener)
void
addIndexScrollListener(IndexScrollListener listener)
void
addLayoutListener(LayoutListener listener)
void
addLiveFieldSelectionListener(FieldSelectionListener listener)
Adds a selection listener that will be notified while the selection is being createdvoid
addViewListener(ViewListener listener)
void
center(FieldLocation location)
void
clearHighlight()
Clears the marked area highlight;void
clearSelection()
Clears the selection;void
cursorBottomOfFile()
void
cursorDown()
void
cursorEnd()
Moves the cursor to the end of the line.void
cursorHome()
Moves the cursor to the beginning of the line.void
cursorLeft()
void
cursorRight()
void
cursorTopOfFile()
void
cursorUp()
void
dataChanged(java.math.BigInteger start, java.math.BigInteger end)
Called when the data at an index or range of indexes changes.void
dispose()
Cleans up resources when this FieldPanel is no longer needed.void
enableSelection(boolean b)
java.awt.Color
getBackground()
java.awt.Color
getBackgroundColor()
Returns the default background color.java.awt.Color
getBackgroundColor(java.math.BigInteger index)
Field
getCurrentField()
java.awt.Rectangle
getCursorBounds()
FieldLocation
getCursorLocation()
int
getCursorOffset()
Returns the offset of the cursor from the top of the screenjava.awt.Point
getCursorPoint()
Returns the point in pixels of where the cursor is located.Field
getFieldAt(int x, int y, FieldLocation loc)
Returns the Field at the given x,y coordinates.java.awt.Color
getFocusedCursorColor()
Returns the current cursor color.java.awt.Color
getForegroundColor()
Returns the foreground color.int
getHeight(java.math.BigInteger index)
FieldSelection
getHighlight()
Returns the current highlight (marked area).java.awt.Color
getHighlightColor()
Returns the color color used as the background for highlighted items.HoverHandler
getHoverHandler()
Returns the class responsible for triggering popups for this field panel.java.math.BigInteger
getIndexAfter(java.math.BigInteger index)
java.math.BigInteger
getIndexBefore(java.math.BigInteger index)
java.math.BigInteger
getIndexCount()
LayoutModel
getLayoutModel()
protected LayoutBackgroundColorManager
getLayoutSelectionMap(java.math.BigInteger layoutIndex)
FieldLocation
getLocationForPoint(int x, int y)
java.awt.Color
getNonFocusCursorColor()
int
getOffset(FieldLocation location)
java.awt.Point
getPointForLocation(FieldLocation location)
java.awt.Dimension
getPreferredSize()
FieldSelection
getSelection()
Returns the current selection.java.awt.Color
getSelectionColor()
Returns the color used as the background for selected items.ViewerPosition
getViewerPosition()
Returns a ViewerPosition object which contains the top of screen information.AnchoredLayout
getVisibleEndLayout()
Returns the last visible layout or null if there are no visible layoutsjava.util.List<AnchoredLayout>
getVisibleLayouts()
AnchoredLayout
getVisibleStartLayout()
Returns the first visible layout or null if there are no visible layoutsvoid
goTo(java.math.BigInteger index, int fieldNum, int row, int col, boolean alwaysCenterCursor)
Sets the cursor to the given Field location and attempts to show that location in the center of the screen.protected void
goTo(java.math.BigInteger index, int fieldNum, int row, int col, boolean alwaysCenterCursor, EventTrigger trigger)
boolean
isCursorOn()
Returns the state of the cursor.boolean
isFocused()
boolean
isLocationVisible(FieldLocation location)
Returns true if the given field location is rendered on the screen; false if scrolled offscreenboolean
isStartDragOK()
boolean
isUniformIndex()
void
modelSizeChanged(IndexMapper indexMapper)
Called whenever the number of indexes changedvoid
pageDown()
void
pageUp()
protected void
paintComponent(java.awt.Graphics g)
void
positionCursor(int offset)
Scrolls the view so that the cursor is at the given offset from the top of the screenvoid
removeFieldInputListener(FieldInputListener listener)
void
removeFieldLocationListener(FieldLocationListener listener)
void
removeFieldMouseListener(FieldMouseListener listener)
void
removeFieldSelectionListener(FieldSelectionListener listener)
void
removeHighlightListener(FieldSelectionListener listener)
void
removeIndexScrollListener(IndexScrollListener listener)
void
removeLayoutListener(LayoutListener listener)
void
removeLiveFieldSelectionListener(FieldSelectionListener listener)
Removes the selection listener from being notified when the selection is being createdvoid
removeViewListener(ViewListener listener)
void
repaint()
void
scrollLineDown()
void
scrollLineUp()
void
scrollPageDown()
void
scrollPageUp()
void
scrollTo(FieldLocation fieldLocation)
void
scrollToCursor()
void
scrollView(int viewAmount)
void
setBackgroundColor(java.awt.Color c)
Sets the default background colorvoid
setBackgroundColorModel(BackgroundColorModel model)
void
setBlinkCursor(java.lang.Boolean blinkCursor)
void
setBounds(int x, int y, int width, int height)
void
setCursorOn(boolean cursorOn)
Sets the cursor on or off.boolean
setCursorPosition(java.math.BigInteger index, int fieldNum, int row, int col)
Sets the cursorPosition to the given location.boolean
setCursorPosition(java.math.BigInteger index, int fieldNum, int row, int col, EventTrigger trigger)
Sets the cursorPosition to the given location with the given trigger.void
setFocusedCursorColor(java.awt.Color color)
Sets the cursor color for when this component has focus.void
setHighlight(FieldSelection sel)
Sets the current highlight to the specified field selection.void
setHighlightColor(java.awt.Color color)
Sets the highlight colorvoid
setHorizontalScrollingEnabled(boolean enabled)
void
setHoverProvider(HoverProvider hoverProvider)
Add a new hover provider to be managed.void
setLayoutModel(LayoutModel model)
Sets the layout model for this field panelvoid
setNonFocusCursorColor(java.awt.Color color)
Sets the cursor color for when this component does not have focus.void
setSelection(FieldSelection sel)
Sets the current selection.void
setSelectionColor(java.awt.Color color)
Sets the selection colorvoid
setViewerPosition(java.math.BigInteger index, int xPos, int yPos)
Scrolls the display to show the layout specified by index at the vertical position specified by yPos.void
showIndex(java.math.BigInteger layoutIndex, int verticalOffset)
void
stateChanged(javax.swing.event.ChangeEvent e)
void
takeFocus()
Tell the panel to grab the keyboard input focus.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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
-
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, 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
MOUSEWHEEL_LINES_TO_SCROLL
public static final int MOUSEWHEEL_LINES_TO_SCROLL
- See Also:
- Constant Field Values
-
backgroundColorModel
protected BackgroundColorModel backgroundColorModel
-
paintContext
protected PaintContext paintContext
-
-
Constructor Detail
-
FieldPanel
public FieldPanel(LayoutModel model)
-
-
Method Detail
-
showIndex
public void showIndex(java.math.BigInteger layoutIndex, int verticalOffset)
- Specified by:
showIndex
in interfaceIndexedScrollable
-
scrollView
public void scrollView(int viewAmount)
-
scrollTo
public void scrollTo(FieldLocation fieldLocation)
-
center
public void center(FieldLocation location)
-
scrollLineDown
public void scrollLineDown()
- Specified by:
scrollLineDown
in interfaceIndexedScrollable
-
scrollLineUp
public void scrollLineUp()
- Specified by:
scrollLineUp
in interfaceIndexedScrollable
-
scrollPageDown
public void scrollPageDown()
- Specified by:
scrollPageDown
in interfaceIndexedScrollable
-
scrollPageUp
public void scrollPageUp()
- Specified by:
scrollPageUp
in interfaceIndexedScrollable
-
pageUp
public void pageUp()
-
pageDown
public void pageDown()
-
getHeight
public int getHeight(java.math.BigInteger index)
- Specified by:
getHeight
in interfaceIndexedScrollable
-
getIndexAfter
public java.math.BigInteger getIndexAfter(java.math.BigInteger index)
- Specified by:
getIndexAfter
in interfaceIndexedScrollable
-
getIndexBefore
public java.math.BigInteger getIndexBefore(java.math.BigInteger index)
- Specified by:
getIndexBefore
in interfaceIndexedScrollable
-
getIndexCount
public java.math.BigInteger getIndexCount()
- Specified by:
getIndexCount
in interfaceIndexedScrollable
-
isUniformIndex
public boolean isUniformIndex()
- Specified by:
isUniformIndex
in interfaceIndexedScrollable
-
cursorUp
public void cursorUp()
-
cursorDown
public void cursorDown()
-
cursorLeft
public void cursorLeft()
-
cursorRight
public void cursorRight()
-
cursorHome
public void cursorHome()
Moves the cursor to the beginning of the line.
-
cursorTopOfFile
public void cursorTopOfFile()
-
cursorBottomOfFile
public void cursorBottomOfFile()
-
cursorEnd
public void cursorEnd()
Moves the cursor to the end of the line.
-
getVisibleLayouts
public java.util.List<AnchoredLayout> getVisibleLayouts()
-
isLocationVisible
public boolean isLocationVisible(FieldLocation location)
Returns true if the given field location is rendered on the screen; false if scrolled offscreen- Parameters:
location
- the location to check- Returns:
- true if the location is on the screen
-
getVisibleStartLayout
public AnchoredLayout getVisibleStartLayout()
Returns the first visible layout or null if there are no visible layouts- Returns:
- the first visible layout
-
getVisibleEndLayout
public AnchoredLayout getVisibleEndLayout()
Returns the last visible layout or null if there are no visible layouts- Returns:
- the last visible layout
-
repaint
public void repaint()
- Overrides:
repaint
in classjava.awt.Component
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
getPreferredSize
in classjavax.swing.JComponent
-
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent e)
- Specified by:
stateChanged
in interfacejavax.swing.event.ChangeListener
-
setBounds
public void setBounds(int x, int y, int width, int height)
- Overrides:
setBounds
in classjava.awt.Component
-
setBlinkCursor
public void setBlinkCursor(java.lang.Boolean blinkCursor)
-
enableSelection
public void enableSelection(boolean b)
-
setHorizontalScrollingEnabled
public void setHorizontalScrollingEnabled(boolean enabled)
-
getBackgroundColor
public java.awt.Color getBackgroundColor()
Returns the default background color.
-
getBackground
public java.awt.Color getBackground()
- Overrides:
getBackground
in classjava.awt.Component
-
setBackgroundColor
public void setBackgroundColor(java.awt.Color c)
Sets the default background color- Parameters:
c
- the color to use for the background.
-
getBackgroundColor
public java.awt.Color getBackgroundColor(java.math.BigInteger index)
-
setBackgroundColorModel
public void setBackgroundColorModel(BackgroundColorModel model)
-
getForegroundColor
public java.awt.Color getForegroundColor()
Returns the foreground color.
-
getSelectionColor
public java.awt.Color getSelectionColor()
Returns the color used as the background for selected items.
-
getHighlightColor
public java.awt.Color getHighlightColor()
Returns the color color used as the background for highlighted items.
-
getFocusedCursorColor
public java.awt.Color getFocusedCursorColor()
Returns the current cursor color.
-
getNonFocusCursorColor
public java.awt.Color getNonFocusCursorColor()
-
isFocused
public boolean isFocused()
-
dispose
public void dispose()
Cleans up resources when this FieldPanel is no longer needed.
-
getCursorPoint
public java.awt.Point getCursorPoint()
Returns the point in pixels of where the cursor is located.
-
getCursorBounds
public java.awt.Rectangle getCursorBounds()
-
getCursorLocation
public FieldLocation getCursorLocation()
-
getCurrentField
public Field getCurrentField()
-
addIndexScrollListener
public void addIndexScrollListener(IndexScrollListener listener)
- Specified by:
addIndexScrollListener
in interfaceIndexedScrollable
-
removeIndexScrollListener
public void removeIndexScrollListener(IndexScrollListener listener)
- Specified by:
removeIndexScrollListener
in interfaceIndexedScrollable
-
addFieldSelectionListener
public void addFieldSelectionListener(FieldSelectionListener listener)
-
removeFieldSelectionListener
public void removeFieldSelectionListener(FieldSelectionListener listener)
-
addLiveFieldSelectionListener
public void addLiveFieldSelectionListener(FieldSelectionListener listener)
Adds a selection listener that will be notified while the selection is being created- Parameters:
listener
- the listener to be notified
-
removeLiveFieldSelectionListener
public void removeLiveFieldSelectionListener(FieldSelectionListener listener)
Removes the selection listener from being notified when the selection is being created- Parameters:
listener
- the listener to be removed from being notified
-
addHighlightListener
public void addHighlightListener(FieldSelectionListener listener)
-
removeHighlightListener
public void removeHighlightListener(FieldSelectionListener listener)
-
addFieldMouseListener
public void addFieldMouseListener(FieldMouseListener listener)
-
removeFieldMouseListener
public void removeFieldMouseListener(FieldMouseListener listener)
-
addFieldInputListener
public void addFieldInputListener(FieldInputListener listener)
-
removeFieldInputListener
public void removeFieldInputListener(FieldInputListener listener)
-
addFieldLocationListener
public void addFieldLocationListener(FieldLocationListener listener)
-
removeFieldLocationListener
public void removeFieldLocationListener(FieldLocationListener listener)
-
addLayoutListener
public void addLayoutListener(LayoutListener listener)
-
removeLayoutListener
public void removeLayoutListener(LayoutListener listener)
-
addViewListener
public void addViewListener(ViewListener listener)
-
removeViewListener
public void removeViewListener(ViewListener listener)
-
setHoverProvider
public void setHoverProvider(HoverProvider hoverProvider)
Add a new hover provider to be managed.- Parameters:
hoverProvider
- the new hover provider to be managed.
-
getHoverHandler
public HoverHandler getHoverHandler()
Returns the class responsible for triggering popups for this field panel.- Returns:
- the hover handler.
-
getFieldAt
public Field getFieldAt(int x, int y, FieldLocation loc)
Returns the Field at the given x,y coordinates. Note the x,y must currently be visible on the screen or else this method will return null.- Parameters:
x
- the x mouse coordinate in the component.y
- the y mouse coordinate in the component.loc
- will be filled in with the FieldLocation for the given point. Values will be undefined if the Field return value is null.- Returns:
- Field the Field object the point is over.
-
clearSelection
public void clearSelection()
Clears the selection;
-
clearHighlight
public void clearHighlight()
Clears the marked area highlight;
-
setFocusedCursorColor
public void setFocusedCursorColor(java.awt.Color color)
Sets the cursor color for when this component has focus.- Parameters:
color
- Color to use for the cursor when this component has keyboard focus.
-
setNonFocusCursorColor
public void setNonFocusCursorColor(java.awt.Color color)
Sets the cursor color for when this component does not have focus.- Parameters:
color
- Color to use for the cursor when this component does not have keyboard focus.
-
getSelection
public FieldSelection getSelection()
Returns the current selection.
-
getHighlight
public FieldSelection getHighlight()
Returns the current highlight (marked area).
-
setSelection
public void setSelection(FieldSelection sel)
Sets the current selection.- Parameters:
sel
- the selection to set.
-
setHighlight
public void setHighlight(FieldSelection sel)
Sets the current highlight to the specified field selection.- Parameters:
sel
- the selection to set as the highlight.
-
setCursorPosition
public boolean setCursorPosition(java.math.BigInteger index, int fieldNum, int row, int col)
Sets the cursorPosition to the given location.- Parameters:
index
- the index of the Layout on which to place the cursor.fieldNum
- the index of the field within its layout on which to place the cursor.row
- the row within the field to place the cursor.col
- the col within the row to place the cursor.- Returns:
- true if the cursor changed
-
setCursorPosition
public boolean setCursorPosition(java.math.BigInteger index, int fieldNum, int row, int col, EventTrigger trigger)
Sets the cursorPosition to the given location with the given trigger.- Parameters:
index
- the index of the Layout on which to place the cursor.fieldNum
- the index of the field within its layout on which to place the cursor.row
- the row within the field to place the cursor.col
- the col within the row to place the cursor.trigger
- a caller-specified event trigger.- Returns:
- true if the cursor changed
-
setCursorOn
public void setCursorOn(boolean cursorOn)
Sets the cursor on or off. When the cursor is turned off, there is no visible cursor displayed on the screen.- Parameters:
cursorOn
- true turns the cursor on, false turns it off.
-
isCursorOn
public boolean isCursorOn()
Returns the state of the cursor. True if on, false if off.
-
scrollToCursor
public void scrollToCursor()
-
goTo
public void goTo(java.math.BigInteger index, int fieldNum, int row, int col, boolean alwaysCenterCursor)
Sets the cursor to the given Field location and attempts to show that location in the center of the screen.- Parameters:
index
- the index of the line to go to.fieldNum
- the field on the line to go to.row
- the row in the field to go to.col
- the column in the field to go to.alwaysCenterCursor
- if true, centers cursor on screen. Otherwise, only centers cursor if cursor is offscreen.
-
goTo
protected void goTo(java.math.BigInteger index, int fieldNum, int row, int col, boolean alwaysCenterCursor, EventTrigger trigger)
-
takeFocus
public void takeFocus()
Tell the panel to grab the keyboard input focus.
-
positionCursor
public void positionCursor(int offset)
Scrolls the view so that the cursor is at the given offset from the top of the screen- Parameters:
offset
- the pixel distance from the top of the screen at which to scroll the display such that the cursor is at that offset.
-
isStartDragOK
public boolean isStartDragOK()
-
setSelectionColor
public void setSelectionColor(java.awt.Color color)
Sets the selection color- Parameters:
color
- the color to use for selection.
-
setHighlightColor
public void setHighlightColor(java.awt.Color color)
Sets the highlight color- Parameters:
color
- the color to use for highlights.
-
getViewerPosition
public ViewerPosition getViewerPosition()
Returns a ViewerPosition object which contains the top of screen information. The ViewerPosition will have the index of the layout at the top of the screen and the yPos of that layout. For example, if the layout is completely displayed, yPos will be 0. If part of the layout is off the top off the screen, then yPos will have a negative value (indicating that it begins above the displayable part of the screen.
-
setViewerPosition
public void setViewerPosition(java.math.BigInteger index, int xPos, int yPos)
Scrolls the display to show the layout specified by index at the vertical position specified by yPos. Generally, the index will be layout at the top of the screen and the yPos will be <= 0, meaning the layout may be partially off the top of the screen.- Parameters:
index
- the index of the layout to show at the top of the screen.yPos
- the position to show the layout.
-
getLayoutModel
public LayoutModel getLayoutModel()
-
setLayoutModel
public void setLayoutModel(LayoutModel model)
Sets the layout model for this field panel- Parameters:
model
- the layout model to use.
-
dataChanged
public void dataChanged(java.math.BigInteger start, java.math.BigInteger end)
Description copied from interface:LayoutModelListener
Called when the data at an index or range of indexes changes.- Specified by:
dataChanged
in interfaceLayoutModelListener
- Parameters:
start
- the starting index for the region of data changes.end
- the ending index (inclusive) for the region of data changes.
-
modelSizeChanged
public void modelSizeChanged(IndexMapper indexMapper)
Description copied from interface:LayoutModelListener
Called whenever the number of indexes changed- Specified by:
modelSizeChanged
in interfaceLayoutModelListener
- Parameters:
indexMapper
- Maps indexes from before the model size change to indexes after the model size changed.
-
paintComponent
protected void paintComponent(java.awt.Graphics g)
- Overrides:
paintComponent
in classjavax.swing.JComponent
-
getOffset
public int getOffset(FieldLocation location)
-
getCursorOffset
public int getCursorOffset()
Returns the offset of the cursor from the top of the screen
-
getLayoutSelectionMap
protected LayoutBackgroundColorManager getLayoutSelectionMap(java.math.BigInteger layoutIndex)
-
getPointForLocation
public java.awt.Point getPointForLocation(FieldLocation location)
-
getLocationForPoint
public FieldLocation getLocationForPoint(int x, int y)
-
-