Commit c55dcbaf authored by claes's avatar claes

ClassGraphs implemented

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