Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.trapezium.chisel.gui
Class ScrollablePane  view ScrollablePane download ScrollablePane.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended bycom.trapezium.chisel.gui.ChiselAWTPane
              extended bycom.trapezium.chisel.gui.ScrollablePane
All Implemented Interfaces:
java.awt.event.AdjustmentListener, DisplayConstants, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, com.trapezium.chisel.Workspace
Direct Known Subclasses:
ChiselAWTViewer.SceneTextPane

public class ScrollablePane
extends ChiselAWTPane
implements java.awt.event.AdjustmentListener

The base container for our own gui implementation. This class includes commonly needed functionality such as double buffering, background texture and border.


Nested Class Summary
(package private)  class ScrollablePane.ComponentTracker
           
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int DYNAMIC
           
private  java.awt.Rectangle fullRect
           
private  boolean hEnabled
           
(package private)  HolderPane holder
           
(package private)  java.awt.Component hScrollComponent
           
(package private)  int mode
           
static int STATIC
           
private  java.awt.event.ComponentAdapter tracker
           
private  boolean vEnabled
           
(package private)  java.awt.Component vScrollComponent
           
 
Fields inherited from class com.trapezium.chisel.gui.ChiselAWTPane
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.trapezium.chisel.gui.DisplayConstants
BOTTOM_MARGIN, DEFAULT_ACTIVECOLOR, DEFAULT_BGCOLOR, DEFAULT_BORDERCOLOR, DEFAULT_CONTROLCOLOR, DEFAULT_DECAL, DEFAULT_FADEDTEXTCOLOR, DEFAULT_FRAMECOLOR, DEFAULT_GROOVECOLOR, DEFAULT_INACTIVECOLOR, DEFAULT_LITESHADOWCOLOR, DEFAULT_PANECOLOR, DEFAULT_POPUPCOLOR, DEFAULT_POPUPTEXTCOLOR, DEFAULT_PROGRESSBARCOLOR, DEFAULT_ROWHEADERCOLOR, DEFAULT_RULECOLOR, DEFAULT_SELECTEDCOLOR, DEFAULT_SELECTEDTEXTCOLOR, DEFAULT_SHADOWCOLOR, DEFAULT_STATUSBARCOLOR, DEFAULT_TABLECOLOR, DEFAULT_TEXTCOLOR, DEFAULT_TILE, DEFAULT_TILEX, DEFAULT_TILEY, DEFAULT_TITLETEXTCOLOR, DEFAULT_TOOLBARCOLOR, DEFAULT_TOOLTIPCOLOR, DEFAULT_TOPTABLECOLOR, DEFAULT_WORKSPACECOLOR, FRAMED_BORDER, HGAP, LEFT_MARGIN, LOWERED_BORDER, NO_BORDER, RAISED_BORDER, RIGHT_MARGIN, THICK_BORDER, THIN_BORDER, TOP_MARGIN, VGAP
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ScrollablePane()
           
ScrollablePane(int border)
           
ScrollablePane(int border, boolean opaque)
           
 
Method Summary
 void addContainerListener(java.awt.event.ContainerListener listener)
          Adds the specified container listener to this object's list of container listeners.
protected  void addImpl(java.awt.Component c, java.lang.Object constraints, int index)
          This method is called by all the add() methods to perform the actual adding of the component.
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt)
          This method is called when an adjustable value changes.
(package private)  void computeFullRect()
          void calibrateComponents() { computeFullRect(); int x = fullRect.x; int y = fullRect.y; System.out.println( "*** calibrate: Set holder x,y to " + x + "," + y ); Point pt = holder.getLocation(); int dx = x - pt.x; int dy = (y - pt.y); ///15; holder.setBounds(x, y, fullRect.width, fullRect.height); if (dx != 0 || dy != 0) { int count = holder.getComponentCount(); for (int i = 0; i < count; i++) { Component c = holder.getComponent(i); Point cpt = c.getLocation(); c.setLocation(cpt.x - dx, cpt.y - dy); } int xval = ((Adjustable) hScrollComponent).getValue(); ((Adjustable) hScrollComponent).setValue(xval - dx); int yval = ((Adjustable) vScrollComponent).getValue(); ((Adjustable) vScrollComponent).setValue(yval - dy); } repaint(); }
(package private)  void createScrollers(boolean opaque)
           
 void doLayout()
          lay out the pane.
 void enableScroll(boolean horiz, boolean vert)
           
 java.awt.Component getComponent(int n)
          Returns the component at the specified index.
 int getComponentCount()
          Returns the number of components in this container.
 java.awt.Component getHScrollComponent()
           
 java.awt.Dimension getMinimumSize()
          determine the minimum size
 java.awt.Dimension getPreferredSize()
          determine the preferred size
 java.awt.Component getVScrollComponent()
           
 void hookScrollersTo(java.awt.Container c)
          this lets an outside component own the scrollers
 void moveToBack(java.awt.Component c)
          move to back
 void moveToFront(java.awt.Component c)
          the scrollers should always be in front
 void paint(java.awt.Graphics g)
          overrides paint in order to paint the holder separately, otherwise it might be excessively clipped
 void remove(java.awt.Component comp)
          Removes the specified component from this container.
 void setErrorMarks(java.util.BitSet errorMarks, java.util.BitSet warningMarks, java.util.BitSet nonconformanceMarks)
           
 void setScrollIncrements(int hUnit, int vUnit, int hBlock, int vBlock)
           
 void setScrollMode(int mode)
           
 void setScrollValues()
          set the horizontal and vertical scroll values.
 
Methods inherited from class com.trapezium.chisel.gui.ChiselAWTPane
close, copy, cut, getBorder, getInsets, getSelection, isOpaque, nextError, paintBackground, paste, prevError, redo, setBorder, setBorder, setBounds, setOpaque, setSelection, undo
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponentAt, getComponentAt, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATIC

public static final int STATIC
See Also:
Constant Field Values

DYNAMIC

public static final int DYNAMIC
See Also:
Constant Field Values

holder

HolderPane holder

hScrollComponent

java.awt.Component hScrollComponent

vScrollComponent

java.awt.Component vScrollComponent

mode

int mode

tracker

private java.awt.event.ComponentAdapter tracker

fullRect

private java.awt.Rectangle fullRect

hEnabled

private boolean hEnabled

vEnabled

private boolean vEnabled
Constructor Detail

ScrollablePane

public ScrollablePane()

ScrollablePane

public ScrollablePane(int border)

ScrollablePane

public ScrollablePane(int border,
                      boolean opaque)
Method Detail

setScrollMode

public void setScrollMode(int mode)

enableScroll

public void enableScroll(boolean horiz,
                         boolean vert)

setErrorMarks

public void setErrorMarks(java.util.BitSet errorMarks,
                          java.util.BitSet warningMarks,
                          java.util.BitSet nonconformanceMarks)

setScrollIncrements

public void setScrollIncrements(int hUnit,
                                int vUnit,
                                int hBlock,
                                int vBlock)

getHScrollComponent

public final java.awt.Component getHScrollComponent()

getVScrollComponent

public final java.awt.Component getVScrollComponent()

createScrollers

void createScrollers(boolean opaque)

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt)
Description copied from interface: java.awt.event.AdjustmentListener
This method is called when an adjustable value changes.

Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

computeFullRect

void computeFullRect()
void calibrateComponents() { computeFullRect(); int x = fullRect.x; int y = fullRect.y; System.out.println( "*** calibrate: Set holder x,y to " + x + "," + y ); Point pt = holder.getLocation(); int dx = x - pt.x; int dy = (y - pt.y); ///15; holder.setBounds(x, y, fullRect.width, fullRect.height); if (dx != 0 || dy != 0) { int count = holder.getComponentCount(); for (int i = 0; i < count; i++) { Component c = holder.getComponent(i); Point cpt = c.getLocation(); c.setLocation(cpt.x - dx, cpt.y - dy); } int xval = ((Adjustable) hScrollComponent).getValue(); ((Adjustable) hScrollComponent).setValue(xval - dx); int yval = ((Adjustable) vScrollComponent).getValue(); ((Adjustable) vScrollComponent).setValue(yval - dy); } repaint(); }


setScrollValues

public void setScrollValues()
set the horizontal and vertical scroll values. The default is to set the min and max values equal to the furthest extents of all child components and the visibleAmount values to the ScrollablePane's bounds on the screen.


hookScrollersTo

public void hookScrollersTo(java.awt.Container c)
this lets an outside component own the scrollers


moveToFront

public void moveToFront(java.awt.Component c)
the scrollers should always be in front

Specified by:
moveToFront in interface com.trapezium.chisel.Workspace
Overrides:
moveToFront in class ChiselAWTPane

moveToBack

public void moveToBack(java.awt.Component c)
move to back

Specified by:
moveToBack in interface com.trapezium.chisel.Workspace
Overrides:
moveToBack in class ChiselAWTPane

addImpl

protected void addImpl(java.awt.Component c,
                       java.lang.Object constraints,
                       int index)
Description copied from class: java.awt.Container
This method is called by all the add() methods to perform the actual adding of the component. Subclasses who wish to perform their own processing when a component is added should override this method. Any subclass doing this must call the superclass version of this method in order to ensure proper functioning of the container.

Overrides:
addImpl in class ChiselAWTPane

remove

public void remove(java.awt.Component comp)
Description copied from class: java.awt.Container
Removes the specified component from this container.

Overrides:
remove in class ChiselAWTPane

getComponentCount

public int getComponentCount()
Description copied from class: java.awt.Container
Returns the number of components in this container.


getComponent

public java.awt.Component getComponent(int n)
Description copied from class: java.awt.Container
Returns the component at the specified index.


addContainerListener

public void addContainerListener(java.awt.event.ContainerListener listener)
Description copied from class: java.awt.Container
Adds the specified container listener to this object's list of container listeners.


getMinimumSize

public java.awt.Dimension getMinimumSize()
determine the minimum size


getPreferredSize

public java.awt.Dimension getPreferredSize()
determine the preferred size


doLayout

public void doLayout()
lay out the pane. Only the scrollers are positioned; other components remain where they are.


paint

public void paint(java.awt.Graphics g)
overrides paint in order to paint the holder separately, otherwise it might be excessively clipped

Overrides:
paint in class ChiselAWTPane