org.basex.gui.layout
Class BaseXText

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.basex.gui.layout.BaseXBack
                      extended by org.basex.gui.layout.BaseXPanel
                          extended by org.basex.gui.layout.BaseXText
All Implemented Interfaces:
ComponentListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class BaseXText
extends BaseXPanel

This class offers a fast text input, using the BaseXTextRenderer class.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class org.basex.gui.layout.BaseXPanel
gui
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
BaseXText(boolean edit, Window win)
          Default constructor.
 
Method Summary
 void addSearch(BaseXTextField f)
          Adds a search dialog.
 void componentResized(ComponentEvent e)
           
 void error(int s)
          Refreshes the syntax highlighting.
 void find(int y)
          Displays the search term.
 void find(String t, boolean b)
          Finds the specified term.
 byte[] getText()
          Returns the output text.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void mouseWheelMoved(MouseWheelEvent e)
           
 void scrollToEnd()
          Jumps to the end of the text.
 void selectAll()
          Selects the whole text.
 void setCaret(int p)
          Sets a new cursor position.
 void setEnabled(boolean e)
           
 void setFont(Font f)
           
 void setSyntax(BaseXSyntax s)
          Sets a syntax highlighter.
 void setText(byte[] t)
          Sets the output text.
 void setText(byte[] t, int s)
          Sets the output text.
 void showCursor(int align)
          Displays the currently edited text area.
 
Methods inherited from class org.basex.gui.layout.BaseXPanel
componentHidden, componentMoved, componentShown, mouseClicked, mouseMoved
 
Methods inherited from class org.basex.gui.layout.BaseXBack
paintComponent, setBorder, setMode
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseXText

public BaseXText(boolean edit,
                 Window win)
Default constructor.

Parameters:
edit - editable flag
win - parent window
Method Detail

setText

public void setText(byte[] t)
Sets the output text.

Parameters:
t - output text

addSearch

public final void addSearch(BaseXTextField f)
Adds a search dialog.

Parameters:
f - search field

find

public final void find(String t,
                       boolean b)
Finds the specified term.

Parameters:
t - output text
b - backward browsing

find

public final void find(int y)
Displays the search term.

Parameters:
y - vertical position

setText

public final void setText(byte[] t,
                          int s)
Sets the output text.

Parameters:
t - output text
s - text size

setSyntax

public final void setSyntax(BaseXSyntax s)
Sets a syntax highlighter.

Parameters:
s - syntax reference

setCaret

public final void setCaret(int p)
Sets a new cursor position.

Parameters:
p - cursor position

scrollToEnd

public final void scrollToEnd()
Jumps to the end of the text.


getText

public final byte[] getText()
Returns the output text.

Returns:
output text

setFont

public final void setFont(Font f)
Overrides:
setFont in class JComponent

error

public final void error(int s)
Refreshes the syntax highlighting.

Parameters:
s - start of optional error mark

setEnabled

public final void setEnabled(boolean e)
Overrides:
setEnabled in class JComponent

selectAll

public final void selectAll()
Selects the whole text.


mouseEntered

public final void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener
Overrides:
mouseEntered in class BaseXPanel

mouseExited

public final void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
Overrides:
mouseExited in class BaseXPanel

mouseReleased

public final void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class BaseXPanel

mouseDragged

public final void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class BaseXPanel

mousePressed

public final void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class BaseXPanel

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener
Overrides:
keyPressed in class BaseXPanel

showCursor

public final void showCursor(int align)
Displays the currently edited text area.

Parameters:
align - vertical alignment

keyTyped

public final void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener
Overrides:
keyTyped in class BaseXPanel

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener
Overrides:
keyReleased in class BaseXPanel

mouseWheelMoved

public final void mouseWheelMoved(MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface MouseWheelListener
Overrides:
mouseWheelMoved in class BaseXPanel

componentResized

public final void componentResized(ComponentEvent e)
Specified by:
componentResized in interface ComponentListener
Overrides:
componentResized in class BaseXPanel