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 {
String utilityName;
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);
utilityName = JopUtility.fileToName( file);
......
......@@ -37,6 +37,7 @@
package jpwr.jop;
import jpwr.rt.*;
import java.lang.*;
import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;
......@@ -186,7 +187,6 @@ public class JopSessionRep implements JopSessionIfc {
cid = tid.typeId;
while ( true) {
CdhrObjid coid = engine.gdh.classIdToObjid( cid);
if ( coid.evenSts()) return;
......@@ -204,6 +204,7 @@ public class JopSessionRep implements JopSessionIfc {
name = "pwr_c_" + sret.str.toLowerCase().substring(1) + ".pwg"; // Pwg test
else
name = "pwr_c_" + sret.str.toLowerCase() + ".pwg"; // Pwg test
int pwgidx = name.lastIndexOf( ".pwg");
if ( pwgidx == -1) {
if ( coid.objid.vid < Cdh.cUserClassVolMin ||
......@@ -237,8 +238,10 @@ public class JopSessionRep implements JopSessionIfc {
if ( coid.objid.vid < Cdh.cUserClassVolMin ||
(coid.objid.vid >= Cdh.cManufactClassVolMin &&
coid.objid.vid <= Cdh.cManufactClassVolMax)) {
if ( isApplication())
if ( isApplication()) {
name = "$pwr_exe/" + name;
pwgidx = name.lastIndexOf( ".pwg");
}
}
if ( suffix.length() > 0)
name = name.substring(0, pwgidx) + suffix + name.substring(pwgidx);
......@@ -260,11 +263,18 @@ public class JopSessionRep implements JopSessionIfc {
graph = JopSpider.loadFrame( session, name, instance, scrollbar);
if ( graph != null) {
addUtility( graph);
System.out.println( "Add utility graph " + name);
}
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) {
CdhrClassId rcid = engine.gdh.getSuperClass( cid, null);
if ( rcid.evenSts())
......@@ -297,6 +307,8 @@ public class JopSessionRep implements JopSessionIfc {
}
catch ( ClassNotFoundException e) {
}
catch ( FileNotFoundException e) {
}
}
}
}
......
......@@ -43,6 +43,7 @@ import javax.swing.*;
import java.net.*;
import java.applet.*;
import java.util.*;
import java.io.*;
import jpwr.rt.*;
import java.awt.event.*;
import jpwr.jopg.*;
......@@ -268,6 +269,8 @@ public class JopSpider {
}
catch ( ClassNotFoundException e) {
}
catch ( FileNotFoundException e) {
}
local_cmd = true;
}
}
......@@ -986,6 +989,8 @@ System.out.println( "JopSpiderCmd start");
}
catch ( ClassNotFoundException e) {
}
catch ( FileNotFoundException e) {
}
}
}
}
......@@ -1005,8 +1010,8 @@ System.out.println( "JopSpiderCmd start");
}
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) {
JopGrowFrame frame = new JopGrowFrame(className, session.getGdh(), instance, new GrowFrameCb(session),
session.getRoot());
......
......@@ -82,7 +82,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
Dimension prevSize;
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.instance = instance;
this.appl = appl;
......@@ -90,7 +90,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
init( file, gdh);
}
private void init( String file, Gdh gdh) {
private void init( String file, Gdh gdh) throws FileNotFoundException {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
contentPane.add(localPanel, BorderLayout.CENTER);
......@@ -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");
throw new FileNotFoundException( "File not found: " + file);
}
}
else {
......@@ -181,7 +182,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
catch ( Exception e) {
System.out.println( "Unable to open file " + filename);
return;
throw new FileNotFoundException( "Unable to open file " + filename);
}
// Read size info
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