1// BEGIN LICENSE BLOCK 2// Version: CMPL 1.1 3// 4// The contents of this file are subject to the Cisco-style Mozilla Public 5// License Version 1.1 (the "License"); you may not use this file except 6// in compliance with the License. You may obtain a copy of the License 7// at www.eclipse-clp.org/license. 8// 9// Software distributed under the License is distributed on an "AS IS" 10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11// the License for the specific language governing rights and limitations 12// under the License. 13// 14// The Original Code is The ECLiPSe Constraint Logic Programming System. 15// The Initial Developer of the Original Code is Cisco Systems, Inc. 16// Portions created by the Initial Developer are 17// Copyright (C) 2006 Cisco Systems, Inc. All Rights Reserved. 18// 19// Contributor(s): 20// 21// END LICENSE BLOCK 22 23package com.parctechnologies.eclipse.jdotview; 24 25import java.awt.*; 26import java.awt.geom.*; 27import java.awt.event.*; 28import java.io.*; 29import java.net.*; 30import java.util.*; 31import javax.swing.*; 32import java.awt.print.*; 33import att.grappa.*; 34 35public class JDotView 36 implements GrappaConstants 37{ 38 public static final int SLEEPTIME=500; 39 40 public Frame frame = null; 41 42 public static void main(String[] args) { 43 InputStream input = System.in; 44 String filename = "-"; 45 if(args.length > 2) { 46 System.err.println("USAGE: java JDotView [input_graph_file]"); 47 System.exit(1); 48 } else if(args.length >= 1) { 49 filename=args[0]; 50 } 51 JDotView viewer = new JDotView(); 52 viewer.view(filename); 53 } 54 55 JDotView() { 56 } 57 58 void view(String filename) { 59 frame = new Frame("ECLiPSe graph viewer : "+filename); 60 final GraphVizPanel panel = new GraphVizPanel(filename, SLEEPTIME); 61 frame.addWindowListener(new WindowAdapter() { 62 public void windowClosing(WindowEvent wev) { 63 Window w = wev.getWindow(); 64 w.setVisible(false); 65 w.dispose(); 66 panel.cleanupAndExit(); 67 } 68 }); 69 frame.add(panel); 70 frame.setSize(600,400); 71 frame.setLocation(100,100); 72 frame.show(); 73 } 74 75 76} 77