Commit 9c4c1fd8 authored by claes's avatar claes

Changes from V3.4b copied

parent 38436917
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include "rt_mh_outunit.h" #include "rt_mh_outunit.h"
#include "rt_mh_util.h" #include "rt_mh_util.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "co_cdh.h" #include "co_cdh.h"
#include "co_dcli.h" #include "co_dcli.h"
...@@ -16,39 +14,11 @@ ...@@ -16,39 +14,11 @@
#include "co_cdh_msg.h" #include "co_cdh_msg.h"
#include "rt_gdh_msg.h" #include "rt_gdh_msg.h"
/*frn xtt_ev.cpp*/
pwr_tStatus ev_mh_ack_bc( mh_sAck *MsgP); pwr_tStatus ev_mh_ack_bc( mh_sAck *MsgP);
pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP); pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP);
pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP); pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP);
pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP); pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP);
pwr_tStatus ev_mh_clear_alarmlist_bc( pwr_tNodeIndex nix); pwr_tStatus ev_mh_clear_alarmlist_bc( pwr_tNodeIndex nix);
/*slut p frn xtt_ev.cpp*/
const int EventType_Info = 0;
const int EventType_Return = 1;
const int EventType_Ack = 2;
const int EventType_Alarm = 3;
const int EventType_ClearAlarmList = 4;
/*frn jpwr_rt_gdh.c
typedef struct {
char TypeStr[32];
pwr_eType Type;
int Size;
} gdh_sSuffixTable;
static int gdh_ExtractNameSuffix( char *Name,
char **Suffix);
static void gdh_TranslateSuffixToClassData (
char *SuffixPtr,
pwr_eType *PwrType,
int *PwrSize,
int *NoOfElements);
static int gdh_StringToAttr( char *str_value, char *buffer_p, int buffer_size,
pwr_eType attrtype, int attrsize);
static void gdh_AttrToString( int type_id, void *value_ptr,
char *str, int size, int *len, char *format);
static void gdh_ConvertUTFstring( char *out, char *in);
//slut p frn jpwr_rt_gdh.c
*/
jclass Mh_id; jclass Mh_id;
jmethodID Mh_messReceived_id; jmethodID Mh_messReceived_id;
...@@ -72,7 +42,7 @@ JNIEXPORT void JNICALL Java_jpwr_rt_Mh_initIDs ...@@ -72,7 +42,7 @@ JNIEXPORT void JNICALL Java_jpwr_rt_Mh_initIDs
sts = (*env)->GetJavaVM(env, &jvm); sts = (*env)->GetJavaVM(env, &jvm);
if(sts) if(sts)
{ {
printf("Skit vid GetJavaVM\n"); printf("Hittar ej JavaVM\n");
} }
} }
...@@ -110,7 +80,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitAck ...@@ -110,7 +80,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitAck
//hmta upp classid och sedan pekare till konstruktorn fr PwrtStatus //hmta upp classid och sedan pekare till konstruktorn fr PwrtStatus
pwrtStatus_cid = (*env)->GetMethodID( env, pwrtStatus_id, pwrtStatus_cid = (*env)->GetMethodID( env, pwrtStatus_id,
"<init>", "(I)V"); "<init>", "(I)V");
printf("efter status methodidhmtning\n");
if(pwrtStatus_cid == NULL) if(pwrtStatus_cid == NULL)
{ {
printf("fel vid PwrtStatus methodidhmtning\n"); printf("fel vid PwrtStatus methodidhmtning\n");
...@@ -147,31 +116,21 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitAck ...@@ -147,31 +116,21 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitAck
sts = -2;//lyckades inte hitta fltet sts = -2;//lyckades inte hitta fltet
} }
//printf("efter birthtime hmtning\n");
eventId.Nix = (pwr_tNodeIndex)(*env)->GetIntField(env,id,nix_fid); eventId.Nix = (pwr_tNodeIndex)(*env)->GetIntField(env,id,nix_fid);
eventId.Idx = (pwr_tUInt32)(*env)->GetIntField(env,id,idx_fid); eventId.Idx = (pwr_tUInt32)(*env)->GetIntField(env,id,idx_fid);
//printf("efter getfielad\n");
jstr = (*env)->GetObjectField(env,id,birthTime_fid); jstr = (*env)->GetObjectField(env,id,birthTime_fid);
(const char *)str_copy = (*env)->GetStringUTFChars(env,jstr,NULL); (const char *)str_copy = (*env)->GetStringUTFChars(env,jstr,NULL);
//strcpy(str, str_copy);
if (str_copy ==NULL) if (str_copy ==NULL)
{ {
sts = -1;//out of memory sts = -1;//out of memory
} }
//printf("efter strcpy\n");
//printf("str = %s", str);
time_AsciiToA(str_copy, &eventId.BirthTime); time_AsciiToA(str_copy, &eventId.BirthTime);
//printf("efter AsciiToA\n");
//printf("eventid= %d %d ", eventId.Idx, eventId.Nix);
sts = mh_OutunitAck(&eventId); sts = mh_OutunitAck(&eventId);
//printf("efter outunitack2 sts %d\n", sts);
(*env)->ReleaseStringUTFChars(env,jstr,str_copy); (*env)->ReleaseStringUTFChars(env,jstr,str_copy);
//(*env)->ReleaseStringUTFChars(env,jstr,str);
jsts = (jint) sts; jsts = (jint) sts;
//skapa returobjekt //skapa returobjekt
...@@ -222,22 +181,9 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitConnect ...@@ -222,22 +181,9 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitConnect
//hmta oix och vid fr objektet som skickats med frn anroparen //hmta oix och vid fr objektet som skickats med frn anroparen
user.oix = (*env)->CallIntMethod( env, objid_obj, PwrtObjid_getOix); user.oix = (*env)->CallIntMethod( env, objid_obj, PwrtObjid_getOix);
user.vid = (*env)->CallIntMethod( env, objid_obj, PwrtObjid_getVid); user.vid = (*env)->CallIntMethod( env, objid_obj, PwrtObjid_getVid);
//printf("user.oix = %d user.vid = %d\n", user.oix, user.vid);
// Wait for mh has flagged initizated qqq vad r detta // Wait for mh has flagged initizated qqq vad r detta
//printf("innan waitformh\n");
mh_UtilWaitForMh(); mh_UtilWaitForMh();
//printf("efter waitformh\n");
/*
sts = gdh_ObjidToPointer ( user, (pwr_tAddress *) &userobject_ptr);
if ( EVEN(sts))
{
printf("skit vid objidtopinter\n");
}
*/
//gr connect //gr connect
sts = mh_OutunitConnect( sts = mh_OutunitConnect(
...@@ -253,8 +199,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitConnect ...@@ -253,8 +199,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitConnect
ev_mh_info_bc, ev_mh_info_bc,
ev_mh_return_bc ev_mh_return_bc
); );
//printf("I connect C-kod sts= %d\n", sts);
jsts = (jint) sts; jsts = (jint) sts;
//skapa returobjekt //skapa returobjekt
...@@ -279,7 +223,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitDisConnect ...@@ -279,7 +223,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitDisConnect
"<init>", "(I)V"); "<init>", "(I)V");
sts = mh_OutunitDisconnect(); sts = mh_OutunitDisconnect();
//printf("I disconnect C-kod sts= %d\n", sts);
jsts = (jint) sts; jsts = (jint) sts;
...@@ -312,16 +255,13 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitReceive ...@@ -312,16 +255,13 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Mh_outunitReceive
//hmta upp classid och sedan pekare till konstruktorn fr PwrtStatus //hmta upp classid och sedan pekare till konstruktorn fr PwrtStatus
pwrtStatus_cid = (*env)->GetMethodID( env, pwrtStatus_id, pwrtStatus_cid = (*env)->GetMethodID( env, pwrtStatus_id,
"<init>", "(I)V"); "<init>", "(I)V");
printf("efter PwrtStatus methodid hmtning\n");
if(pwrtStatus_cid == NULL) if(pwrtStatus_cid == NULL)
{ {
printf("fel vid PwrtStatus methodid hmtning\n"); printf("fel vid PwrtStatus methodid hmtning\n");
return NULL; return NULL;
} }
} }
//printf("Innan receive C-kod\n");
sts = mh_OutunitReceive(); sts = mh_OutunitReceive();
//printf("Efter receive C-kod sts= %d\n", sts);
jsts = (jint) sts; jsts = (jint) sts;
//skapa returobjekt //skapa returobjekt
...@@ -426,7 +366,7 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP) ...@@ -426,7 +366,7 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP)
char birthTime_str[40]; char birthTime_str[40];
pwr_tObjid objid = MsgP->Info.SupObject; pwr_tObjid objid = MsgP->Info.Object;
pwr_tTime time = MsgP->Info.EventTime; pwr_tTime time = MsgP->Info.EventTime;
pwr_tTime birthTime = MsgP->Info.Id.BirthTime; pwr_tTime birthTime = MsgP->Info.Id.BirthTime;
...@@ -494,7 +434,7 @@ pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP) ...@@ -494,7 +434,7 @@ pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP)
char birthTime_str[40]; char birthTime_str[40];
pwr_tObjid objid = MsgP->Info.SupObject; pwr_tObjid objid = MsgP->Info.Object;
pwr_tTime time = MsgP->Info.EventTime; pwr_tTime time = MsgP->Info.EventTime;
pwr_tTime birthTime = MsgP->Info.Id.BirthTime; pwr_tTime birthTime = MsgP->Info.Id.BirthTime;
...@@ -562,7 +502,7 @@ pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP) ...@@ -562,7 +502,7 @@ pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP)
char birthTime_str[40]; char birthTime_str[40];
pwr_tObjid objid = MsgP->Info.SupObject; pwr_tObjid objid = MsgP->Info.Object;
pwr_tTime time = MsgP->Info.EventTime; pwr_tTime time = MsgP->Info.EventTime;
pwr_tTime birthTime = MsgP->Info.Id.BirthTime; pwr_tTime birthTime = MsgP->Info.Id.BirthTime;
......
...@@ -214,11 +214,7 @@ public class FlowFrame extends JFrame implements JopUtilityIfc { ...@@ -214,11 +214,7 @@ public class FlowFrame extends JFrame implements JopUtilityIfc {
System.out.println( "Menu: " + e.getActionCommand()); System.out.println( "Menu: " + e.getActionCommand());
if ( e.getActionCommand().equals("Close")) { if ( e.getActionCommand().equals("Close")) {
for ( int i = 0; i < ctx.cmn.a.size(); i++) { closeFlow();
Object o = ctx.cmn.a.get(i);
engine.remove( o);
session.removeUtility( this);
}
dispose(); dispose();
} }
if ( e.getActionCommand().equals("Show Crossreferences")) { if ( e.getActionCommand().equals("Show Crossreferences")) {
...@@ -299,15 +295,19 @@ public class FlowFrame extends JFrame implements JopUtilityIfc { ...@@ -299,15 +295,19 @@ public class FlowFrame extends JFrame implements JopUtilityIfc {
return null; return null;
} }
public void closeFlow() {
for ( int i = 0; i < ctx.cmn.a.size(); i++) {
Object o = ctx.cmn.a.get(i);
engine.remove( o);
}
session.removeUtility( this);
}
// Exit when window is closed // Exit when window is closed
protected void processWindowEvent(WindowEvent e) { protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e); super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) { if (e.getID() == WindowEvent.WINDOW_CLOSING) {
for ( int i = 0; i < ctx.cmn.a.size(); i++) { closeFlow();
Object o = ctx.cmn.a.get(i);
engine.remove( o);
session.removeUtility( this);
}
} }
} }
} }
......
...@@ -11,6 +11,8 @@ public class JopOpWindow extends JPanel { ...@@ -11,6 +11,8 @@ public class JopOpWindow extends JPanel {
Object root; Object root;
public JopOpWindow( JopSession session, Object root) { public JopOpWindow( JopSession session, Object root) {
// super( BoxLayout.Y_AXIS);
// createGlue();
this.session = session; this.session = session;
this.root = root; this.root = root;
en = session.getEngine(); en = session.getEngine();
...@@ -147,11 +149,18 @@ public class JopOpWindow extends JPanel { ...@@ -147,11 +149,18 @@ public class JopOpWindow extends JPanel {
boolean scrollbar; boolean scrollbar;
String instance; String instance;
public Dimension getPreferredSize() {
return new Dimension( 200, 25);
}
public Dimension getMininumSize() { return getPreferredSize();}
public Dimension getMaximumSize() { return getPreferredSize();}
public OpWindButton( JopSession bsession, String name, String text, int btype) { public OpWindButton( JopSession bsession, String name, String text, int btype) {
this.session = bsession; this.session = bsession;
this.action = name; this.action = name;
this.type = btype; this.type = btype;
setText( text); setText( text);
setHorizontalTextPosition( SwingConstants.LEFT);
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
switch ( type) { switch ( type) {
......
...@@ -38,7 +38,7 @@ public class JopOpWindowFrame extends JFrame { ...@@ -38,7 +38,7 @@ public class JopOpWindowFrame extends JFrame {
scrollPane = new JScrollPane(localPanel); scrollPane = new JScrollPane(localPanel);
contentPane.add(scrollPane, BorderLayout.CENTER); contentPane.add(scrollPane, BorderLayout.CENTER);
contentPane.setOpaque(true); contentPane.setOpaque(true);
localPanel.setLayout(new BoxLayout( localPanel, BoxLayout.Y_AXIS)); localPanel.setLayout( new BoxLayout( localPanel, BoxLayout.Y_AXIS));
localPanel.setOpaque(true); localPanel.setOpaque(true);
localPanel.setBackground( Color.white); localPanel.setBackground( Color.white);
this.setTitle("Operator Window"); this.setTitle("Operator Window");
...@@ -55,3 +55,5 @@ public class JopOpWindowFrame extends JFrame { ...@@ -55,3 +55,5 @@ public class JopOpWindowFrame extends JFrame {
} }
} }
} }
...@@ -51,7 +51,7 @@ public class JopSessionRep implements JopSessionIfc { ...@@ -51,7 +51,7 @@ public class JopSessionRep implements JopSessionIfc {
public void openAlarmList() { public void openAlarmList() {
if ( alarmList == null) { if ( alarmList == null) {
alarmList = new MhFrame(); alarmList = new MhFrame(session);
alarmList.setVisible( true); alarmList.setVisible( true);
} }
else { else {
......
...@@ -25,6 +25,11 @@ import java.awt.event.*; ...@@ -25,6 +25,11 @@ import java.awt.event.*;
*/ */
public class MhFrame extends JFrame public class MhFrame extends JFrame
{ {
JopSession session;
JopEngine engine;
XttTree xttTree;
Object root;
/** Description of the Field */ /** Description of the Field */
BorderLayout borderLayout1 = new BorderLayout(); BorderLayout borderLayout1 = new BorderLayout();
...@@ -54,6 +59,7 @@ public class MhFrame extends JFrame ...@@ -54,6 +59,7 @@ public class MhFrame extends JFrame
/** Constructor for the MhClient object */ /** Constructor for the MhClient object */
/*
public MhFrame() public MhFrame()
{ {
addWindowListener( addWindowListener(
...@@ -68,7 +74,24 @@ public class MhFrame extends JFrame ...@@ -68,7 +74,24 @@ public class MhFrame extends JFrame
this.init(); this.init();
} }
*/
public MhFrame()
{
engine = new JopEngine( 1000, (Object)this);
session = new JopSession( engine, (Object)this);
root = (Object) this;
init();
}
public MhFrame( JopSession session)
{
this.session = session;
engine = session.getEngine();
root = session.getRoot();
init();
}
/** Description of the Method */ /** Description of the Method */
public void destroy() public void destroy()
{ {
...@@ -110,7 +133,7 @@ public class MhFrame extends JFrame ...@@ -110,7 +133,7 @@ public class MhFrame extends JFrame
messagePanel.add(labelMessage, BorderLayout.NORTH); messagePanel.add(labelMessage, BorderLayout.NORTH);
//Logg.logg("MhClient: Fre XttTree-skapande", 6); //Logg.logg("MhClient: Fre XttTree-skapande", 6);
this.mhTable = new MhTable(this, false, this.labelMessage); this.mhTable = new MhTable(root, false, this.labelMessage);
//Logg.logg("MhClient: mhTable-skapande klart", 6); //Logg.logg("MhClient: mhTable-skapande klart", 6);
this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER); this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
......
...@@ -105,7 +105,6 @@ public class MhTable extends JPanel ...@@ -105,7 +105,6 @@ public class MhTable extends JPanel
//Create the scroll pane and add the table to it. //Create the scroll pane and add the table to it.
scrollPaneEv = new JScrollPane(eventTable); scrollPaneEv = new JScrollPane(eventTable);
scrollPaneEv.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPaneEv.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
//scrollPaneEv.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
//Add the scroll pane to this window. //Add the scroll pane to this window.
this.initColumnSizes(eventTable, evModel, false); this.initColumnSizes(eventTable, evModel, false);
scrollPaneEv.getViewport().setBackground(Color.white); scrollPaneEv.getViewport().setBackground(Color.white);
...@@ -204,10 +203,15 @@ public class MhTable extends JPanel ...@@ -204,10 +203,15 @@ public class MhTable extends JPanel
{ {
URL url; URL url;
String urlString = "127.0.0.1"; String urlString = "127.0.0.1";
if(root instanceof JApplet) try
{ {
url = ((JApplet)root).getCodeBase(); url = ((JApplet)root).getCodeBase();
urlString = url.getHost(); if(url != null)
urlString = url.getHost();
}
catch(Exception e)
{
System.out.println(e.toString());
} }
if(trace) if(trace)
{ {
......
...@@ -33,7 +33,7 @@ public class XttTree extends JPanel ...@@ -33,7 +33,7 @@ public class XttTree extends JPanel
JTextField userValue = new JTextField(25); JTextField userValue = new JTextField(25);
/** Description of the Field */ /** Description of the Field */
JLabel userValueLabel = new JLabel("Value input: "); JLabel userValueLabel = new JLabel("Value input: ");
JLabel labelMessage = new JLabel("Jonas Nylund was here"); JLabel labelMessage = new JLabel("Navigator ver 1.0");
Dimension size; Dimension size;
/** Description of the Field */ /** Description of the Field */
JTree tree; JTree tree;
...@@ -276,7 +276,7 @@ public class XttTree extends JPanel ...@@ -276,7 +276,7 @@ public class XttTree extends JPanel
//then expand row 0 so we can se the rootlevel in the system //then expand row 0 so we can se the rootlevel in the system
tree.expandRow(0); tree.expandRow(0);
tree.setScrollsOnExpand(false); tree.setScrollsOnExpand(true);
tree.setRootVisible(false); tree.setRootVisible(false);
tree.setShowsRootHandles(true); tree.setShowsRootHandles(true);
tree.setSelectionRow(0); tree.setSelectionRow(0);
...@@ -701,6 +701,10 @@ public class XttTree extends JPanel ...@@ -701,6 +701,10 @@ public class XttTree extends JPanel
String str = this.gdh.objidToName(objid, Cdh.mName_pathStrict).str; String str = this.gdh.objidToName(objid, Cdh.mName_pathStrict).str;
if(str != null) if(str != null)
this.find(str); this.find(str);
TreePath selectedPath = this.tree.getSelectionPath();
System.out.println(selectedPath);
if(selectedPath != null)
this.tree.scrollPathToVisible(selectedPath);
} }
public void find(String userStr) public void find(String userStr)
...@@ -793,11 +797,11 @@ public class XttTree extends JPanel ...@@ -793,11 +797,11 @@ public class XttTree extends JPanel
System.out.println("Hittat skvg"); System.out.println("Hittat skvg");
TreePath tp = new TreePath(tn.getPath()); TreePath tp = new TreePath(tn.getPath());
if(tn.isLeaf()) // if(tn.isLeaf())
{ // {
addObjectInfo(tp); // addObjectInfo(tp);
} // }
else // else
this.tree.expandPath(tp); this.tree.expandPath(tp);
this.tree.setSelectionPath(tp); this.tree.setSelectionPath(tp);
return tp; return tp;
......
...@@ -398,12 +398,13 @@ public class GdhServer ...@@ -398,12 +398,13 @@ public class GdhServer
String attrName = in.readUTF(); String attrName = in.readUTF();
CdhrBoolean ret = gdh.getObjectInfoBoolean(attrName); CdhrBoolean ret = gdh.getObjectInfoBoolean(attrName);
out.writeInt(ret.sts); out.writeInt(ret.sts);
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeBoolean(ret.value); out.writeBoolean(ret.value);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -416,12 +417,13 @@ public class GdhServer ...@@ -416,12 +417,13 @@ public class GdhServer
String attrName = in.readUTF(); String attrName = in.readUTF();
CdhrInt ret = gdh.getObjectInfoInt(attrName); CdhrInt ret = gdh.getObjectInfoInt(attrName);
out.writeInt(ret.sts); out.writeInt(ret.sts);
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.value); out.writeInt(ret.value);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -434,12 +436,13 @@ public class GdhServer ...@@ -434,12 +436,13 @@ public class GdhServer
String attrName = in.readUTF(); String attrName = in.readUTF();
CdhrFloat ret = gdh.getObjectInfoFloat(attrName); CdhrFloat ret = gdh.getObjectInfoFloat(attrName);
out.writeInt(ret.sts); out.writeInt(ret.sts);
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeFloat(ret.value); out.writeFloat(ret.value);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -452,12 +455,13 @@ public class GdhServer ...@@ -452,12 +455,13 @@ public class GdhServer
String attrName = in.readUTF(); String attrName = in.readUTF();
CdhrString ret = gdh.getObjectInfoString(attrName); CdhrString ret = gdh.getObjectInfoString(attrName);
out.writeInt(ret.sts); out.writeInt(ret.sts);
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeUTF(ret.str); out.writeUTF(ret.str);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -470,13 +474,14 @@ public class GdhServer ...@@ -470,13 +474,14 @@ public class GdhServer
String name = in.readUTF(); String name = in.readUTF();
CdhrObjid ret = gdh.getObjectInfoObjid(name); CdhrObjid ret = gdh.getObjectInfoObjid(name);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -901,13 +906,14 @@ public class GdhServer ...@@ -901,13 +906,14 @@ public class GdhServer
PwrtObjid objid = new PwrtObjid(oix, vid); PwrtObjid objid = new PwrtObjid(oix, vid);
CdhrObjid ret = gdh.getChild(objid); CdhrObjid ret = gdh.getChild(objid);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -922,13 +928,14 @@ public class GdhServer ...@@ -922,13 +928,14 @@ public class GdhServer
PwrtObjid objid = new PwrtObjid(oix, vid); PwrtObjid objid = new PwrtObjid(oix, vid);
CdhrObjid ret = gdh.getParent(objid); CdhrObjid ret = gdh.getParent(objid);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -943,13 +950,14 @@ public class GdhServer ...@@ -943,13 +950,14 @@ public class GdhServer
PwrtObjid objid = new PwrtObjid(oix, vid); PwrtObjid objid = new PwrtObjid(oix, vid);
CdhrObjid ret = gdh.getNextSibling(objid); CdhrObjid ret = gdh.getNextSibling(objid);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -981,13 +989,14 @@ public class GdhServer ...@@ -981,13 +989,14 @@ public class GdhServer
int classid = in.readInt(); int classid = in.readInt();
CdhrObjid ret = gdh.getClassList(classid); CdhrObjid ret = gdh.getClassList(classid);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
......
...@@ -82,10 +82,10 @@ public class RtUtilities { ...@@ -82,10 +82,10 @@ public class RtUtilities {
int offs1; int offs1;
int offs2; int offs2;
// Replace in instance name because mozilla can't pass them as // Replace in instance name because mozilla can't pass them as
// parameter // parameter
for ( int i = 0; i < instance.length(); i++) { for ( int i = 0; i < instance.length(); i++) {
if ( instanceBuff[i] == '' || instanceBuff[i] == '') if ( instanceBuff[i] == '' || instanceBuff[i] == '')
instanceBuff[i] = '\\'; instanceBuff[i] = '\\';
if ( instanceBuff[i] == '' || instanceBuff[i] == '') if ( instanceBuff[i] == '' || instanceBuff[i] == '')
instanceBuff[i] = '/'; instanceBuff[i] = '/';
......
...@@ -214,11 +214,7 @@ public class FlowFrame extends JFrame implements JopUtilityIfc { ...@@ -214,11 +214,7 @@ public class FlowFrame extends JFrame implements JopUtilityIfc {
System.out.println( "Menu: " + e.getActionCommand()); System.out.println( "Menu: " + e.getActionCommand());
if ( e.getActionCommand().equals("Close")) { if ( e.getActionCommand().equals("Close")) {
for ( int i = 0; i < ctx.cmn.a.size(); i++) { closeFlow();
Object o = ctx.cmn.a.get(i);
engine.remove( o);
session.removeUtility( this);
}
dispose(); dispose();
} }
if ( e.getActionCommand().equals("Show Crossreferences")) { if ( e.getActionCommand().equals("Show Crossreferences")) {
...@@ -299,15 +295,19 @@ public class FlowFrame extends JFrame implements JopUtilityIfc { ...@@ -299,15 +295,19 @@ public class FlowFrame extends JFrame implements JopUtilityIfc {
return null; return null;
} }
public void closeFlow() {
for ( int i = 0; i < ctx.cmn.a.size(); i++) {
Object o = ctx.cmn.a.get(i);
engine.remove( o);
}
session.removeUtility( this);
}
// Exit when window is closed // Exit when window is closed
protected void processWindowEvent(WindowEvent e) { protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e); super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) { if (e.getID() == WindowEvent.WINDOW_CLOSING) {
for ( int i = 0; i < ctx.cmn.a.size(); i++) { closeFlow();
Object o = ctx.cmn.a.get(i);
engine.remove( o);
session.removeUtility( this);
}
} }
} }
} }
......
...@@ -11,6 +11,8 @@ public class JopOpWindow extends JPanel { ...@@ -11,6 +11,8 @@ public class JopOpWindow extends JPanel {
Object root; Object root;
public JopOpWindow( JopSession session, Object root) { public JopOpWindow( JopSession session, Object root) {
// super( BoxLayout.Y_AXIS);
// createGlue();
this.session = session; this.session = session;
this.root = root; this.root = root;
en = session.getEngine(); en = session.getEngine();
...@@ -147,11 +149,18 @@ public class JopOpWindow extends JPanel { ...@@ -147,11 +149,18 @@ public class JopOpWindow extends JPanel {
boolean scrollbar; boolean scrollbar;
String instance; String instance;
public Dimension getPreferredSize() {
return new Dimension( 200, 25);
}
public Dimension getMininumSize() { return getPreferredSize();}
public Dimension getMaximumSize() { return getPreferredSize();}
public OpWindButton( JopSession bsession, String name, String text, int btype) { public OpWindButton( JopSession bsession, String name, String text, int btype) {
this.session = bsession; this.session = bsession;
this.action = name; this.action = name;
this.type = btype; this.type = btype;
setText( text); setText( text);
setHorizontalTextPosition( SwingConstants.LEFT);
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
switch ( type) { switch ( type) {
......
...@@ -38,7 +38,7 @@ public class JopOpWindowFrame extends JFrame { ...@@ -38,7 +38,7 @@ public class JopOpWindowFrame extends JFrame {
scrollPane = new JScrollPane(localPanel); scrollPane = new JScrollPane(localPanel);
contentPane.add(scrollPane, BorderLayout.CENTER); contentPane.add(scrollPane, BorderLayout.CENTER);
contentPane.setOpaque(true); contentPane.setOpaque(true);
localPanel.setLayout(new BoxLayout( localPanel, BoxLayout.Y_AXIS)); localPanel.setLayout( new BoxLayout( localPanel, BoxLayout.Y_AXIS));
localPanel.setOpaque(true); localPanel.setOpaque(true);
localPanel.setBackground( Color.white); localPanel.setBackground( Color.white);
this.setTitle("Operator Window"); this.setTitle("Operator Window");
...@@ -55,3 +55,5 @@ public class JopOpWindowFrame extends JFrame { ...@@ -55,3 +55,5 @@ public class JopOpWindowFrame extends JFrame {
} }
} }
} }
...@@ -51,7 +51,7 @@ public class JopSessionRep implements JopSessionIfc { ...@@ -51,7 +51,7 @@ public class JopSessionRep implements JopSessionIfc {
public void openAlarmList() { public void openAlarmList() {
if ( alarmList == null) { if ( alarmList == null) {
alarmList = new MhFrame(); alarmList = new MhFrame(session);
alarmList.setVisible( true); alarmList.setVisible( true);
} }
else { else {
......
...@@ -25,6 +25,11 @@ import java.awt.event.*; ...@@ -25,6 +25,11 @@ import java.awt.event.*;
*/ */
public class MhFrame extends JFrame public class MhFrame extends JFrame
{ {
JopSession session;
JopEngine engine;
XttTree xttTree;
Object root;
/** Description of the Field */ /** Description of the Field */
BorderLayout borderLayout1 = new BorderLayout(); BorderLayout borderLayout1 = new BorderLayout();
...@@ -54,6 +59,7 @@ public class MhFrame extends JFrame ...@@ -54,6 +59,7 @@ public class MhFrame extends JFrame
/** Constructor for the MhClient object */ /** Constructor for the MhClient object */
/*
public MhFrame() public MhFrame()
{ {
addWindowListener( addWindowListener(
...@@ -68,7 +74,24 @@ public class MhFrame extends JFrame ...@@ -68,7 +74,24 @@ public class MhFrame extends JFrame
this.init(); this.init();
} }
*/
public MhFrame()
{
engine = new JopEngine( 1000, (Object)this);
session = new JopSession( engine, (Object)this);
root = (Object) this;
init();
}
public MhFrame( JopSession session)
{
this.session = session;
engine = session.getEngine();
root = session.getRoot();
init();
}
/** Description of the Method */ /** Description of the Method */
public void destroy() public void destroy()
{ {
...@@ -110,7 +133,7 @@ public class MhFrame extends JFrame ...@@ -110,7 +133,7 @@ public class MhFrame extends JFrame
messagePanel.add(labelMessage, BorderLayout.NORTH); messagePanel.add(labelMessage, BorderLayout.NORTH);
//Logg.logg("MhClient: Fre XttTree-skapande", 6); //Logg.logg("MhClient: Fre XttTree-skapande", 6);
this.mhTable = new MhTable(this, false, this.labelMessage); this.mhTable = new MhTable(root, false, this.labelMessage);
//Logg.logg("MhClient: mhTable-skapande klart", 6); //Logg.logg("MhClient: mhTable-skapande klart", 6);
this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER); this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
......
...@@ -105,7 +105,6 @@ public class MhTable extends JPanel ...@@ -105,7 +105,6 @@ public class MhTable extends JPanel
//Create the scroll pane and add the table to it. //Create the scroll pane and add the table to it.
scrollPaneEv = new JScrollPane(eventTable); scrollPaneEv = new JScrollPane(eventTable);
scrollPaneEv.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPaneEv.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
//scrollPaneEv.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
//Add the scroll pane to this window. //Add the scroll pane to this window.
this.initColumnSizes(eventTable, evModel, false); this.initColumnSizes(eventTable, evModel, false);
scrollPaneEv.getViewport().setBackground(Color.white); scrollPaneEv.getViewport().setBackground(Color.white);
...@@ -204,10 +203,15 @@ public class MhTable extends JPanel ...@@ -204,10 +203,15 @@ public class MhTable extends JPanel
{ {
URL url; URL url;
String urlString = "127.0.0.1"; String urlString = "127.0.0.1";
if(root instanceof JApplet) try
{ {
url = ((JApplet)root).getCodeBase(); url = ((JApplet)root).getCodeBase();
urlString = url.getHost(); if(url != null)
urlString = url.getHost();
}
catch(Exception e)
{
System.out.println(e.toString());
} }
if(trace) if(trace)
{ {
......
...@@ -33,7 +33,7 @@ public class XttTree extends JPanel ...@@ -33,7 +33,7 @@ public class XttTree extends JPanel
JTextField userValue = new JTextField(25); JTextField userValue = new JTextField(25);
/** Description of the Field */ /** Description of the Field */
JLabel userValueLabel = new JLabel("Value input: "); JLabel userValueLabel = new JLabel("Value input: ");
JLabel labelMessage = new JLabel("Jonas Nylund was here"); JLabel labelMessage = new JLabel("Navigator ver 1.0");
Dimension size; Dimension size;
/** Description of the Field */ /** Description of the Field */
JTree tree; JTree tree;
...@@ -276,7 +276,7 @@ public class XttTree extends JPanel ...@@ -276,7 +276,7 @@ public class XttTree extends JPanel
//then expand row 0 so we can se the rootlevel in the system //then expand row 0 so we can se the rootlevel in the system
tree.expandRow(0); tree.expandRow(0);
tree.setScrollsOnExpand(false); tree.setScrollsOnExpand(true);
tree.setRootVisible(false); tree.setRootVisible(false);
tree.setShowsRootHandles(true); tree.setShowsRootHandles(true);
tree.setSelectionRow(0); tree.setSelectionRow(0);
...@@ -701,6 +701,10 @@ public class XttTree extends JPanel ...@@ -701,6 +701,10 @@ public class XttTree extends JPanel
String str = this.gdh.objidToName(objid, Cdh.mName_pathStrict).str; String str = this.gdh.objidToName(objid, Cdh.mName_pathStrict).str;
if(str != null) if(str != null)
this.find(str); this.find(str);
TreePath selectedPath = this.tree.getSelectionPath();
System.out.println(selectedPath);
if(selectedPath != null)
this.tree.scrollPathToVisible(selectedPath);
} }
public void find(String userStr) public void find(String userStr)
...@@ -793,11 +797,11 @@ public class XttTree extends JPanel ...@@ -793,11 +797,11 @@ public class XttTree extends JPanel
System.out.println("Hittat skvg"); System.out.println("Hittat skvg");
TreePath tp = new TreePath(tn.getPath()); TreePath tp = new TreePath(tn.getPath());
if(tn.isLeaf()) // if(tn.isLeaf())
{ // {
addObjectInfo(tp); // addObjectInfo(tp);
} // }
else // else
this.tree.expandPath(tp); this.tree.expandPath(tp);
this.tree.setSelectionPath(tp); this.tree.setSelectionPath(tp);
return tp; return tp;
......
...@@ -398,12 +398,13 @@ public class GdhServer ...@@ -398,12 +398,13 @@ public class GdhServer
String attrName = in.readUTF(); String attrName = in.readUTF();
CdhrBoolean ret = gdh.getObjectInfoBoolean(attrName); CdhrBoolean ret = gdh.getObjectInfoBoolean(attrName);
out.writeInt(ret.sts); out.writeInt(ret.sts);
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeBoolean(ret.value); out.writeBoolean(ret.value);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -416,12 +417,13 @@ public class GdhServer ...@@ -416,12 +417,13 @@ public class GdhServer
String attrName = in.readUTF(); String attrName = in.readUTF();
CdhrInt ret = gdh.getObjectInfoInt(attrName); CdhrInt ret = gdh.getObjectInfoInt(attrName);
out.writeInt(ret.sts); out.writeInt(ret.sts);
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.value); out.writeInt(ret.value);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -434,12 +436,13 @@ public class GdhServer ...@@ -434,12 +436,13 @@ public class GdhServer
String attrName = in.readUTF(); String attrName = in.readUTF();
CdhrFloat ret = gdh.getObjectInfoFloat(attrName); CdhrFloat ret = gdh.getObjectInfoFloat(attrName);
out.writeInt(ret.sts); out.writeInt(ret.sts);
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeFloat(ret.value); out.writeFloat(ret.value);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -452,12 +455,13 @@ public class GdhServer ...@@ -452,12 +455,13 @@ public class GdhServer
String attrName = in.readUTF(); String attrName = in.readUTF();
CdhrString ret = gdh.getObjectInfoString(attrName); CdhrString ret = gdh.getObjectInfoString(attrName);
out.writeInt(ret.sts); out.writeInt(ret.sts);
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeUTF(ret.str); out.writeUTF(ret.str);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -470,13 +474,14 @@ public class GdhServer ...@@ -470,13 +474,14 @@ public class GdhServer
String name = in.readUTF(); String name = in.readUTF();
CdhrObjid ret = gdh.getObjectInfoObjid(name); CdhrObjid ret = gdh.getObjectInfoObjid(name);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -901,13 +906,14 @@ public class GdhServer ...@@ -901,13 +906,14 @@ public class GdhServer
PwrtObjid objid = new PwrtObjid(oix, vid); PwrtObjid objid = new PwrtObjid(oix, vid);
CdhrObjid ret = gdh.getChild(objid); CdhrObjid ret = gdh.getChild(objid);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -922,13 +928,14 @@ public class GdhServer ...@@ -922,13 +928,14 @@ public class GdhServer
PwrtObjid objid = new PwrtObjid(oix, vid); PwrtObjid objid = new PwrtObjid(oix, vid);
CdhrObjid ret = gdh.getParent(objid); CdhrObjid ret = gdh.getParent(objid);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -943,13 +950,14 @@ public class GdhServer ...@@ -943,13 +950,14 @@ public class GdhServer
PwrtObjid objid = new PwrtObjid(oix, vid); PwrtObjid objid = new PwrtObjid(oix, vid);
CdhrObjid ret = gdh.getNextSibling(objid); CdhrObjid ret = gdh.getNextSibling(objid);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -981,13 +989,14 @@ public class GdhServer ...@@ -981,13 +989,14 @@ public class GdhServer
int classid = in.readInt(); int classid = in.readInt();
CdhrObjid ret = gdh.getClassList(classid); CdhrObjid ret = gdh.getClassList(classid);
out.writeInt(ret.getSts()); out.writeInt(ret.getSts());
out.flush(); //out.flush();
if(ret.oddSts()) if(ret.oddSts())
{ {
out.writeInt(ret.objid.oix); out.writeInt(ret.objid.oix);
out.writeInt(ret.objid.vid); out.writeInt(ret.objid.vid);
out.flush(); //out.flush();
} }
out.flush();
} }
catch(IOException e) catch(IOException e)
{ {
......
...@@ -82,10 +82,10 @@ public class RtUtilities { ...@@ -82,10 +82,10 @@ public class RtUtilities {
int offs1; int offs1;
int offs2; int offs2;
// Replace in instance name because mozilla can't pass them as // Replace in instance name because mozilla can't pass them as
// parameter // parameter
for ( int i = 0; i < instance.length(); i++) { for ( int i = 0; i < instance.length(); i++) {
if ( instanceBuff[i] == '' || instanceBuff[i] == '') if ( instanceBuff[i] == '' || instanceBuff[i] == '')
instanceBuff[i] = '\\'; instanceBuff[i] = '\\';
if ( instanceBuff[i] == '' || instanceBuff[i] == '') if ( instanceBuff[i] == '' || instanceBuff[i] == '')
instanceBuff[i] = '/'; instanceBuff[i] = '/';
......
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