Created
April 27, 2016 20:49
-
-
Save matheus1lva/689a517504f3f63f03449f38b168d46b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class grafoComparacao implements ViewerListener { | |
private List<Comparados> integralizacoesComparadas; | |
private Viewer viewer; | |
private Graph graph; | |
private View view; | |
protected boolean loop = true; | |
public grafoComparacao(List<Comparados> listaComparados) throws HeadlessException, InterruptedException { | |
System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer"); | |
this.integralizacoesComparadas = listaComparados; | |
graph = new MultiGraph("clicks"); | |
graph.addAttribute("ui.stylesheet", GraphsStreamStylesheet.stylesheet); | |
adicionaNodes(graph); | |
viewer = new Viewer(graph, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD); | |
viewer.enableAutoLayout(); | |
view = viewer.addDefaultView(false); | |
JFrame frame = new JFrame("Comparação de catálogos"); | |
frame.add((Component) view); | |
frame.setExtendedState(JFrame.MAXIMIZED_BOTH); | |
ViewerPipe fromViewer = viewer.newViewerPipe(); | |
fromViewer.addViewerListener(this); | |
fromViewer.addSink(graph); | |
frame.setVisible(true); | |
while(loop) { | |
fromViewer.pump(); | |
} | |
} | |
//this actually works too. | |
// public static void main(String[] args) throws HeadlessException, InterruptedException{ | |
// Control.Controller ctrl = new Controller(); | |
// JFileChooser escolherAlunos = new JFileChooser(); | |
// escolherAlunos.setMultiSelectionEnabled(true); | |
// escolherAlunos.showOpenDialog(null); | |
// File[] integralzacoes = escolherAlunos.getSelectedFiles(); | |
// List<Comparados> integralizacoesComparadas = ctrl.geraComparacaoIntegralizacoes(integralzacoes); | |
// try { | |
// grafoComparacao comparacao = new grafoComparacao(integralizacoesComparadas); | |
// } catch (HeadlessException ex) { | |
// Logger.getLogger(FrmPrincipal.class.getName()).log(Level.SEVERE, null, ex); | |
// } catch (InterruptedException ex) { | |
// Logger.getLogger(FrmPrincipal.class.getName()).log(Level.SEVERE, null, ex); | |
// } | |
// new grafoComparacao(integralizacoesComparadas); | |
// } | |
@Override | |
public void viewClosed(String string) { | |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | |
} | |
@Override | |
public void buttonPushed(String string) { | |
} | |
@Override | |
public void buttonReleased(String string) { | |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | |
} | |
private void adicionaNodes(Graph graph) { | |
//function that populate my graph | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment