org.grinvin.gui.icons

Class SmallGraphIcon

Implemented Interfaces:
GraphIcon, Icon, SelectUnselectIcon

public class SmallGraphIcon
extends AbstractGraphIcon

Icon that represents a Graph. It uses the first embedding of the GraphBundleView to draw the icon.

Field Summary

Fields inherited from class org.grinvin.gui.icons.AbstractSelectUnselectIcon

selected

Constructor Summary

SmallGraphIcon(EmbeddingView embedding, Renderer renderer, int size)
Create a graph icon for the given embedded graph.
SmallGraphIcon(GraphBundleView bundle, Renderer renderer, int size)
Create a graph icon based on the first embedding stored in the given graph bundle.

Method Summary

int
getIconHeight()
int
getIconWidth()
protected void
paintEdges(Graphics2D g2)
Paint all edges of the graph using the current renderer.
void
paintIcon(Component c, Graphics g, int x, int y)
First paints the edges and then the vertices.
protected void
paintVertices(Graphics2D g2)
Paint all vertices of the graph using the current vertex renderer.
void
setSize(int size)
Set or change the size of the bounding square of this icon.

Methods inherited from class org.grinvin.gui.icons.AbstractSelectUnselectIcon

getIconHeight, getIconWidth, isSelected, paintIcon, setSelected

Constructor Details

SmallGraphIcon

public SmallGraphIcon(EmbeddingView embedding,
                      Renderer renderer,
                      int size)
Create a graph icon for the given embedded graph. The (two-dimensional) embedding is assumed to be restricted to coordinates in the range (-1.0,-1.0) - (1.0,1.0) which will be scaled to a square of the indicated size.
Parameters:
embedding - Two-dimensional embedding of a graph
renderer - Renderer which is used to draw the graph
size - Size in pixels for the width and height of the enclosing square

SmallGraphIcon

public SmallGraphIcon(GraphBundleView bundle,
                      Renderer renderer,
                      int size)
Create a graph icon based on the first embedding stored in the given graph bundle.

Method Details

getIconHeight

public int getIconHeight()
Overrides:
getIconHeight in interface AbstractSelectUnselectIcon

getIconWidth

public int getIconWidth()
Overrides:
getIconWidth in interface AbstractSelectUnselectIcon

paintEdges

protected void paintEdges(Graphics2D g2)

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
First paints the edges and then the vertices.
Overrides:
paintIcon in interface AbstractSelectUnselectIcon

paintVertices

protected void paintVertices(Graphics2D g2)

setSize

public void setSize(int size)
Set or change the size of the bounding square of this icon.