Class GradientEdgePaintTransformer<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.visualization.decorators.GradientEdgePaintTransformer<V,E>
-
- All Implemented Interfaces:
com.google.common.base.Function<E,java.awt.Paint>,java.util.function.Function<E,java.awt.Paint>
- Direct Known Subclasses:
PluggableRendererDemo.GradientPickedEdgePaintFunction
public class GradientEdgePaintTransformer<V,E> extends java.lang.Object implements com.google.common.base.Function<E,java.awt.Paint>CreatesGradientPaintinstances which can be used to paint anEdge. ForDirectedEdges, the color will blend fromc1(source) toc2(destination); forUndirectedEdges, the color will bec1at each end andc2in the middle.- Author:
- Joshua O'Madadhain
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.Colorc1protected java.awt.Colorc2protected com.google.common.base.Predicate<Context<Graph<V,E>,E>>selfLoopprotected BidirectionalTransformertransformerprotected VisualizationViewer<V,E>vv
-
Constructor Summary
Constructors Constructor Description GradientEdgePaintTransformer(java.awt.Color c1, java.awt.Color c2, VisualizationViewer<V,E> vv)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Paintapply(E e)protected java.awt.ColorgetColor1(E e)Returnsc1.protected java.awt.ColorgetColor2(E e)Returnsc2.
-
-
-
Field Detail
-
c1
protected java.awt.Color c1
-
c2
protected java.awt.Color c2
-
vv
protected VisualizationViewer<V,E> vv
-
transformer
protected BidirectionalTransformer transformer
-
-
Constructor Detail
-
GradientEdgePaintTransformer
public GradientEdgePaintTransformer(java.awt.Color c1, java.awt.Color c2, VisualizationViewer<V,E> vv)
-
-
Method Detail
-
apply
public java.awt.Paint apply(E e)
-
getColor1
protected java.awt.Color getColor1(E e)
Returnsc1. Subclasses may override this method to enable more complex behavior (e.g., for picked edges).- Parameters:
e- the edge for which a color is to be retrieved- Returns:
- the constructor-supplied color
c1
-
getColor2
protected java.awt.Color getColor2(E e)
Returnsc2. Subclasses may override this method to enable more complex behavior (e.g., for picked edges).- Parameters:
e- the edge for which a color is to be retrieved- Returns:
- the constructor-supplied color
c2
-
-