FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.gui.DOTrenderer Class Reference

Renders and displays DOT code. More...

Inheritance diagram for frodo2.gui.DOTrenderer:

Public Member Functions

 DOTrenderer (String title, String dotCode)
 Constructor of this JFrame instance.
 DOTrenderer (String title, String dotCode, String layout)
 Constructor of this JFrame instance.
void actionPerformed (ActionEvent e)
 This method is called whenever a button is pressed.

Private Member Functions

boolean createDOTFile (String dotCode, String fileName)
 This method creates a temporary file from a string representing DOT code.
ImageIcon createDOTfigure ()
 This method calls the layout executable in order to create an image from the DOT code given in a temporary file.
ImageIcon zoomFigure (ImageIcon figure, boolean zoomIn)
synchronized int increaseFileID ()
void copyFile (File srcFile, File destFile)
 This method is used to copy a file.

Private Attributes

String dotFileName
 Name of temporary .dot file of this DOTrenderer instance.
Image dotImage
 Image displayed by this DOTrenderer instance.
JLabel content
 Component displaying the image.
ImageIcon currentDotImage
 Currently displayed image; size may be different from original image.
String layout
 The name of the Graphviz executable.

Static Private Attributes

static final long serialVersionUID = -8149101075827511346L
 Serial version ID of JFrame.
static final String TEMP_DOT_FILE_NAME = ".temp"
 String determining name of temporary files.
static int TEMP_FILE_ID = 0
 Integer used to create unique file names.
static final Object posLock = new Object ()
 Lock to synchronize access to xPos and yPos.
static int xPos = 0
 The x position of the next window.
static int yPos = 30
 The y position of the next window.

Detailed Description

Renders and displays DOT code.

Author
Andreas Schaedeli, Thomas Leaute
Todo
Increase scrolling speed.

Constructor & Destructor Documentation

◆ DOTrenderer() [1/2]

frodo2.gui.DOTrenderer.DOTrenderer ( String title,
String dotCode )

Constructor of this JFrame instance.

Determines size and components of the Frame. Uses the dot layout.

Parameters
titleJFrame title
dotCodeDOT formatted code to be displayed as image

◆ DOTrenderer() [2/2]

frodo2.gui.DOTrenderer.DOTrenderer ( String title,
String dotCode,
String layout )

Constructor of this JFrame instance.

Determines size and components of the Frame.

Parameters
titleJFrame title
dotCodeDOT formatted code to be displayed as image
layoutone of the following: dot, neato, twopi, circo, fdp, sfdp

References content, createDOTfigure(), createDOTFile(), currentDotImage, dotFileName, increaseFileID(), layout, posLock, TEMP_DOT_FILE_NAME, xPos, and yPos.

Here is the call graph for this function:

Member Function Documentation

◆ actionPerformed()

void frodo2.gui.DOTrenderer.actionPerformed ( ActionEvent e)

This method is called whenever a button is pressed.

According to which button is concerned, the corresponding action is taken.

Parameters
eAction event

References content, copyFile(), currentDotImage, dotFileName, and zoomFigure().

Here is the call graph for this function:

◆ copyFile()

void frodo2.gui.DOTrenderer.copyFile ( File srcFile,
File destFile )
private

This method is used to copy a file.

This is needed, as all the files created are only temporary and will be deleted when JVM exits. Therefore, to keep them, they need to be copied to files that will not be deleted. For this, the input file is read and the content is written to the destination file.

Parameters
srcFileSource file (temporary)
destFileDestination file (durable)

Referenced by actionPerformed().

◆ createDOTfigure()

ImageIcon frodo2.gui.DOTrenderer.createDOTfigure ( )
private

This method calls the layout executable in order to create an image from the DOT code given in a temporary file.

Returns
ImageIcon representing the image created from DOT code
Bug
err will not be closed

References dotFileName, and dotImage.

Referenced by DOTrenderer().

◆ createDOTFile()

boolean frodo2.gui.DOTrenderer.createDOTFile ( String dotCode,
String fileName )
private

This method creates a temporary file from a string representing DOT code.

Parameters
dotCodeString representing DOT formatted code
fileNameName of temporary file where code should be saved
Returns
true if creation of file was successful, else false

Referenced by DOTrenderer().

◆ increaseFileID()

synchronized int frodo2.gui.DOTrenderer.increaseFileID ( )
private
Returns
Unique identifier for temporary files

References TEMP_FILE_ID.

Referenced by DOTrenderer().

◆ zoomFigure()

ImageIcon frodo2.gui.DOTrenderer.zoomFigure ( ImageIcon figure,
boolean zoomIn )
private
Parameters
figureCurrently displayed image
zoomIntrue if user wants to zoom in, false if he wants to zoom out
Returns
Scaled instance of the image

References dotImage.

Referenced by actionPerformed().

Member Data Documentation

◆ content

JLabel frodo2.gui.DOTrenderer.content
private

Component displaying the image.

Referenced by actionPerformed(), and DOTrenderer().

◆ currentDotImage

ImageIcon frodo2.gui.DOTrenderer.currentDotImage
private

Currently displayed image; size may be different from original image.

Referenced by actionPerformed(), and DOTrenderer().

◆ dotFileName

String frodo2.gui.DOTrenderer.dotFileName
private

Name of temporary .dot file of this DOTrenderer instance.

Referenced by actionPerformed(), createDOTfigure(), and DOTrenderer().

◆ dotImage

Image frodo2.gui.DOTrenderer.dotImage
private

Image displayed by this DOTrenderer instance.

Referenced by createDOTfigure(), and zoomFigure().

◆ layout

String frodo2.gui.DOTrenderer.layout
private

The name of the Graphviz executable.

Referenced by DOTrenderer().

◆ posLock

final Object frodo2.gui.DOTrenderer.posLock = new Object ()
staticprivate

Lock to synchronize access to xPos and yPos.

Referenced by DOTrenderer().

◆ serialVersionUID

final long frodo2.gui.DOTrenderer.serialVersionUID = -8149101075827511346L
staticprivate

Serial version ID of JFrame.

◆ TEMP_DOT_FILE_NAME

final String frodo2.gui.DOTrenderer.TEMP_DOT_FILE_NAME = ".temp"
staticprivate

String determining name of temporary files.

Referenced by DOTrenderer().

◆ TEMP_FILE_ID

int frodo2.gui.DOTrenderer.TEMP_FILE_ID = 0
staticprivate

Integer used to create unique file names.

Referenced by increaseFileID().

◆ xPos

int frodo2.gui.DOTrenderer.xPos = 0
staticprivate

The x position of the next window.

Referenced by DOTrenderer().

◆ yPos

int frodo2.gui.DOTrenderer.yPos = 30
staticprivate

The y position of the next window.

Referenced by DOTrenderer().


The documentation for this class was generated from the following file: