Class sgraphics.SgraphicsAdapter
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sgraphics.SgraphicsAdapter

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----sgraphics.SgraphicsAdapter

public class SgraphicsAdapter
extends Panel
The SgraphicsAdapter connects a glyph tree to AWT. A TopViewer is inserted between the top glyph and the adapter to handle events. SgraphicsAdapter handles double buffering for the tree.

Constructor Index

 o SgraphicsAdapter(Glyph)
Create an adapter between an AWT Container and a glyph tree.
 o SgraphicsAdapter(Glyph, boolean, boolean)
Create an adapter between an awt Component and a glyph tree.

Method Index

 o disableDrawing()
 o doubleBuffering()
Check if double buffering is on.
 o doubleBuffering(boolean)
Set the double buffer.
 o enableDrawing()
 o getPainter()
Gets a painter object.
 o minimumSize()
Get the minimum size.
 o needRedraw()
Redraws all glyphs by calling repaint().
 o needRedraw(Area)
Redraws all glyphs overlapping the area.
 o needResize()
Forces geometry calculation and redraws all glyphs.
 o paint(Graphics)
Paints the component.
 o postEvent(Event)
Posts an event to the top viewer and if it does not handle the event it calls the parent class which passes the event to the parent container.
 o postEvent(GraphicsEvent)
Post a new GraphicsEvent.
 o preferredSize()
Get the preferred size.
 o refresh()
Force the buffer to copy to the screen.
 o removeOrphanWidgets()
For internal use by widgets.
 o reshape(int, int, int, int)
Reshapes the Component to the specified bounding box.
 o setTopGlyph(Glyph)
Used to change the top glyph after construction.
 o update(Graphics)
Updates the component.

Constructors

 o SgraphicsAdapter
  public SgraphicsAdapter(Glyph glyph)
Create an adapter between an AWT Container and a glyph tree. By default, SgraphicsAdapter is not double buffered and update clears the background before painting.
Parameters:
glyph - the root of the glyph tree.
 o SgraphicsAdapter
  public SgraphicsAdapter(Glyph glyph,
                          boolean buffer,
                          boolean override)
Create an adapter between an awt Component and a glyph tree. By default, SgraphicsAdapter is not double buffered and update clears the background before painting.
Parameters:
glyph - the root of the glyph tree.
buffer - if true then double buffer the glyph tree.
override - if true then update() does not clear the background before painting.

Methods

 o minimumSize
  public Dimension minimumSize()
Get the minimum size. The minimum size is determined from the top glyph's minimum size.
Returns:
the minimum size.
Overrides:
minimumSize in class Container
 o preferredSize
  public Dimension preferredSize()
Get the preferred size. The preferred size is determined from the top glyph's natural size.
Returns:
the preferred size.
Overrides:
preferredSize in class Container
 o reshape
  public synchronized void reshape(int x,
                                   int y,
                                   int width,
                                   int height)
Reshapes the Component to the specified bounding box.
Overrides:
reshape in class Component
 o postEvent
  public boolean postEvent(Event event)
Posts an event to the top viewer and if it does not handle the event it calls the parent class which passes the event to the parent container.
Parameters:
event - the event.
Returns:
true if the event is handled.
Overrides:
postEvent in class Component
 o postEvent
  public boolean postEvent(GraphicsEvent event)
Post a new GraphicsEvent. If it is not handled, it is passed to the parent container. A decendent viewer can use this call to introduce an event to the system. If an event is already being processed by this method or postEvent(Event) the event is placed on a queue and false is returned. Queued events are processed after any current event processing is complete.
Parameters:
event - the new event.
Returns:
true if the event is handled.
 o update
  public void update(Graphics g)
Updates the component.
Overrides:
update in class Component
 o refresh
  public void refresh()
Force the buffer to copy to the screen. The purpose of this is to call disableDrawing(), draw some things, call enableDrawing(), then finally call refresh() to update the screen. If this is called when not double buffering, nothing happens.
 o paint
  public void paint(Graphics g)
Paints the component.
Overrides:
paint in class Component
 o setTopGlyph
  public void setTopGlyph(Glyph glyph)
Used to change the top glyph after construction.
 o removeOrphanWidgets
  public void removeOrphanWidgets()
For internal use by widgets. Not for normal use.
 o needRedraw
  public void needRedraw()
Redraws all glyphs by calling repaint().
 o needRedraw
  public void needRedraw(Area area)
Redraws all glyphs overlapping the area. If area is null needRedraw() is called. Do not call this from the "main" thread or you will get an IllegalMonitorException.
Parameters:
area - the area that needs redrawing.
 o needResize
  public void needResize()
Forces geometry calculation and redraws all glyphs.
 o getPainter
  public Painter getPainter()
Gets a painter object. If you use this, you will bypass any double buffering.
 o disableDrawing
  public void disableDrawing()
 o enableDrawing
  public void enableDrawing()
 o doubleBuffering
  public boolean doubleBuffering()
Check if double buffering is on.
Returns:
true if double buffering.
 o doubleBuffering
  public void doubleBuffering(boolean enable)
Set the double buffer. This will not clear an existing buffer.
Parameters:
enable - true enables double buffering.

All Packages  Class Hierarchy  This Package  Previous  Next  Index