fi.hut.tml.xsmiles.csslayout
Class CSSRenderer

java.lang.Object
  extended byfi.hut.tml.xsmiles.csslayout.CSSRenderer
All Implemented Interfaces:
java.util.EventListener, java.awt.LayoutManager, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, PopupHandler
Direct Known Subclasses:
XHTML2Renderer

public class CSSRenderer
extends java.lang.Object
implements java.awt.LayoutManager, PopupHandler, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Author:

Field Summary
static boolean antiAlias
          should we do antializing
protected  java.util.Vector componentsToBeRemoved
          ComponentView will do delayed removal using this vector.
protected  boolean dirty
           
protected  ContentFocusPointsProvider fpProvider
           
protected  java.awt.Dimension lastSize
           
static short LAYOUT_DONE
           
static short LAYOUT_IN_PROGRESS
           
 int layouts
           
protected  short layoutState
           
static int minAlias
           
protected  MLFC mlfc
           
protected  boolean redoLayout
           
protected  boolean refreshScheduled
          only one refreshImmediately will be scheduled
protected  RendererComponent renderer
           
protected  java.awt.Container rootContainer
          this is the root, which is e.g.
protected  java.awt.Dimension size
           
protected  boolean transactionInProgress
           
protected  ExternalWindow window
          this is used if this renderer is part of anouther renderer, which wants to show part of DOM in external window
 
Constructor Summary
CSSRenderer(MLFC m, boolean isInWindow)
          Creates a new instance of CSSRenderer
 
Method Summary
 void addLayoutComponent(java.lang.String arg0, java.awt.Component arg1)
          THESE METHODS ARE FOR LAYOUTING THE CONTAINER WHEN THE PARENT SIZE CHANGES
 void addWindow(ExternalWindow frame)
           
 void cancelComponentRemoval(java.awt.Component comp)
           
 void closePopup(StylableElement elem)
           
 void commit()
           
 void createRootContainer()
           
 void createViews()
           
 void createWindow(org.w3c.dom.Node node, java.lang.String display, java.lang.String containertype)
           
 java.awt.Container getComponent()
           
 ComponentFactory getComponentFactory()
           
 org.w3c.dom.Document getDocument()
           
 java.awt.Graphics getGraphicsContext()
           
 MLFC getMLFC()
           
 RootView getRootView()
           
protected  void invokeLater(java.lang.Runnable run)
           
 boolean isInWindow()
           
 void layoutContainer(java.awt.Container arg0)
           
 void layoutRenderer()
          this is called internally to layout the rootView and all other views e.g.
 java.awt.Dimension minimumLayoutSize(java.awt.Container arg0)
           
 void mouseClicked(java.awt.event.MouseEvent event)
           
 void mouseClicked(View view, java.awt.event.MouseEvent event)
           
 void mouseDragged(java.awt.event.MouseEvent arg0)
           
 void mouseEntered(java.awt.event.MouseEvent arg0)
           
 void mouseExited(java.awt.event.MouseEvent arg0)
           
 void mouseMoved(java.awt.event.MouseEvent event)
           
 void mouseMoved(View view, java.awt.event.MouseEvent event)
           
 void mousePressed(java.awt.event.MouseEvent event)
           
 void mouseReleased(java.awt.event.MouseEvent event)
           
 java.awt.Dimension preferredLayoutSize(java.awt.Container arg0)
           
 void recreateViews()
          this is called from the MLFC when the zoom is changed
 void refresh()
           
 void refresh(View view)
          Refresh only given view if its size hasn't been changed.
 void removeAllDelayedComponents()
           
 void removeComponentDelayed(java.awt.Component comp)
           
 void removeLayoutComponent(java.awt.Component arg0)
           
 void repaint(java.awt.Rectangle rect)
           
 void setDocument(org.w3c.dom.Document adoc)
           
protected  void setFocusComponent()
           
 void setInitialSize(java.awt.Dimension size)
           
 void setRootView(RootView root)
           
 void setZoom(double zoom)
          to set the zoom, for instance by the UI
 void showAsPopup(StylableElement elem, java.lang.String containerType)
           
 void startTransaction()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

renderer

protected RendererComponent renderer

mlfc

protected MLFC mlfc

layouts

public int layouts

rootContainer

protected java.awt.Container rootContainer
this is the root, which is e.g. a Panel in AWT J9 and Container in Swing It's size is handled by the implemented LayoutManager The size depends on the size of the rootView, which depends on the size of the parent container...


size

protected java.awt.Dimension size

window

protected ExternalWindow window
this is used if this renderer is part of anouther renderer, which wants to show part of DOM in external window


antiAlias

public static boolean antiAlias
should we do antializing


minAlias

public static int minAlias

dirty

protected boolean dirty

refreshScheduled

protected boolean refreshScheduled
only one refreshImmediately will be scheduled


fpProvider

protected ContentFocusPointsProvider fpProvider

componentsToBeRemoved

protected java.util.Vector componentsToBeRemoved
ComponentView will do delayed removal using this vector. Reason: when style is changed, old views are removed from view and new ones created. If the component is always first removed and then re-added, it will lose focus.


lastSize

protected java.awt.Dimension lastSize

LAYOUT_DONE

public static final short LAYOUT_DONE
See Also:
Constant Field Values

LAYOUT_IN_PROGRESS

public static final short LAYOUT_IN_PROGRESS
See Also:
Constant Field Values

layoutState

protected short layoutState

redoLayout

protected boolean redoLayout

transactionInProgress

protected boolean transactionInProgress
Constructor Detail

CSSRenderer

public CSSRenderer(MLFC m,
                   boolean isInWindow)
Creates a new instance of CSSRenderer

Method Detail

removeComponentDelayed

public void removeComponentDelayed(java.awt.Component comp)

cancelComponentRemoval

public void cancelComponentRemoval(java.awt.Component comp)

removeAllDelayedComponents

public void removeAllDelayedComponents()

setZoom

public void setZoom(double zoom)
to set the zoom, for instance by the UI


getComponentFactory

public ComponentFactory getComponentFactory()

getComponent

public java.awt.Container getComponent()

createRootContainer

public void createRootContainer()

recreateViews

public void recreateViews()
this is called from the MLFC when the zoom is changed


layoutRenderer

public void layoutRenderer()
this is called internally to layout the rootView and all other views e.g. when the parent container size has changed


setDocument

public void setDocument(org.w3c.dom.Document adoc)

getDocument

public org.w3c.dom.Document getDocument()

setFocusComponent

protected void setFocusComponent()

setInitialSize

public void setInitialSize(java.awt.Dimension size)

getRootView

public RootView getRootView()

setRootView

public void setRootView(RootView root)

createViews

public void createViews()

createWindow

public void createWindow(org.w3c.dom.Node node,
                         java.lang.String display,
                         java.lang.String containertype)

addWindow

public void addWindow(ExternalWindow frame)

getMLFC

public MLFC getMLFC()

isInWindow

public boolean isInWindow()

getGraphicsContext

public java.awt.Graphics getGraphicsContext()

startTransaction

public void startTransaction()

commit

public void commit()

invokeLater

protected void invokeLater(java.lang.Runnable run)

repaint

public void repaint(java.awt.Rectangle rect)

refresh

public void refresh()

refresh

public void refresh(View view)
Refresh only given view if its size hasn't been changed. Otherwise calls general refresh. This is an optimized version of the refresh, which is called e.g. when a style is changed for mouseovers

Parameters:
view -

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(View view,
                       java.awt.event.MouseEvent event)

mouseClicked

public void mouseClicked(View view,
                         java.awt.event.MouseEvent event)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent arg0)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent arg0)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent arg0)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

addLayoutComponent

public void addLayoutComponent(java.lang.String arg0,
                               java.awt.Component arg1)
THESE METHODS ARE FOR LAYOUTING THE CONTAINER WHEN THE PARENT SIZE CHANGES

Specified by:
addLayoutComponent in interface java.awt.LayoutManager

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component arg0)
Specified by:
removeLayoutComponent in interface java.awt.LayoutManager

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container arg0)
Specified by:
preferredLayoutSize in interface java.awt.LayoutManager

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container arg0)
Specified by:
minimumLayoutSize in interface java.awt.LayoutManager

layoutContainer

public void layoutContainer(java.awt.Container arg0)
Specified by:
layoutContainer in interface java.awt.LayoutManager

showAsPopup

public void showAsPopup(StylableElement elem,
                        java.lang.String containerType)
Specified by:
showAsPopup in interface PopupHandler

closePopup

public void closePopup(StylableElement elem)
Specified by:
closePopup in interface PopupHandler


X-Smiles 1.2