Commit 768808bd authored by Claes Sjofors's avatar Claes Sjofors

Build method for WebGraph objects

parent 91e2b37b
...@@ -41,11 +41,10 @@ SObject pwrb:Class ...@@ -41,11 +41,10 @@ SObject pwrb:Class
Attr StructName = "WebGraph" Attr StructName = "WebGraph"
EndBody EndBody
!/** !/**
! @Summary Name of the graph. ! @Summary The JavaName of the graph.
! Name of the graph. This is Ge name of the graph. ! The JavaName of the graph. When a Ge graph is exported to java it
! Every graph-applet that is displayed, opens a link to the GdhSever ! is exported with a java classname. By default it is the same as the
! process. If MaxConnections is exceeded, the connect request will ! graph name, but with block letter in the first character.
! be rejected.
!*/ !*/
Object Name $Attribute 1 Object Name $Attribute 1
Body SysBody Body SysBody
...@@ -92,6 +91,13 @@ SObject pwrb:Class ...@@ -92,6 +91,13 @@ SObject pwrb:Class
Attr MethodName = "WebGraph-OpenGraph" Attr MethodName = "WebGraph-OpenGraph"
EndBody EndBody
EndObject EndObject
Object Build $MenuButton
Body SysBody
Attr ButtonName = "Build"
Attr MethodName = "WebGraph-Build"
Attr FilterName = "$Object-BuildFilter"
EndBody
EndObject
EndObject EndObject
EndObject EndObject
Object NavigatorPoson $Menu Object NavigatorPoson $Menu
...@@ -102,6 +108,13 @@ SObject pwrb:Class ...@@ -102,6 +108,13 @@ SObject pwrb:Class
Attr MethodName = "WebGraph-OpenGraph" Attr MethodName = "WebGraph-OpenGraph"
EndBody EndBody
EndObject EndObject
Object Build $MenuButton
Body SysBody
Attr ButtonName = "Build"
Attr MethodName = "WebGraph-Build"
Attr FilterName = "$Object-BuildFilter"
EndBody
EndObject
EndObject EndObject
EndObject EndObject
Object NavigatorPosos $Menu Object NavigatorPosos $Menu
...@@ -112,6 +125,13 @@ SObject pwrb:Class ...@@ -112,6 +125,13 @@ SObject pwrb:Class
Attr MethodName = "WebGraph-OpenGraph" Attr MethodName = "WebGraph-OpenGraph"
EndBody EndBody
EndObject EndObject
Object Build $MenuButton
Body SysBody
Attr ButtonName = "Build"
Attr MethodName = "WebGraph-Build"
Attr FilterName = "$Object-BuildFilter"
EndBody
EndObject
EndObject EndObject
EndObject EndObject
Object NavigatorPosms $Menu Object NavigatorPosms $Menu
...@@ -122,6 +142,13 @@ SObject pwrb:Class ...@@ -122,6 +142,13 @@ SObject pwrb:Class
Attr MethodName = "WebGraph-OpenGraph" Attr MethodName = "WebGraph-OpenGraph"
EndBody EndBody
EndObject EndObject
Object Build $MenuButton
Body SysBody
Attr ButtonName = "Build"
Attr MethodName = "WebGraph-Build"
Attr FilterName = "$Object-BuildFilter"
EndBody
EndObject
EndObject EndObject
EndObject EndObject
Object NavigatorPosmn $Menu Object NavigatorPosmn $Menu
...@@ -132,6 +159,13 @@ SObject pwrb:Class ...@@ -132,6 +159,13 @@ SObject pwrb:Class
Attr MethodName = "WebGraph-OpenGraph" Attr MethodName = "WebGraph-OpenGraph"
EndBody EndBody
EndObject EndObject
Object Build $MenuButton
Body SysBody
Attr ButtonName = "Build"
Attr MethodName = "WebGraph-Build"
Attr FilterName = "$Object-BuildFilter"
EndBody
EndObject
EndObject EndObject
EndObject EndObject
EndObject EndObject
......
...@@ -144,4 +144,5 @@ ...@@ -144,4 +144,5 @@
091020 cs wb Expand/Compress in plc editor on GetATp, GetDTp, StoATp etc. 091020 cs wb Expand/Compress in plc editor on GetATp, GetDTp, StoATp etc.
091021 cs wb Crossreferences on channels added. 091021 cs wb Crossreferences on channels added.
091028 cs wb Syntax check works again with new check functions, and SyntaxCheck in configurator popup menu. 091028 cs wb Syntax check works again with new check functions, and SyntaxCheck in configurator popup menu.
091030 cs wb History log in wb. 091030 cs wb History log in wb.
\ No newline at end of file 091104 cs wb Build method for WebGraph objects added.
\ No newline at end of file
...@@ -60,6 +60,9 @@ void wb_build::classlist( pwr_tCid cid) ...@@ -60,6 +60,9 @@ void wb_build::classlist( pwr_tCid cid)
case pwr_cClass_WebHandler: case pwr_cClass_WebHandler:
webhandler( o.oid()); webhandler( o.oid());
break; break;
case pwr_cClass_WebGraph:
webgraph( o.oid());
break;
case pwr_cClass_Application: case pwr_cClass_Application:
application( o.oid()); application( o.oid());
break; break;
...@@ -322,6 +325,12 @@ void wb_build::rootvolume( pwr_tVid vid) ...@@ -322,6 +325,12 @@ void wb_build::rootvolume( pwr_tVid vid)
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts; sumsts = m_sts;
// Build all WebGraph
classlist( pwr_cClass_WebGraph);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
classlist( pwr_cClass_Application); classlist( pwr_cClass_Application);
if ( evenSts()) return; if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
...@@ -518,12 +527,12 @@ void wb_build::nodehier( pwr_tOid oid) ...@@ -518,12 +527,12 @@ void wb_build::nodehier( pwr_tOid oid)
if ( evenSts()) return; if ( evenSts()) return;
sumsts = m_sts; sumsts = m_sts;
classlist( pwr_cClass_XttGraph); classlist( pwr_cClass_WebHandler);
if ( evenSts()) return; if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts; sumsts = m_sts;
classlist( pwr_cClass_WebHandler); classlist( pwr_cClass_WebGraph);
if ( evenSts()) return; if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts; sumsts = m_sts;
...@@ -708,6 +717,125 @@ void wb_build::xttgraph( pwr_tOid oid) ...@@ -708,6 +717,125 @@ void wb_build::xttgraph( pwr_tOid oid)
} }
} }
void wb_build::webgraph( pwr_tOid oid)
{
pwr_tFileName dest_fname;
pwr_tCmd cmd;
pwr_tString80 java_name;
pwr_tString80 name;
pwr_tTime dest_time, src_time;
int check_hierarchy = cdh_ObjidIsNotNull( m_hierarchy);
int hierarchy_found = 0;
int is_frame, is_applet;
char jname[80];
pwr_tStatus fsts;
int jexport;
int found;
pwr_tFileName found_file, file_spec;
pwr_tFileName graph_name, dir;
char dev[80], type[80];
int version;
wb_object o = m_session.object(oid);
if ( !o) {
m_sts = o.sts();
return;
}
// Check that no ancestor is a LibHier
for ( wb_object p = o.parent(); p.oddSts(); p = p.parent()) {
if ( p.cid() == pwr_eClass_LibHier) {
m_sts = PWRB__INLIBHIER;
return;
}
if ( check_hierarchy && cdh_ObjidIsEqual( m_hierarchy, p.oid()))
hierarchy_found = 1;
}
if ( check_hierarchy && !hierarchy_found) {
m_sts = PWRB__NOBUILT;
return;
}
wb_attribute a = m_session.attribute( oid, "RtBody", "Name");
if ( !a) {
m_sts = a.sts();
return;
}
a.value( java_name);
if ( !a) {
m_sts = a.sts();
return;
}
cdh_ToLower( java_name, java_name);
java_name[0] = toupper(java_name[0]);
// Get the .pwg file for this javaname
sprintf( name, "$pwrp_pop/%s.pwg", cdh_Low(java_name));
dcli_translate_filename( name, name);
m_sts = dcli_file_time( name, &src_time);
if ( evenSts()) {
// Search in all pwg files
found = 0;
strcpy( file_spec, "$pwrp_pop/*.pwg");
for ( fsts = dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_INIT);
ODD(fsts);
fsts = dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_NEXT)) {
fsts = grow_IsJava( found_file, &is_frame, &is_applet, jname);
if ( EVEN(fsts)) continue;
if ( is_frame && strcmp( jname, java_name) == 0) {
dcli_parse_filename( found_file, dev, dir, graph_name, type, &version);
strcpy( name, found_file);
found = 1;
break;
}
}
dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_END);
if ( !found) {
char msg[200];
sprintf( msg, "Graph for %s not found", java_name);
MsgWindow::message('E', msg, msgw_ePop_Yes, oid);
return;
}
}
m_sts = dcli_file_time( name, &src_time);
if ( evenSts()) return;
// Check exported java frame
jexport = 0;
sprintf( dest_fname, "$pwrp_pop/%s.java", java_name);
dcli_translate_filename( dest_fname, dest_fname);
fsts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || EVEN(fsts) || time_Acomp( &src_time, &dest_time) == 1)
jexport = 1;
if ( jexport) {
if ( !m_wnav) {
sprintf( cmd, "Build: WebGraph Unable to export java in this environment %s", java_name);
MsgWindow::message('W', cmd, msgw_ePop_No, oid);
}
else {
Ge *gectx = m_wnav->ge_new( graph_name);
strcpy( cmd, "export java");
gectx->command( cmd);
delete gectx;
sprintf( cmd, "Build: WebGraph Export java %s", java_name);
MsgWindow::message('I', cmd, msgw_ePop_No, oid);
m_sts = PWRB__SUCCESS;
}
}
}
void wb_build::webhandler( pwr_tOid oid) void wb_build::webhandler( pwr_tOid oid)
{ {
pwr_tTime modtime; pwr_tTime modtime;
......
...@@ -44,6 +44,7 @@ class wb_build : public wb_status ...@@ -44,6 +44,7 @@ class wb_build : public wb_status
void plcpgm( pwr_tOid oid); void plcpgm( pwr_tOid oid);
void xttgraph( pwr_tOid oid); void xttgraph( pwr_tOid oid);
void webhandler( pwr_tOid oid); void webhandler( pwr_tOid oid);
void webgraph( pwr_tOid oid);
void application( pwr_tOid oid); void application( pwr_tOid oid);
wb_build_opt opt; wb_build_opt opt;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "wb_pwrb_msg.h" #include "wb_pwrb_msg.h"
#include "wb_wsx.h" #include "wb_wsx.h"
#include "wb_wsx_msg.h" #include "wb_wsx_msg.h"
#include "wb_build.h"
#include "co_cdh.h" #include "co_cdh.h"
...@@ -55,6 +56,20 @@ static pwr_tStatus OpenGraph ( ...@@ -55,6 +56,20 @@ static pwr_tStatus OpenGraph (
return 1; return 1;
} }
static pwr_tStatus Build (
ldh_sMenuCall *ip
)
{
wb_build build( *(wb_session *)ip->PointedSession, ip->wnav);
build.opt = ip->wnav->gbl.build;
build.webgraph( ip->Pointed.Objid);
if ( build.sts() == PWRB__NOBUILT)
ip->wnav->message( 'I', "Nothing to build");
return build.sts();
}
/*----------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here. Every method to be exported to the workbench should be registred here.
...@@ -62,6 +77,7 @@ static pwr_tStatus OpenGraph ( ...@@ -62,6 +77,7 @@ static pwr_tStatus OpenGraph (
pwr_dExport pwr_BindMethods(WebGraph) = { pwr_dExport pwr_BindMethods(WebGraph) = {
pwr_BindMethod(OpenGraph), pwr_BindMethod(OpenGraph),
pwr_BindMethod(Build),
pwr_NullMethod pwr_NullMethod
}; };
......
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