/** * render the nodes in net * * @param gl * @param nr * @param text */ public void renderNodes3D(GL gl, GraphRenderer nr, int text) { applyPickColors(); for (Node n : net.nNodes) { nr.renderNode(gl, n); nr.renderNodeLabels(gl, n, text, false); } }
public void render(Graphics2D g) { renderer.render(g, getX(), getY(), getWidth(), getHeight()); String screenshot = (String) graph.getLabel("ui.screenshot"); if (screenshot != null) { graph.removeAttribute("ui.screenshot"); renderer.screenshot(screenshot, getWidth(), getHeight()); } }
void update() { ThingWithProperties show = graph.getSelection(); if (show != null) { Vector props = show.getProperties(); // new lab[0].setText(((Property) props.elementAt(0)).toString()); lab[1].setText(((Property) props.elementAt(1)).toString()); if (dl1 != null) textfields[0].getDocument().removeDocumentListener(dl1); if (dl2 != null) textfields[1].getDocument().removeDocumentListener(dl2); dl1 = new PropertyListener((Property) props.elementAt(0)); dl2 = new PropertyListener((Property) props.elementAt(1)); textfields[0].getDocument().addDocumentListener(dl1); textfields[1].getDocument().addDocumentListener(dl2); textfields[0].setText(((Property) props.elementAt(0)).get()); textfields[0].setEditable(((Property) props.elementAt(0)).getEditable()); textfields[1].setText(((Property) props.elementAt(1)).get()); textfields[1].setEditable(((Property) props.elementAt(1)).getEditable()); /* setLayout(new GridLayout(2, props.size())); JTextField tf; Property p; JLabel n; for (int i = 0; i < props.size(); i++) { p = (Property) props.elementAt(i); System.out.println("Proprty " + p); n = new JLabel(p.toString()); tf = new JTextField(3); add(n); add(tf); tf.setText(p.get()); tf.setEditable(p.getEditable()); tf.getDocument().addDocumentListener(new PropertyListener(p)); }*/ } repaint(); }
/** * render the group labels * * @param gl * @param nr * @param net * @param fonttype */ public void renderGroupLabels(GL gl, GraphRenderer nr, Net net, int fonttype) { Node center; for (String m : net.groups.keySet()) { Net group1 = net.groups.get(m); center = group1.hasNode(m); nr.renderGroupLabels(gl, center, fonttype); } }
public void paintComponent(Graphics g) { if (position == null) return; int x = (int) position.getX(); int y = (int) position.getY(); if (parent.inFirstPath(this)) { g.setColor(Color.yellow); g.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS); } else if (parent.inQueue(this)) { g.setColor(Color.orange); g.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS); } g.setColor(getColor()); g.drawOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS); if (parent.isGoalNode(this)) g.setColor(Color.green); else if (parent.isStartNode(this)) g.setColor(Color.blue); g.drawString(toString(), x, y); if (!parent.getHideHeur()) g.drawString(model.getHeuristic() + "", x + RADIUS, y + RADIUS); }
public void moveElementAtPx(GraphicElement element, double x, double y) { // The feedback on the node positions is often off since not needed // and generating lots of events. We activate it here since the // movement of the node is decided by the viewer. This is one of the // only moment when the viewer really moves a node. boolean on = graph.feedbackXYZ(); graph.feedbackXYZ(true); renderer.moveElementAtPx(element, x, y); graph.feedbackXYZ(on); }
public void close(GraphicGraph graph) { renderer.close(); graph.addAttribute("ui.viewClosed", getId()); removeKeyListener(shortcuts); shortcuts.release(); mouseClicks.release(); openInAFrame(false); }
/** * setup and render the grouped nodes in net * * @param gl * @param nr */ void renderClusters(GL gl, GraphRenderer nr) { clustersSetup(gl); HashSet<Node> cl = null; for (Node n : net.fNodes) { cl = n.cluster; float rad = cl.size(); if (rad > 4 && app.drawClusters) { nr.renderFan(gl, cl, n); } } }
@Override public int renderGraphTick(MapCanvas canvas, int nextPosX) { for (int i = 0; i < graphRenderers.length; i++) { GraphRenderer graphRenderer = graphRenderers[i]; int position = this.componentLastPos[i]; position++; // index starts with 0 so in the end - 1 int maxComponentWidth = (i + 1) * componentWidth + i * SPACES - 1; if (position > maxComponentWidth) { // reset it to the start pos position = i * componentWidth + i * SPACES; } graphRenderer.renderGraphTick(canvas, position); this.componentLastPos[i] = position; } return 100; }
public DefaultView(Viewer viewer, String identifier, GraphRenderer renderer) { super(identifier); this.viewer = viewer; this.graph = viewer.getGraphicGraph(); this.renderer = renderer; setOpaque(false); setDoubleBuffered(true); setMouseManager(null); setShortcutManager(null); renderer.open(graph, this); }
/** * render the groups defined in the group attribute * * @param gl * @param nr * @param net * @param fonttype */ public void renderGroups(GL gl, GraphRenderer nr, Net net, int fonttype) { for (String n : net.groups.keySet()) { Net group = net.groups.get(n); Node center = group.hasNode(n); nr.renderGroups(gl, group.nNodes, center); // nr.renderNode(gl, center); // // for (Node eref: group.nNodes) { // nr.renderNode(gl, eref); // nr.renderNodeLabels(gl, eref, 2, false); // } // // for (Edge eref: group.nEdges) { // nr.renderEdges(gl, eref); // } } }
/** * render node labels with font = text * * @param gl * @param nr * @param text */ void renderLabels(GL gl, GraphRenderer nr, int text) { // boolean fast = (net.nNodes.size()>edgeTresh); boolean fast = false; for (Edge eref : net.nEdges) nr.renderEdgeLabels(gl, eref, text, fast); for (Node nref : net.nNodes) nr.renderNodeLabels(gl, nref, text, fast); }
/** * render edges contained in net in 3d * * @param gl * @param nr * @param text */ public void renderEdges3D(GL gl, GraphRenderer nr, int text) { for (Edge eref : net.nEdges) { nr.renderEdges(gl, eref); nr.renderEdgeLabels(gl, eref, text, false); } }
/** * render edges contained in net * * @param gl * @param nr * @param text */ public void renderEdges(GL gl, GraphRenderer nr, int text) { for (Edge eref : net.nEdges) { nr.renderEdges(gl, eref); } }
public Visitor<Void, E> visitSubgraph(String name) throws E { return new Visualizer<E>(renderer.renderSubgraph(name)); }
public void selectionGrowsAt(double x, double y) { renderer.selectionGrowsAt(x, y); repaint(); }
public Camera getCamera() { return renderer.getCamera(); }
public GraphicElement findNodeOrSpriteAt(double x, double y) { return renderer.findNodeOrSpriteAt(x, y); }
public Collection<GraphicElement> allNodesOrSpritesIn( double x1, double y1, double x2, double y2) { return renderer.allNodesOrSpritesIn(x1, y1, x2, y2); }
public void endSelectionAt(double x2, double y2) { renderer.endSelectionAt(x2, y2); repaint(); }
/** * render the nodes in net * * @param gl * @param nr * @param text */ public void renderNodes(GL gl, GraphRenderer nr, int text) { applyPickColors(); for (Node n : net.nNodes) { nr.renderNode(gl, n); } }
public void visitRelationship(Relationship relationship) throws E { if (visitedRelationships.add(relationship)) { renderProperties(renderer.renderRelationship(relationship), relationship); } }
public void beginSelectionAt(double x1, double y1) { renderer.beginSelectionAt(x1, y1); repaint(); }
public Void done() throws E { renderer.done(); return null; }
public void visitNode(Node node) throws E { if (visitedNodes.add(node)) { renderProperties(renderer.renderNode(node), node); } }
public void mouseClicked(MouseEvent m) { boss.gotoStartState(); }
// TEMPORARY SOLUTION! public void repaint() { parent.repaint(); }