private void setVertexColor(Object vertex, Color color) {

    DefaultGraphCell cell = m_jgAdapter.getVertexCell(vertex);
    AttributeMap attr = cell.getAttributes();

    GraphConstants.setBackground(attr, color);

    AttributeMap cellAttr = new AttributeMap();

    cellAttr.put(cell, attr);

    m_jgAdapter.edit(cellAttr, null, null, null);
  }
  private void positionVertexAt(Object vertex, int x, int y) {

    DefaultGraphCell cell = m_jgAdapter.getVertexCell(vertex);
    AttributeMap attr = cell.getAttributes();
    Rectangle2D b = GraphConstants.getBounds(attr);

    Rectangle2D newBounds = new Rectangle2D.Double(x, y, 5, 5);
    GraphConstants.setBounds(attr, newBounds);

    AttributeMap cellAttr = new AttributeMap();

    cellAttr.put(cell, attr);

    m_jgAdapter.edit(cellAttr, null, null, null);
  }
Example #3
0
  @SuppressWarnings("unchecked")
  private AttributeMap createVertexAttributeMap(GraphCell vertexCell) {
    AttributeMap attrs = new AttributeMap();

    // FIXME hb 28-nov-05: waiting for graph to go generic
    attrs.put(vertexCell, getDefaultVertexAttributes().clone());

    return attrs;
  }