Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* DataCleaner (community edition)
* Copyright (C) 2014 Free Software Foundation, Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.datacleaner.widgets.visualization;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import java.awt.event.MouseEvent;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import org.apache.metamodel.schema.Table;
import org.datacleaner.api.ColumnProperty;
import org.datacleaner.api.InputColumn;
import org.datacleaner.api.OutputDataStream;
import org.datacleaner.data.MutableInputColumn;
import org.datacleaner.descriptors.ConfiguredPropertyDescriptor;
import org.datacleaner.job.ComponentRequirement;
import org.datacleaner.job.CompoundComponentRequirement;
import org.datacleaner.job.FilterOutcome;
import org.datacleaner.job.HasFilterOutcomes;
import org.datacleaner.job.InputColumnSourceJob;
import org.datacleaner.job.SimpleComponentRequirement;
import org.datacleaner.job.builder.AnalysisJobBuilder;
import org.datacleaner.job.builder.ComponentBuilder;
import org.datacleaner.util.GraphUtils;
import org.datacleaner.util.IconUtils;
import org.datacleaner.util.LabelUtils;
import org.datacleaner.util.ReflectionUtils;
import org.datacleaner.util.WidgetFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.uci.ics.jung.algorithms.layout.AbstractLayout;
import edu.uci.ics.jung.visualization.VisualizationServer;
/**
* Supporting class containing the state surrounding the drawing of new
* {@link JobGraphLink}s.
*/
public class JobGraphLinkPainter {
public static class VertexContext {
private final Object _vertex;
private final OutputDataStream _outputDataStream;
private final AnalysisJobBuilder _analysisJobBuilder;
public VertexContext(final Object vertex, final AnalysisJobBuilder analysisJobBuilder,
final OutputDataStream outputDataStream) {
_vertex = vertex;
_outputDataStream = outputDataStream;
_analysisJobBuilder = analysisJobBuilder;
}
public Object getVertex() {
return _vertex;
}
public OutputDataStream getOutputDataStream() {
return _outputDataStream;
}
public AnalysisJobBuilder getAnalysisJobBuilder() {
return _analysisJobBuilder;
}
}
/**
* Used for the edge creation visual effect during mouse drag
*/
class EdgePaintable implements VisualizationServer.Paintable {
public void paint(final Graphics graphics) {
if (_edgeShape != null) {
final Color oldColor = graphics.getColor();
graphics.setColor(Color.black);
((Graphics2D) graphics).draw(_edgeShape);
graphics.setColor(oldColor);
}
}
public boolean useTransform() {
return false;
}
}
/**
* Used for the directed edge creation visual effect during mouse drag
*/
class ArrowPaintable implements VisualizationServer.Paintable {
public void paint(final Graphics graphics) {
if (_arrowShape != null) {
final Color oldColor = graphics.getColor();
graphics.setColor(Color.black);
((Graphics2D) graphics).fill(_arrowShape);
graphics.setColor(oldColor);
}
}
public boolean useTransform() {
return false;
}
}
private static final Logger logger = LoggerFactory.getLogger(JobGraphLinkPainter.class);
private final JobGraphContext _graphContext;
private final JobGraphActions _actions;
private final VisualizationServer.Paintable _edgePaintable;
private final VisualizationServer.Paintable _arrowPaintable;
private Shape _edgeShape;
private Shape _arrowShape;
private VertexContext _startVertex;
private Point2D _startPoint;
public JobGraphLinkPainter(final JobGraphContext graphContext, final JobGraphActions actions) {
_graphContext = graphContext;
_actions = actions;
_edgePaintable = new EdgePaintable();
_arrowPaintable = new ArrowPaintable();
}
/**
* Called when the drawing of a new link/edge is started
*
* @param startVertex
*/
public void startLink(final VertexContext startVertex) {
if (startVertex == null) {
return;
}
final AbstractLayout