org.jdesktop.swingx.plaf
Class ContextMenuAuxTextUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.TextUI
          extended by org.jdesktop.swingx.plaf.ContextMenuAuxTextUI

public class ContextMenuAuxTextUI
extends TextUI


Constructor Summary
ContextMenuAuxTextUI()
           
 
Method Summary
static ComponentUI createUI(JComponent c)
           
 void damageRange(JTextComponent t, int p0, int p1)
          Causes the portion of the view responsible for the given part of the model to be repainted.
 void damageRange(JTextComponent t, int p0, int p1, Position.Bias firstBias, Position.Bias secondBias)
          Causes the portion of the view responsible for the given part of the model to be repainted.
 EditorKit getEditorKit(JTextComponent t)
          Fetches the binding of services that set a policy for the type of document being edited.
 int getNextVisualPositionFrom(JTextComponent t, int pos, Position.Bias b, int direction, Position.Bias[] biasRet)
          Provides a way to determine the next visually represented model location that one might place a caret.
 View getRootView(JTextComponent t)
          Fetches a View with the allocation of the associated text component (i.e.
 void installUI(JComponent comp)
          Configures the specified component appropriate for the look and feel.
 Rectangle modelToView(JTextComponent t, int pos)
          Converts the given location in the model to a place in the view coordinate system.
 Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias)
          Converts the given location in the model to a place in the view coordinate system.
 void uninstallUI(JComponent comp)
          Reverses configuration which was done on the specified component during installUI.
 void update(Graphics g, JComponent c)
          Notifies this UI delegate that it's time to paint the specified component.
 int viewToModel(JTextComponent t, Point pt)
          Converts the given place in the view coordinate system to the nearest representative location in the model.
 int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn)
          Provides a mapping from the view coordinate space to the logical coordinate space of the model.
 
Methods inherited from class javax.swing.plaf.TextUI
getToolTipText
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextMenuAuxTextUI

public ContextMenuAuxTextUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent c)

installUI

public void installUI(JComponent comp)
Description copied from class: javax.swing.plaf.ComponentUI
Configures the specified component appropriate for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:
  1. Install any default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  7. Initialize any appropriate instance data.

Overrides:
installUI in class ComponentUI
Parameters:
comp - the component where this UI delegate is being installed
See Also:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

uninstallUI

public void uninstallUI(JComponent comp)
Description copied from class: javax.swing.plaf.ComponentUI
Reverses configuration which was done on the specified component during installUI. This method is invoked when this UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in installUI, being careful to leave the JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:
  1. Remove any UI-set borders from the component.
  2. Remove any UI-set layout managers on the component.
  3. Remove any UI-added sub-components from the component.
  4. Remove any UI-added event/property listeners from the component.
  5. Remove any UI-installed keyboard UI from the component.
  6. Nullify any allocated instance data objects to allow for GC.

Overrides:
uninstallUI in class ComponentUI
Parameters:
comp - the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
See Also:
ComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()

update

public void update(Graphics g,
                   JComponent c)
Description copied from class: javax.swing.plaf.ComponentUI
Notifies this UI delegate that it's time to paint the specified component. This method is invoked by JComponent when the specified component is being painted. By default this method will fill the specified component with its background color (if its opaque property is true) and then immediately call paint. In general this method need not be overridden by subclasses; all look-and-feel rendering code should reside in the paint method.

Overrides:
update in class ComponentUI
Parameters:
g - the Graphics context in which to paint
c - the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
See Also:
ComponentUI.paint(java.awt.Graphics, javax.swing.JComponent), JComponent.paintComponent(java.awt.Graphics)

modelToView

public Rectangle modelToView(JTextComponent t,
                             int pos)
                      throws BadLocationException
Description copied from class: javax.swing.plaf.TextUI
Converts the given location in the model to a place in the view coordinate system.

Specified by:
modelToView in class TextUI
pos - the local location in the model to translate >= 0
Returns:
the coordinates as a rectangle
Throws:
BadLocationException - if the given position does not represent a valid location in the associated document

modelToView

public Rectangle modelToView(JTextComponent t,
                             int pos,
                             Position.Bias bias)
                      throws BadLocationException
Description copied from class: javax.swing.plaf.TextUI
Converts the given location in the model to a place in the view coordinate system.

Specified by:
modelToView in class TextUI
pos - the local location in the model to translate >= 0
Returns:
the coordinates as a rectangle
Throws:
BadLocationException - if the given position does not represent a valid location in the associated document

viewToModel

public int viewToModel(JTextComponent t,
                       Point pt)
Description copied from class: javax.swing.plaf.TextUI
Converts the given place in the view coordinate system to the nearest representative location in the model.

Specified by:
viewToModel in class TextUI
pt - the location in the view to translate. This should be in the same coordinate system as the mouse events.
Returns:
the offset from the start of the document >= 0

viewToModel

public int viewToModel(JTextComponent t,
                       Point pt,
                       Position.Bias[] biasReturn)
Description copied from class: javax.swing.plaf.TextUI
Provides a mapping from the view coordinate space to the logical coordinate space of the model.

Specified by:
viewToModel in class TextUI
pt - the location in the view to translate. This should be in the same coordinate system as the mouse events.
biasReturn - filled in by this method to indicate whether the point given is closer to the previous or the next character in the model
Returns:
the location within the model that best represents the given point in the view >= 0

getNextVisualPositionFrom

public int getNextVisualPositionFrom(JTextComponent t,
                                     int pos,
                                     Position.Bias b,
                                     int direction,
                                     Position.Bias[] biasRet)
                              throws BadLocationException
Description copied from class: javax.swing.plaf.TextUI
Provides a way to determine the next visually represented model location that one might place a caret. Some views may not be visible, they might not be in the same order found in the model, or they just might not allow access to some of the locations in the model.

Specified by:
getNextVisualPositionFrom in class TextUI
pos - the position to convert >= 0
direction - the direction from the current position that can be thought of as the arrow keys typically found on a keyboard. This may be SwingConstants.WEST, SwingConstants.EAST, SwingConstants.NORTH, or SwingConstants.SOUTH.
Returns:
the location within the model that best represents the next location visual position.
Throws:
BadLocationException

damageRange

public void damageRange(JTextComponent t,
                        int p0,
                        int p1)
Description copied from class: javax.swing.plaf.TextUI
Causes the portion of the view responsible for the given part of the model to be repainted.

Specified by:
damageRange in class TextUI
p0 - the beginning of the range >= 0
p1 - the end of the range >= p0

damageRange

public void damageRange(JTextComponent t,
                        int p0,
                        int p1,
                        Position.Bias firstBias,
                        Position.Bias secondBias)
Description copied from class: javax.swing.plaf.TextUI
Causes the portion of the view responsible for the given part of the model to be repainted.

Specified by:
damageRange in class TextUI
p0 - the beginning of the range >= 0
p1 - the end of the range >= p0

getEditorKit

public EditorKit getEditorKit(JTextComponent t)
Description copied from class: javax.swing.plaf.TextUI
Fetches the binding of services that set a policy for the type of document being edited. This contains things like the commands available, stream readers and writers, etc.

Specified by:
getEditorKit in class TextUI
Returns:
the editor kit binding

getRootView

public View getRootView(JTextComponent t)
Description copied from class: javax.swing.plaf.TextUI
Fetches a View with the allocation of the associated text component (i.e. the root of the hierarchy) that can be traversed to determine how the model is being represented spatially.

Specified by:
getRootView in class TextUI
Returns:
the view