com.eliad.swing
Class BasicGridUI

java.lang.Object
  |
  +--javax.swing.plaf.ComponentUI
        |
        +--com.eliad.swing.GridUI
              |
              +--com.eliad.swing.BasicGridUI
Direct Known Subclasses:
BasicGridHeaderUI

public class BasicGridUI
extends GridUI
implements RulerConstants

Basic GridUI implementation. Suitable both for grid views, and for grid headers.

Version:
0.90 00/03/26
Author:
Patrick Mérissert-Coffinières

Inner Class Summary
 class BasicGridUI.FocusHandler
          This inner class is marked "public" due to a compiler bug.
 class BasicGridUI.MouseInputHandler
          This inner class is marked "public" due to a compiler bug.
 class BasicGridUI.ResizableContext
           
 
Field Summary
protected  java.awt.event.FocusListener focusListener_
           
protected  JSmartGrid grid_
          The JSmartGrid that is delegating the painting to this UI.
protected  java.awt.event.KeyListener keyListener_
           
protected  javax.swing.event.MouseInputListener mouseInputListener_
           
 
Constructor Summary
BasicGridUI()
           
 
Method Summary
protected  void clearDirtyDraggingArea(java.awt.Graphics g, java.awt.Rectangle band)
          Repaints the background of the grid (probably in front of part of other cells). before painting the dragged cells.
protected  void clearDraggingArea(java.awt.Graphics g, java.awt.Rectangle band)
          Paints the area vacated by the dragged cells with the background behind the grid.
protected  java.awt.event.FocusListener createFocusListener()
          Creates the focus listener for handling keyboard navigation in the JSmartGrid.
protected  java.awt.event.KeyListener createKeyListener()
          Creates the key listener for handling keyboard navigation in the JSmartGrid.
protected  javax.swing.event.MouseInputListener createMouseInputListener()
          Creates the mouse listener for the JSmartGrid.
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
 java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
          Return the maximum size of the grid.
 java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
          Return the minimum size of the grid.
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          Return the preferred size of the grid.
protected  void installDefaults()
          Initialize Grid properties, e.g. font, foreground, and background.
protected  void installKeyboardActions()
          Register all keyboard actions on the JSmartGrid.
protected  void installListeners()
          Attaches listeners to the JSmartGrid.
 void installUI(javax.swing.JComponent jc)
           
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paint a representation of the JSmartGrid instance that was set in installUI().
protected  void uninstallDefaults()
           
protected  void uninstallKeyboardActions()
           
protected  void uninstallListeners()
          Cleans up listeners to the JSmartGrid.
 void uninstallUI(javax.swing.JComponent c)
           
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

grid_

protected JSmartGrid grid_
The JSmartGrid that is delegating the painting to this UI.

keyListener_

protected java.awt.event.KeyListener keyListener_

focusListener_

protected java.awt.event.FocusListener focusListener_

mouseInputListener_

protected javax.swing.event.MouseInputListener mouseInputListener_
Constructor Detail

BasicGridUI

public BasicGridUI()
Method Detail

createKeyListener

protected java.awt.event.KeyListener createKeyListener()
Creates the key listener for handling keyboard navigation in the JSmartGrid.

createFocusListener

protected java.awt.event.FocusListener createFocusListener()
Creates the focus listener for handling keyboard navigation in the JSmartGrid.

createMouseInputListener

protected javax.swing.event.MouseInputListener createMouseInputListener()
Creates the mouse listener for the JSmartGrid.

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

installUI

public void installUI(javax.swing.JComponent jc)
Overrides:
installUI in class javax.swing.plaf.ComponentUI

installDefaults

protected void installDefaults()
Initialize Grid properties, e.g. font, foreground, and background. The font, foreground, and background properties are only set if their current value is either null or a UIResource, other properties are set if the current value is null.
See Also:
installUI(javax.swing.JComponent)

installListeners

protected void installListeners()
Attaches listeners to the JSmartGrid.

installKeyboardActions

protected void installKeyboardActions()
Register all keyboard actions on the JSmartGrid.

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Overrides:
uninstallUI in class javax.swing.plaf.ComponentUI

uninstallDefaults

protected void uninstallDefaults()

uninstallListeners

protected void uninstallListeners()
Cleans up listeners to the JSmartGrid.

uninstallKeyboardActions

protected void uninstallKeyboardActions()

getMinimumSize

public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
Return the minimum size of the grid.
Overrides:
getMinimumSize in class javax.swing.plaf.ComponentUI

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Return the preferred size of the grid. The preferred height is the row height times the number of rows. The preferred width is the sum of the preferred widths of each column.
Overrides:
getPreferredSize in class javax.swing.plaf.ComponentUI

getMaximumSize

public java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
Return the maximum size of the grid.
Overrides:
getMaximumSize in class javax.swing.plaf.ComponentUI

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paint a representation of the JSmartGrid instance that was set in installUI().
Overrides:
paint in class javax.swing.plaf.ComponentUI

clearDraggingArea

protected void clearDraggingArea(java.awt.Graphics g,
                                 java.awt.Rectangle band)
Paints the area vacated by the dragged cells with the background behind the grid.

clearDirtyDraggingArea

protected void clearDirtyDraggingArea(java.awt.Graphics g,
                                      java.awt.Rectangle band)
Repaints the background of the grid (probably in front of part of other cells). before painting the dragged cells.