Commit afe2116a authored by claes's avatar claes

Window and Folder with instance object

parent 407a0395
/*
* Proview $Id: ge_graph_javabean.cpp,v 1.10 2006-04-24 13:22:24 claes Exp $
* Proview $Id: ge_graph_javabean.cpp,v 1.11 2006-06-14 05:04:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1394,13 +1394,16 @@ int Graph::export_gejava_nodeclass( ofstream& fp, grow_tNodeClass nodeclass)
pages = grow_GetNodeClassPages( nodeclass);
if ( dyn_action_type & ge_mActionType_ValueInput) {
glow_eDrawType annot_background = (glow_eDrawType) 31;
grow_GetNodeClassAnnotBackground( nodeclass, &annot_background);
fp <<
"protected class " << bean_name << " extends GeTextField {" << endl <<
" public " << bean_name << "( JopSession session)" << endl <<
" {" << endl <<
" super( session);" << endl <<
" setFont( annotFont);" << endl <<
" setFillColor( annotBackground);" << endl <<
" setFillColor( " << annot_background << ");" << endl <<
" }" << endl;
fp <<
......@@ -1559,7 +1562,7 @@ int Graph::export_javaframe( char *filename, char *bean_name, int applet,
fp <<
" JPanel contentPane;" << endl <<
" BorderLayout borderLayout1 = new BorderLayout();" << endl <<
" LocalPanel localPanel = new LocalPanel();" << endl <<
" public LocalPanel localPanel = new LocalPanel();" << endl <<
" Dimension size;" << endl;
// Declarations of components
......@@ -1765,6 +1768,7 @@ int Graph::export_gejava( char *filename, char *bean_name, int applet, int html)
fp <<
"import jpwr.rt.*;" << endl <<
"import jpwr.jop.*;" << endl <<
"import jpwr.jopc.*;" << endl <<
"import java.awt.*;" << endl <<
"import java.awt.geom.*;" << endl <<
"import java.awt.image.*;" << endl <<
......@@ -1780,7 +1784,7 @@ int Graph::export_gejava( char *filename, char *bean_name, int applet, int html)
fp <<
" JPanel contentPane;" << endl <<
" BorderLayout borderLayout1 = new BorderLayout();" << endl <<
" LocalPanel localPanel = new LocalPanel();" << endl <<
" public LocalPanel localPanel = new LocalPanel();" << endl <<
" boolean scrollbar = false;" << endl <<
" Dimension size;" << endl;
......
/*
* Proview $Id: glow_exportjbean.cpp,v 1.14 2006-04-24 13:22:24 claes Exp $
* Proview $Id: glow_exportjbean.cpp,v 1.15 2006-06-14 05:04:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1944,7 +1944,7 @@ void GlowExportJBean::axis( double x1, double y1, double x2, double y2,
void GlowExportJBean::window( double x1, double y1, double x2, double y2,
char *filename,
int vertical_scrollbar, int horizontal_scrollbar,
int vertical_scrollbar, int horizontal_scrollbar, char *owner,
glow_eExportPass pass, int *shape_cnt, int node_cnt, ofstream& fp)
{
double dim_x0, dim_x1, dim_y0, dim_y1;
......@@ -1959,7 +1959,17 @@ void GlowExportJBean::window( double x1, double y1, double x2, double y2,
sprintf( &var_name[strlen(var_name)], "%d", node_cnt);
// Convert filename to java class
if ( (s = strrchr( filename, '/')) != 0)
strcpy( class_fname, s+1);
else
strcpy( class_fname, filename);
if ( strncmp( class_fname, "pwr_c_", 6) == 0) {
char str[80];
strcpy( str, "Jopc");
strcat( str, &class_fname[6]);
str[4] = _toupper( str[4]);
strcpy( class_fname, str);
}
if ( (s = strchr( class_fname, '.')))
*s = 0;
sprintf( var_fname, "%s%d", class_fname, node_cnt);
......@@ -1979,8 +1989,15 @@ void GlowExportJBean::window( double x1, double y1, double x2, double y2,
{
((GrowCtx *)ctx)->measure_javabean( &dim_x1, &dim_x0, &dim_y1, &dim_y0);
if ( strcmp( owner, "") == 0)
fp <<
" " << class_fname << " " << var_fname << " = new " << class_fname << "(session, null, false);" << endl;
else
fp <<
" " << class_fname << " " << var_fname << " = new " << class_fname << "(session, \"" <<
owner << "\", false);" << endl;
fp <<
" " << class_fname << " " << var_fname << " = new " << class_fname << "(session, null, false);" << endl <<
" " << var_name << " = new " << class_name << "(" << var_fname << ".localPanel);" << endl <<
" " << var_name << ".setBounds(new Rectangle(" <<
(int)(x1 - dim_x0 /* - glow_cJBean_Offset) */) << "," <<
......@@ -2000,7 +2017,7 @@ void GlowExportJBean::window( double x1, double y1, double x2, double y2,
void GlowExportJBean::folder( double x1, double y1, double x2, double y2,
int folders,
char *folder_file_names, char *folder_text,
int *folder_v_scrollbar, int *folder_h_scrollbar,
int *folder_v_scrollbar, int *folder_h_scrollbar, char *owner,
glow_eExportPass pass, int *shape_cnt, int node_cnt, ofstream& fp)
{
double dim_x0, dim_x1, dim_y0, dim_y1;
......@@ -2009,6 +2026,7 @@ void GlowExportJBean::folder( double x1, double y1, double x2, double y2,
char class_fname[80];
char var_fname[80];
char *s;
char *own;
strcpy( var_name, class_name);
var_name[0] = _tolower(var_name[0]);
......@@ -2034,14 +2052,32 @@ void GlowExportJBean::folder( double x1, double y1, double x2, double y2,
char *fname_p = folder_file_names;
char *text_p = folder_text;
for ( int i = 0; i < folders; i++) {
// Convert filename to java class
if ( (s = strrchr( fname_p, '/')) != 0)
strcpy( class_fname, s+1);
else
strcpy( class_fname, fname_p);
if ( strncmp( class_fname, "pwr_c_", 6) == 0) {
char str[80];
strcpy( str, "Jopc");
strcat( str, &class_fname[6]);
str[4] = _toupper( str[4]);
strcpy( class_fname, str);
}
if ( (s = strchr( class_fname, '.')))
*s = 0;
sprintf( var_fname, "%s%d_%d", class_fname, node_cnt, i);
class_fname[0] = _toupper( class_fname[0]);
own = owner + i * 256;
if ( strcmp( own, "") == 0)
fp <<
" " << class_fname << " " << var_fname << " = new " << class_fname << "(session, null, false);" << endl;
else
fp <<
" " << class_fname << " " << var_fname << " = new " << class_fname <<
"(session, \"" << owner << "\" , false);" << endl;
if ( folder_v_scrollbar[i] || folder_h_scrollbar[i])
fp <<
" " << var_name << ".addTab(\"" << text_p << "\", new JScrollPane(" << var_fname << ".localPanel));" << endl;
......
/*
* Proview $Id: glow_exportjbean.h,v 1.7 2005-12-13 15:14:16 claes Exp $
* Proview $Id: glow_exportjbean.h,v 1.8 2006-06-14 05:04:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -145,11 +145,12 @@ class GlowExportJBean {
char *filename,
int vertical_scrollbar,
int horizontal_scrollbar,
char *owner,
glow_eExportPass pass, int *shape_cnt, int node_cnt, ofstream& fp);
void folder( double x1, double y1, double x2, double y2,
int folders,
char *folder_file_names, char *folder_text,
int *folder_v_scrollbar, int *folder_h_scrollbar,
int *folder_v_scrollbar, int *folder_h_scrollbar, char *folder,
glow_eExportPass pass, int *shape_cnt, int node_cnt, ofstream& fp);
void table( double x1, double y1, double x2, double y2,
glow_eDrawType fill_drawtype, int fill,
......
/*
* Proview $Id: glow_growapi.cpp,v 1.22 2006-05-24 08:01:51 claes Exp $
* Proview $Id: glow_growapi.cpp,v 1.23 2006-06-14 05:04:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -4418,6 +4418,11 @@ void grow_SetOwner( grow_tCtx ctx, char *owner)
((GrowCtx *)ctx)->set_owner( owner);
}
int grow_GetNodeClassAnnotBackground( grow_tNodeClass nodeclass, glow_eDrawType *background)
{
return ((GlowNodeClass *)nodeclass)->get_annot_background( 0, 0, background);
}
/*@}*/
......
/*
* Proview $Id: glow_growapi.h,v 1.20 2006-05-16 11:50:27 claes Exp $
* Proview $Id: glow_growapi.h,v 1.21 2006-06-14 05:04:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -2875,6 +2875,7 @@ typedef GlowTraceData glow_sTraceData;
int grow_IsJava( char *name, int *is_frame, int *is_applet, char *java_name);
void grow_GetOwner( grow_tCtx ctx, char *owner);
void grow_SetOwner( grow_tCtx ctx, char *owner);
int grow_GetNodeClassAnnotBackground( grow_tNodeClass nodeclass, glow_eDrawType *background);
/*@}*/
#if defined __cplusplus
......
/*
* Proview $Id: glow_growfolder.cpp,v 1.5 2006-05-16 11:50:27 claes Exp $
* Proview $Id: glow_growfolder.cpp,v 1.6 2006-06-14 05:04:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -192,29 +192,29 @@ void GrowFolder::open( ifstream& fp)
case glow_eSave_GrowFolder_folder_scale12: fp >> folder_scale[11]; break;
case glow_eSave_GrowFolder_folder_v_scrollbar12: fp >> folder_v_scrollbar[11]; break;
case glow_eSave_GrowFolder_folder_h_scrollbar12: fp >> folder_h_scrollbar[11]; break;
case glow_eSave_GrowFolder_folder_owner1:
case glow_eSave_GrowFolder_folder_owner1: fp.get();
fp.getline( folder_owner[0], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner2:
case glow_eSave_GrowFolder_folder_owner2: fp.get();
fp.getline( folder_owner[1], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner3:
case glow_eSave_GrowFolder_folder_owner3: fp.get();
fp.getline( folder_owner[2], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner4:
case glow_eSave_GrowFolder_folder_owner4: fp.get();
fp.getline( folder_owner[3], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner5:
case glow_eSave_GrowFolder_folder_owner5: fp.get();
fp.getline( folder_owner[4], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner6:
case glow_eSave_GrowFolder_folder_owner6: fp.get();
fp.getline( folder_owner[5], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner7:
case glow_eSave_GrowFolder_folder_owner7: fp.get();
fp.getline( folder_owner[6], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner8:
case glow_eSave_GrowFolder_folder_owner8: fp.get();
fp.getline( folder_owner[7], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner9:
case glow_eSave_GrowFolder_folder_owner9: fp.get();
fp.getline( folder_owner[8], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner10:
case glow_eSave_GrowFolder_folder_owner10: fp.get();
fp.getline( folder_owner[9], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner11:
case glow_eSave_GrowFolder_folder_owner11: fp.get();
fp.getline( folder_owner[10], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_folder_owner12:
case glow_eSave_GrowFolder_folder_owner12: fp.get();
fp.getline( folder_owner[11], sizeof(folder_owner[0])); break;
case glow_eSave_GrowFolder_window_part:
GrowWindow::open( fp);
......@@ -598,7 +598,7 @@ void GrowFolder::export_javabean( GlowTransform *t, void *node,
((GrowCtx *)ctx)->export_jbean->folder( ll_x, ll_y, ur_x, ur_y, folders,
(char *)folder_file_names, (char *)folder_text,
(int *)folder_v_scrollbar, (int *)folder_h_scrollbar,
pass, shape_cnt, node_cnt, fp);
owner, pass, shape_cnt, node_cnt, fp);
}
void GrowFolder::convert( glow_eConvert version)
......
/*
* Proview $Id: glow_growwindow.cpp,v 1.10 2006-06-02 08:21:31 claes Exp $
* Proview $Id: glow_growwindow.cpp,v 1.11 2006-06-14 05:04:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -111,6 +111,7 @@ void GrowWindow::open( ifstream& fp)
case glow_eSave_GrowWindow_horizontal_scrollbar: fp >> horizontal_scrollbar; break;
case glow_eSave_GrowWindow_window_scale: fp >> window_scale; break;
case glow_eSave_GrowWindow_owner:
fp.get();
fp.getline( owner, sizeof(owner)); break;
case glow_eSave_GrowWindow_rect_part:
GrowRect::open( fp);
......@@ -567,6 +568,7 @@ void GrowWindow::export_javabean( GlowTransform *t, void *node,
((GrowCtx *)ctx)->export_jbean->window( ll_x, ll_y, ur_x, ur_y,
file_name, vertical_scrollbar, horizontal_scrollbar,
owner,
pass, shape_cnt, node_cnt, fp);
}
......
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