FreeHEP API
Version current

org.freehep.swing.graphics
Interface PanelArtist

All Known Implementing Classes:
AbstractPanelArtist

public interface PanelArtist

This interface allows the implementing component to interact with a StackedPanel. The StackedPanel handles all of the details of layering, repainting, etc.; however, it cannot provide the actual content to display. This is the responsibility of the PanelArtist. If the content changes then the PanelArtist is expected to signal to the StackedPanel that a redraw is needed (redrawNeeded method of StackedPanel). The StackedPanel will then callback the PanelArtist via the drawPanel method. The PanelArtist is then responsible for deciding what needs to be drawn. The actual drawing can be done in a background thread if desired. This interface allows only one StackedPanel to be controlled by a given PanelArtist. Consequently, when the setPanelArtist method is called the component should save the value.

Version:
$Id: PanelArtist.java,v 1.2 2004/01/19 21:23:53 duns Exp $
Author:
Charles Loomis
Source Code:
PanelArtist.java

Method Summary
 void abortDraw()
          This method aborts any drawing which is being done in another thread.
 boolean drawPanel()
          This method draws the graphics onto the StackedPanel.
 JComponent getControlPanel()
          This method returns a JComponent which contains controls for the given PanelArtist.
 String getDescription()
          This returns a descriptive string for this PanelArtist.
 Object getEventData()
          This method returns the data sample which is currently being used.
 StackedPanel getStackedPanel()
          Return the StackedPanel which is being controlled.
 void panelResized()
          This method is called when the size of the StackedPanel has changed.
 void setEventData(Object data)
          This method sets which data sample should be used.
 void setStackedPanel(StackedPanel panel)
          Set the StackedPanel that this PanelArtist will control.
 

Method Detail

getDescription

public String getDescription()
This returns a descriptive string for this PanelArtist.

Returns:
a String describing this PanelArtist

drawPanel

public boolean drawPanel()
This method draws the graphics onto the StackedPanel. Usually this is called only when the content has changed, simple repaints are handled by the StackedPanel's buffering. The class which implements this interface has the option of doing the drawing in a background thread. In such a case, the method should return immediately after starting the thread and return false indicating that the drawing has not completed. After the drawing has completed, this method should call the drawComplete() method of the StackedPanel.

Returns:
boolean indicating whether the drawing has completed

setEventData

public void setEventData(Object data)
This method sets which data sample should be used.

Parameters:
data - data sample to use

getEventData

public Object getEventData()
This method returns the data sample which is currently being used.

Returns:
the event data currently being used.

setStackedPanel

public void setStackedPanel(StackedPanel panel)
Set the StackedPanel that this PanelArtist will control.

Parameters:
panel - StackedPanel to control

getStackedPanel

public StackedPanel getStackedPanel()
Return the StackedPanel which is being controlled.

Returns:
the StackedPanel which is being controlled

abortDraw

public void abortDraw()
This method aborts any drawing which is being done in another thread. This method should NOT return until the drawing has been stopped.


panelResized

public void panelResized()
This method is called when the size of the StackedPanel has changed. This gives the implementing class the opportunity to change transformation matricies, flag that a redraw is needed, etc.


getControlPanel

public JComponent getControlPanel()
This method returns a JComponent which contains controls for the given PanelArtist. The implementing class may return null if no controls are relevant.

Returns:
JComponent containing controls for the Panel Artist

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.