net.sf.gluebooster.java.booster.basic.math.graph.GraphDisplayConfiguration Maven / Gradle / Ivy
package net.sf.gluebooster.java.booster.basic.math.graph;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.beans.ExceptionListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.swing.Icon;
import org.apache.commons.collections4.Transformer;
import edu.uci.ics.jung.visualization.control.GraphMouseListener;
import edu.uci.ics.jung.visualization.renderers.Renderer;
import net.sf.gluebooster.java.booster.basic.container.SimpleBoostedNode;
import net.sf.gluebooster.java.booster.basic.transformation.CallableToShape;
import net.sf.gluebooster.java.booster.essentials.eventsCommands.Callable;
import net.sf.gluebooster.java.booster.essentials.eventsCommands.CallableAbstraction;
import net.sf.gluebooster.java.booster.essentials.meta.HasName;
import net.sf.gluebooster.java.booster.essentials.meta.Stringable;
import net.sf.gluebooster.java.booster.essentials.meta.objects.DisplayConfiguration;
import net.sf.gluebooster.java.booster.essentials.meta.objects.ObjectDescription;
import net.sf.gluebooster.java.booster.essentials.utils.ThrowableBoostUtils;
/**
* Configuration how a graph is to be displayed
*
* @author CBauer
*
*/
public class GraphDisplayConfiguration extends DisplayConfiguration {
/**
* Should the vertex labels be displayed.
*/
private boolean displayVertexLabel = false;
/**
* The position of the label relative to the center of the vertex.
*/
private Renderer.VertexLabel.Position vertexLabelPosition = Renderer.VertexLabel.Position.CNTR;
/**
* Generates the label for a vertex
*/
private Callable vertexLabelTransformer;
/**
* Generates the display of the vertex (if it should not just be a shape)
*/
private Callable vertexIconTransformer;
/**
* Should the tooltips of vertices be displayed.
*/
private boolean displayVertexTooltip = true;
/**
* Generates the tooltip for a vertex.
*/
private Callable vertexToolTipTransformer;
/**
* Should the label of a vertex be the value or the name (default).
*/
private boolean displayVertexValueInsteadOfName = false;
/**
* The level how detailed a vertex should be displayed.
*/
private int vertexDetailDisplayLevel;
/**
* The vertices that should be highlighted.
*/
private Collection highlightedVertices;
/**
* The colors of the vertices
*/
private Map vertexColors;
/**
* Listeners for user keyboard interaction
*/
private List keyListeners = new ArrayList();
/**
* Generates the shape of a vertex.
*/
private Callable vertexShapeTransformer;
/**
* The background color of vertices.
*/
private Callable vertexBackgroundTransformer;
/**
* Listener for user mouse interaction.
*/
private GraphMouseListener clickListener;
/**
* if false an exception will occur if there is overlapping (of nodes)
*/
private ObjectDescription overlappingAllowed = ObjectDescription.createFlag(true, false);
/**
* Listener to exceptions
*/
private ExceptionListener exceptionListener;
/**
* a transformer that extracts information of a vertex (or an edge).
*
* @author cbauer
*
*/
private class ToStringTransformer extends CallableAbstraction