Commit c55dcbaf authored by claes's avatar claes

ClassGraphs implemented

parent 6a2d651b
...@@ -150,6 +150,15 @@ public class GeCFormat { ...@@ -150,6 +150,15 @@ public class GeCFormat {
return buff; return buff;
} }
public StringBuffer format( boolean value, StringBuffer buff) {
buff.setLength(0);
if ( value)
buff.append('1');
else
buff.append('0');
return buff;
}
public StringBuffer format( String value, StringBuffer buff) { public StringBuffer format( String value, StringBuffer buff) {
switch( format_type) { switch( format_type) {
case FRM_S: { case FRM_S: {
......
...@@ -248,6 +248,10 @@ public class GeDyn { ...@@ -248,6 +248,10 @@ public class GeDyn {
return Pwr.eType_AttrRef; return Pwr.eType_AttrRef;
return -1; return -1;
} }
boolean isLocalDb( String attribute) {
return (attribute.startsWith("$local.") && en.ldb != null);
}
} }
......
...@@ -11,6 +11,7 @@ public class GeDynDigLowColor extends GeDynElem { ...@@ -11,6 +11,7 @@ public class GeDynDigLowColor extends GeDynElem {
boolean inverted; boolean inverted;
boolean oldValue; boolean oldValue;
boolean firstScan = true; boolean firstScan = true;
boolean localDb = false;
public GeDynDigLowColor( GeDyn dyn, String attribute, int color) { public GeDynDigLowColor( GeDyn dyn, String attribute, int color) {
super( dyn, GeDyn.mDynType_DigLowColor, GeDyn.mActionType_No); super( dyn, GeDyn.mDynType_DigLowColor, GeDyn.mActionType_No);
...@@ -20,7 +21,12 @@ public class GeDynDigLowColor extends GeDynElem { ...@@ -20,7 +21,12 @@ public class GeDynDigLowColor extends GeDynElem {
public void connect() { public void connect() {
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
if ( attrName.compareTo("") != 0) { if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName); GdhrRefObjectInfo ret;
localDb = dyn.isLocalDb(attrName);
if ( !localDb)
ret = dyn.en.gdh.refObjectInfo( attrName);
else
ret = dyn.en.ldb.refObjectInfo( dyn.comp.dynamicGetRoot(), attrName);
if ( ret.evenSts()) if ( ret.evenSts())
System.out.println( "DigLowColor: " + attrName); System.out.println( "DigLowColor: " + attrName);
else { else {
...@@ -32,14 +38,18 @@ public class GeDynDigLowColor extends GeDynElem { ...@@ -32,14 +38,18 @@ public class GeDynDigLowColor extends GeDynElem {
} }
} }
public void disconnect() { public void disconnect() {
if ( attrFound) if ( attrFound && !localDb)
dyn.en.gdh.unrefObjectInfo( subid); dyn.en.gdh.unrefObjectInfo( subid);
System.out.println("Disconnecting: " + attribute); System.out.println("Disconnecting: " + attribute);
} }
public void scan() { public void scan() {
if ( !attrFound || dyn.ignoreColor) if ( !attrFound || dyn.ignoreColor)
return; return;
boolean value = dyn.en.gdh.getObjectRefInfoBoolean( p); boolean value;
if ( !localDb)
value = dyn.en.gdh.getObjectRefInfoBoolean( p);
else
value = dyn.en.ldb.getObjectRefInfoBoolean( p);
if ( !firstScan) { if ( !firstScan) {
if ( oldValue == value && !dyn.resetColor) if ( oldValue == value && !dyn.resetColor)
return; return;
......
...@@ -4,8 +4,8 @@ import javax.swing.*; ...@@ -4,8 +4,8 @@ import javax.swing.*;
import jpwr.rt.*; import jpwr.rt.*;
public class GeDynMove extends GeDynElem { public class GeDynMove extends GeDynElem {
String moveXAttribute; public String moveXAttribute;
String moveYAttribute; public String moveYAttribute;
String scaleXAttribute; String scaleXAttribute;
String scaleYAttribute; String scaleYAttribute;
double xOffset; double xOffset;
...@@ -31,6 +31,8 @@ public class GeDynMove extends GeDynElem { ...@@ -31,6 +31,8 @@ public class GeDynMove extends GeDynElem {
float scaleYOldValue; float scaleYOldValue;
public double xOrig; public double xOrig;
public double yOrig; public double yOrig;
public double wOrig;
public double hOrig;
public double xScale = 1; public double xScale = 1;
public double yScale = 1; public double yScale = 1;
boolean firstScan = true; boolean firstScan = true;
...@@ -111,11 +113,15 @@ public class GeDynMove extends GeDynElem { ...@@ -111,11 +113,15 @@ public class GeDynMove extends GeDynElem {
Point loc = ((JComponent)dyn.comp).getLocation(); Point loc = ((JComponent)dyn.comp).getLocation();
xOrig = (double) loc.x; xOrig = (double) loc.x;
yOrig = (double) loc.y; yOrig = (double) loc.y;
Dimension size = ((JComponent)dyn.comp).getSize();
wOrig= (double) size.width;
hOrig= (double) size.height;
} }
if ( attrMoveXFound || attrMoveYFound) { if ( attrMoveXFound || attrMoveYFound) {
// Move // Move
Point loc = ((JComponent)dyn.comp).getLocation(); Point loc = ((JComponent)dyn.comp).getLocation();
Dimension size = ((JComponent)dyn.comp).getSize();
float valueMoveX = 0; float valueMoveX = 0;
float valueMoveY = 0; float valueMoveY = 0;
...@@ -134,10 +140,14 @@ public class GeDynMove extends GeDynElem { ...@@ -134,10 +140,14 @@ public class GeDynMove extends GeDynElem {
} }
} }
if ( repaintNow) { if ( repaintNow) {
if ( attrMoveXFound) if ( attrMoveXFound){
loc.x = (int) (xOrig + (valueMoveX - xOffset) * factor); double xRatio=(size.width/wOrig);
if ( attrMoveYFound) loc.x = (int) ((xOrig + (valueMoveX - xOffset) * factor) * xRatio);
loc.y = (int) (yOrig + (valueMoveY - yOffset) * factor); }
if ( attrMoveYFound){
double yRatio=(size.height/hOrig);
loc.y = (int) ((yOrig + (valueMoveY - yOffset) * factor) * yRatio);
}
((JComponent)dyn.comp).setLocation( loc); ((JComponent)dyn.comp).setLocation( loc);
} }
} }
...@@ -186,3 +196,12 @@ public class GeDynMove extends GeDynElem { ...@@ -186,3 +196,12 @@ public class GeDynMove extends GeDynElem {
} }
...@@ -24,7 +24,11 @@ public class GeDynSetDig extends GeDynElem { ...@@ -24,7 +24,11 @@ public class GeDynSetDig extends GeDynElem {
break; break;
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
PwrtStatus sts = dyn.en.gdh.setObjectInfo( attrName, true); PwrtStatus sts;
if ( !dyn.isLocalDb( attrName))
sts = dyn.en.gdh.setObjectInfo( attrName, true);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, true);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "SetDig: " + attrName); System.out.println( "SetDig: " + attrName);
break; break;
......
...@@ -4,9 +4,10 @@ import java.awt.event.*; ...@@ -4,9 +4,10 @@ import java.awt.event.*;
import java.awt.*; import java.awt.*;
import javax.swing.*; import javax.swing.*;
public class GeDynSlider extends GeDynElem { public class GeDynSlider extends GeDynElem {
String attribute; String attribute;
int direction; public int direction;
double minValue; double minValue;
double maxValue; double maxValue;
double minPos; double minPos;
...@@ -21,6 +22,8 @@ public class GeDynSlider extends GeDynElem { ...@@ -21,6 +22,8 @@ public class GeDynSlider extends GeDynElem {
boolean firstScan = true; boolean firstScan = true;
boolean moveActive = false; boolean moveActive = false;
Point offset = new Point(); Point offset = new Point();
float original_width = 0;
float original_height = 0;
public GeDynSlider( GeDyn dyn, String attribute, double minValue, double maxValue, public GeDynSlider( GeDyn dyn, String attribute, double minValue, double maxValue,
int direction, double minPos, double maxPos) { int direction, double minPos, double maxPos) {
...@@ -32,6 +35,24 @@ public class GeDynSlider extends GeDynElem { ...@@ -32,6 +35,24 @@ public class GeDynSlider extends GeDynElem {
this.minPos = minPos; this.minPos = minPos;
this.maxPos = maxPos; this.maxPos = maxPos;
} }
public void setMinValue( double minValue) {
this.minValue = minValue;
}
public void setMaxValue( double maxValue) {
this.maxValue = maxValue;
}
public void update() {
if ( !attrFound || moveActive)
return;
switch ( typeId) {
case Pwr.eType_Int32:
oldValueI = -10000;
break;
default:
oldValueF = -10000;
}
}
public void connect() { public void connect() {
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
if ( attrName.compareTo("") != 0) { if ( attrName.compareTo("") != 0) {
...@@ -54,6 +75,13 @@ public class GeDynSlider extends GeDynElem { ...@@ -54,6 +75,13 @@ public class GeDynSlider extends GeDynElem {
if ( !attrFound || moveActive) if ( !attrFound || moveActive)
return; return;
float width = ((JComponent)dyn.comp).getParent().getWidth();
float height = ((JComponent)dyn.comp).getParent().getHeight();
if ( original_width == 0) {
original_width = width;
original_height = height;
}
float value; float value;
switch ( typeId) { switch ( typeId) {
case Pwr.eType_Int32: case Pwr.eType_Int32:
...@@ -73,25 +101,51 @@ public class GeDynSlider extends GeDynElem { ...@@ -73,25 +101,51 @@ public class GeDynSlider extends GeDynElem {
Point loc = ((JComponent)dyn.comp).getLocation(); Point loc = ((JComponent)dyn.comp).getLocation();
int pos; int pos;
double minPos;
double maxPos;
switch ( direction) { switch ( direction) {
case Ge.DIRECTION_RIGHT: case Ge.DIRECTION_RIGHT:
minPos = this.minPos * width / original_width;
maxPos = this.maxPos * width / original_width;
pos = (int)((maxValue - value)/(maxValue - minValue) * pos = (int)((maxValue - value)/(maxValue - minValue) *
(maxPos - minPos) + minPos); (maxPos - minPos) + minPos);
if ( pos < minPos)
pos = (int)minPos;
if ( pos > maxPos)
pos = (int)maxPos;
loc.x = pos; loc.x = pos;
break; break;
case Ge.DIRECTION_LEFT: case Ge.DIRECTION_LEFT:
minPos = this.minPos * width / original_width;
maxPos = this.maxPos * width / original_width;
pos = (int)(value /(maxValue - minValue) * pos = (int)(value /(maxValue - minValue) *
(maxPos - minPos) + minPos); (maxPos - minPos) + minPos);
if ( pos < minPos)
pos = (int)minPos;
if ( pos > maxPos)
pos = (int)maxPos;
loc.x = pos; loc.x = pos;
break; break;
case Ge.DIRECTION_UP: case Ge.DIRECTION_UP:
minPos = this.minPos * height / original_height;
maxPos = this.maxPos * height / original_height;
pos = (int)((value - minValue)/(maxValue - minValue) * pos = (int)((value - minValue)/(maxValue - minValue) *
(maxPos - minPos) + minPos); (maxPos - minPos) + minPos);
if ( pos < minPos)
pos = (int)minPos;
if ( pos > maxPos)
pos = (int)maxPos;
loc.y = pos; loc.y = pos;
break; break;
default: default:
minPos = this.minPos * height / original_height;
maxPos = this.maxPos * height / original_height;
pos = (int)((maxValue - value)/(maxValue - minValue) * pos = (int)((maxValue - value)/(maxValue - minValue) *
(maxPos - minPos) + minPos); (maxPos - minPos) + minPos);
if ( pos < minPos)
pos = (int)minPos;
if ( pos > maxPos)
pos = (int)maxPos;
loc.y = pos; loc.y = pos;
} }
((JComponent)dyn.comp).setLocation( loc); ((JComponent)dyn.comp).setLocation( loc);
...@@ -116,14 +170,22 @@ public class GeDynSlider extends GeDynElem { ...@@ -116,14 +170,22 @@ public class GeDynSlider extends GeDynElem {
break; break;
case GeDyn.eEvent_SliderMoved: case GeDyn.eEvent_SliderMoved:
float value; float value;
double minPos;
double maxPos;
PwrtStatus sts; PwrtStatus sts;
Point new_loc = new Point(); Point new_loc = new Point();
float width = ((JComponent)dyn.comp).getParent().getWidth();
float height = ((JComponent)dyn.comp).getParent().getHeight();
Point ePoint = e.getPoint(); Point ePoint = e.getPoint();
// System.out.println("Mouse dragged: " + thisPoint.x + ", " + // System.out.println("Mouse dragged: " + thisPoint.x + ", " +
// thisPoint.y); // thisPoint.y);
Point loc = ((GeComponent)dyn.comp).getLocation(); Point loc = ((GeComponent)dyn.comp).getLocation();
if ( original_width == 0)
return;
switch ( direction) { switch ( direction) {
case Ge.DIRECTION_RIGHT: case Ge.DIRECTION_RIGHT:
minPos = this.minPos * width / original_width;
maxPos = this.maxPos * width / original_width;
new_loc.x = loc.x + ePoint.x - offset.x; new_loc.x = loc.x + ePoint.x - offset.x;
new_loc.y = loc.y; new_loc.y = loc.y;
if ( new_loc.x > maxPos) if ( new_loc.x > maxPos)
...@@ -134,6 +196,8 @@ public class GeDynSlider extends GeDynElem { ...@@ -134,6 +196,8 @@ public class GeDynSlider extends GeDynElem {
(maxValue - minValue) + minValue); (maxValue - minValue) + minValue);
break; break;
case Ge.DIRECTION_LEFT: case Ge.DIRECTION_LEFT:
minPos = this.minPos * width / original_width;
maxPos = this.maxPos * width / original_width;
new_loc.x = loc.x + ePoint.x - offset.x; new_loc.x = loc.x + ePoint.x - offset.x;
new_loc.y = loc.y; new_loc.y = loc.y;
if ( new_loc.x > maxPos) if ( new_loc.x > maxPos)
...@@ -144,6 +208,8 @@ public class GeDynSlider extends GeDynElem { ...@@ -144,6 +208,8 @@ public class GeDynSlider extends GeDynElem {
(maxValue - minValue) + minValue); (maxValue - minValue) + minValue);
break; break;
case Ge.DIRECTION_UP: case Ge.DIRECTION_UP:
minPos = this.minPos * height / original_height;
maxPos = this.maxPos * height / original_height;
new_loc.y = loc.y + ePoint.y - offset.y; new_loc.y = loc.y + ePoint.y - offset.y;
new_loc.x = loc.x; new_loc.x = loc.x;
if ( new_loc.y > maxPos) if ( new_loc.y > maxPos)
...@@ -155,6 +221,8 @@ public class GeDynSlider extends GeDynElem { ...@@ -155,6 +221,8 @@ public class GeDynSlider extends GeDynElem {
// System.out.println("old_y: " + ePoint.y + " new_y: " + new_loc.y + "v: " + value); // System.out.println("old_y: " + ePoint.y + " new_y: " + new_loc.y + "v: " + value);
break; break;
default: default:
minPos = this.minPos * height / original_height;
maxPos = this.maxPos * height / original_height;
new_loc.y = loc.y + ePoint.y - offset.y; new_loc.y = loc.y + ePoint.y - offset.y;
// System.out.println( "loc.y " + loc.y + " eP.y " + ePoint.y + " offset.y " + offset.y + " new_loc.y " + new_loc.y + " maxPos " + maxPos + " minPos " + minPos); // System.out.println( "loc.y " + loc.y + " eP.y " + ePoint.y + " offset.y " + offset.y + " new_loc.y " + new_loc.y + " maxPos " + maxPos + " minPos " + minPos);
new_loc.x = loc.x; new_loc.x = loc.x;
...@@ -168,12 +236,13 @@ public class GeDynSlider extends GeDynElem { ...@@ -168,12 +236,13 @@ public class GeDynSlider extends GeDynElem {
} }
((JComponent)dyn.comp).setLocation(new_loc); ((JComponent)dyn.comp).setLocation(new_loc);
String attrName = dyn.getAttrName(attribute);
switch ( typeId) { switch ( typeId) {
case Pwr.eType_Int32: case Pwr.eType_Int32:
sts = dyn.en.gdh.setObjectInfo( attribute, (int) value); sts = dyn.en.gdh.setObjectInfo( attrName, (int) value);
break; break;
default: default:
sts = dyn.en.gdh.setObjectInfo( attribute, value); sts = dyn.en.gdh.setObjectInfo( attrName, value);
} }
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "GeSlider: " + sts); System.out.println( "GeSlider: " + sts);
......
...@@ -23,7 +23,9 @@ public class GeDynTable extends GeDynElem { ...@@ -23,7 +23,9 @@ public class GeDynTable extends GeDynElem {
public String[][] oldValueS; public String[][] oldValueS;
boolean firstScan = true; boolean firstScan = true;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
boolean[] isHeaderRef;
int[][] headerRefp;
PwrtRefId[][] headerRefSubid;
public GeDynTable( GeDyn dyn, String[] attribute, String[] format, String[] selAttribute, public GeDynTable( GeDyn dyn, String[] attribute, String[] format, String[] selAttribute,
int rows, int columns) { int rows, int columns) {
super( dyn, GeDyn.mDynType_Table, GeDyn.mActionType_No); super( dyn, GeDyn.mDynType_Table, GeDyn.mActionType_No);
...@@ -45,8 +47,12 @@ public class GeDynTable extends GeDynElem { ...@@ -45,8 +47,12 @@ public class GeDynTable extends GeDynElem {
oldValueF = new float[columns][]; oldValueF = new float[columns][];
oldValueI = new int[columns][]; oldValueI = new int[columns][];
oldValueS = new String[columns][]; oldValueS = new String[columns][];
isHeaderRef = new boolean[columns];
headerRefp = new int[columns][];
headerRefSubid = new PwrtRefId[columns][];
} }
public void connect() { public void connect() {
GdhrRefObjectInfo ret;
for ( int i = 0; i < columns; i++) { for ( int i = 0; i < columns; i++) {
String attrName = dyn.getAttrName( attribute[i]); String attrName = dyn.getAttrName( attribute[i]);
...@@ -55,16 +61,38 @@ public class GeDynTable extends GeDynElem { ...@@ -55,16 +61,38 @@ public class GeDynTable extends GeDynElem {
if ( attrName.startsWith("$header.")) { if ( attrName.startsWith("$header.")) {
// NYI TODO !!! // NYI TODO !!!
// Replace $header with the object in the header column // Replace $header with the object in the header column
String hName = dyn.getAttrName( attribute[0]);
CdhrString cstr = dyn.en.gdh.getObjectInfoString( hName);
if (cstr.evenSts()) continue;
attrName = cstr.str + attrName.substring(7); isHeaderRef[i] = true;
headerRefp[i] = new int[rows];
headerRefSubid[i] = new PwrtRefId[rows];
for ( int j = 0; j < rows; j++) {
String hName = dyn.getAttrNameNoSuffix( attribute[0]);
hName = hName + "[" + j + "]";
CdhrString cstr = dyn.en.gdh.getObjectInfoString( hName);
if (cstr.evenSts()) {
headerRefp[i][j] = 0;
// headerRefSubid[i][j] = null;
continue; continue;
} }
String cellAttrName = cstr.str + attrName.substring(7);
ret = dyn.en.gdh.refObjectInfo( cellAttrName);
if ( ret.evenSts()) {
System.out.println( "Table: " + cellAttrName);
}
else {
attrFound[i] = true;
headerRefp[i][j] = ret.id;
headerRefSubid[i][j] = ret.refid;
typeId[i] = ret.typeId;
}
}
}
else {
isHeaderRef[i] = false;
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName); ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts()) { if ( ret.evenSts()) {
System.out.println( "Table: " + attrName); System.out.println( "Table: " + attrName);
attrFound[i] = false; attrFound[i] = false;
...@@ -78,6 +106,8 @@ public class GeDynTable extends GeDynElem { ...@@ -78,6 +106,8 @@ public class GeDynTable extends GeDynElem {
size[i] = ret.getSize(); size[i] = ret.getSize();
if ( elements[i] > rows) if ( elements[i] > rows)
elements[i] = rows; elements[i] = rows;
}
}
if ( typeId[i] == Pwr.eType_Float32) { if ( typeId[i] == Pwr.eType_Float32) {
oldValueF[i] = new float[rows]; oldValueF[i] = new float[rows];
} }
...@@ -101,19 +131,88 @@ public class GeDynTable extends GeDynElem { ...@@ -101,19 +131,88 @@ public class GeDynTable extends GeDynElem {
} }
} }
} }
}
public void disconnect() { public void disconnect() {
for ( int i = 0; i < columns; i++) { for ( int i = 0; i < columns; i++) {
if ( attrFound[i]) if ( attrFound[i]) {
if ( isHeaderRef[i]) {
for ( int j = 0; j < rows; j++) {
if ( headerRefSubid[i][j] != null)
dyn.en.gdh.unrefObjectInfo( headerRefSubid[i][j]);
}
}
else
dyn.en.gdh.unrefObjectInfo( subid[i]); dyn.en.gdh.unrefObjectInfo( subid[i]);
} }
} }
}
public void scan() { public void scan() {
for ( int i = 0; i < columns; i++) { for ( int i = 0; i < columns; i++) {
if ( !attrFound[i]) if ( !attrFound[i])
continue; continue;
if ( isHeaderRef[i]) {
if ( typeId[i] == Pwr.eType_Float32) {
for ( int j = 0; j < rows; j++) {
if ( headerRefp[i][j] != 0) {
float value0 = dyn.en.gdh.getObjectRefInfoFloat( headerRefp[i][j]);
if ( value0 != oldValueF[i][j] || firstScan) {
sb = cFormat[i].format( value0, sb);
((GeTable)dyn.comp).setValueAt(new String(sb), j, i);
// dyn.repaintNow = true;
oldValueF[i][j] = value0;
}
}
}
}
else if ( typeId[i] == Pwr.eType_Boolean) {
for ( int j = 0; j < rows; j++) {
if ( headerRefp[i][j] != 0) {
boolean value0 = dyn.en.gdh.getObjectRefInfoBoolean( headerRefp[i][j]);
if ( value0 != oldValueB[i][j] || firstScan) {
sb = cFormat[i].format( value0, sb);
((GeTable)dyn.comp).setValueAt(new String(sb), j, i);
// dyn.repaintNow = true;
oldValueB[i][j] = value0;
}
}
}
}
else if ( typeId[i] == Pwr.eType_Int32 ||
typeId[i] == Pwr.eType_UInt32 ||
typeId[i] == Pwr.eType_Int16 ||
typeId[i] == Pwr.eType_UInt16 ||
typeId[i] == Pwr.eType_Int8 ||
typeId[i] == Pwr.eType_UInt8) {
for ( int j = 0; j < rows; j++) {
if ( headerRefp[i][j] != 0) {
int value0 = dyn.en.gdh.getObjectRefInfoInt( headerRefp[i][j]);
if ( value0 != oldValueI[i][j] || firstScan) {
sb = cFormat[i].format( value0, sb);
((GeTable)dyn.comp).setValueAt(new String(sb), j, i);
// dyn.repaintNow = true;
oldValueI[i][j] = value0;
}
}
}
}
else if ( typeId[i] == Pwr.eType_String ||
typeId[i] == Pwr.eType_Objid ||
typeId[i] == Pwr.eType_Time ||
typeId[i] == Pwr.eType_DeltaTime) {
for ( int j = 0; j < rows; j++) {
String value0 = dyn.en.gdh.getObjectRefInfoString( headerRefp[i][j], typeId[i]);
if ( firstScan || value0.compareTo( oldValueS[i][j]) != 0) {
sb = cFormat[i].format( value0, sb);
((GeTable)dyn.comp).setValueAt(new String(sb), j, i);
// dyn.repaintNow = true;
oldValueS[i][j] = value0;
}
}
}
}
else {
if ( typeId[i] == Pwr.eType_Float32) { if ( typeId[i] == Pwr.eType_Float32) {
float[] value0 = dyn.en.gdh.getObjectRefInfoFloatArray( p[i], elements[i]); float[] value0 = dyn.en.gdh.getObjectRefInfoFloatArray( p[i], elements[i]);
for ( int j = 0; j < value0.length; j++) { for ( int j = 0; j < value0.length; j++) {
...@@ -177,10 +276,11 @@ public class GeDynTable extends GeDynElem { ...@@ -177,10 +276,11 @@ public class GeDynTable extends GeDynElem {
} }
} }
} }
}
}
if ( firstScan) if ( firstScan)
firstScan = false; firstScan = false;
} }
}
public void action( int eventType, MouseEvent e) { public void action( int eventType, MouseEvent e) {
int row; int row;
......
...@@ -24,7 +24,11 @@ public class GeDynToggleDig extends GeDynElem { ...@@ -24,7 +24,11 @@ public class GeDynToggleDig extends GeDynElem {
break; break;
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
PwrtStatus sts = dyn.en.gdh.toggleObjectInfo( attrName); PwrtStatus sts;
if ( !dyn.isLocalDb( attrName))
sts = dyn.en.gdh.toggleObjectInfo( attrName);
else
sts = dyn.en.ldb.toggleObjectInfo( dyn.comp.dynamicGetRoot(), attrName);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "ToggleDig: " + attrName); System.out.println( "ToggleDig: " + attrName);
break; break;
......
...@@ -15,6 +15,7 @@ public class GeDynValue extends GeDynElem { ...@@ -15,6 +15,7 @@ public class GeDynValue extends GeDynElem {
boolean firstScan = true; boolean firstScan = true;
GeCFormat cFormat; GeCFormat cFormat;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
boolean localDb = false;
public GeDynValue( GeDyn dyn, String attribute, String format) { public GeDynValue( GeDyn dyn, String attribute, String format) {
super( dyn, GeDyn.mDynType_Value, GeDyn.mActionType_No); super( dyn, GeDyn.mDynType_Value, GeDyn.mActionType_No);
...@@ -24,7 +25,13 @@ public class GeDynValue extends GeDynElem { ...@@ -24,7 +25,13 @@ public class GeDynValue extends GeDynElem {
public void connect() { public void connect() {
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
if ( attrName.compareTo("") != 0) { if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName); GdhrRefObjectInfo ret;
localDb = dyn.isLocalDb(attrName);
if ( !localDb)
ret = dyn.en.gdh.refObjectInfo( attrName);
else
ret = dyn.en.ldb.refObjectInfo( dyn.comp.dynamicGetRoot(), attrName);
if ( ret.evenSts()) if ( ret.evenSts())
System.out.println( "Value: " + attrName); System.out.println( "Value: " + attrName);
else { else {
...@@ -36,7 +43,7 @@ public class GeDynValue extends GeDynElem { ...@@ -36,7 +43,7 @@ public class GeDynValue extends GeDynElem {
} }
} }
public void disconnect() { public void disconnect() {
if ( attrFound) if ( attrFound && !localDb)
dyn.en.gdh.unrefObjectInfo( subid); dyn.en.gdh.unrefObjectInfo( subid);
} }
public void scan() { public void scan() {
...@@ -45,7 +52,11 @@ public class GeDynValue extends GeDynElem { ...@@ -45,7 +52,11 @@ public class GeDynValue extends GeDynElem {
switch ( typeId) { switch ( typeId) {
case Pwr.eType_Float32: { case Pwr.eType_Float32: {
float value0 = dyn.en.gdh.getObjectRefInfoFloat( p); float value0 = 0;
if ( !localDb)
value0 = dyn.en.gdh.getObjectRefInfoFloat( p);
else
value0 = dyn.en.ldb.getObjectRefInfoFloat( p);
if ( value0 != oldValueF || firstScan) { if ( value0 != oldValueF || firstScan) {
sb = cFormat.format( value0, sb); sb = cFormat.format( value0, sb);
dyn.comp.setAnnot1(new String(sb)); dyn.comp.setAnnot1(new String(sb));
...@@ -60,7 +71,12 @@ public class GeDynValue extends GeDynElem { ...@@ -60,7 +71,12 @@ public class GeDynValue extends GeDynElem {
case Pwr.eType_UInt16: case Pwr.eType_UInt16:
case Pwr.eType_Int8: case Pwr.eType_Int8:
case Pwr.eType_UInt8: { case Pwr.eType_UInt8: {
int value0 = dyn.en.gdh.getObjectRefInfoInt( p); int value0;
if ( !localDb)
value0 = dyn.en.gdh.getObjectRefInfoInt( p);
else
value0 = dyn.en.ldb.getObjectRefInfoInt( p);
if ( value0 != oldValueI || firstScan) { if ( value0 != oldValueI || firstScan) {
sb = cFormat.format( value0, sb); sb = cFormat.format( value0, sb);
dyn.comp.setAnnot1(new String(sb)); dyn.comp.setAnnot1(new String(sb));
...@@ -69,11 +85,31 @@ public class GeDynValue extends GeDynElem { ...@@ -69,11 +85,31 @@ public class GeDynValue extends GeDynElem {
} }
break; break;
} }
case Pwr.eType_Boolean: {
boolean value0;
if ( !localDb)
value0 = dyn.en.gdh.getObjectRefInfoBoolean( p);
else
value0 = dyn.en.ldb.getObjectRefInfoBoolean( p);
if ( value0 != oldValueB || firstScan) {
sb = cFormat.format( value0, sb);
dyn.comp.setAnnot1(new String(sb));
dyn.repaintNow = true;
oldValueB = value0;
}
break;
}
case Pwr.eType_String: case Pwr.eType_String:
case Pwr.eType_Objid: case Pwr.eType_Objid:
case Pwr.eType_Time: case Pwr.eType_Time:
case Pwr.eType_DeltaTime: { case Pwr.eType_DeltaTime: {
String value0 = dyn.en.gdh.getObjectRefInfoString( p, typeId); String value0;
if ( !localDb)
value0 = dyn.en.gdh.getObjectRefInfoString( p, typeId);
else
value0 = dyn.en.ldb.getObjectRefInfoString( p, typeId);
if ( firstScan || value0.compareTo( oldValueS) != 0) { if ( firstScan || value0.compareTo( oldValueS) != 0) {
sb = cFormat.format( value0, sb); sb = cFormat.format( value0, sb);
dyn.comp.setAnnot1(new String(sb)); dyn.comp.setAnnot1(new String(sb));
......
...@@ -29,6 +29,8 @@ public class GeDynValueInput extends GeDynElem { ...@@ -29,6 +29,8 @@ public class GeDynValueInput extends GeDynElem {
break; break;
} }
} }
if ( !attrFound)
System.out.println("ValueInput: attribute not found");
} }
public void disconnect() { public void disconnect() {
} }
...@@ -57,14 +59,20 @@ public class GeDynValueInput extends GeDynElem { ...@@ -57,14 +59,20 @@ public class GeDynValueInput extends GeDynElem {
valueElement.oldValueF = inputValue; valueElement.oldValueF = inputValue;
if ( minValue == 0 && maxValue == 0) { if ( minValue == 0 && maxValue == 0) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue); sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts); System.out.println( "setObjectInfoError " + sts);
} }
else { else {
if ( inputValue >= minValue && inputValue <= maxValue ) { if ( inputValue >= minValue && inputValue <= maxValue ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue); sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + attrName + " " + sts); System.out.println( "setObjectInfoError " + attrName + " " + sts);
} }
...@@ -82,14 +90,20 @@ public class GeDynValueInput extends GeDynElem { ...@@ -82,14 +90,20 @@ public class GeDynValueInput extends GeDynElem {
valueElement.oldValueI = inputValue; valueElement.oldValueI = inputValue;
if ( minValue == 0 && maxValue == 0) { if ( minValue == 0 && maxValue == 0) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue); sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts); System.out.println( "setObjectInfoError " + sts);
} }
else { else {
if ( inputValue >= minValue && inputValue <= maxValue ) { if ( inputValue >= minValue && inputValue <= maxValue ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue); sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts); System.out.println( "setObjectInfoError " + sts);
} }
...@@ -97,9 +111,31 @@ public class GeDynValueInput extends GeDynElem { ...@@ -97,9 +111,31 @@ public class GeDynValueInput extends GeDynElem {
valueElement.oldValueI = -10000; valueElement.oldValueI = -10000;
} }
} }
else if ( typeId == Pwr.eType_Boolean) {
int inputValueInt = Integer.parseInt( text.trim(), 10);
boolean inputValue;
if ( inputValueInt == 0)
inputValue = false;
else if ( inputValueInt == 1)
inputValue = true;
else
break;
valueElement.oldValueB = inputValue;
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts);
}
else if ( typeId == Pwr.eType_String) { else if ( typeId == Pwr.eType_String) {
valueElement.oldValueS = text; valueElement.oldValueS = text;
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, text);
else
sts = dyn.en.gdh.setObjectInfo( attrName, text); sts = dyn.en.gdh.setObjectInfo( attrName, text);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts); System.out.println( "setObjectInfoError " + sts);
......
...@@ -26,6 +26,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc, ...@@ -26,6 +26,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
int hRow; int hRow;
int hColumn; int hColumn;
JViewport jv; JViewport jv;
int headerRowHeight = 0;
public boolean focus = false; public boolean focus = false;
public boolean confirmActive = false; public boolean confirmActive = false;
...@@ -52,6 +53,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc, ...@@ -52,6 +53,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
if ( hRow == 0) { if ( hRow == 0) {
table.setTableHeader( null); table.setTableHeader( null);
} }
if ( hColumn == 1) { if ( hColumn == 1) {
// Set up the header column // Set up the header column
headerColumn = new JTable(rows, 1); headerColumn = new JTable(rows, 1);
...@@ -98,7 +100,17 @@ public class GeTable extends JScrollPane implements GeComponentIfc, ...@@ -98,7 +100,17 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
if ( hColumn == 1) if ( hColumn == 1)
headerColumn.setRowHeight( height); headerColumn.setRowHeight( height);
} }
public void setHeaderRowHeight( int height) { public void setHeaderRowHeight( int headerRowHeight) {
if ( hRow == 1) {
Dimension d = table.getTableHeader().getPreferredSize();
d.height = headerRowHeight;
table.getTableHeader().setPreferredSize( d);
if ( hColumn == 1) {
Dimension hd = headerColumn.getTableHeader().getPreferredSize();
hd.height = headerRowHeight;
headerColumn.getTableHeader().setPreferredSize( hd);
}
}
} }
public void setFont( Font font) { public void setFont( Font font) {
if ( table != null) if ( table != null)
...@@ -339,6 +351,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc, ...@@ -339,6 +351,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
paintComponent(g); paintComponent(g);
paintChildren(g); paintChildren(g);
} }
} }
......
...@@ -10,9 +10,11 @@ import javax.swing.Timer; ...@@ -10,9 +10,11 @@ import javax.swing.Timer;
public class GeTextField extends JTextField implements GeComponentIfc, public class GeTextField extends JTextField implements GeComponentIfc,
JopDynamic, JopConfirm, ActionListener JopDynamic, JopConfirm, ActionListener
{ {
public boolean isFocusTraversable() { return root != null;}
Dimension size; Dimension size;
Object root; Object root;
Timer timer = new Timer(500, this); public Timer timer = new Timer(500, this);
JopSession session; JopSession session;
public JopEngine en; public JopEngine en;
public GeDyn dd = new GeDyn( this); public GeDyn dd = new GeDyn( this);
......
...@@ -157,8 +157,6 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -157,8 +157,6 @@ public class JopBar extends JComponent implements GeComponentIfc,
public int getBarBorderWidth() { public int getBarBorderWidth() {
return barBorderWidth; return barBorderWidth;
} }
int original_width = 30;
int original_height = 120;
public double rotate; public double rotate;
public void setRotate( double rotate) { this.rotate = rotate;} public void setRotate( double rotate) { this.rotate = rotate;}
public double getRotate() { return rotate;} public double getRotate() { return rotate;}
...@@ -177,6 +175,8 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -177,6 +175,8 @@ public class JopBar extends JComponent implements GeComponentIfc,
g.setTransform(save); g.setTransform(save);
} }
} }
float original_width;
float original_height;
public void paintComponent(Graphics g1) { public void paintComponent(Graphics g1) {
Graphics2D g = (Graphics2D) g1; Graphics2D g = (Graphics2D) g1;
...@@ -189,13 +189,17 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -189,13 +189,17 @@ public class JopBar extends JComponent implements GeComponentIfc,
// g.transform( AffineTransform.getRotateInstance( // g.transform( AffineTransform.getRotateInstance(
// Math.PI * rotate/180,((double)original_width)/2, ((double)original_height)/2)); // Math.PI * rotate/180,((double)original_width)/2, ((double)original_height)/2));
// g.transform( AffineTransform.getScaleInstance( scaleWidth, scaleHeight)); // g.transform( AffineTransform.getScaleInstance( scaleWidth, scaleHeight));
if ( shapes[0] == null) {
float width = getWidth(); float width = getWidth();
float height = getHeight(); float height = getHeight();
if ( shapes[0] == null) {
original_width = width;
original_height = height;
shapes[0] = new Rectangle2D.Float(0F, 0F, width, height); shapes[0] = new Rectangle2D.Float(0F, 0F, width, height);
shapes[1] = new Rectangle2D.Float(0F, 0F, width, 1F); shapes[1] = new Rectangle2D.Float(0F, 0F, width, 1F);
shapes[2] = new Line2D.Float(0F, 0F, width, 0F); shapes[2] = new Line2D.Float(0F, 0F, width, 0F);
} }
g.transform( AffineTransform.getScaleInstance( width/original_width,
height/original_height));
if ( drawFill == 1) { if ( drawFill == 1) {
g.setColor(GeColor.getColor(22, fillColor)); g.setColor(GeColor.getColor(22, fillColor));
g.fill( shapes[0]); g.fill( shapes[0]);
...@@ -242,9 +246,16 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -242,9 +246,16 @@ public class JopBar extends JComponent implements GeComponentIfc,
public Object dynamicGetRoot() { public Object dynamicGetRoot() {
return root; return root;
} }
public void update() {
valueColorOld = -10000;
dynamicUpdate( false);
}
public void dynamicOpen() { public void dynamicOpen() {
if ( en.isInstance())
dd.setInstance( en.getInstance());
if ( pwrAttribute.compareTo("") != 0) { if ( pwrAttribute.compareTo("") != 0) {
retColor = en.gdh.refObjectInfo( pwrAttribute); String attrName = dd.getAttrName(pwrAttribute);
retColor = en.gdh.refObjectInfo( attrName);
if ( retColor.evenSts()) if ( retColor.evenSts())
System.out.println( "refObjectInfoError retColor"); System.out.println( "refObjectInfoError retColor");
else else
...@@ -256,6 +267,8 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -256,6 +267,8 @@ public class JopBar extends JComponent implements GeComponentIfc,
en.gdh.unrefObjectInfo( retColor.refid); en.gdh.unrefObjectInfo( retColor.refid);
} }
public void dynamicUpdate( boolean animationOnly) { public void dynamicUpdate( boolean animationOnly) {
if ( maxValue == minValue)
return;
if ( animationOnly) if ( animationOnly)
return; return;
if ( colorAttrFound) { if ( colorAttrFound) {
...@@ -288,7 +301,11 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -288,7 +301,11 @@ public class JopBar extends JComponent implements GeComponentIfc,
x + width - bar_height, y + height); x + width - bar_height, y + height);
} }
else { else {
bar_height = valueColor / (maxValue - minValue) * height; bar_height = (valueColor - minValue) / (maxValue - minValue) * height;
if ( bar_height < 0)
bar_height = 0;
if ( bar_height > height)
bar_height = height;
((Rectangle2D.Float )shapes[1]).setRect( x, y + height - bar_height, width, ((Rectangle2D.Float )shapes[1]).setRect( x, y + height - bar_height, width,
bar_height); bar_height);
((Line2D.Float )shapes[2]).setLine( x, y + height - bar_height, x + width, ((Line2D.Float )shapes[2]).setLine( x, y + height - bar_height, x + width,
......
...@@ -19,6 +19,7 @@ public class JopEngine implements ActionListener { ...@@ -19,6 +19,7 @@ public class JopEngine implements ActionListener {
Vector updateVector; Vector updateVector;
Timer timer; Timer timer;
public Gdh gdh; public Gdh gdh;
public LocalDb ldb = null;
boolean initDone = false; boolean initDone = false;
boolean ready = false; boolean ready = false;
boolean gdhReady = false; boolean gdhReady = false;
...@@ -153,6 +154,9 @@ public class JopEngine implements ActionListener { ...@@ -153,6 +154,9 @@ public class JopEngine implements ActionListener {
public void setInstance( String instance) { public void setInstance( String instance) {
this.instance = instance; this.instance = instance;
if ( ldb == null) {
ldb = new LocalDb();
}
} }
public String getInstance() { public String getInstance() {
return instance; return instance;
...@@ -160,9 +164,15 @@ public class JopEngine implements ActionListener { ...@@ -160,9 +164,15 @@ public class JopEngine implements ActionListener {
public boolean isInstance() { public boolean isInstance() {
return ( instance != null); return ( instance != null);
} }
public void setLocalDb( LocalDb ldb) {
if ( this.ldb == null)
this.ldb = ldb;
}
} }
...@@ -8,6 +8,7 @@ import java.net.*; ...@@ -8,6 +8,7 @@ import java.net.*;
import java.applet.*; import java.applet.*;
import java.util.*; import java.util.*;
import jpwr.rt.*; import jpwr.rt.*;
import jpwr.jopc.*;
public class JopSpider { public class JopSpider {
int qcom_qix; int qcom_qix;
...@@ -61,7 +62,7 @@ System.out.println( "qcom put finished"); ...@@ -61,7 +62,7 @@ System.out.println( "qcom put finished");
static CliTable[] cliTable = new CliTable[] { static CliTable[] cliTable = new CliTable[] {
new CliTable( "OPEN", new String[] {"cli_arg1", "cli_arg2", "/NAME", new CliTable( "OPEN", new String[] {"cli_arg1", "cli_arg2", "/NAME",
"/FILE", "/SCROLLBAR", "/WIDTH", "/HEIGHT", "/MENU", "/NAVIGATOR", "/FILE", "/SCROLLBAR", "/WIDTH", "/HEIGHT", "/MENU", "/NAVIGATOR",
"/CENTER", "/OBJECT", "/INSTANCE", "/NEW", "/CLASSGRAPH"}), "/CENTER", "/OBJECT", "/INSTANCE", "/NEW", "/CLASSGRAPH", "/ACCESS"}),
new CliTable( "EXIT", null), new CliTable( "EXIT", null),
new CliTable( "HELP", new String[] {"cli_arg1", "cli_arg2", "cli_arg3", new CliTable( "HELP", new String[] {"cli_arg1", "cli_arg2", "cli_arg3",
"cli_arg4", "/HELPFILE", "/POPNAVIGATOR", "/BOOKMARK", "/INDEX", "cli_arg4", "/HELPFILE", "/POPNAVIGATOR", "/BOOKMARK", "/INDEX",
...@@ -463,7 +464,13 @@ System.out.println( "JopSpiderCmd start"); ...@@ -463,7 +464,13 @@ System.out.println( "JopSpiderCmd start");
Object argList[] = new Object[] { session, instance, new Boolean(scrollbar)}; Object argList[] = new Object[] { session, instance, new Boolean(scrollbar)};
Constructor constructor = clazz.getConstructor( argTypeList); Constructor constructor = clazz.getConstructor( argTypeList);
try {
frame = constructor.newInstance( argList); frame = constructor.newInstance( argList);
}
catch ( Exception e) {
System.out.println("Class instatiation error: " + className);
return null;
}
// frame = clazz.newInstance(); // frame = clazz.newInstance();
openFrame( frame); openFrame( frame);
return frame; return frame;
......
...@@ -16,6 +16,8 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -16,6 +16,8 @@ public class JopTrend extends JComponent implements GeComponentIfc,
JopSession session; JopSession session;
JopEngine en; JopEngine en;
public GeDyn dd = new GeDyn( this); public GeDyn dd = new GeDyn( this);
boolean hold = false;
public JopTrend( JopSession session) public JopTrend( JopSession session)
{ {
this.session = session; this.session = session;
...@@ -77,6 +79,10 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -77,6 +79,10 @@ public class JopTrend extends JComponent implements GeComponentIfc,
dd.confirmedAction( GeDyn.eEvent_MB1Click, null); dd.confirmedAction( GeDyn.eEvent_MB1Click, null);
} }
public void setHold( boolean hold) {
this.hold = hold;
}
// GeComponents Ifc // GeComponents Ifc
public void tsetFillColor( int fillColor) {} public void tsetFillColor( int fillColor) {}
public void tsetColorTone( int colorTone) {} public void tsetColorTone( int colorTone) {}
...@@ -220,6 +226,8 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -220,6 +226,8 @@ public class JopTrend extends JComponent implements GeComponentIfc,
g.setTransform(save); g.setTransform(save);
} }
} }
float original_width;
float original_height;
public void paintComponent(Graphics g1) { public void paintComponent(Graphics g1) {
int i, j; int i, j;
Graphics2D g = (Graphics2D) g1; Graphics2D g = (Graphics2D) g1;
...@@ -229,6 +237,8 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -229,6 +237,8 @@ public class JopTrend extends JComponent implements GeComponentIfc,
float delta; float delta;
if ( shapes == null) { if ( shapes == null) {
original_width = width;
original_height = height;
shapes = new Shape[1]; shapes = new Shape[1];
shapes[0] = new Rectangle2D.Float(0F, 0F, width, height); shapes[0] = new Rectangle2D.Float(0F, 0F, width, height);
if ( verticalLines > 0) if ( verticalLines > 0)
...@@ -263,10 +273,7 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -263,10 +273,7 @@ public class JopTrend extends JComponent implements GeComponentIfc,
} }
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
if ( drawFill == 1) { /*
g.setColor(GeColor.getColor(22, fillColor));
g.fill( shapes[0]);
}
if ( 45.0 <= rotate && rotate < 135.0) { if ( 45.0 <= rotate && rotate < 135.0) {
g.translate( -height, 0.0); g.translate( -height, 0.0);
g.rotate( - Math.PI * rotate/180, height, 0.0); g.rotate( - Math.PI * rotate/180, height, 0.0);
...@@ -282,14 +289,44 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -282,14 +289,44 @@ public class JopTrend extends JComponent implements GeComponentIfc,
g.rotate( - Math.PI * rotate/180, 0.0, 0.0); g.rotate( - Math.PI * rotate/180, 0.0, 0.0);
g.transform( AffineTransform.getScaleInstance( height/width, width/height)); g.transform( AffineTransform.getScaleInstance( height/width, width/height));
} }
*/
if ( 45.0 <= rotate && rotate < 135.0) {
g.translate( width, 0.0);
g.rotate( Math.PI * rotate/180, 0.0, 0.0);
g.transform( AffineTransform.getScaleInstance( height/original_width,
width/original_height));
}
else if ( 135.0 <= rotate && rotate < 225.0)
{
g.rotate( Math.PI * rotate/180, width/2, height/2);
g.transform( AffineTransform.getScaleInstance( width/original_width,
height/original_height));
}
else if ( 225.0 <= rotate && rotate < 315.0)
{
g.translate( -height, 0.0);
g.rotate( Math.PI * rotate/180, height, 0.0);
g.transform( AffineTransform.getScaleInstance( height/original_width,
width/original_height));
}
else {
g.transform( AffineTransform.getScaleInstance( width/original_width,
height/original_height));
}
if ( drawFill == 1) {
g.setColor(GeColor.getColor(22, fillColor));
g.fill( shapes[0]);
}
g.setStroke( new BasicStroke((float)trendBorderWidth)); g.setStroke( new BasicStroke((float)trendBorderWidth));
for ( j = 0; j < 2; j++) { for ( j = 0; j < 2; j++) {
if ( attrFound[j]) { if ( attrFound[j]) {
curve[j].reset(); curve[j].reset();
curve[j].moveTo(width,height); curve[j].moveTo(original_width,original_height);
for ( i = 0; i < noOfPoints; i++) for ( i = 0; i < noOfPoints; i++)
curve[j].lineTo( x_values[j][i], y_values[j][i]); curve[j].lineTo( x_values[j][i], y_values[j][i]);
curve[j].lineTo( 0,height); curve[j].lineTo( 0,original_height);
if ( drawFill == 1) { if ( drawFill == 1) {
g.setColor(GeColor.getColor(0, fillColorTrend[j])); g.setColor(GeColor.getColor(0, fillColorTrend[j]));
...@@ -309,12 +346,12 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -309,12 +346,12 @@ public class JopTrend extends JComponent implements GeComponentIfc,
g.draw( curve[j]); g.draw( curve[j]);
} }
} }
g.setTransform(save);
g.setStroke( new BasicStroke((float)lineWidth)); g.setStroke( new BasicStroke((float)lineWidth));
if ( drawBorder == 1 || drawFill == 0) { if ( drawBorder == 1 || drawFill == 0) {
g.setColor(GeColor.getColor(0, borderColor)); g.setColor(GeColor.getColor(0, borderColor));
g.draw( shapes[0]); g.draw( shapes[0]);
} }
g.setTransform(save);
} }
public Dimension getPreferredSize() { return size;} public Dimension getPreferredSize() { return size;}
public Dimension getMinimumSize() { return size;} public Dimension getMinimumSize() { return size;}
...@@ -356,10 +393,20 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -356,10 +393,20 @@ public class JopTrend extends JComponent implements GeComponentIfc,
public Object dynamicGetRoot() { public Object dynamicGetRoot() {
return root; return root;
} }
public void reset() {
for ( int j = 0; j < 2; j++) {
for ( int i = 0; i < noOfPoints; i++)
y_values[j][i] = original_height;
}
repaint();
}
public void dynamicOpen() { public void dynamicOpen() {
if ( en.isInstance())
dd.setInstance( en.getInstance());
for ( int j = 0; j < 2; j++) { for ( int j = 0; j < 2; j++) {
if ( pwrAttribute[j] != null && pwrAttribute[j].compareTo("") != 0) { if ( pwrAttribute[j] != null && pwrAttribute[j].compareTo("") != 0) {
retColor[j] = en.gdh.refObjectInfo( pwrAttribute[j]); String attrName = dd.getAttrName(pwrAttribute[j]);
retColor[j] = en.gdh.refObjectInfo( attrName);
if ( retColor[j].evenSts()) if ( retColor[j].evenSts())
System.out.println( "refObjectInfoError " + pwrAttribute[j]); System.out.println( "refObjectInfoError " + pwrAttribute[j]);
else else
...@@ -374,6 +421,8 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -374,6 +421,8 @@ public class JopTrend extends JComponent implements GeComponentIfc,
} }
} }
public void dynamicUpdate( boolean animationOnly) { public void dynamicUpdate( boolean animationOnly) {
if ( hold)
return;
if ( animationOnly) if ( animationOnly)
return; return;
if ( shapes == null) if ( shapes == null)
...@@ -406,7 +455,11 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -406,7 +455,11 @@ public class JopTrend extends JComponent implements GeComponentIfc,
for ( i = noOfPoints - 1; i > 0; i--) for ( i = noOfPoints - 1; i > 0; i--)
y_values[j][i] = y_values[j][i-1]; y_values[j][i] = y_values[j][i-1];
y_values[j][0] = (maxValue[j] - value) / (maxValue[j] - y_values[j][0] = (maxValue[j] - value) / (maxValue[j] -
minValue[j]) * height; minValue[j]) * original_height;
if ( y_values[j][0] < 0)
y_values[j][0] = 0;
if ( y_values[j][0] > original_height)
y_values[j][0] = original_height;
valueOld[j] = value; valueOld[j] = value;
} }
} }
......
...@@ -150,6 +150,15 @@ public class GeCFormat { ...@@ -150,6 +150,15 @@ public class GeCFormat {
return buff; return buff;
} }
public StringBuffer format( boolean value, StringBuffer buff) {
buff.setLength(0);
if ( value)
buff.append('1');
else
buff.append('0');
return buff;
}
public StringBuffer format( String value, StringBuffer buff) { public StringBuffer format( String value, StringBuffer buff) {
switch( format_type) { switch( format_type) {
case FRM_S: { case FRM_S: {
......
...@@ -248,6 +248,10 @@ public class GeDyn { ...@@ -248,6 +248,10 @@ public class GeDyn {
return Pwr.eType_AttrRef; return Pwr.eType_AttrRef;
return -1; return -1;
} }
boolean isLocalDb( String attribute) {
return (attribute.startsWith("$local.") && en.ldb != null);
}
} }
......
...@@ -11,6 +11,7 @@ public class GeDynDigLowColor extends GeDynElem { ...@@ -11,6 +11,7 @@ public class GeDynDigLowColor extends GeDynElem {
boolean inverted; boolean inverted;
boolean oldValue; boolean oldValue;
boolean firstScan = true; boolean firstScan = true;
boolean localDb = false;
public GeDynDigLowColor( GeDyn dyn, String attribute, int color) { public GeDynDigLowColor( GeDyn dyn, String attribute, int color) {
super( dyn, GeDyn.mDynType_DigLowColor, GeDyn.mActionType_No); super( dyn, GeDyn.mDynType_DigLowColor, GeDyn.mActionType_No);
...@@ -20,7 +21,12 @@ public class GeDynDigLowColor extends GeDynElem { ...@@ -20,7 +21,12 @@ public class GeDynDigLowColor extends GeDynElem {
public void connect() { public void connect() {
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
if ( attrName.compareTo("") != 0) { if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName); GdhrRefObjectInfo ret;
localDb = dyn.isLocalDb(attrName);
if ( !localDb)
ret = dyn.en.gdh.refObjectInfo( attrName);
else
ret = dyn.en.ldb.refObjectInfo( dyn.comp.dynamicGetRoot(), attrName);
if ( ret.evenSts()) if ( ret.evenSts())
System.out.println( "DigLowColor: " + attrName); System.out.println( "DigLowColor: " + attrName);
else { else {
...@@ -32,14 +38,18 @@ public class GeDynDigLowColor extends GeDynElem { ...@@ -32,14 +38,18 @@ public class GeDynDigLowColor extends GeDynElem {
} }
} }
public void disconnect() { public void disconnect() {
if ( attrFound) if ( attrFound && !localDb)
dyn.en.gdh.unrefObjectInfo( subid); dyn.en.gdh.unrefObjectInfo( subid);
System.out.println("Disconnecting: " + attribute); System.out.println("Disconnecting: " + attribute);
} }
public void scan() { public void scan() {
if ( !attrFound || dyn.ignoreColor) if ( !attrFound || dyn.ignoreColor)
return; return;
boolean value = dyn.en.gdh.getObjectRefInfoBoolean( p); boolean value;
if ( !localDb)
value = dyn.en.gdh.getObjectRefInfoBoolean( p);
else
value = dyn.en.ldb.getObjectRefInfoBoolean( p);
if ( !firstScan) { if ( !firstScan) {
if ( oldValue == value && !dyn.resetColor) if ( oldValue == value && !dyn.resetColor)
return; return;
......
...@@ -4,8 +4,8 @@ import javax.swing.*; ...@@ -4,8 +4,8 @@ import javax.swing.*;
import jpwr.rt.*; import jpwr.rt.*;
public class GeDynMove extends GeDynElem { public class GeDynMove extends GeDynElem {
String moveXAttribute; public String moveXAttribute;
String moveYAttribute; public String moveYAttribute;
String scaleXAttribute; String scaleXAttribute;
String scaleYAttribute; String scaleYAttribute;
double xOffset; double xOffset;
...@@ -31,6 +31,8 @@ public class GeDynMove extends GeDynElem { ...@@ -31,6 +31,8 @@ public class GeDynMove extends GeDynElem {
float scaleYOldValue; float scaleYOldValue;
public double xOrig; public double xOrig;
public double yOrig; public double yOrig;
public double wOrig;
public double hOrig;
public double xScale = 1; public double xScale = 1;
public double yScale = 1; public double yScale = 1;
boolean firstScan = true; boolean firstScan = true;
...@@ -111,11 +113,15 @@ public class GeDynMove extends GeDynElem { ...@@ -111,11 +113,15 @@ public class GeDynMove extends GeDynElem {
Point loc = ((JComponent)dyn.comp).getLocation(); Point loc = ((JComponent)dyn.comp).getLocation();
xOrig = (double) loc.x; xOrig = (double) loc.x;
yOrig = (double) loc.y; yOrig = (double) loc.y;
Dimension size = ((JComponent)dyn.comp).getSize();
wOrig= (double) size.width;
hOrig= (double) size.height;
} }
if ( attrMoveXFound || attrMoveYFound) { if ( attrMoveXFound || attrMoveYFound) {
// Move // Move
Point loc = ((JComponent)dyn.comp).getLocation(); Point loc = ((JComponent)dyn.comp).getLocation();
Dimension size = ((JComponent)dyn.comp).getSize();
float valueMoveX = 0; float valueMoveX = 0;
float valueMoveY = 0; float valueMoveY = 0;
...@@ -134,10 +140,14 @@ public class GeDynMove extends GeDynElem { ...@@ -134,10 +140,14 @@ public class GeDynMove extends GeDynElem {
} }
} }
if ( repaintNow) { if ( repaintNow) {
if ( attrMoveXFound) if ( attrMoveXFound){
loc.x = (int) (xOrig + (valueMoveX - xOffset) * factor); double xRatio=(size.width/wOrig);
if ( attrMoveYFound) loc.x = (int) ((xOrig + (valueMoveX - xOffset) * factor) * xRatio);
loc.y = (int) (yOrig + (valueMoveY - yOffset) * factor); }
if ( attrMoveYFound){
double yRatio=(size.height/hOrig);
loc.y = (int) ((yOrig + (valueMoveY - yOffset) * factor) * yRatio);
}
((JComponent)dyn.comp).setLocation( loc); ((JComponent)dyn.comp).setLocation( loc);
} }
} }
...@@ -186,3 +196,12 @@ public class GeDynMove extends GeDynElem { ...@@ -186,3 +196,12 @@ public class GeDynMove extends GeDynElem {
} }
...@@ -24,7 +24,11 @@ public class GeDynSetDig extends GeDynElem { ...@@ -24,7 +24,11 @@ public class GeDynSetDig extends GeDynElem {
break; break;
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
PwrtStatus sts = dyn.en.gdh.setObjectInfo( attrName, true); PwrtStatus sts;
if ( !dyn.isLocalDb( attrName))
sts = dyn.en.gdh.setObjectInfo( attrName, true);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, true);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "SetDig: " + attrName); System.out.println( "SetDig: " + attrName);
break; break;
......
...@@ -4,9 +4,10 @@ import java.awt.event.*; ...@@ -4,9 +4,10 @@ import java.awt.event.*;
import java.awt.*; import java.awt.*;
import javax.swing.*; import javax.swing.*;
public class GeDynSlider extends GeDynElem { public class GeDynSlider extends GeDynElem {
String attribute; String attribute;
int direction; public int direction;
double minValue; double minValue;
double maxValue; double maxValue;
double minPos; double minPos;
...@@ -21,6 +22,8 @@ public class GeDynSlider extends GeDynElem { ...@@ -21,6 +22,8 @@ public class GeDynSlider extends GeDynElem {
boolean firstScan = true; boolean firstScan = true;
boolean moveActive = false; boolean moveActive = false;
Point offset = new Point(); Point offset = new Point();
float original_width = 0;
float original_height = 0;
public GeDynSlider( GeDyn dyn, String attribute, double minValue, double maxValue, public GeDynSlider( GeDyn dyn, String attribute, double minValue, double maxValue,
int direction, double minPos, double maxPos) { int direction, double minPos, double maxPos) {
...@@ -32,6 +35,24 @@ public class GeDynSlider extends GeDynElem { ...@@ -32,6 +35,24 @@ public class GeDynSlider extends GeDynElem {
this.minPos = minPos; this.minPos = minPos;
this.maxPos = maxPos; this.maxPos = maxPos;
} }
public void setMinValue( double minValue) {
this.minValue = minValue;
}
public void setMaxValue( double maxValue) {
this.maxValue = maxValue;
}
public void update() {
if ( !attrFound || moveActive)
return;
switch ( typeId) {
case Pwr.eType_Int32:
oldValueI = -10000;
break;
default:
oldValueF = -10000;
}
}
public void connect() { public void connect() {
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
if ( attrName.compareTo("") != 0) { if ( attrName.compareTo("") != 0) {
...@@ -54,6 +75,13 @@ public class GeDynSlider extends GeDynElem { ...@@ -54,6 +75,13 @@ public class GeDynSlider extends GeDynElem {
if ( !attrFound || moveActive) if ( !attrFound || moveActive)
return; return;
float width = ((JComponent)dyn.comp).getParent().getWidth();
float height = ((JComponent)dyn.comp).getParent().getHeight();
if ( original_width == 0) {
original_width = width;
original_height = height;
}
float value; float value;
switch ( typeId) { switch ( typeId) {
case Pwr.eType_Int32: case Pwr.eType_Int32:
...@@ -73,25 +101,51 @@ public class GeDynSlider extends GeDynElem { ...@@ -73,25 +101,51 @@ public class GeDynSlider extends GeDynElem {
Point loc = ((JComponent)dyn.comp).getLocation(); Point loc = ((JComponent)dyn.comp).getLocation();
int pos; int pos;
double minPos;
double maxPos;
switch ( direction) { switch ( direction) {
case Ge.DIRECTION_RIGHT: case Ge.DIRECTION_RIGHT:
minPos = this.minPos * width / original_width;
maxPos = this.maxPos * width / original_width;
pos = (int)((maxValue - value)/(maxValue - minValue) * pos = (int)((maxValue - value)/(maxValue - minValue) *
(maxPos - minPos) + minPos); (maxPos - minPos) + minPos);
if ( pos < minPos)
pos = (int)minPos;
if ( pos > maxPos)
pos = (int)maxPos;
loc.x = pos; loc.x = pos;
break; break;
case Ge.DIRECTION_LEFT: case Ge.DIRECTION_LEFT:
minPos = this.minPos * width / original_width;
maxPos = this.maxPos * width / original_width;
pos = (int)(value /(maxValue - minValue) * pos = (int)(value /(maxValue - minValue) *
(maxPos - minPos) + minPos); (maxPos - minPos) + minPos);
if ( pos < minPos)
pos = (int)minPos;
if ( pos > maxPos)
pos = (int)maxPos;
loc.x = pos; loc.x = pos;
break; break;
case Ge.DIRECTION_UP: case Ge.DIRECTION_UP:
minPos = this.minPos * height / original_height;
maxPos = this.maxPos * height / original_height;
pos = (int)((value - minValue)/(maxValue - minValue) * pos = (int)((value - minValue)/(maxValue - minValue) *
(maxPos - minPos) + minPos); (maxPos - minPos) + minPos);
if ( pos < minPos)
pos = (int)minPos;
if ( pos > maxPos)
pos = (int)maxPos;
loc.y = pos; loc.y = pos;
break; break;
default: default:
minPos = this.minPos * height / original_height;
maxPos = this.maxPos * height / original_height;
pos = (int)((maxValue - value)/(maxValue - minValue) * pos = (int)((maxValue - value)/(maxValue - minValue) *
(maxPos - minPos) + minPos); (maxPos - minPos) + minPos);
if ( pos < minPos)
pos = (int)minPos;
if ( pos > maxPos)
pos = (int)maxPos;
loc.y = pos; loc.y = pos;
} }
((JComponent)dyn.comp).setLocation( loc); ((JComponent)dyn.comp).setLocation( loc);
...@@ -116,14 +170,22 @@ public class GeDynSlider extends GeDynElem { ...@@ -116,14 +170,22 @@ public class GeDynSlider extends GeDynElem {
break; break;
case GeDyn.eEvent_SliderMoved: case GeDyn.eEvent_SliderMoved:
float value; float value;
double minPos;
double maxPos;
PwrtStatus sts; PwrtStatus sts;
Point new_loc = new Point(); Point new_loc = new Point();
float width = ((JComponent)dyn.comp).getParent().getWidth();
float height = ((JComponent)dyn.comp).getParent().getHeight();
Point ePoint = e.getPoint(); Point ePoint = e.getPoint();
// System.out.println("Mouse dragged: " + thisPoint.x + ", " + // System.out.println("Mouse dragged: " + thisPoint.x + ", " +
// thisPoint.y); // thisPoint.y);
Point loc = ((GeComponent)dyn.comp).getLocation(); Point loc = ((GeComponent)dyn.comp).getLocation();
if ( original_width == 0)
return;
switch ( direction) { switch ( direction) {
case Ge.DIRECTION_RIGHT: case Ge.DIRECTION_RIGHT:
minPos = this.minPos * width / original_width;
maxPos = this.maxPos * width / original_width;
new_loc.x = loc.x + ePoint.x - offset.x; new_loc.x = loc.x + ePoint.x - offset.x;
new_loc.y = loc.y; new_loc.y = loc.y;
if ( new_loc.x > maxPos) if ( new_loc.x > maxPos)
...@@ -134,6 +196,8 @@ public class GeDynSlider extends GeDynElem { ...@@ -134,6 +196,8 @@ public class GeDynSlider extends GeDynElem {
(maxValue - minValue) + minValue); (maxValue - minValue) + minValue);
break; break;
case Ge.DIRECTION_LEFT: case Ge.DIRECTION_LEFT:
minPos = this.minPos * width / original_width;
maxPos = this.maxPos * width / original_width;
new_loc.x = loc.x + ePoint.x - offset.x; new_loc.x = loc.x + ePoint.x - offset.x;
new_loc.y = loc.y; new_loc.y = loc.y;
if ( new_loc.x > maxPos) if ( new_loc.x > maxPos)
...@@ -144,6 +208,8 @@ public class GeDynSlider extends GeDynElem { ...@@ -144,6 +208,8 @@ public class GeDynSlider extends GeDynElem {
(maxValue - minValue) + minValue); (maxValue - minValue) + minValue);
break; break;
case Ge.DIRECTION_UP: case Ge.DIRECTION_UP:
minPos = this.minPos * height / original_height;
maxPos = this.maxPos * height / original_height;
new_loc.y = loc.y + ePoint.y - offset.y; new_loc.y = loc.y + ePoint.y - offset.y;
new_loc.x = loc.x; new_loc.x = loc.x;
if ( new_loc.y > maxPos) if ( new_loc.y > maxPos)
...@@ -155,6 +221,8 @@ public class GeDynSlider extends GeDynElem { ...@@ -155,6 +221,8 @@ public class GeDynSlider extends GeDynElem {
// System.out.println("old_y: " + ePoint.y + " new_y: " + new_loc.y + "v: " + value); // System.out.println("old_y: " + ePoint.y + " new_y: " + new_loc.y + "v: " + value);
break; break;
default: default:
minPos = this.minPos * height / original_height;
maxPos = this.maxPos * height / original_height;
new_loc.y = loc.y + ePoint.y - offset.y; new_loc.y = loc.y + ePoint.y - offset.y;
// System.out.println( "loc.y " + loc.y + " eP.y " + ePoint.y + " offset.y " + offset.y + " new_loc.y " + new_loc.y + " maxPos " + maxPos + " minPos " + minPos); // System.out.println( "loc.y " + loc.y + " eP.y " + ePoint.y + " offset.y " + offset.y + " new_loc.y " + new_loc.y + " maxPos " + maxPos + " minPos " + minPos);
new_loc.x = loc.x; new_loc.x = loc.x;
...@@ -168,12 +236,13 @@ public class GeDynSlider extends GeDynElem { ...@@ -168,12 +236,13 @@ public class GeDynSlider extends GeDynElem {
} }
((JComponent)dyn.comp).setLocation(new_loc); ((JComponent)dyn.comp).setLocation(new_loc);
String attrName = dyn.getAttrName(attribute);
switch ( typeId) { switch ( typeId) {
case Pwr.eType_Int32: case Pwr.eType_Int32:
sts = dyn.en.gdh.setObjectInfo( attribute, (int) value); sts = dyn.en.gdh.setObjectInfo( attrName, (int) value);
break; break;
default: default:
sts = dyn.en.gdh.setObjectInfo( attribute, value); sts = dyn.en.gdh.setObjectInfo( attrName, value);
} }
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "GeSlider: " + sts); System.out.println( "GeSlider: " + sts);
......
...@@ -23,7 +23,9 @@ public class GeDynTable extends GeDynElem { ...@@ -23,7 +23,9 @@ public class GeDynTable extends GeDynElem {
public String[][] oldValueS; public String[][] oldValueS;
boolean firstScan = true; boolean firstScan = true;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
boolean[] isHeaderRef;
int[][] headerRefp;
PwrtRefId[][] headerRefSubid;
public GeDynTable( GeDyn dyn, String[] attribute, String[] format, String[] selAttribute, public GeDynTable( GeDyn dyn, String[] attribute, String[] format, String[] selAttribute,
int rows, int columns) { int rows, int columns) {
super( dyn, GeDyn.mDynType_Table, GeDyn.mActionType_No); super( dyn, GeDyn.mDynType_Table, GeDyn.mActionType_No);
...@@ -45,8 +47,12 @@ public class GeDynTable extends GeDynElem { ...@@ -45,8 +47,12 @@ public class GeDynTable extends GeDynElem {
oldValueF = new float[columns][]; oldValueF = new float[columns][];
oldValueI = new int[columns][]; oldValueI = new int[columns][];
oldValueS = new String[columns][]; oldValueS = new String[columns][];
isHeaderRef = new boolean[columns];
headerRefp = new int[columns][];
headerRefSubid = new PwrtRefId[columns][];
} }
public void connect() { public void connect() {
GdhrRefObjectInfo ret;
for ( int i = 0; i < columns; i++) { for ( int i = 0; i < columns; i++) {
String attrName = dyn.getAttrName( attribute[i]); String attrName = dyn.getAttrName( attribute[i]);
...@@ -55,16 +61,38 @@ public class GeDynTable extends GeDynElem { ...@@ -55,16 +61,38 @@ public class GeDynTable extends GeDynElem {
if ( attrName.startsWith("$header.")) { if ( attrName.startsWith("$header.")) {
// NYI TODO !!! // NYI TODO !!!
// Replace $header with the object in the header column // Replace $header with the object in the header column
String hName = dyn.getAttrName( attribute[0]);
CdhrString cstr = dyn.en.gdh.getObjectInfoString( hName);
if (cstr.evenSts()) continue;
attrName = cstr.str + attrName.substring(7); isHeaderRef[i] = true;
headerRefp[i] = new int[rows];
headerRefSubid[i] = new PwrtRefId[rows];
for ( int j = 0; j < rows; j++) {
String hName = dyn.getAttrNameNoSuffix( attribute[0]);
hName = hName + "[" + j + "]";
CdhrString cstr = dyn.en.gdh.getObjectInfoString( hName);
if (cstr.evenSts()) {
headerRefp[i][j] = 0;
// headerRefSubid[i][j] = null;
continue; continue;
} }
String cellAttrName = cstr.str + attrName.substring(7);
ret = dyn.en.gdh.refObjectInfo( cellAttrName);
if ( ret.evenSts()) {
System.out.println( "Table: " + cellAttrName);
}
else {
attrFound[i] = true;
headerRefp[i][j] = ret.id;
headerRefSubid[i][j] = ret.refid;
typeId[i] = ret.typeId;
}
}
}
else {
isHeaderRef[i] = false;
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName); ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts()) { if ( ret.evenSts()) {
System.out.println( "Table: " + attrName); System.out.println( "Table: " + attrName);
attrFound[i] = false; attrFound[i] = false;
...@@ -78,6 +106,8 @@ public class GeDynTable extends GeDynElem { ...@@ -78,6 +106,8 @@ public class GeDynTable extends GeDynElem {
size[i] = ret.getSize(); size[i] = ret.getSize();
if ( elements[i] > rows) if ( elements[i] > rows)
elements[i] = rows; elements[i] = rows;
}
}
if ( typeId[i] == Pwr.eType_Float32) { if ( typeId[i] == Pwr.eType_Float32) {
oldValueF[i] = new float[rows]; oldValueF[i] = new float[rows];
} }
...@@ -101,19 +131,88 @@ public class GeDynTable extends GeDynElem { ...@@ -101,19 +131,88 @@ public class GeDynTable extends GeDynElem {
} }
} }
} }
}
public void disconnect() { public void disconnect() {
for ( int i = 0; i < columns; i++) { for ( int i = 0; i < columns; i++) {
if ( attrFound[i]) if ( attrFound[i]) {
if ( isHeaderRef[i]) {
for ( int j = 0; j < rows; j++) {
if ( headerRefSubid[i][j] != null)
dyn.en.gdh.unrefObjectInfo( headerRefSubid[i][j]);
}
}
else
dyn.en.gdh.unrefObjectInfo( subid[i]); dyn.en.gdh.unrefObjectInfo( subid[i]);
} }
} }
}
public void scan() { public void scan() {
for ( int i = 0; i < columns; i++) { for ( int i = 0; i < columns; i++) {
if ( !attrFound[i]) if ( !attrFound[i])
continue; continue;
if ( isHeaderRef[i]) {
if ( typeId[i] == Pwr.eType_Float32) {
for ( int j = 0; j < rows; j++) {
if ( headerRefp[i][j] != 0) {
float value0 = dyn.en.gdh.getObjectRefInfoFloat( headerRefp[i][j]);
if ( value0 != oldValueF[i][j] || firstScan) {
sb = cFormat[i].format( value0, sb);
((GeTable)dyn.comp).setValueAt(new String(sb), j, i);
// dyn.repaintNow = true;
oldValueF[i][j] = value0;
}
}
}
}
else if ( typeId[i] == Pwr.eType_Boolean) {
for ( int j = 0; j < rows; j++) {
if ( headerRefp[i][j] != 0) {
boolean value0 = dyn.en.gdh.getObjectRefInfoBoolean( headerRefp[i][j]);
if ( value0 != oldValueB[i][j] || firstScan) {
sb = cFormat[i].format( value0, sb);
((GeTable)dyn.comp).setValueAt(new String(sb), j, i);
// dyn.repaintNow = true;
oldValueB[i][j] = value0;
}
}
}
}
else if ( typeId[i] == Pwr.eType_Int32 ||
typeId[i] == Pwr.eType_UInt32 ||
typeId[i] == Pwr.eType_Int16 ||
typeId[i] == Pwr.eType_UInt16 ||
typeId[i] == Pwr.eType_Int8 ||
typeId[i] == Pwr.eType_UInt8) {
for ( int j = 0; j < rows; j++) {
if ( headerRefp[i][j] != 0) {
int value0 = dyn.en.gdh.getObjectRefInfoInt( headerRefp[i][j]);
if ( value0 != oldValueI[i][j] || firstScan) {
sb = cFormat[i].format( value0, sb);
((GeTable)dyn.comp).setValueAt(new String(sb), j, i);
// dyn.repaintNow = true;
oldValueI[i][j] = value0;
}
}
}
}
else if ( typeId[i] == Pwr.eType_String ||
typeId[i] == Pwr.eType_Objid ||
typeId[i] == Pwr.eType_Time ||
typeId[i] == Pwr.eType_DeltaTime) {
for ( int j = 0; j < rows; j++) {
String value0 = dyn.en.gdh.getObjectRefInfoString( headerRefp[i][j], typeId[i]);
if ( firstScan || value0.compareTo( oldValueS[i][j]) != 0) {
sb = cFormat[i].format( value0, sb);
((GeTable)dyn.comp).setValueAt(new String(sb), j, i);
// dyn.repaintNow = true;
oldValueS[i][j] = value0;
}
}
}
}
else {
if ( typeId[i] == Pwr.eType_Float32) { if ( typeId[i] == Pwr.eType_Float32) {
float[] value0 = dyn.en.gdh.getObjectRefInfoFloatArray( p[i], elements[i]); float[] value0 = dyn.en.gdh.getObjectRefInfoFloatArray( p[i], elements[i]);
for ( int j = 0; j < value0.length; j++) { for ( int j = 0; j < value0.length; j++) {
...@@ -177,10 +276,11 @@ public class GeDynTable extends GeDynElem { ...@@ -177,10 +276,11 @@ public class GeDynTable extends GeDynElem {
} }
} }
} }
}
}
if ( firstScan) if ( firstScan)
firstScan = false; firstScan = false;
} }
}
public void action( int eventType, MouseEvent e) { public void action( int eventType, MouseEvent e) {
int row; int row;
......
...@@ -24,7 +24,11 @@ public class GeDynToggleDig extends GeDynElem { ...@@ -24,7 +24,11 @@ public class GeDynToggleDig extends GeDynElem {
break; break;
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
PwrtStatus sts = dyn.en.gdh.toggleObjectInfo( attrName); PwrtStatus sts;
if ( !dyn.isLocalDb( attrName))
sts = dyn.en.gdh.toggleObjectInfo( attrName);
else
sts = dyn.en.ldb.toggleObjectInfo( dyn.comp.dynamicGetRoot(), attrName);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "ToggleDig: " + attrName); System.out.println( "ToggleDig: " + attrName);
break; break;
......
...@@ -15,6 +15,7 @@ public class GeDynValue extends GeDynElem { ...@@ -15,6 +15,7 @@ public class GeDynValue extends GeDynElem {
boolean firstScan = true; boolean firstScan = true;
GeCFormat cFormat; GeCFormat cFormat;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
boolean localDb = false;
public GeDynValue( GeDyn dyn, String attribute, String format) { public GeDynValue( GeDyn dyn, String attribute, String format) {
super( dyn, GeDyn.mDynType_Value, GeDyn.mActionType_No); super( dyn, GeDyn.mDynType_Value, GeDyn.mActionType_No);
...@@ -24,7 +25,13 @@ public class GeDynValue extends GeDynElem { ...@@ -24,7 +25,13 @@ public class GeDynValue extends GeDynElem {
public void connect() { public void connect() {
String attrName = dyn.getAttrName( attribute); String attrName = dyn.getAttrName( attribute);
if ( attrName.compareTo("") != 0) { if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName); GdhrRefObjectInfo ret;
localDb = dyn.isLocalDb(attrName);
if ( !localDb)
ret = dyn.en.gdh.refObjectInfo( attrName);
else
ret = dyn.en.ldb.refObjectInfo( dyn.comp.dynamicGetRoot(), attrName);
if ( ret.evenSts()) if ( ret.evenSts())
System.out.println( "Value: " + attrName); System.out.println( "Value: " + attrName);
else { else {
...@@ -36,7 +43,7 @@ public class GeDynValue extends GeDynElem { ...@@ -36,7 +43,7 @@ public class GeDynValue extends GeDynElem {
} }
} }
public void disconnect() { public void disconnect() {
if ( attrFound) if ( attrFound && !localDb)
dyn.en.gdh.unrefObjectInfo( subid); dyn.en.gdh.unrefObjectInfo( subid);
} }
public void scan() { public void scan() {
...@@ -45,7 +52,11 @@ public class GeDynValue extends GeDynElem { ...@@ -45,7 +52,11 @@ public class GeDynValue extends GeDynElem {
switch ( typeId) { switch ( typeId) {
case Pwr.eType_Float32: { case Pwr.eType_Float32: {
float value0 = dyn.en.gdh.getObjectRefInfoFloat( p); float value0 = 0;
if ( !localDb)
value0 = dyn.en.gdh.getObjectRefInfoFloat( p);
else
value0 = dyn.en.ldb.getObjectRefInfoFloat( p);
if ( value0 != oldValueF || firstScan) { if ( value0 != oldValueF || firstScan) {
sb = cFormat.format( value0, sb); sb = cFormat.format( value0, sb);
dyn.comp.setAnnot1(new String(sb)); dyn.comp.setAnnot1(new String(sb));
...@@ -60,7 +71,12 @@ public class GeDynValue extends GeDynElem { ...@@ -60,7 +71,12 @@ public class GeDynValue extends GeDynElem {
case Pwr.eType_UInt16: case Pwr.eType_UInt16:
case Pwr.eType_Int8: case Pwr.eType_Int8:
case Pwr.eType_UInt8: { case Pwr.eType_UInt8: {
int value0 = dyn.en.gdh.getObjectRefInfoInt( p); int value0;
if ( !localDb)
value0 = dyn.en.gdh.getObjectRefInfoInt( p);
else
value0 = dyn.en.ldb.getObjectRefInfoInt( p);
if ( value0 != oldValueI || firstScan) { if ( value0 != oldValueI || firstScan) {
sb = cFormat.format( value0, sb); sb = cFormat.format( value0, sb);
dyn.comp.setAnnot1(new String(sb)); dyn.comp.setAnnot1(new String(sb));
...@@ -69,11 +85,31 @@ public class GeDynValue extends GeDynElem { ...@@ -69,11 +85,31 @@ public class GeDynValue extends GeDynElem {
} }
break; break;
} }
case Pwr.eType_Boolean: {
boolean value0;
if ( !localDb)
value0 = dyn.en.gdh.getObjectRefInfoBoolean( p);
else
value0 = dyn.en.ldb.getObjectRefInfoBoolean( p);
if ( value0 != oldValueB || firstScan) {
sb = cFormat.format( value0, sb);
dyn.comp.setAnnot1(new String(sb));
dyn.repaintNow = true;
oldValueB = value0;
}
break;
}
case Pwr.eType_String: case Pwr.eType_String:
case Pwr.eType_Objid: case Pwr.eType_Objid:
case Pwr.eType_Time: case Pwr.eType_Time:
case Pwr.eType_DeltaTime: { case Pwr.eType_DeltaTime: {
String value0 = dyn.en.gdh.getObjectRefInfoString( p, typeId); String value0;
if ( !localDb)
value0 = dyn.en.gdh.getObjectRefInfoString( p, typeId);
else
value0 = dyn.en.ldb.getObjectRefInfoString( p, typeId);
if ( firstScan || value0.compareTo( oldValueS) != 0) { if ( firstScan || value0.compareTo( oldValueS) != 0) {
sb = cFormat.format( value0, sb); sb = cFormat.format( value0, sb);
dyn.comp.setAnnot1(new String(sb)); dyn.comp.setAnnot1(new String(sb));
......
...@@ -29,6 +29,8 @@ public class GeDynValueInput extends GeDynElem { ...@@ -29,6 +29,8 @@ public class GeDynValueInput extends GeDynElem {
break; break;
} }
} }
if ( !attrFound)
System.out.println("ValueInput: attribute not found");
} }
public void disconnect() { public void disconnect() {
} }
...@@ -57,14 +59,20 @@ public class GeDynValueInput extends GeDynElem { ...@@ -57,14 +59,20 @@ public class GeDynValueInput extends GeDynElem {
valueElement.oldValueF = inputValue; valueElement.oldValueF = inputValue;
if ( minValue == 0 && maxValue == 0) { if ( minValue == 0 && maxValue == 0) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue); sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts); System.out.println( "setObjectInfoError " + sts);
} }
else { else {
if ( inputValue >= minValue && inputValue <= maxValue ) { if ( inputValue >= minValue && inputValue <= maxValue ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue); sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + attrName + " " + sts); System.out.println( "setObjectInfoError " + attrName + " " + sts);
} }
...@@ -82,14 +90,20 @@ public class GeDynValueInput extends GeDynElem { ...@@ -82,14 +90,20 @@ public class GeDynValueInput extends GeDynElem {
valueElement.oldValueI = inputValue; valueElement.oldValueI = inputValue;
if ( minValue == 0 && maxValue == 0) { if ( minValue == 0 && maxValue == 0) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue); sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts); System.out.println( "setObjectInfoError " + sts);
} }
else { else {
if ( inputValue >= minValue && inputValue <= maxValue ) { if ( inputValue >= minValue && inputValue <= maxValue ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue); sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts); System.out.println( "setObjectInfoError " + sts);
} }
...@@ -97,9 +111,31 @@ public class GeDynValueInput extends GeDynElem { ...@@ -97,9 +111,31 @@ public class GeDynValueInput extends GeDynElem {
valueElement.oldValueI = -10000; valueElement.oldValueI = -10000;
} }
} }
else if ( typeId == Pwr.eType_Boolean) {
int inputValueInt = Integer.parseInt( text.trim(), 10);
boolean inputValue;
if ( inputValueInt == 0)
inputValue = false;
else if ( inputValueInt == 1)
inputValue = true;
else
break;
valueElement.oldValueB = inputValue;
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
sts = dyn.en.ldb.setObjectInfo( dyn.comp.dynamicGetRoot(), attrName, inputValue);
if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts);
}
else if ( typeId == Pwr.eType_String) { else if ( typeId == Pwr.eType_String) {
valueElement.oldValueS = text; valueElement.oldValueS = text;
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute); String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, text);
else
sts = dyn.en.gdh.setObjectInfo( attrName, text); sts = dyn.en.gdh.setObjectInfo( attrName, text);
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "setObjectInfoError " + sts); System.out.println( "setObjectInfoError " + sts);
......
...@@ -26,6 +26,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc, ...@@ -26,6 +26,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
int hRow; int hRow;
int hColumn; int hColumn;
JViewport jv; JViewport jv;
int headerRowHeight = 0;
public boolean focus = false; public boolean focus = false;
public boolean confirmActive = false; public boolean confirmActive = false;
...@@ -52,6 +53,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc, ...@@ -52,6 +53,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
if ( hRow == 0) { if ( hRow == 0) {
table.setTableHeader( null); table.setTableHeader( null);
} }
if ( hColumn == 1) { if ( hColumn == 1) {
// Set up the header column // Set up the header column
headerColumn = new JTable(rows, 1); headerColumn = new JTable(rows, 1);
...@@ -98,7 +100,17 @@ public class GeTable extends JScrollPane implements GeComponentIfc, ...@@ -98,7 +100,17 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
if ( hColumn == 1) if ( hColumn == 1)
headerColumn.setRowHeight( height); headerColumn.setRowHeight( height);
} }
public void setHeaderRowHeight( int height) { public void setHeaderRowHeight( int headerRowHeight) {
if ( hRow == 1) {
Dimension d = table.getTableHeader().getPreferredSize();
d.height = headerRowHeight;
table.getTableHeader().setPreferredSize( d);
if ( hColumn == 1) {
Dimension hd = headerColumn.getTableHeader().getPreferredSize();
hd.height = headerRowHeight;
headerColumn.getTableHeader().setPreferredSize( hd);
}
}
} }
public void setFont( Font font) { public void setFont( Font font) {
if ( table != null) if ( table != null)
...@@ -339,6 +351,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc, ...@@ -339,6 +351,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
paintComponent(g); paintComponent(g);
paintChildren(g); paintChildren(g);
} }
} }
......
...@@ -10,9 +10,11 @@ import javax.swing.Timer; ...@@ -10,9 +10,11 @@ import javax.swing.Timer;
public class GeTextField extends JTextField implements GeComponentIfc, public class GeTextField extends JTextField implements GeComponentIfc,
JopDynamic, JopConfirm, ActionListener JopDynamic, JopConfirm, ActionListener
{ {
public boolean isFocusTraversable() { return root != null;}
Dimension size; Dimension size;
Object root; Object root;
Timer timer = new Timer(500, this); public Timer timer = new Timer(500, this);
JopSession session; JopSession session;
public JopEngine en; public JopEngine en;
public GeDyn dd = new GeDyn( this); public GeDyn dd = new GeDyn( this);
......
...@@ -157,8 +157,6 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -157,8 +157,6 @@ public class JopBar extends JComponent implements GeComponentIfc,
public int getBarBorderWidth() { public int getBarBorderWidth() {
return barBorderWidth; return barBorderWidth;
} }
int original_width = 30;
int original_height = 120;
public double rotate; public double rotate;
public void setRotate( double rotate) { this.rotate = rotate;} public void setRotate( double rotate) { this.rotate = rotate;}
public double getRotate() { return rotate;} public double getRotate() { return rotate;}
...@@ -177,6 +175,8 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -177,6 +175,8 @@ public class JopBar extends JComponent implements GeComponentIfc,
g.setTransform(save); g.setTransform(save);
} }
} }
float original_width;
float original_height;
public void paintComponent(Graphics g1) { public void paintComponent(Graphics g1) {
Graphics2D g = (Graphics2D) g1; Graphics2D g = (Graphics2D) g1;
...@@ -189,13 +189,17 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -189,13 +189,17 @@ public class JopBar extends JComponent implements GeComponentIfc,
// g.transform( AffineTransform.getRotateInstance( // g.transform( AffineTransform.getRotateInstance(
// Math.PI * rotate/180,((double)original_width)/2, ((double)original_height)/2)); // Math.PI * rotate/180,((double)original_width)/2, ((double)original_height)/2));
// g.transform( AffineTransform.getScaleInstance( scaleWidth, scaleHeight)); // g.transform( AffineTransform.getScaleInstance( scaleWidth, scaleHeight));
if ( shapes[0] == null) {
float width = getWidth(); float width = getWidth();
float height = getHeight(); float height = getHeight();
if ( shapes[0] == null) {
original_width = width;
original_height = height;
shapes[0] = new Rectangle2D.Float(0F, 0F, width, height); shapes[0] = new Rectangle2D.Float(0F, 0F, width, height);
shapes[1] = new Rectangle2D.Float(0F, 0F, width, 1F); shapes[1] = new Rectangle2D.Float(0F, 0F, width, 1F);
shapes[2] = new Line2D.Float(0F, 0F, width, 0F); shapes[2] = new Line2D.Float(0F, 0F, width, 0F);
} }
g.transform( AffineTransform.getScaleInstance( width/original_width,
height/original_height));
if ( drawFill == 1) { if ( drawFill == 1) {
g.setColor(GeColor.getColor(22, fillColor)); g.setColor(GeColor.getColor(22, fillColor));
g.fill( shapes[0]); g.fill( shapes[0]);
...@@ -242,9 +246,16 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -242,9 +246,16 @@ public class JopBar extends JComponent implements GeComponentIfc,
public Object dynamicGetRoot() { public Object dynamicGetRoot() {
return root; return root;
} }
public void update() {
valueColorOld = -10000;
dynamicUpdate( false);
}
public void dynamicOpen() { public void dynamicOpen() {
if ( en.isInstance())
dd.setInstance( en.getInstance());
if ( pwrAttribute.compareTo("") != 0) { if ( pwrAttribute.compareTo("") != 0) {
retColor = en.gdh.refObjectInfo( pwrAttribute); String attrName = dd.getAttrName(pwrAttribute);
retColor = en.gdh.refObjectInfo( attrName);
if ( retColor.evenSts()) if ( retColor.evenSts())
System.out.println( "refObjectInfoError retColor"); System.out.println( "refObjectInfoError retColor");
else else
...@@ -256,6 +267,8 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -256,6 +267,8 @@ public class JopBar extends JComponent implements GeComponentIfc,
en.gdh.unrefObjectInfo( retColor.refid); en.gdh.unrefObjectInfo( retColor.refid);
} }
public void dynamicUpdate( boolean animationOnly) { public void dynamicUpdate( boolean animationOnly) {
if ( maxValue == minValue)
return;
if ( animationOnly) if ( animationOnly)
return; return;
if ( colorAttrFound) { if ( colorAttrFound) {
...@@ -288,7 +301,11 @@ public class JopBar extends JComponent implements GeComponentIfc, ...@@ -288,7 +301,11 @@ public class JopBar extends JComponent implements GeComponentIfc,
x + width - bar_height, y + height); x + width - bar_height, y + height);
} }
else { else {
bar_height = valueColor / (maxValue - minValue) * height; bar_height = (valueColor - minValue) / (maxValue - minValue) * height;
if ( bar_height < 0)
bar_height = 0;
if ( bar_height > height)
bar_height = height;
((Rectangle2D.Float )shapes[1]).setRect( x, y + height - bar_height, width, ((Rectangle2D.Float )shapes[1]).setRect( x, y + height - bar_height, width,
bar_height); bar_height);
((Line2D.Float )shapes[2]).setLine( x, y + height - bar_height, x + width, ((Line2D.Float )shapes[2]).setLine( x, y + height - bar_height, x + width,
......
...@@ -19,6 +19,7 @@ public class JopEngine implements ActionListener { ...@@ -19,6 +19,7 @@ public class JopEngine implements ActionListener {
Vector updateVector; Vector updateVector;
Timer timer; Timer timer;
public Gdh gdh; public Gdh gdh;
public LocalDb ldb = null;
boolean initDone = false; boolean initDone = false;
boolean ready = false; boolean ready = false;
boolean gdhReady = false; boolean gdhReady = false;
...@@ -153,6 +154,9 @@ public class JopEngine implements ActionListener { ...@@ -153,6 +154,9 @@ public class JopEngine implements ActionListener {
public void setInstance( String instance) { public void setInstance( String instance) {
this.instance = instance; this.instance = instance;
if ( ldb == null) {
ldb = new LocalDb();
}
} }
public String getInstance() { public String getInstance() {
return instance; return instance;
...@@ -160,9 +164,15 @@ public class JopEngine implements ActionListener { ...@@ -160,9 +164,15 @@ public class JopEngine implements ActionListener {
public boolean isInstance() { public boolean isInstance() {
return ( instance != null); return ( instance != null);
} }
public void setLocalDb( LocalDb ldb) {
if ( this.ldb == null)
this.ldb = ldb;
}
} }
...@@ -8,6 +8,7 @@ import java.net.*; ...@@ -8,6 +8,7 @@ import java.net.*;
import java.applet.*; import java.applet.*;
import java.util.*; import java.util.*;
import jpwr.rt.*; import jpwr.rt.*;
import jpwr.jopc.*;
public class JopSpider { public class JopSpider {
int qcom_qix; int qcom_qix;
...@@ -61,7 +62,7 @@ System.out.println( "qcom put finished"); ...@@ -61,7 +62,7 @@ System.out.println( "qcom put finished");
static CliTable[] cliTable = new CliTable[] { static CliTable[] cliTable = new CliTable[] {
new CliTable( "OPEN", new String[] {"cli_arg1", "cli_arg2", "/NAME", new CliTable( "OPEN", new String[] {"cli_arg1", "cli_arg2", "/NAME",
"/FILE", "/SCROLLBAR", "/WIDTH", "/HEIGHT", "/MENU", "/NAVIGATOR", "/FILE", "/SCROLLBAR", "/WIDTH", "/HEIGHT", "/MENU", "/NAVIGATOR",
"/CENTER", "/OBJECT", "/INSTANCE", "/NEW", "/CLASSGRAPH"}), "/CENTER", "/OBJECT", "/INSTANCE", "/NEW", "/CLASSGRAPH", "/ACCESS"}),
new CliTable( "EXIT", null), new CliTable( "EXIT", null),
new CliTable( "HELP", new String[] {"cli_arg1", "cli_arg2", "cli_arg3", new CliTable( "HELP", new String[] {"cli_arg1", "cli_arg2", "cli_arg3",
"cli_arg4", "/HELPFILE", "/POPNAVIGATOR", "/BOOKMARK", "/INDEX", "cli_arg4", "/HELPFILE", "/POPNAVIGATOR", "/BOOKMARK", "/INDEX",
...@@ -463,7 +464,13 @@ System.out.println( "JopSpiderCmd start"); ...@@ -463,7 +464,13 @@ System.out.println( "JopSpiderCmd start");
Object argList[] = new Object[] { session, instance, new Boolean(scrollbar)}; Object argList[] = new Object[] { session, instance, new Boolean(scrollbar)};
Constructor constructor = clazz.getConstructor( argTypeList); Constructor constructor = clazz.getConstructor( argTypeList);
try {
frame = constructor.newInstance( argList); frame = constructor.newInstance( argList);
}
catch ( Exception e) {
System.out.println("Class instatiation error: " + className);
return null;
}
// frame = clazz.newInstance(); // frame = clazz.newInstance();
openFrame( frame); openFrame( frame);
return frame; return frame;
......
...@@ -16,6 +16,8 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -16,6 +16,8 @@ public class JopTrend extends JComponent implements GeComponentIfc,
JopSession session; JopSession session;
JopEngine en; JopEngine en;
public GeDyn dd = new GeDyn( this); public GeDyn dd = new GeDyn( this);
boolean hold = false;
public JopTrend( JopSession session) public JopTrend( JopSession session)
{ {
this.session = session; this.session = session;
...@@ -77,6 +79,10 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -77,6 +79,10 @@ public class JopTrend extends JComponent implements GeComponentIfc,
dd.confirmedAction( GeDyn.eEvent_MB1Click, null); dd.confirmedAction( GeDyn.eEvent_MB1Click, null);
} }
public void setHold( boolean hold) {
this.hold = hold;
}
// GeComponents Ifc // GeComponents Ifc
public void tsetFillColor( int fillColor) {} public void tsetFillColor( int fillColor) {}
public void tsetColorTone( int colorTone) {} public void tsetColorTone( int colorTone) {}
...@@ -220,6 +226,8 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -220,6 +226,8 @@ public class JopTrend extends JComponent implements GeComponentIfc,
g.setTransform(save); g.setTransform(save);
} }
} }
float original_width;
float original_height;
public void paintComponent(Graphics g1) { public void paintComponent(Graphics g1) {
int i, j; int i, j;
Graphics2D g = (Graphics2D) g1; Graphics2D g = (Graphics2D) g1;
...@@ -229,6 +237,8 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -229,6 +237,8 @@ public class JopTrend extends JComponent implements GeComponentIfc,
float delta; float delta;
if ( shapes == null) { if ( shapes == null) {
original_width = width;
original_height = height;
shapes = new Shape[1]; shapes = new Shape[1];
shapes[0] = new Rectangle2D.Float(0F, 0F, width, height); shapes[0] = new Rectangle2D.Float(0F, 0F, width, height);
if ( verticalLines > 0) if ( verticalLines > 0)
...@@ -263,10 +273,7 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -263,10 +273,7 @@ public class JopTrend extends JComponent implements GeComponentIfc,
} }
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
if ( drawFill == 1) { /*
g.setColor(GeColor.getColor(22, fillColor));
g.fill( shapes[0]);
}
if ( 45.0 <= rotate && rotate < 135.0) { if ( 45.0 <= rotate && rotate < 135.0) {
g.translate( -height, 0.0); g.translate( -height, 0.0);
g.rotate( - Math.PI * rotate/180, height, 0.0); g.rotate( - Math.PI * rotate/180, height, 0.0);
...@@ -282,14 +289,44 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -282,14 +289,44 @@ public class JopTrend extends JComponent implements GeComponentIfc,
g.rotate( - Math.PI * rotate/180, 0.0, 0.0); g.rotate( - Math.PI * rotate/180, 0.0, 0.0);
g.transform( AffineTransform.getScaleInstance( height/width, width/height)); g.transform( AffineTransform.getScaleInstance( height/width, width/height));
} }
*/
if ( 45.0 <= rotate && rotate < 135.0) {
g.translate( width, 0.0);
g.rotate( Math.PI * rotate/180, 0.0, 0.0);
g.transform( AffineTransform.getScaleInstance( height/original_width,
width/original_height));
}
else if ( 135.0 <= rotate && rotate < 225.0)
{
g.rotate( Math.PI * rotate/180, width/2, height/2);
g.transform( AffineTransform.getScaleInstance( width/original_width,
height/original_height));
}
else if ( 225.0 <= rotate && rotate < 315.0)
{
g.translate( -height, 0.0);
g.rotate( Math.PI * rotate/180, height, 0.0);
g.transform( AffineTransform.getScaleInstance( height/original_width,
width/original_height));
}
else {
g.transform( AffineTransform.getScaleInstance( width/original_width,
height/original_height));
}
if ( drawFill == 1) {
g.setColor(GeColor.getColor(22, fillColor));
g.fill( shapes[0]);
}
g.setStroke( new BasicStroke((float)trendBorderWidth)); g.setStroke( new BasicStroke((float)trendBorderWidth));
for ( j = 0; j < 2; j++) { for ( j = 0; j < 2; j++) {
if ( attrFound[j]) { if ( attrFound[j]) {
curve[j].reset(); curve[j].reset();
curve[j].moveTo(width,height); curve[j].moveTo(original_width,original_height);
for ( i = 0; i < noOfPoints; i++) for ( i = 0; i < noOfPoints; i++)
curve[j].lineTo( x_values[j][i], y_values[j][i]); curve[j].lineTo( x_values[j][i], y_values[j][i]);
curve[j].lineTo( 0,height); curve[j].lineTo( 0,original_height);
if ( drawFill == 1) { if ( drawFill == 1) {
g.setColor(GeColor.getColor(0, fillColorTrend[j])); g.setColor(GeColor.getColor(0, fillColorTrend[j]));
...@@ -309,12 +346,12 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -309,12 +346,12 @@ public class JopTrend extends JComponent implements GeComponentIfc,
g.draw( curve[j]); g.draw( curve[j]);
} }
} }
g.setTransform(save);
g.setStroke( new BasicStroke((float)lineWidth)); g.setStroke( new BasicStroke((float)lineWidth));
if ( drawBorder == 1 || drawFill == 0) { if ( drawBorder == 1 || drawFill == 0) {
g.setColor(GeColor.getColor(0, borderColor)); g.setColor(GeColor.getColor(0, borderColor));
g.draw( shapes[0]); g.draw( shapes[0]);
} }
g.setTransform(save);
} }
public Dimension getPreferredSize() { return size;} public Dimension getPreferredSize() { return size;}
public Dimension getMinimumSize() { return size;} public Dimension getMinimumSize() { return size;}
...@@ -356,10 +393,20 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -356,10 +393,20 @@ public class JopTrend extends JComponent implements GeComponentIfc,
public Object dynamicGetRoot() { public Object dynamicGetRoot() {
return root; return root;
} }
public void reset() {
for ( int j = 0; j < 2; j++) {
for ( int i = 0; i < noOfPoints; i++)
y_values[j][i] = original_height;
}
repaint();
}
public void dynamicOpen() { public void dynamicOpen() {
if ( en.isInstance())
dd.setInstance( en.getInstance());
for ( int j = 0; j < 2; j++) { for ( int j = 0; j < 2; j++) {
if ( pwrAttribute[j] != null && pwrAttribute[j].compareTo("") != 0) { if ( pwrAttribute[j] != null && pwrAttribute[j].compareTo("") != 0) {
retColor[j] = en.gdh.refObjectInfo( pwrAttribute[j]); String attrName = dd.getAttrName(pwrAttribute[j]);
retColor[j] = en.gdh.refObjectInfo( attrName);
if ( retColor[j].evenSts()) if ( retColor[j].evenSts())
System.out.println( "refObjectInfoError " + pwrAttribute[j]); System.out.println( "refObjectInfoError " + pwrAttribute[j]);
else else
...@@ -374,6 +421,8 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -374,6 +421,8 @@ public class JopTrend extends JComponent implements GeComponentIfc,
} }
} }
public void dynamicUpdate( boolean animationOnly) { public void dynamicUpdate( boolean animationOnly) {
if ( hold)
return;
if ( animationOnly) if ( animationOnly)
return; return;
if ( shapes == null) if ( shapes == null)
...@@ -406,7 +455,11 @@ public class JopTrend extends JComponent implements GeComponentIfc, ...@@ -406,7 +455,11 @@ public class JopTrend extends JComponent implements GeComponentIfc,
for ( i = noOfPoints - 1; i > 0; i--) for ( i = noOfPoints - 1; i > 0; i--)
y_values[j][i] = y_values[j][i-1]; y_values[j][i] = y_values[j][i-1];
y_values[j][0] = (maxValue[j] - value) / (maxValue[j] - y_values[j][0] = (maxValue[j] - value) / (maxValue[j] -
minValue[j]) * height; minValue[j]) * original_height;
if ( y_values[j][0] < 0)
y_values[j][0] = 0;
if ( y_values[j][0] > original_height)
y_values[j][0] = original_height;
valueOld[j] = value; valueOld[j] = value;
} }
} }
......
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