All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.uci.ics.jung.visualization.RenderContext Maven / Gradle / Ivy

The newest version!
package edu.uci.ics.jung.visualization;

import java.awt.BasicStroke;
import java.awt.Font;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.Stroke;

import javax.swing.CellRendererPane;
import javax.swing.Icon;
import javax.swing.JComponent;

import com.google.common.base.Function;
import com.google.common.base.Predicate;

import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor;
import edu.uci.ics.jung.graph.Graph;
import edu.uci.ics.jung.graph.util.Context;
import edu.uci.ics.jung.graph.util.EdgeIndexFunction;
import edu.uci.ics.jung.graph.util.EdgeType;
import edu.uci.ics.jung.visualization.picking.PickedState;
import edu.uci.ics.jung.visualization.renderers.EdgeLabelRenderer;
import edu.uci.ics.jung.visualization.renderers.VertexLabelRenderer;
import edu.uci.ics.jung.visualization.transform.shape.GraphicsDecorator;

public interface RenderContext {

    float[] dotting = {1.0f, 3.0f};
    float[] dashing = {5.0f};

    /**
     * A stroke for a dotted line: 1 pixel width, round caps, round joins, and an 
     * array of {1.0f, 3.0f}.
     */
    Stroke DOTTED = new BasicStroke(1.0f,
            BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, dotting, 0f);

    /**
     * A stroke for a dashed line: 1 pixel width, square caps, beveled joins, and an
     * array of {5.0f}.
     */
    Stroke DASHED = new BasicStroke(1.0f,
            BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 1.0f, dashing, 0f);

    /**
     * Specifies the offset for the edge labels.
     */
    int LABEL_OFFSET = 10;

    int getLabelOffset();
    
    void setLabelOffset(int labelOffset);
    
    float getArrowPlacementTolerance();

    void setArrowPlacementTolerance(float arrow_placement_tolerance);

    Function,E>,Shape> getEdgeArrowTransformer();

    void setEdgeArrowTransformer(Function,E>,Shape> edgeArrowTransformer);

    Predicate,E>> getEdgeArrowPredicate() ;

    void setEdgeArrowPredicate(Predicate,E>> edgeArrowPredicate);

    Function getEdgeFontTransformer();

    void setEdgeFontTransformer(Function edgeFontTransformer);

    Predicate,E>> getEdgeIncludePredicate();

    void setEdgeIncludePredicate(Predicate,E>> edgeIncludePredicate);

    Function,E>,Number> getEdgeLabelClosenessTransformer();

    void setEdgeLabelClosenessTransformer(
    		Function,E>,Number> edgeLabelClosenessTransformer);

    EdgeLabelRenderer getEdgeLabelRenderer();

    void setEdgeLabelRenderer(EdgeLabelRenderer edgeLabelRenderer);

    Function getEdgeFillPaintTransformer();

    void setEdgeFillPaintTransformer(Function edgePaintTransformer);

    Function getEdgeDrawPaintTransformer();

    void setEdgeDrawPaintTransformer(Function edgeDrawPaintTransformer);

    Function getArrowDrawPaintTransformer();

    void setArrowDrawPaintTransformer(Function arrowDrawPaintTransformer);

    Function getArrowFillPaintTransformer();

    void setArrowFillPaintTransformer(Function arrowFillPaintTransformer);

    Function getEdgeShapeTransformer();

    void setEdgeShapeTransformer(Function edgeShapeTransformer);

    Function getEdgeLabelTransformer();

    void setEdgeLabelTransformer(Function edgeStringer);

    Function getEdgeStrokeTransformer();

    void setEdgeStrokeTransformer(Function edgeStrokeTransformer);
    
    Function getEdgeArrowStrokeTransformer();

    void setEdgeArrowStrokeTransformer(Function edgeArrowStrokeTransformer);
    
    GraphicsDecorator getGraphicsContext();
    
    void setGraphicsContext(GraphicsDecorator graphicsContext);

    EdgeIndexFunction getParallelEdgeIndexFunction();

    void setParallelEdgeIndexFunction(
            EdgeIndexFunction parallelEdgeIndexFunction);

    PickedState getPickedEdgeState();

    void setPickedEdgeState(PickedState pickedEdgeState);

    PickedState getPickedVertexState();

    void setPickedVertexState(PickedState pickedVertexState);

    CellRendererPane getRendererPane();

    void setRendererPane(CellRendererPane rendererPane);

    JComponent getScreenDevice();

    void setScreenDevice(JComponent screenDevice);

    Function getVertexFontTransformer();

    void setVertexFontTransformer(Function vertexFontTransformer);

    Function getVertexIconTransformer();

    void setVertexIconTransformer(Function vertexIconTransformer);

    Predicate,V>> getVertexIncludePredicate();

    void setVertexIncludePredicate(Predicate,V>> vertexIncludePredicate);

    VertexLabelRenderer getVertexLabelRenderer();

    void setVertexLabelRenderer(VertexLabelRenderer vertexLabelRenderer);

    Function getVertexFillPaintTransformer();

    void setVertexFillPaintTransformer(Function vertexFillPaintTransformer);

    Function getVertexDrawPaintTransformer();

    void setVertexDrawPaintTransformer(Function vertexDrawPaintTransformer);

    Function getVertexShapeTransformer();

    void setVertexShapeTransformer(Function vertexShapeTransformer);

    Function getVertexLabelTransformer();

    void setVertexLabelTransformer(Function vertexStringer);

    Function getVertexStrokeTransformer();

    void setVertexStrokeTransformer(Function vertexStrokeTransformer);

    class DirectedEdgeArrowPredicate 
    	implements Predicate,E>> {

        public boolean apply(Context,E> c) {
            return c.graph.getEdgeType(c.element) == EdgeType.DIRECTED;
        }
        
    }
    
    class UndirectedEdgeArrowPredicate 
    	implements Predicate,E>> {
    	//extends AbstractGraphPredicate {

        public boolean apply(Context,E> c) {
            return c.graph.getEdgeType(c.element) == EdgeType.UNDIRECTED;
        }
        
    }
    
    MultiLayerTransformer getMultiLayerTransformer();
    
    void setMultiLayerTransformer(MultiLayerTransformer basicTransformer);
    
	/**
	 * @return the pickSupport
	 */
	GraphElementAccessor getPickSupport();

	/**
	 * @param pickSupport the pickSupport to set
	 */
	void setPickSupport(GraphElementAccessor pickSupport);
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy