use of org.talend.dq.indicators.graph.GraphBuilder in project tdq-studio-se by Talend.
the class MyFirstMain method main.
/**
* DOC scorreia Comment method "main".
*
* @param args
*/
public static void main(String[] args) {
final MyFirstMain myFirstMain = new MyFirstMain();
myFirstMain.setAllData(createListObjects());
myFirstMain.run(new GraphBuilder());
}
use of org.talend.dq.indicators.graph.GraphBuilder in project tdq-studio-se by Talend.
the class MyFullDemoMain method startFunction.
public JPanel startFunction() {
final GraphBuilder graphBuilder = new GraphBuilder();
// getGraph();
Graph g = graphBuilder.createMultiGraph(MyFirstMain.createListObjects());
// init variables
edge_weight = graphBuilder.getEdgeWeight();
vertexWeights = graphBuilder.getVertexWeight();
final GraphRenderer graphRenderer = new GraphRenderer();
// pr = graphRenderer.createPluggableRenderer();
pr = new PluggableRenderer();
Layout layout = new FRLayout(g);
vv = new VisualizationViewer(layout, pr);
// add Shape based pick support
vv.setPickSupport(new ShapePickSupport());
PickedState picked_state = vv.getPickedState();
affineTransformer = vv.getLayoutTransformer();
// create decorators
vcf = new SeedColor(picked_state);
ewcs = new EdgeWeightStrokeFunction(edge_weight);
vsh = new VertexStrokeHighlight(picked_state);
ff = new FontHandler();
vs_none = new ConstantVertexStringer(null);
es_none = new ConstantEdgeStringer(null);
vssa = new VertexShapeSizeAspect(vertexWeights);
show_edge = new DirectionDisplayPredicate(true, true);
show_arrow = new DirectionDisplayPredicate(true, false);
show_vertex = new VertexDisplayPredicate(false);
// uses a gradient edge if unpicked, otherwise uses picked selection
edgePaint = new GradientPickedEdgePaintFunction(new PickableEdgePaintFunction(picked_state, Color.black, Color.cyan), vv, vv, picked_state);
pr.setVertexPaintFunction(vcf);
pr.setVertexStrokeFunction(vsh);
pr.setVertexStringer(vs_none);
pr.setVertexFontFunction(ff);
pr.setVertexShapeFunction(vssa);
pr.setVertexIncludePredicate(show_vertex);
pr.setEdgePaintFunction(edgePaint);
pr.setEdgeStringer(es_none);
pr.setEdgeFontFunction(ff);
pr.setEdgeStrokeFunction(ewcs);
pr.setEdgeIncludePredicate(show_edge);
pr.setEdgeShapeFunction(new EdgeShape.Line());
pr.setEdgeArrowPredicate(show_arrow);
JPanel jp = new JPanel();
jp.setLayout(new BorderLayout());
vv.setBackground(Color.white);
GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
jp.add(scrollPane);
gm = new DefaultModalGraphMouse();
vv.setGraphMouse(gm);
gm.add(new PopupGraphMousePlugin());
addBottomControls(jp);
vssa.setScaling(true);
vv.setToolTipFunction(new VoltageTips());
vv.setToolTipText("<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");
return jp;
}
use of org.talend.dq.indicators.graph.GraphBuilder in project tdq-studio-se by Talend.
the class CorrelationAnalysisDetailsPage method createPreviewCharts.
public void createPreviewCharts(final ScrolledForm form, final Composite composite, final boolean isCreate) {
List<Composite> previewChartList = new ArrayList<Composite>();
if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
GraphBuilder gBuilder = new GraphBuilder();
gBuilder.setTotalWeight(columnSetMultiIndicator.getCount());
List<Object[]> listRows = columnSetMultiIndicator.getListRows();
// MOD msjian TDQ-4781 2012-6-8: make sure exist data
if (listRows != null && listRows.size() > 0) {
// TDQ-4781~
JungGraphGenerator generator = new JungGraphGenerator(gBuilder, listRows);
// MOD yyi 2009-09-09 feature 8834
generator.generate(composite, false, true);
}
} else {
List<ModelElement> numericOrDateList = new ArrayList<ModelElement>();
if (ColumnsetPackage.eINSTANCE.getCountAvgNullIndicator() == columnSetMultiIndicator.eClass()) {
numericOrDateList = columnSetMultiIndicator.getNumericColumns();
}
if (ColumnsetPackage.eINSTANCE.getMinMaxDateIndicator() == columnSetMultiIndicator.eClass()) {
numericOrDateList = columnSetMultiIndicator.getDateColumns();
}
for (ModelElement column : numericOrDateList) {
final MetadataColumn tdColumn = (MetadataColumn) column;
ExpandableComposite exComp = toolkit.createExpandableComposite(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
// $NON-NLS-1$
exComp.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.column", tdColumn.getName()));
exComp.setLayout(new GridLayout());
exComp.setData(columnSetMultiIndicator);
previewChartList.add(exComp);
final Composite comp = toolkit.createComposite(exComp);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
if (tdColumn != null) {
IRunnableWithProgress rwp = new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(// $NON-NLS-1$
DefaultMessagesImpl.getString(// $NON-NLS-1$
"ColumnMasterDetailsPage.createPreview", tdColumn.getName()), IProgressMonitor.UNKNOWN);
Display.getDefault().asyncExec(new Runnable() {
public void run() {
new HideSeriesChartComposite(comp, getCurrentModelElement(), columnSetMultiIndicator, tdColumn, false);
}
});
monitor.done();
}
};
try {
new ProgressMonitorDialog(getSite().getShell()).run(true, false, rwp);
} catch (Exception ex) {
log.error(ex, ex);
}
}
exComp.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
getChartComposite().layout();
form.reflow(true);
}
});
exComp.setExpanded(true);
exComp.setClient(comp);
}
}
if (!previewChartList.isEmpty()) {
this.previewChartCompsites = previewChartList.toArray(new Composite[previewChartList.size()]);
}
}
use of org.talend.dq.indicators.graph.GraphBuilder in project tdq-studio-se by Talend.
the class CorrelationAnalysisResultPage method createGraphicsSectionPart.
protected Section createGraphicsSectionPart(Composite parentComp) {
Section section = createSection(// $NON-NLS-1$
form, // $NON-NLS-1$
parentComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.graphics"), // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.space"));
section.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite sectionClient = toolkit.createComposite(section);
sectionClient.setLayout(new GridLayout());
sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
chartComposite = toolkit.createComposite(sectionClient);
chartComposite.setLayout(new GridLayout());
if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
GridData gd = new GridData();
gd.widthHint = 900;
gd.heightHint = 450;
chartComposite.setLayoutData(gd);
GraphBuilder gBuilder = new GraphBuilder();
gBuilder.setTotalWeight(columnSetMultiIndicator.getCount());
List<Object[]> listRows = columnSetMultiIndicator.getListRows();
// MOD msjian TDQ-4781 2012-6-8: make sure exist data
if (listRows != null && listRows.size() > 0) {
JungGraphGenerator generator = new JungGraphGenerator(gBuilder, listRows);
// MOD yyi 2009-09-09 feature 8834
generator.generate(chartComposite, false, false);
}
// TDQ-4781~
} else {
createBubbleOrGanttChart(form, chartComposite, columnSetMultiIndicator);
}
section.setClient(sectionClient);
return section;
}
Aggregations