Commit c6b2f327 authored by Claes Sjofors's avatar Claes Sjofors

Java inheritens of graph from base class added

parent ad5a7595
...@@ -56,7 +56,7 @@ public class JopGrowFrame extends GrowFrame implements JopUtilityIfc { ...@@ -56,7 +56,7 @@ public class JopGrowFrame extends GrowFrame implements JopUtilityIfc {
String utilityName; String utilityName;
PwrtAttrRef utilityAref; PwrtAttrRef utilityAref;
public JopGrowFrame( String file, Gdh gdh, String instance, GrowFrameApplIfc appl, Object root) { public JopGrowFrame( String file, Gdh gdh, String instance, GrowFrameApplIfc appl, Object root) throws FileNotFoundException {
super(file, gdh, instance, appl, root); super(file, gdh, instance, appl, root);
utilityName = JopUtility.fileToName( file); utilityName = JopUtility.fileToName( file);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
package jpwr.jop; package jpwr.jop;
import jpwr.rt.*; import jpwr.rt.*;
import java.lang.*; import java.lang.*;
import java.io.*;
import java.util.*; import java.util.*;
import java.awt.*; import java.awt.*;
import javax.swing.*; import javax.swing.*;
...@@ -186,7 +187,6 @@ public class JopSessionRep implements JopSessionIfc { ...@@ -186,7 +187,6 @@ public class JopSessionRep implements JopSessionIfc {
cid = tid.typeId; cid = tid.typeId;
while ( true) { while ( true) {
CdhrObjid coid = engine.gdh.classIdToObjid( cid); CdhrObjid coid = engine.gdh.classIdToObjid( cid);
if ( coid.evenSts()) return; if ( coid.evenSts()) return;
...@@ -204,6 +204,7 @@ public class JopSessionRep implements JopSessionIfc { ...@@ -204,6 +204,7 @@ public class JopSessionRep implements JopSessionIfc {
name = "pwr_c_" + sret.str.toLowerCase().substring(1) + ".pwg"; // Pwg test name = "pwr_c_" + sret.str.toLowerCase().substring(1) + ".pwg"; // Pwg test
else else
name = "pwr_c_" + sret.str.toLowerCase() + ".pwg"; // Pwg test name = "pwr_c_" + sret.str.toLowerCase() + ".pwg"; // Pwg test
int pwgidx = name.lastIndexOf( ".pwg"); int pwgidx = name.lastIndexOf( ".pwg");
if ( pwgidx == -1) { if ( pwgidx == -1) {
if ( coid.objid.vid < Cdh.cUserClassVolMin || if ( coid.objid.vid < Cdh.cUserClassVolMin ||
...@@ -237,8 +238,10 @@ public class JopSessionRep implements JopSessionIfc { ...@@ -237,8 +238,10 @@ public class JopSessionRep implements JopSessionIfc {
if ( coid.objid.vid < Cdh.cUserClassVolMin || if ( coid.objid.vid < Cdh.cUserClassVolMin ||
(coid.objid.vid >= Cdh.cManufactClassVolMin && (coid.objid.vid >= Cdh.cManufactClassVolMin &&
coid.objid.vid <= Cdh.cManufactClassVolMax)) { coid.objid.vid <= Cdh.cManufactClassVolMax)) {
if ( isApplication()) if ( isApplication()) {
name = "$pwr_exe/" + name; name = "$pwr_exe/" + name;
pwgidx = name.lastIndexOf( ".pwg");
}
} }
if ( suffix.length() > 0) if ( suffix.length() > 0)
name = name.substring(0, pwgidx) + suffix + name.substring(pwgidx); name = name.substring(0, pwgidx) + suffix + name.substring(pwgidx);
...@@ -260,11 +263,18 @@ public class JopSessionRep implements JopSessionIfc { ...@@ -260,11 +263,18 @@ public class JopSessionRep implements JopSessionIfc {
graph = JopSpider.loadFrame( session, name, instance, scrollbar); graph = JopSpider.loadFrame( session, name, instance, scrollbar);
if ( graph != null) { if ( graph != null) {
addUtility( graph); addUtility( graph);
System.out.println( "Add utility graph " + name);
} }
break; break;
} }
catch ( ClassNotFoundException e) { catch ( ClassNotFoundException e) {
if ( classGraph) {
CdhrClassId rcid = engine.gdh.getSuperClass( cid, null);
if ( rcid.evenSts())
break;
cid = rcid.classId;
}
}
catch ( FileNotFoundException e) {
if ( classGraph) { if ( classGraph) {
CdhrClassId rcid = engine.gdh.getSuperClass( cid, null); CdhrClassId rcid = engine.gdh.getSuperClass( cid, null);
if ( rcid.evenSts()) if ( rcid.evenSts())
...@@ -297,6 +307,8 @@ public class JopSessionRep implements JopSessionIfc { ...@@ -297,6 +307,8 @@ public class JopSessionRep implements JopSessionIfc {
} }
catch ( ClassNotFoundException e) { catch ( ClassNotFoundException e) {
} }
catch ( FileNotFoundException e) {
}
} }
} }
} }
......
...@@ -43,6 +43,7 @@ import javax.swing.*; ...@@ -43,6 +43,7 @@ import javax.swing.*;
import java.net.*; import java.net.*;
import java.applet.*; import java.applet.*;
import java.util.*; import java.util.*;
import java.io.*;
import jpwr.rt.*; import jpwr.rt.*;
import java.awt.event.*; import java.awt.event.*;
import jpwr.jopg.*; import jpwr.jopg.*;
...@@ -268,6 +269,8 @@ public class JopSpider { ...@@ -268,6 +269,8 @@ public class JopSpider {
} }
catch ( ClassNotFoundException e) { catch ( ClassNotFoundException e) {
} }
catch ( FileNotFoundException e) {
}
local_cmd = true; local_cmd = true;
} }
} }
...@@ -986,6 +989,8 @@ System.out.println( "JopSpiderCmd start"); ...@@ -986,6 +989,8 @@ System.out.println( "JopSpiderCmd start");
} }
catch ( ClassNotFoundException e) { catch ( ClassNotFoundException e) {
} }
catch ( FileNotFoundException e) {
}
} }
} }
} }
...@@ -1005,8 +1010,8 @@ System.out.println( "JopSpiderCmd start"); ...@@ -1005,8 +1010,8 @@ System.out.println( "JopSpiderCmd start");
} }
public static Object loadFrame( JopSession session, String className, public static Object loadFrame( JopSession session, String className,
String instance, boolean scrollbar) throws ClassNotFoundException { String instance, boolean scrollbar) throws ClassNotFoundException, FileNotFoundException {
System.out.println( "loadFrame " + className);
if ( className.indexOf(".pwg") != -1) { if ( className.indexOf(".pwg") != -1) {
JopGrowFrame frame = new JopGrowFrame(className, session.getGdh(), instance, new GrowFrameCb(session), JopGrowFrame frame = new JopGrowFrame(className, session.getGdh(), instance, new GrowFrameCb(session),
session.getRoot()); session.getRoot());
......
...@@ -82,7 +82,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener { ...@@ -82,7 +82,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
Dimension prevSize; Dimension prevSize;
int skipResize = 0; int skipResize = 0;
public GrowFrame( String file, Gdh gdh, String instance, GrowFrameApplIfc appl, Object root) { public GrowFrame( String file, Gdh gdh, String instance, GrowFrameApplIfc appl, Object root) throws FileNotFoundException {
this.root = root; this.root = root;
this.instance = instance; this.instance = instance;
this.appl = appl; this.appl = appl;
...@@ -90,7 +90,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener { ...@@ -90,7 +90,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
init( file, gdh); init( file, gdh);
} }
private void init( String file, Gdh gdh) { private void init( String file, Gdh gdh) throws FileNotFoundException {
contentPane = (JPanel) this.getContentPane(); contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1); contentPane.setLayout(borderLayout1);
contentPane.add(localPanel, BorderLayout.CENTER); contentPane.add(localPanel, BorderLayout.CENTER);
...@@ -159,8 +159,9 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener { ...@@ -159,8 +159,9 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
*/ */
} }
} }
catch ( Exception e) { catch ( Exception e) {
System.out.println( "Unable to open file"); System.out.println( "Unable to open file");
throw new FileNotFoundException( "File not found: " + file);
} }
} }
else { else {
...@@ -181,7 +182,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener { ...@@ -181,7 +182,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
} }
catch ( Exception e) { catch ( Exception e) {
System.out.println( "Unable to open file " + filename); System.out.println( "Unable to open file " + filename);
return; throw new FileNotFoundException( "Unable to open file " + filename);
} }
// Read size info // Read size info
String line; String line;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment