From eb9764670f19f42535fc8b4cd20d7e0c77ea8d53 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Wed, 7 May 2003 15:45:47 +0000 Subject: [PATCH] Added -output option to specify output file. --- src/gr/spinellis/umlgraph/doclet/ClassGraph.java | 9 +++++++-- src/gr/spinellis/umlgraph/doclet/ClassInfo.java | 9 +++++++-- src/gr/spinellis/umlgraph/doclet/Options.java | 9 +++++++-- src/gr/spinellis/umlgraph/doclet/StringUtil.java | 9 +++++++-- src/gr/spinellis/umlgraph/doclet/UmlGraph.java | 9 +++++++-- src/org/umlgraph/doclet/ClassGraph.java | 9 +++++++-- src/org/umlgraph/doclet/ClassInfo.java | 9 +++++++-- src/org/umlgraph/doclet/Options.java | 9 +++++++-- src/org/umlgraph/doclet/StringUtil.java | 9 +++++++-- src/org/umlgraph/doclet/UmlGraph.java | 9 +++++++-- 10 files changed, 70 insertions(+), 20 deletions(-) diff --git a/src/gr/spinellis/umlgraph/doclet/ClassGraph.java b/src/gr/spinellis/umlgraph/doclet/ClassGraph.java index 6d9f93d..cd6826d 100644 --- a/src/gr/spinellis/umlgraph/doclet/ClassGraph.java +++ b/src/gr/spinellis/umlgraph/doclet/ClassGraph.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/gr/spinellis/umlgraph/doclet/ClassInfo.java b/src/gr/spinellis/umlgraph/doclet/ClassInfo.java index 6d9f93d..cd6826d 100644 --- a/src/gr/spinellis/umlgraph/doclet/ClassInfo.java +++ b/src/gr/spinellis/umlgraph/doclet/ClassInfo.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/gr/spinellis/umlgraph/doclet/Options.java b/src/gr/spinellis/umlgraph/doclet/Options.java index 6d9f93d..cd6826d 100644 --- a/src/gr/spinellis/umlgraph/doclet/Options.java +++ b/src/gr/spinellis/umlgraph/doclet/Options.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/gr/spinellis/umlgraph/doclet/StringUtil.java b/src/gr/spinellis/umlgraph/doclet/StringUtil.java index 6d9f93d..cd6826d 100644 --- a/src/gr/spinellis/umlgraph/doclet/StringUtil.java +++ b/src/gr/spinellis/umlgraph/doclet/StringUtil.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/gr/spinellis/umlgraph/doclet/UmlGraph.java b/src/gr/spinellis/umlgraph/doclet/UmlGraph.java index 6d9f93d..cd6826d 100644 --- a/src/gr/spinellis/umlgraph/doclet/UmlGraph.java +++ b/src/gr/spinellis/umlgraph/doclet/UmlGraph.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/org/umlgraph/doclet/ClassGraph.java b/src/org/umlgraph/doclet/ClassGraph.java index 6d9f93d..cd6826d 100644 --- a/src/org/umlgraph/doclet/ClassGraph.java +++ b/src/org/umlgraph/doclet/ClassGraph.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/org/umlgraph/doclet/ClassInfo.java b/src/org/umlgraph/doclet/ClassInfo.java index 6d9f93d..cd6826d 100644 --- a/src/org/umlgraph/doclet/ClassInfo.java +++ b/src/org/umlgraph/doclet/ClassInfo.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/org/umlgraph/doclet/Options.java b/src/org/umlgraph/doclet/Options.java index 6d9f93d..cd6826d 100644 --- a/src/org/umlgraph/doclet/Options.java +++ b/src/org/umlgraph/doclet/Options.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/org/umlgraph/doclet/StringUtil.java b/src/org/umlgraph/doclet/StringUtil.java index 6d9f93d..cd6826d 100644 --- a/src/org/umlgraph/doclet/StringUtil.java +++ b/src/org/umlgraph/doclet/StringUtil.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else diff --git a/src/org/umlgraph/doclet/UmlGraph.java b/src/org/umlgraph/doclet/UmlGraph.java index 6d9f93d..cd6826d 100644 --- a/src/org/umlgraph/doclet/UmlGraph.java +++ b/src/org/umlgraph/doclet/UmlGraph.java @@ -44,6 +44,7 @@ class Options implements Cloneable { double nodeFontSize; String nodeFillColor; String bgColor; + String outputFileName; Options() { showQualified = false; @@ -61,6 +62,7 @@ class Options implements Cloneable { nodeFontSize = 10; nodeFillColor = null; bgColor = null; + outputFileName = "graph.dot"; } public Object clone() @@ -118,6 +120,8 @@ class Options implements Cloneable { nodeFontSize = Integer.parseInt(opt[1]); } else if(opt[0].equals("-nodefillcolor")) { nodeFillColor = opt[1]; + } else if(opt[0].equals("-output")) { + outputFileName = opt[1]; } } @@ -142,7 +146,7 @@ class Options implements Cloneable { } public void openFile() throws IOException, UnsupportedEncodingException { - FileOutputStream fos = new FileOutputStream("graph.dot"); + FileOutputStream fos = new FileOutputStream(outputFileName); w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos))); } } @@ -486,8 +490,8 @@ public class UmlGraph { /** Entry point */ public static boolean start(RootDoc root) throws IOException, UnsupportedEncodingException { - opt.openFile(); opt.setOptions(root.options()); + opt.openFile(); opt.setOptions(root.classNamed("UMLOptions")); prologue(); ClassDoc[] classes = root.classes(); @@ -518,6 +522,7 @@ public class UmlGraph { option.equals("-edgecolor") || option.equals("-edgefontsize") || option.equals("-edgefontname") || + option.equals("-output") || option.equals("-bgcolor")) return 2; else