1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.graphviz.internal.xdot;
\r
14 import java.awt.BasicStroke;
\r
15 import java.awt.Graphics2D;
\r
17 public class SetStyle implements DrawCommand {
\r
19 private static final BasicStroke SOLID = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, null, 0.0f);
\r
20 private static final BasicStroke DASHED = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, new float[] {5f, 5f}, 0.0f);
\r
21 private static final BasicStroke DOTTED = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, new float[] {0f, 2f}, 0.0f);
\r
25 public SetStyle(String styleName) {
\r
26 this.styleName = styleName;
\r
30 public void draw(Graphics2D g) {
\r
31 if(styleName.equals("solid"))
\r
33 else if(styleName.equals("dashed"))
\r
34 g.setStroke(DASHED);
\r
35 else if(styleName.equals("dotted"))
\r
36 g.setStroke(DOTTED);
\r
38 System.out.println("Unknown style: " + styleName);
\r