@Override protected boolean performTask() { try { final KaxVizFrame frame = new KaxVizFrame(this.kaxFilename, AnalysisController.loadFromFile(new File(this.kaxFilename)), this.svgFilename); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setSize(800, 600); frame.setVisible(true); } catch (final IOException ex) { LOG.error("The given file could not be loaded", ex); return false; } catch (final Exception ex) { // NOPMD NOCS (log all errors) LOG.error("Error", ex); return false; } return true; }
if (plugin instanceof MIReader) { final MIReader reader = (MIReader) plugin; final mxCell vertex = this.createReader(reader, x++); mapPlugin2Graph.put(reader, vertex); mapPluginOutputPorts2Graph.put(reader, this.createOutputPorts(reader, vertex, true)); } else if (plugin instanceof MIFilter) { final MIFilter filter = (MIFilter) plugin; final mxCell vertex = this.createFilter(filter, x++); mapPlugin2Graph.put(filter, vertex); mapPluginInputPorts2Graph.put(filter, this.createInputPorts(filter, vertex)); mapPluginOutputPorts2Graph.put(filter, this.createOutputPorts(filter, vertex, false)); final mxCell cell = this.createRepository(repo, x++); mapRepository2Graph.put(repo, cell);
private final Map<String, mxCell> createInputPorts(final MIFilter plugin, final mxCell vertex) { final Map<String, mxCell> port2graph = new HashMap<>(); // NOPMD (no concurrent access) final String[] portNames = KaxVizFrame.getAllInputPortNames(plugin); for (int i = 0; i < portNames.length; i++) { final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), -0.06, 10, 10); portGeometry.setOffset(new mxPoint(0, 0)); portGeometry.setRelative(true); final mxCell port = new mxCell( portNames[i], portGeometry, STYLE_PORT + "spacingTop=3;verticalLabelPosition=bottom;portConstraint=north;" + STYLE_FILTER_COLOR); port.setVertex(true); this.graph.addCell(port, vertex); port2graph.put(portNames[i], port); } return port2graph; }
this.addWindowListener(new WindowAdapter() { graphComponent.setFoldingEnabled(false); // prevent folding of vertexes new com.mxgraph.swing.handler.mxRubberband(graphComponent); // add rubberband selection this.getContentPane().add(graphComponent); this.displayGraph();
this.addWindowListener(new WindowAdapter() { graphComponent.setFoldingEnabled(false); // prevent folding of vertexes new com.mxgraph.swing.handler.mxRubberband(graphComponent); // add rubberband selection this.getContentPane().add(graphComponent); this.displayGraph();
if (plugin instanceof MIReader) { final MIReader reader = (MIReader) plugin; final mxCell vertex = this.createReader(reader, x++); mapPlugin2Graph.put(reader, vertex); mapPluginOutputPorts2Graph.put(reader, this.createOutputPorts(reader, vertex, true)); } else if (plugin instanceof MIFilter) { final MIFilter filter = (MIFilter) plugin; final mxCell vertex = this.createFilter(filter, x++); mapPlugin2Graph.put(filter, vertex); mapPluginInputPorts2Graph.put(filter, this.createInputPorts(filter, vertex)); mapPluginOutputPorts2Graph.put(filter, this.createOutputPorts(filter, vertex, false)); final mxCell cell = this.createRepository(repo, x++); mapRepository2Graph.put(repo, cell);
private final Map<String, mxCell> createInputPorts(final MIFilter plugin, final mxCell vertex) { final Map<String, mxCell> port2graph = new HashMap<String, mxCell>(); // NOPMD (no concurrent access) final String[] portNames = KaxVizFrame.getAllInputPortNames(plugin); for (int i = 0; i < portNames.length; i++) { final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), -0.06, 10, 10); portGeometry.setOffset(new mxPoint(0, 0)); portGeometry.setRelative(true); final mxCell port = new mxCell( portNames[i], portGeometry, STYLE_PORT + "spacingTop=3;verticalLabelPosition=bottom;portConstraint=north;" + STYLE_FILTER_COLOR); port.setVertex(true); this.graph.addCell(port, vertex); port2graph.put(portNames[i], port); } return port2graph; }
@Override protected boolean performTask() { try { final KaxVizFrame frame = new KaxVizFrame(this.kaxFilename, AnalysisController.loadFromFile(new File(this.kaxFilename)), this.svgFilename); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setSize(800, 600); frame.setVisible(true); } catch (final IOException ex) { LOGGER.error("The given file could not be loaded", ex); return false; } catch (final Exception ex) { // NOPMD NOCS (log all errors) LOGGER.error("Error", ex); return false; } return true; }
private static String[] getAllInputPortNames(final MIFilter plugin) { return KaxVizFrame.convertPortsToNameArray(plugin.getInputPorts()); }
private static String[] getAllOutputPortNames(final MIPlugin plugin) { return KaxVizFrame.convertPortsToNameArray(plugin.getOutputPorts()); }
private static String[] getAllInputPortNames(final MIFilter plugin) { return KaxVizFrame.convertPortsToNameArray(plugin.getInputPorts()); }
private static String[] getAllOutputPortNames(final MIPlugin plugin) { return KaxVizFrame.convertPortsToNameArray(plugin.getOutputPorts()); }