1 package com.opensymphony.webwork.webFlow.model; 2 3 import java.io.IOException ; 4 5 10 public abstract class WebFlowNode implements Render, Comparable { 11 private String name; 12 private SubGraph parent; 13 14 public WebFlowNode(String name) { 15 this.name = name; 16 } 17 18 public SubGraph getParent() { 19 return parent; 20 } 21 22 public void setParent(SubGraph parent) { 23 this.parent = parent; 24 } 25 26 public void render(IndentWriter writer) throws IOException { 27 writer.write(getFullName() + " [label=\"" + name + "\",color=\"" + getColor() + "\"];"); 28 } 29 30 public String getFullName() { 31 String prefix = ""; 32 if (parent != null) { 33 String parentPrefix = parent.getPrefix(); 34 if (!parentPrefix.equals("")) { 35 prefix = parentPrefix + "_"; 36 } 37 } 38 return prefix + cleanName(); 39 } 40 41 private String cleanName() { 42 return name.replaceAll("[\\.\\/\\-\\$\\{\\}]", "_"); 43 } 44 45 public abstract String getColor(); 46 47 public int compareTo(Object o) { 48 return name.compareTo(((WebFlowNode) o).name); 49 } 50 } 51 | Popular Tags |