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

net.sf.gluebooster.java.booster.basic.math.graph.JungVisualizationViewer Maven / Gradle / Ivy

Go to download

Basic classes to support the development of applications. There should be as few dependencies on other frameworks as possible.

The newest version!
package net.sf.gluebooster.java.booster.basic.math.graph;

import java.awt.Dimension;
import java.awt.Graphics;
import java.beans.ExceptionListener;

import edu.uci.ics.jung.algorithms.layout.Layout;
import edu.uci.ics.jung.visualization.VisualizationModel;
import edu.uci.ics.jung.visualization.VisualizationViewer;

/**
 * Extended view of jung graphs.
 * 
 * @author cbauer
 *
 * @param 
 *            Vertex
 * @param 
 *            Edge
 */
public class JungVisualizationViewer extends VisualizationViewer {

	/**
	 * 
	 * @param layout
	 *            layout of the view
	 * @param preferredSize
	 *            preferred size
	 */
	public JungVisualizationViewer(Layout layout, Dimension preferredSize) {
		super(layout, preferredSize);
	}

	/**
	 * 
	 * @param layout
	 *            layout of the view
	 */
	public JungVisualizationViewer(Layout layout) {
		super(layout);
	}

	/**
	 * 
	 * @param model
	 *            model for vizialiation
	 * @param preferredSize
	 *            preferred size
	 */
	public JungVisualizationViewer(VisualizationModel model, Dimension preferredSize) {
		super(model, preferredSize);
	}

	/**
	 * @param model
	 *            model for vizialiation
	 * 
	 * @param model
	 */
	public JungVisualizationViewer(VisualizationModel model) {
		super(model);
	}

	/**
	 * Will be informed of exceptions
	 */
	private ExceptionListener exceptionListener;

	@Override
	public void paint(Graphics g) {
		try {
			super.paint(g);
		} catch (Exception ex) {
			// informs the listener and throws the exception
			if (exceptionListener != null) {
				exceptionListener.exceptionThrown(ex);
			}
			throw ex;
		}

	}

	public ExceptionListener getExceptionListener() {
		return exceptionListener;
	}

	public void setExceptionListener(ExceptionListener exceptionListener) {
		this.exceptionListener = exceptionListener;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy