Commit 5a77516c authored by Claes Sjofors's avatar Claes Sjofors

Android app, operator window added

parent 263cfc45
package jpwr.app;
import android.graphics.Bitmap;
public class AGraphInfo {
public Bitmap bpm;
public String graph;
public String text;
public int iconX;
public int iconY;
public int iconWidth;
public int iconHeight;
public int textX;
public int textY;
}
package jpwr.app;
import java.util.Vector;
import jpwr.pwrxtt.MainActivity;
import android.graphics.Canvas;
import android.graphics.Paint;
public class OpwinCmn implements PlowCmnIfc {
Object userData;
Canvas canvas;
Vector<AGraphInfo> graphList;
MainActivity appl;
boolean configured = false;
int canvasHeight;
int canvasWidth;
int offsetY = 0;
int borderY = 0;
public OpwinCmn( MainActivity appl, Vector<AGraphInfo> graphList) {
this.graphList = graphList;
this.appl = appl;
}
public int type() {
return TYPE_OPWIN;
}
public void configureIcons() {
canvasWidth = canvas.getWidth();
canvasHeight = canvas.getHeight();
// Get largest bitmap size
int iconWidthMax = 0;
int iconHeightMax = 0;
for ( int i = 0; i < graphList.size(); i++) {
AGraphInfo graph = graphList.get(i);
graph.iconWidth = graph.bpm.getWidth();
graph.iconHeight = graph.bpm.getHeight();
if (graph.iconWidth > iconWidthMax)
iconWidthMax = graph.iconWidth;
if (graph.iconHeight > iconHeightMax)
iconHeightMax = graph.iconHeight;
}
int offsetX = 100;
int offsetY = 100;
int distX = iconWidthMax + 50;
int distY = iconHeightMax + 70;
int x = offsetX;
int y = offsetY;
for ( int i = 0; i < graphList.size(); i++) {
AGraphInfo graph = graphList.get(i);
graph.iconX = x;
graph.iconY = y;
graph.textX = graph.iconX + graph.iconWidth/2;
graph.textY = graph.iconY + graph.iconHeight + 15;
borderY = graph.textY + 100;
x += distX;
if ( x + distX > canvasWidth) {
x = offsetX;
y += distY;
}
}
configured = true;
}
public Object getUserData() {
return userData;
}
public void setUserData(Object userData) {
this.userData = userData;
}
public void draw() {
Paint p = new Paint();
if ( !configured)
configureIcons();
for ( int i = 0; i < graphList.size(); i++) {
AGraphInfo graph = graphList.get(i);
canvas.drawBitmap(graph.bpm, graph.iconX, graph.iconY - offsetY, p);
int textWidth = (int) p.measureText(graph.text);
canvas.drawText(graph.text, graph.textX - textWidth/2, graph.textY - offsetY, p);
}
}
public void setNodraw() {}
public void resetNodraw() {}
public void zoom(double factor) {}
public void scroll( int x, int y) {
if ( borderY < canvasHeight)
return;
offsetY += y;
if ( offsetY < 0)
offsetY = 0;
if ( offsetY > borderY - canvasHeight)
offsetY = borderY - canvasHeight;
}
public void pageUp() {}
public void pageDown() {}
public void eventHandler(int action, double fx, double fy) {
switch (action) {
case PlowEvent.TYPE_CLICK:
System.out.println("Opwin click " + fx + " " + fy);
for ( int i = 0; i < graphList.size(); i++) {
if ( fx > graphList.get(i).iconX && fx <= graphList.get(i).iconX + graphList.get(i).iconWidth &&
fy > graphList.get(i).iconY - offsetY && fy <= graphList.get(i).iconY + graphList.get(i).iconHeight - offsetY) {
System.out.println("Hit in icon");
String cmd = "open graph " + graphList.get(i).graph;
appl.command(cmd);
}
}
break;
}
}
public void select(Object node) {}
public void selectClear() {}
public Object getSelect() { return null;}
public void configure() {}
public void dynamicOpen() {}
public void dynamicClose() {}
public void dynamicUpdate() {}
public void setCanvas(Canvas canvas) {
this.canvas = canvas;
}
public Object getFirst() { return null;}
public Object getLast() { return null;}
public Object getNext(Object elem) {return null;}
public Object getPrevious(Object elem) {return null;}
public int remove(Object e) {return 0;}
}
......@@ -7,6 +7,7 @@ public interface PlowCmnIfc {
public static final int TYPE_FLOW = 2;
public static final int TYPE_GRAPH = 3;
public static final int TYPE_EV = 4;
public static final int TYPE_OPWIN = 5;
public int type();
public Object getUserData();
......
......@@ -16,7 +16,9 @@ import android.os.Handler;
import android.support.v4.app.FragmentManager;
import android.text.Editable;
import android.text.InputType;
import android.util.FloatMath;
import android.util.Log;
import android.util.TypedValue;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
......@@ -35,6 +37,9 @@ import jpwr.app.*;
import jpwr.jopg.*;
public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, GdhApplIfc, OnClickListener, AEvAppl {
static final int MODE_NO = 0;
static final int MODE_SCROLL = 1;
static final int MODE_ZOOM = 2;
Timer timer = new Timer();
MainView view;
......@@ -68,11 +73,17 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
Object confirmObject;
String confirmText;
String messageText;
AlertDialog inputDialog = null;
static private boolean initDone = false;
AlertDialog inputDialog = null;
Context context;
static private boolean initDone = false;
String pwrHost = null;
AEv aev = null;
OpwinCmn opwinCmn = null;
Menu menu = null;
int viewOffsetY = 0;
int eventMode;
float eventDistance;
Vector<AGraphInfo> graphList = new Vector<AGraphInfo>();
Vector<PlowCmnIfc> cmnList = new Vector<PlowCmnIfc>();
@Override
......@@ -131,6 +142,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
dialog.dismiss();
new GdhTask().execute(new GdhTaskArg(GdhTask.ROOTLIST,(AXttItemBase)null));
new GdhTask().execute(new GdhTaskArg(GdhTask.OPWIN, null));
}
}
......@@ -142,7 +154,18 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
this.menu = menu;
configMenu();
return true;
}
public void configMenu() {
if ( menu == null)
return;
MenuItem item_close = menu.findItem(R.id.close_option);
MenuItem item_zoomin = menu.findItem(R.id.zoomin_option);
MenuItem item_zoomout = menu.findItem(R.id.zoomout_option);
MenuItem item_pageup = menu.findItem(R.id.pageup_option);
MenuItem item_pagedown = menu.findItem(R.id.pagedown_option);
MenuItem item_openobject = menu.findItem(R.id.openobject_option);
......@@ -151,9 +174,13 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
MenuItem item_openplc = menu.findItem(R.id.openplc_option);
MenuItem item_opencrr = menu.findItem(R.id.opencrr_option);
MenuItem item_alarmack = menu.findItem(R.id.alarmack_option);
MenuItem item_navigator = menu.findItem(R.id.navigator_option);
MenuItem item_changevalue = menu.findItem(R.id.changevalue_option);
if ( aev != null && currentCmn == aev.getCmnAla()) {
// Alarm list
item_close.setVisible(true);
item_zoomin.setVisible(true);
item_zoomout.setVisible(true);
item_pageup.setVisible(true);
item_pagedown.setVisible(true);
item_openobject.setVisible(true);
......@@ -162,10 +189,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
item_openplc.setVisible(true);
item_opencrr.setVisible(true);
item_alarmack.setVisible(true);
item_navigator.setVisible(true);
item_changevalue.setVisible(false);
}
else if ( aev != null && currentCmn == aev.getCmnEve()) {
// Event list
item_close.setVisible(true);
item_zoomin.setVisible(true);
item_zoomout.setVisible(true);
item_pageup.setVisible(true);
item_pagedown.setVisible(true);
item_openobject.setVisible(true);
......@@ -174,10 +205,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
item_openplc.setVisible(true);
item_opencrr.setVisible(true);
item_alarmack.setVisible(false);
item_navigator.setVisible(true);
item_changevalue.setVisible(false);
}
else if ( currentCmn == cmnList.get(0)) {
// Navigator
item_close.setVisible(true);
item_zoomin.setVisible(true);
item_zoomout.setVisible(true);
item_pageup.setVisible(true);
item_pagedown.setVisible(true);
item_openobject.setVisible(true);
......@@ -186,10 +221,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
item_openplc.setVisible(true);
item_opencrr.setVisible(true);
item_alarmack.setVisible(false);
item_navigator.setVisible(true);
item_changevalue.setVisible(true);
}
else if ( currentCmn.type() == PlowCmnIfc.TYPE_FLOW) {
// Plc
item_close.setVisible(true);
item_zoomin.setVisible(true);
item_zoomout.setVisible(true);
item_pageup.setVisible(true);
item_pagedown.setVisible(true);
item_openobject.setVisible(true);
......@@ -198,10 +237,30 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
item_openplc.setVisible(true);
item_opencrr.setVisible(true);
item_alarmack.setVisible(false);
item_navigator.setVisible(true);
item_changevalue.setVisible(false);
}
else if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH) {
// Graph
item_close.setVisible(true);
item_zoomin.setVisible(true);
item_zoomout.setVisible(true);
item_pageup.setVisible(false);
item_pagedown.setVisible(false);
item_openobject.setVisible(false);
item_opengraph.setVisible(false);
item_openclassgraph.setVisible(false);
item_openplc.setVisible(false);
item_opencrr.setVisible(false);
item_alarmack.setVisible(false);
item_navigator.setVisible(true);
item_changevalue.setVisible(false);
}
else if ( currentCmn.type() == PlowCmnIfc.TYPE_OPWIN) {
// Operator window
item_close.setVisible(true);
item_zoomin.setVisible(true);
item_zoomout.setVisible(true);
item_pageup.setVisible(false);
item_pagedown.setVisible(false);
item_openobject.setVisible(false);
......@@ -210,11 +269,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
item_openplc.setVisible(false);
item_opencrr.setVisible(false);
item_alarmack.setVisible(false);
item_navigator.setVisible(true);
item_changevalue.setVisible(false);
}
else {
// Default
item_pageup.setVisible(true);
item_zoomin.setVisible(true);
item_zoomout.setVisible(true);
item_pagedown.setVisible(true);
item_openobject.setVisible(true);
item_opengraph.setVisible(true);
......@@ -222,12 +284,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
item_openplc.setVisible(true);
item_opencrr.setVisible(true);
item_alarmack.setVisible(false);
item_navigator.setVisible(true);
item_changevalue.setVisible(false);
}
// this.invalidateOptionsMenu();
return true;
}
@Override
......@@ -257,7 +316,12 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
switch(currentCmn.type()) {
case PlowCmnIfc.TYPE_PLOW: {
if ( cmnList.size() == 1) {
// TODO Close application
// Open opwin
if ( opwinCmn != null) {
currentCmn = opwinCmn;
cmnList.add(opwinCmn);
view.invalidate();
}
break;
}
......@@ -299,6 +363,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
view.invalidate();
System.out.println("Close graph");
break;
case PlowCmnIfc.TYPE_OPWIN:
// Close app ?
break;
}
break;
case R.id.openobject_option: {
......@@ -443,6 +510,16 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
}
break;
}
case R.id.navigator_option: {
System.out.println("Open Navigator");
int xttCmnIdx = 0;
currentCmn = cmnList.get(xttCmnIdx);
for ( int i = cmnList.size()-1; i > xttCmnIdx; i--)
cmnList.removeElementAt(i);
break;
}
case R.id.alarmlist_option: {
System.out.println("Open Alarmlist");
......@@ -566,6 +643,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
}
}
break;
case PlowCmnIfc.TYPE_OPWIN:
currentCmn.eventHandler(e.type, e.x, e.y);
break;
}
break;
case PlowEvent.TYPE_OBJECT_DELETED: {
......@@ -623,6 +703,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
public static final int OPEN_CLASSGRAPH_NAME = 18;
public static final int VALUEINPUT_ACTION = 19;
public static final int CONFIRM_ACTION = 20;
public static final int OPWIN = 21;
@Override
protected Void doInBackground(GdhTaskArg... arg) {
......@@ -957,6 +1038,66 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
((Dyn)confirmDyn).confirmedAction( Glow.eEvent_MB1Click, confirmObject);
break;
}
case OPWIN: {
// If plc window open flow for window, else for first child
CdhrObjid oret = gdh.getClassList( Pwrb.cClass_WebHandler);
if (oret.oddSts()) {
for ( oret = gdh.getChild(oret.objid); oret.oddSts(); oret = gdh.getNextSibling(oret.objid)) {
CdhrClassId cret = gdh.getObjectClass(oret.objid);
if (cret.oddSts() && cret.getClassId() == Pwrb.cClass_AppGraph) {
CdhrString sret = gdh.objidToName(oret.objid, Cdh.mName_volumeStrict);
String name = sret.str;
AGraphInfo info = new AGraphInfo();
String aName = name + ".Image";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
continue;
String image = sret.str;
URL url = null;
try {
if ( image.startsWith("$pwr_exe/")) {
// url = new URL("http://10.0.2.2/data0/x4-8-6/rls/os_linux/hw_x86/exp/exe/" + filename.substring(9));
url = new URL("http://" + pwrHost + "/pwr_exe/" + image.substring(9));
}
else {
// url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename);
url = new URL("http://" + pwrHost + "/pwrp_exe/" + image);
}
info.bpm = BitmapFactory.decodeStream(url.openConnection().getInputStream());
} catch ( IOException e) {
System.out.println( "Unable to open file " + image + " " + url);
continue;
}
aName = name + ".Name";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
continue;
info.graph = sret.str;
aName = name + ".Text";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
continue;
info.text = sret.str;
graphList.add(info);
}
}
if ( graphList.size() > 0) {
opwinCmn = new OpwinCmn(appl, graphList);
currentCmn = opwinCmn;
cmnList.add(opwinCmn);
}
}
break;
}
}
return null;
}
......@@ -1011,61 +1152,104 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
@Override
public boolean onTouchEvent(MotionEvent me) {
int viewOffset = 80;
int action = me.getAction();
float x = me.getX();
float y = me.getY();
if ( viewOffsetY == 0) {
if ( context != null) {
TypedValue tv = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
viewOffsetY = getResources().getDimensionPixelSize(tv.resourceId);
int id = getResources().getIdentifier("status_bar_height", "dimen", "android");
if ( id > 0)
viewOffsetY += getResources().getDimensionPixelSize(id);
}
else
viewOffsetY = 80;
}
System.out.println("offset : " + viewOffsetY);
switch (action) {
case MotionEvent.ACTION_MOVE:
System.out.println("Event Move " + action + " (" + x + "," + y + ")");
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_MOVE, x, y-viewOffset)));
}
else {
if ( (int)(lastTouchY - y) != 0) {
currentCmn.scroll((int)(lastTouchX -x), (int)(lastTouchY - y));
view.invalidate();
if ( eventMode == MODE_SCROLL) {
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_MOVE, x, y-viewOffsetY)));
}
else {
if ( (int)(lastTouchY - y) != 0) {
currentCmn.scroll((int)(lastTouchX -x), (int)(lastTouchY - y));
view.invalidate();
}
lastTouchX = x;
lastTouchY = y;
}
lastTouchX = x;
lastTouchY = y;
}
}
else if ( eventMode == MODE_ZOOM) {
float distance = eventDistance(me);
currentCmn.zoom(distance/eventDistance);
eventDistance = distance;
}
break;
case MotionEvent.ACTION_UP:
if ( currentCmn != null && currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){
System.out.println("Event Up " + action + " (" + x + "," + y + ") cmn " + currentCmn.type());
if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 &&
me.getEventTime() - me.getDownTime() < 700) {
System.out.println("Event Click " + action + " (" + x + "," + y + ") cmn " + currentCmn.type());
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_CLICK, x, y-viewOffset)));
}
else {
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_UP, x, y-viewOffset)));
}
if ( currentCmn != null && currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){
System.out.println("Event Up " + action + " (" + x + "," + y + ") cmn " + currentCmn.type());
if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 &&
me.getEventTime() - me.getDownTime() < 700) {
System.out.println("Event Click " + action + " (" + x + "," + y + ") cmn " + currentCmn.type());
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_CLICK, x, y-viewOffsetY)));
}
else {
if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 && currentCmn != null) {
currentCmn.eventHandler(action, x, y-viewOffset);
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_UP, x, y-viewOffsetY)));
}
}
else {
if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 && currentCmn != null) {
currentCmn.eventHandler(action, x, y-viewOffsetY);
}
}
eventMode = MODE_NO;
break;
case MotionEvent.ACTION_DOWN:
System.out.println("Event Down " + action + " (" + x + "," + y + ")");
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_DOWN, x, y-viewOffset)));
new GdhEventArg(GraphCmn.ACTION_DOWN, x, y-viewOffsetY)));
}
lastTouchX = x;
lastTouchY = y;
downTouchX = x;
downTouchY = y;
eventMode = MODE_SCROLL;
break;
case MotionEvent.ACTION_POINTER_DOWN:
System.out.println("Event Action Pointer Down");
eventDistance = eventDistance(me);
if ( eventDistance > 10)
eventMode = MODE_ZOOM;
break;
case MotionEvent.ACTION_POINTER_UP:
System.out.println("Event Action Pointer Up");
eventMode = MODE_NO;
break;
}
return true;
}
private float eventDistance(MotionEvent me) {
float x = me.getX(0) - me.getX(1);
float y = me.getY(0) - me.getY(1);
return FloatMath.sqrt(x * x + y * y);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
......@@ -1084,6 +1268,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
public MainView(Context context) {
super(context);
appl.context = context;
setWillNotDraw(false);
}
......@@ -1360,9 +1545,13 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
return 0;
}
// Back to basic cmn
currentCmn = cmnList.get(0);
for ( int i = cmnList.size()-1; i > 0; i--)
cmnList.removeElementAt(i);
int cmnIdx = 0;
if ( opwinCmn != null)
cmnIdx = 1;
currentCmn = cmnList.get(cmnIdx);
for ( int i = cmnList.size()-1; i > cmnIdx; i--)
cmnList.removeElementAt(i);
for ( int i = graphObject.size()-1; i >= 0; i--)
graphObject.removeElementAt(i);
......
java/aapp/res/drawable/xnav_close.png

425 Bytes | W: | H:

java/aapp/res/drawable/xnav_close.png

581 Bytes | W: | H:

java/aapp/res/drawable/xnav_close.png
java/aapp/res/drawable/xnav_close.png
java/aapp/res/drawable/xnav_close.png
java/aapp/res/drawable/xnav_close.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -9,12 +9,12 @@
android:id="@+id/pageup_option"
android:title="Page up"
android:icon="@drawable/xnav_pageup"
android:showAsAction="ifRoom"/>
android:showAsAction="never"/>
<item
android:id="@+id/pagedown_option"
android:title="Page down"
android:icon="@drawable/xnav_pagedown"
android:showAsAction="ifRoom"/>
android:showAsAction="never"/>
<item
android:id="@+id/zoomin_option"
android:title="Zoom in"
......@@ -25,6 +25,11 @@
android:title="Zoom out"
android:icon="@drawable/xnav_zoomout"
android:showAsAction="ifRoom"/>
<item
android:id="@+id/navigator_option"
android:title="Navigator"
android:icon="@drawable/xnav_navigator"
android:showAsAction="ifRoom"/>
<item
android:id="@+id/openobject_option"
android:title="Open Object"
......@@ -48,11 +53,13 @@
<item
android:id="@+id/alarmlist_option"
android:title="Alarm List"
android:icon="@drawable/xnav_openobject"/>
android:icon="@drawable/xnav_alarmlist"
android:showAsAction="ifRoom"/>
<item
android:id="@+id/eventlist_option"
android:title="Event List"
android:icon="@drawable/xnav_openobject"/>
android:icon="@drawable/xnav_eventlist"
android:showAsAction="ifRoom"/>
<item
android:id="@+id/alarmack_option"
android:title="Alarm Acknowledge"
......
......@@ -68,6 +68,7 @@ public class Pwrb {
public static final int cClass_Ao_Vmic4800 = 133176;
public static final int cClass_ApCollect = 133224;
public static final int cClass_ApDistribute = 133232;
public static final int cClass_AppGraph = 135960;
public static final int cClass_ApplDistribute = 131208;
public static final int cClass_ASup = 131216;
public static final int cClass_Av = 131224;
......
......@@ -3559,7 +3559,7 @@ to read the statistic table in a mysql database, where the project name is opg7.
<c>>mysql -u pwrp
<c>mysql> use pwrp__opg7;
<c>mysql> select * form set_stat;
<c>mysql> select * from set_stat;
<c>| 7.24149 | 7.90368 | 907.713 | 908.8 | 32321 | 0 | 1 | 0 |
<c>1 row in set (0.00 sec)
......
......@@ -3515,7 +3515,7 @@ l
<c>>mysql -u pwrp
<c>mysql> use pwrp__opg7;
<c>mysql> select * form set_stat;
<c>mysql> select * from set_stat;
<c>| 7.24149 | 7.90368 | 907.713 | 908.8 | 32321 | 0 | 1 | 0 |
<c>1 row in set (0.00 sec)
......
......@@ -83,6 +83,9 @@ void wb_build::classlist( pwr_tCid cid)
case pwr_cClass_WebGraph:
webgraph( o.oid());
break;
case pwr_cClass_AppGraph:
appgraph( o.oid());
break;
case pwr_cClass_Application:
application( o.oid());
break;
......@@ -362,6 +365,12 @@ void wb_build::rootvolume( pwr_tVid vid)
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
// Build all AppGraph
classlist( pwr_cClass_AppGraph);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
classlist( pwr_cClass_Application);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
......@@ -590,6 +599,11 @@ void wb_build::nodehier( pwr_tOid oid)
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
classlist( pwr_cClass_AppGraph);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
classlist( pwr_cClass_Application);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
......@@ -938,6 +952,91 @@ void wb_build::webgraph( pwr_tOid oid)
}
}
void wb_build::appgraph( pwr_tOid oid)
{
pwr_tFileName dest_fname;
pwr_tFileName src_fname;
pwr_tCmd cmd;
pwr_tString80 graph_name;
pwr_tString80 name;
pwr_tTime dest_time, src_time;
int check_hierarchy = cdh_ObjidIsNotNull( m_hierarchy);
int hierarchy_found = 0;
char *s;
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( graph_name);
if ( !a) {
m_sts = a.sts();
return;
}
cdh_ToLower( graph_name, graph_name);
strcpy( src_fname, "$pwrp_pop/");
strcat( src_fname, graph_name);
if ( strstr( src_fname, ".pwg") == 0)
strcat( src_fname, ".pwg");
dcli_translate_filename( src_fname, src_fname);
m_sts = dcli_file_time( src_fname, &src_time);
if ( evenSts()) {
m_sts = PWRB__NOBUILT;
return;
}
strcpy( dest_fname, "$pwrp_exe/");
strcat( dest_fname, graph_name);
if ( strstr( dest_fname, ".pwg") == 0)
strcat( dest_fname, ".pwg");
dcli_translate_filename( dest_fname, dest_fname);
m_sts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) {
sprintf( cmd, "cp %s %s", src_fname, dest_fname);
system( cmd);
sprintf( cmd, "Build: AppGraph copy $pwrp_pop/%s -> $pwrp_exe", graph_name);
MsgWindow::message( 'I', cmd, msgw_ePop_No, oid);
strcpy( name, graph_name);
if (( s = strrchr( name, '.')))
*s = 0;
wb_log::log( wlog_eCategory_GeBuild, name, 0);
m_sts = PWRB__SUCCESS;
}
else
m_sts = PWRB__NOBUILT;
}
void wb_build::webhandler( pwr_tOid oid)
{
pwr_tTime modtime;
......
......@@ -63,6 +63,7 @@ class wb_build : public wb_status
void webhandler( pwr_tOid oid);
void webbrowserconfig( pwr_tOid oid);
void webgraph( pwr_tOid oid);
void appgraph( pwr_tOid oid);
void application( pwr_tOid oid);
void classdef( pwr_tOid oid);
......
......@@ -39,3 +39,4 @@ Application
FriendNodeConfig
SevHistThread
SevHistObject
AppGraph
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