org.proteinshader.gui
Interface Mediator

All Known Implementing Classes:
MediatorImpl

public interface Mediator

This interface specifies the methods for the single central mediator object that allows communication between objects of the gui, the data structure, and the renderer.


Method Summary
 void add(ControlPanel controlPanel)
          Adds the address of the ControlPanel to the Mediator.
 void add(MainMenuBar mainMenuBar)
          Adds the address of the MainMenuBar to the Mediator.
 void add(Renderer renderer)
          Adds the address of the Renderer to the Mediator.
 void add(SpringLoadedJFrame controlFrame)
          Adds the address of the control panel frame to the Mediator.
 void blendObjectEdges(boolean b)
          Turns on or off the ability of the halftoning shaders to soften aliasing (jagged edges) by rendering translucent black silhouettes of tube and ribbon segments (and using jitter) before calling on the halftoning shaders.
 void cacheGeometricObject(GeometricListInfo info)
          Caches a new geomtric object (sphere or cylinder) in the form of an OpenGL display list and redraws the canvas.
 void clickStartAnimation()
          Calls on the startAnimation() method of the MotionPanel (equivalent to clicking the Start button on the MotionPanel).
 void clickStopAnimation()
          Calls on the stopAnimation() method of the MotionPanel (equivalent to clicking the Stop button on the MotionPanel).
 void closeControlFrame()
          Closes the spring-loaded frame holding the control panel.
 void displayErrorAndExit(String title, String message)
          Display an error message in a JOptionPane before exiting.
 void displayWarning(String title, String message)
          Display a warning message in a JOptionPane.
 Vector<Texture> getBendTextures()
          Returns the list of Textures intended for highlighting segment bend regions when halftoning is being used.
 Atom[] getCurrentAtoms()
          Returns the current Atoms.
 Chain getCurrentChain()
          Returns the current Chain.
 Model getCurrentModel()
          Returns the current Model.
 Residue[] getCurrentResidues()
          Returns the current Residues.
 CylinderListInfo getCylinderInfo(StyleEnum style)
          Returns the CylinderListInfo object that holds the information on an OpenGL display list for a cylinder that is currently used for drawing Bonds.
 Frame getFrame()
          Returns the frame that should be used as a parent frame for Dialogs.
 String getGraphicsCardInfo()
          Returns information on the graphics card that was gathered when the init() method of the Renderer was called.
 Vector<Texture> getHalftoningTextures()
          Returns the list of Texture objects intended for halftoning.
 Vector<Texture> getPatternsTextures()
          Returns the list of Texture objects intended for placing patterns on colored surfaces (rather than textures for halftoning).
 SphereListInfo getSphereInfo(StyleEnum style)
          Returns the SphereListInfo object that holds the information on an OpenGL display list for a sphere that is currently used for drawing Atoms.
 Structure getStructure()
          Returns the current Structure to display.
 StyleEnum getStyle()
          Returns the current style (TUBES, RIBBONS, RIBBONS_AND_TUBES, FRENET_FRAMES, SPACE_FILLING, BALLS_AND_STICKS, or STICKS).
 void jitterScene(JitterEnum jitter)
          Draws the scene multiple times to an accumulation buffer while jittering the xy-coordinates a fraction of a pixel.
 void openControlFrame()
          Opens the spring-loaded frame holding the control panel.
 void readStructure(File file)
          Reads in a new Structure to display.
 void redrawCanvas()
          Redraws the canvas.
 void setAutoTiling(boolean autoTiling)
          If automatic tiling is set to true, then the level of detail (tiling number) for a sphere or cylinder will be calculated based on the camera distance for each Atom or Bond, respectively.
 void setBackgroundColor(float red, float green, float blue)
          Sets the background color for the canvas.
 void setCurrentAtoms(Atom[] atoms)
          Sets the current Atoms.
 void setCurrentChain(Chain chain)
          Sets the current Chain.
 void setCurrentModel(Model model)
          Sets the current Model.
 void setCurrentResidues(Residue[] residues)
          Sets the current Residues.
 void setExtraLines(boolean b)
          Controls whether extra lines (at the beginning and end of each segment of a tube or ribbon) will be shown when the display is in cartoon mode.
 void setImageOrientation(OrientationEnum orientation)
          Sets the image to the requested orientation (Front, Back, Left, etc.).
 void setImageScale(double scale)
          Sets the scale factor for the image.
 void setRadioPanelSelectedMenu(String item)
          Sets the "Selected:" menu in the RadioPanel (for both atom and cartoon modifier panels) of the ModiferPanel.
 void setStyle(StyleEnum style)
          Sets the current style (TUBES, RIBBONS, RIBBONS_AND_TUBES, FRENET_FRAMES, SPACE_FILLING, BALLS_AND_STICKS, or STICKS).
 void showAminoAcids(boolean b)
          Controls whether the Renderer will display AminoAcids.
 void showHeterogens(boolean b)
          Controls whether the Renderer will display Heterogens.
 void showWaters(boolean b)
          Controls whether the Renderer will display Waters.
 void startAnimation(double xAxisSpeed, double yAxisSpeed)
          Starts an animation that rotates the image about its x-axis and/or y-axis based on the speeds given as argument.
 void stopAnimation()
          Stops the rotation that was started with the startAnimation() method.
 void takeScreenShot(ImageFormatEnum format, File file)
          Causes the Render to take a screen shot of the current canvas image and save it as a JPEG, PNG or GIF file.
 void updateFPSDisplay(double fps)
          During a rotation animation the Renderer will call this method to update whatever GUI components display the current frames per second the animation is operating at.
 void updateRenderer()
          Updates the arrays of visible objects (opaque and translucent Drawables) held by the Renderer and then has the canvas call display().
 

Method Detail

add

void add(SpringLoadedJFrame controlFrame)
Adds the address of the control panel frame to the Mediator.


add

void add(ControlPanel controlPanel)
Adds the address of the ControlPanel to the Mediator.


add

void add(MainMenuBar mainMenuBar)
Adds the address of the MainMenuBar to the Mediator.


add

void add(Renderer renderer)
Adds the address of the Renderer to the Mediator.


getStructure

Structure getStructure()
Returns the current Structure to display.

Returns:
The current Structure.

readStructure

void readStructure(File file)
Reads in a new Structure to display.

Parameters:
file - a PDB formatted file.

redrawCanvas

void redrawCanvas()
Redraws the canvas.


getCurrentModel

Model getCurrentModel()
Returns the current Model.

Returns:
The current Model.

getCurrentChain

Chain getCurrentChain()
Returns the current Chain.

Returns:
The current Chain.

getCurrentResidues

Residue[] getCurrentResidues()
Returns the current Residues.

Returns:
The current Residues as an array.

getCurrentAtoms

Atom[] getCurrentAtoms()
Returns the current Atoms.

Returns:
The current Atoms as an array.

getStyle

StyleEnum getStyle()
Returns the current style (TUBES, RIBBONS, RIBBONS_AND_TUBES, FRENET_FRAMES, SPACE_FILLING, BALLS_AND_STICKS, or STICKS).

Returns:
The current style.

getFrame

Frame getFrame()
Returns the frame that should be used as a parent frame for Dialogs.

Returns:
The parent frame.

cacheGeometricObject

void cacheGeometricObject(GeometricListInfo info)
Caches a new geomtric object (sphere or cylinder) in the form of an OpenGL display list and redraws the canvas.

Parameters:
info - describes the geometric object to cache.

getSphereInfo

SphereListInfo getSphereInfo(StyleEnum style)
Returns the SphereListInfo object that holds the information on an OpenGL display list for a sphere that is currently used for drawing Atoms. There are two types of spheres cached: one for SPACE_FILLING and one for BALLS_AND_STICKS.

Returns:
The display list info object for a sphere.

getCylinderInfo

CylinderListInfo getCylinderInfo(StyleEnum style)
Returns the CylinderListInfo object that holds the information on an OpenGL display list for a cylinder that is currently used for drawing Bonds. There are two types of cylinders cached: one for BALLS_AND_STICKS and one for STICKS.

Returns:
The display list info object for a cylinder.

getPatternsTextures

Vector<Texture> getPatternsTextures()
Returns the list of Texture objects intended for placing patterns on colored surfaces (rather than textures for halftoning).

A Java Texture object holds information on an OpenGL texture object that is stored in graphics card memory. A Texture will have the name (an integer) of the OpenGL texture object, as well as a menu name for the texture.

Returns:
A list of Texture objects.

getHalftoningTextures

Vector<Texture> getHalftoningTextures()
Returns the list of Texture objects intended for halftoning.

A Java Texture object holds information on an OpenGL texture object that is stored in graphics card memory. A Texture will have the name (an integer) of the OpenGL texture object, as well as a menu name for the texture.

Returns:
A list of Texture objects.

getBendTextures

Vector<Texture> getBendTextures()
Returns the list of Textures intended for highlighting segment bend regions when halftoning is being used.

A Java Texture object holds information on an OpenGL texture object that is stored in graphics card memory. A Texture will have the name (an integer) of the OpenGL texture object, as well as a menu name for the texture.

Returns:
A list of Texture objects.

setCurrentModel

void setCurrentModel(Model model)
Sets the current Model.

Parameters:
model - the current Model.

setCurrentChain

void setCurrentChain(Chain chain)
Sets the current Chain.

Parameters:
chain - the current Chain.

setCurrentResidues

void setCurrentResidues(Residue[] residues)
Sets the current Residues.

Parameters:
residues - the current Residues.

setCurrentAtoms

void setCurrentAtoms(Atom[] atoms)
Sets the current Atoms.

Parameters:
atoms - the current Atoms.

setStyle

void setStyle(StyleEnum style)
Sets the current style (TUBES, RIBBONS, RIBBONS_AND_TUBES, FRENET_FRAMES, SPACE_FILLING, BALLS_AND_STICKS, or STICKS).

Parameters:
style - the current style.

setImageOrientation

void setImageOrientation(OrientationEnum orientation)
Sets the image to the requested orientation (Front, Back, Left, etc.).

Parameters:
orientation - the orientation to set the image to.

setAutoTiling

void setAutoTiling(boolean autoTiling)
If automatic tiling is set to true, then the level of detail (tiling number) for a sphere or cylinder will be calculated based on the camera distance for each Atom or Bond, respectively. If automatic tiling is set to false, then a standard sphere or cylinder will be used (and camera distance will not matter).

Parameters:
autoTiling - boolean value for automatic tiling.

showAminoAcids

void showAminoAcids(boolean b)
Controls whether the Renderer will display AminoAcids.

Parameters:
b - a boolean value indicating if AminoAcids should be displayed.

showHeterogens

void showHeterogens(boolean b)
Controls whether the Renderer will display Heterogens.

Parameters:
b - a boolean value indicating if Heterogens should be displayed.

showWaters

void showWaters(boolean b)
Controls whether the Renderer will display Waters.

Parameters:
b - a boolean value indicating if Waters should be displayed.

setExtraLines

void setExtraLines(boolean b)
Controls whether extra lines (at the beginning and end of each segment of a tube or ribbon) will be shown when the display is in cartoon mode.

Parameters:
b - a boolean value indicating if extra lines should be used.

openControlFrame

void openControlFrame()
Opens the spring-loaded frame holding the control panel. The "Tools" menu in the menu bar will be updated.


closeControlFrame

void closeControlFrame()
Closes the spring-loaded frame holding the control panel. The "Tools" menu in the menu bar will be updated.


displayErrorAndExit

void displayErrorAndExit(String title,
                         String message)
Display an error message in a JOptionPane before exiting.

Parameters:
title - the title to place on the JOptionPane.
message - the error message to display.

displayWarning

void displayWarning(String title,
                    String message)
Display a warning message in a JOptionPane.

Parameters:
title - the title to place on the JOptionPane.
message - the warning message to display.

updateRenderer

void updateRenderer()
Updates the arrays of visible objects (opaque and translucent Drawables) held by the Renderer and then has the canvas call display().


startAnimation

void startAnimation(double xAxisSpeed,
                    double yAxisSpeed)
Starts an animation that rotates the image about its x-axis and/or y-axis based on the speeds given as argument. An argument of zero results in no rotation, whild a negative argument results in clockwise instead of counterclockwise rotation.

Parameters:
xAxisSpeed - the x-axis speed in degrees per second.
yAxisSpeed - the y-axis speed in degrees per second.

stopAnimation

void stopAnimation()
Stops the rotation that was started with the startAnimation() method.


clickStartAnimation

void clickStartAnimation()
Calls on the startAnimation() method of the MotionPanel (equivalent to clicking the Start button on the MotionPanel).


clickStopAnimation

void clickStopAnimation()
Calls on the stopAnimation() method of the MotionPanel (equivalent to clicking the Stop button on the MotionPanel).


updateFPSDisplay

void updateFPSDisplay(double fps)
During a rotation animation the Renderer will call this method to update whatever GUI components display the current frames per second the animation is operating at.

Parameters:
fps - the frames per second for the animation.

setImageScale

void setImageScale(double scale)
Sets the scale factor for the image.

Parameters:
scale - the scale factor as a double.

setBackgroundColor

void setBackgroundColor(float red,
                        float green,
                        float blue)
Sets the background color for the canvas.

Parameters:
red - the red component of the background color.
green - the green component of the background color.
blue - the blue component of the background color.

takeScreenShot

void takeScreenShot(ImageFormatEnum format,
                    File file)
Causes the Render to take a screen shot of the current canvas image and save it as a JPEG, PNG or GIF file.

Parameters:
format - the screen shot image format.
file - the file to save the screen shot to.

setRadioPanelSelectedMenu

void setRadioPanelSelectedMenu(String item)
Sets the "Selected:" menu in the RadioPanel (for both atom and cartoon modifier panels) of the ModiferPanel.

The item argument must be the name of a choice in the menu (such as 'Model', 'Chain', or 'Residues'). Otherwise, no action will occur.

Parameters:
item - the name of a menu choice.

blendObjectEdges

void blendObjectEdges(boolean b)
Turns on or off the ability of the halftoning shaders to soften aliasing (jagged edges) by rendering translucent black silhouettes of tube and ribbon segments (and using jitter) before calling on the halftoning shaders. This effect may be added to other shaders at a later time.

Parameters:
b - boolean value to determine if object edges should be smoothed.

jitterScene

void jitterScene(JitterEnum jitter)
Draws the scene multiple times to an accumulation buffer while jittering the xy-coordinates a fraction of a pixel.

If jitter is set to null, the scene will be rendered a single time with no jitter.

Parameters:
jitter - the JitterEnum object contains a list of xy-coordinate pairs.

getGraphicsCardInfo

String getGraphicsCardInfo()
Returns information on the graphics card that was gathered when the init() method of the Renderer was called.

The description will include the vender name, graphics card model number, and what version of OpenGL is supported. If the init() method of the Renderer has not been called yet, the description will be the word 'unknown'.

Returns:
A several line description of the graphics card.


Copyright © 2007-2008