Ejemplo n.º 1
0
  /**
   * Creates and returns a map of attributes to be used as defaults for vertex attributes.
   *
   * @return a map of attributes to be used as defaults for vertex attributes.
   */
  public static AttributeMap createDefaultVertexAttributes() {
    AttributeMap map = new AttributeMap();
    Color c = Color.decode("#FF9900");

    GraphConstants.setBounds(map, new Rectangle2D.Double(50, 50, 90, 30));
    GraphConstants.setBorder(map, BorderFactory.createRaisedBevelBorder());
    GraphConstants.setBackground(map, c);
    GraphConstants.setForeground(map, Color.white);
    GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
    GraphConstants.setOpaque(map, true);

    return map;
  }
Ejemplo n.º 2
0
  /**
   * Creates and returns a map of attributes to be used as defaults for edge attributes, depending
   * on the specified graph.
   *
   * @param jGraphTGraph the graph for which default edge attributes to be created.
   * @return a map of attributes to be used as default for edge attributes.
   */
  public static <V, E> AttributeMap createDefaultEdgeAttributes(Graph<V, E> jGraphTGraph) {
    AttributeMap map = new AttributeMap();

    if (jGraphTGraph instanceof DirectedGraph<?, ?>) {
      GraphConstants.setLineEnd(map, GraphConstants.ARROW_TECHNICAL);
      GraphConstants.setEndFill(map, true);
      GraphConstants.setEndSize(map, 10);
    }

    GraphConstants.setForeground(map, Color.decode("#25507C"));
    GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
    GraphConstants.setLineColor(map, Color.decode("#7AA1E6"));

    return map;
  }