Commit 7cc405a5 authored by claes's avatar claes

Attributes for minvalue, maxvalue

parent aee83ace
/*
* Proview $Id: GeDynFillLevel.java,v 1.2 2005-09-01 14:57:50 claes Exp $
* Proview $Id: GeDynFillLevel.java,v 1.3 2005-11-02 14:00:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -29,15 +29,22 @@ public class GeDynFillLevel extends GeDynElem {
double maxValue;
double minPos;
double maxPos;
String minValueAttr;
String maxValueAttr;
boolean attrFound;
PwrtRefId subid;
int p;
float oldValue;
boolean firstScan = true;
int minValueP;
int maxValueP;
PwrtRefId minValueSubid;
PwrtRefId maxValueSubid;
public GeDynFillLevel( GeDyn dyn, String attribute, int color, int direction,
double minValue, double maxValue, double minPos, double maxPos) {
double minValue, double maxValue, double minPos, double maxPos,
String minValueAttr, String maxValueAttr) {
super( dyn, GeDyn.mDynType_FillLevel, GeDyn.mActionType_No);
this.attribute = attribute;
this.color = color;
......@@ -46,9 +53,11 @@ public class GeDynFillLevel extends GeDynElem {
this.maxValue = maxValue;
this.minPos = minPos;
this.maxPos = maxPos;
this.minValueAttr = minValueAttr;
this.maxValueAttr = maxValueAttr;
}
public void connect() {
if ( minValue == maxValue)
if ( minValue == maxValue && minValueAttr == null && maxValueAttr == null)
return;
String attrName = dyn.getAttrName( attribute);
......@@ -74,14 +83,54 @@ public class GeDynFillLevel extends GeDynElem {
dyn.comp.setLevelFillColor( color);
}
}
minValueP = 0;
if ( minValueAttr != null) {
attrName = dyn.getAttrName( minValueAttr);
if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts())
System.out.println( "FillLevel: " + attrName);
else {
minValueP = ret.id;
minValueSubid = ret.refid;
}
}
}
maxValueP = 0;
if ( maxValueAttr != null) {
attrName = dyn.getAttrName( maxValueAttr);
if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts())
System.out.println( "FillLevel: " + attrName);
else {
maxValueP = ret.id;
maxValueSubid = ret.refid;
}
}
}
}
public void disconnect() {
if ( attrFound)
dyn.en.gdh.unrefObjectInfo( subid);
if ( minValueP != 0)
dyn.en.gdh.unrefObjectInfo( minValueSubid);
if ( maxValueP != 0)
dyn.en.gdh.unrefObjectInfo( maxValueSubid);
}
public void scan() {
if ( !attrFound)
return;
if ( minValueP != 0 && maxValueP != 0) {
double minVal = dyn.en.gdh.getObjectRefInfoFloat( minValueP);
double maxVal = dyn.en.gdh.getObjectRefInfoFloat( maxValueP);
if ( (minVal != minValue || maxVal != maxValue) && maxVal != minVal) {
minValue = minVal;
maxValue = maxVal;
firstScan = true;
}
}
float value = dyn.en.gdh.getObjectRefInfoFloat( p);
if ( !firstScan) {
if ( value == oldValue)
......
/*
* Proview $Id: GeDynValueInput.java,v 1.4 2005-09-01 14:57:50 claes Exp $
* Proview $Id: GeDynValueInput.java,v 1.5 2005-11-02 14:00:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -25,15 +25,20 @@ import javax.swing.*;
public class GeDynValueInput extends GeDynElem {
double minValue;
double maxValue;
String minValueAttr;
String maxValueAttr;
boolean attrFound = false;
int typeId;
GeDynValue valueElement;
public GeDynValueInput( GeDyn dyn, double minValue, double maxValue) {
public GeDynValueInput( GeDyn dyn, double minValue, double maxValue,
String minValueAttr, String maxValueAttr) {
super( dyn, GeDyn.mDynType_No, GeDyn.mActionType_ValueInput);
this.minValue = minValue;
this.maxValue = maxValue;
this.minValueAttr = minValueAttr;
this.maxValueAttr = maxValueAttr;
}
public void connect() {
// Find the value element
......@@ -73,10 +78,42 @@ public class GeDynValueInput extends GeDynElem {
PwrtStatus sts;
try {
double minval = 0;
double maxval = 0;
if ( minValueAttr != null) {
String attrName = dyn.getAttrName( minValueAttr);
int typeId = dyn.getTypeId( minValueAttr);
if ( typeId < 0 || typeId == Pwr.eType_Float32) {
CdhrFloat ret = dyn.en.gdh.getObjectInfoFloat( attrName);
if ( ret.evenSts()) {
System.out.println( "ValueInput " + attrName);
return;
}
minval = ret.value;
}
}
else
minval = minValue;
if ( maxValueAttr != null) {
String attrName = dyn.getAttrName( maxValueAttr);
int typeId = dyn.getTypeId( maxValueAttr);
if ( typeId < 0 || typeId == Pwr.eType_Float32) {
CdhrFloat ret = dyn.en.gdh.getObjectInfoFloat( attrName);
if ( ret.evenSts()) {
System.out.println( "ValueInput " + attrName);
return;
}
maxval = ret.value;
}
}
else
maxval = maxValue;
if ( typeId == Pwr.eType_Float32) {
float inputValue = Float.parseFloat( text.trim());
valueElement.oldValueF = inputValue;
if ( minValue == 0 && maxValue == 0) {
if ( minval == 0 && maxval == 0) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
......@@ -86,8 +123,8 @@ public class GeDynValueInput extends GeDynElem {
System.out.println( "setObjectInfoError " + sts);
}
else {
if ( inputValue >= minValue && inputValue <= maxValue ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( inputValue >= minval && inputValue <= maxval ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
......@@ -107,7 +144,7 @@ public class GeDynValueInput extends GeDynElem {
typeId == Pwr.eType_UInt8) {
int inputValue = Integer.parseInt( text.trim(), 10);
valueElement.oldValueI = inputValue;
if ( minValue == 0 && maxValue == 0) {
if ( minval == 0 && maxval == 0) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
......@@ -117,7 +154,7 @@ public class GeDynValueInput extends GeDynElem {
System.out.println( "setObjectInfoError " + sts);
}
else {
if ( inputValue >= minValue && inputValue <= maxValue ) {
if ( inputValue >= minval && inputValue <= maxval ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
......
/*
* Proview $Id: JopBar.java,v 1.5 2005-09-01 14:57:50 claes Exp $
* Proview $Id: JopBar.java,v 1.6 2005-11-02 14:00:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -242,12 +242,18 @@ public class JopBar extends JComponent implements GeComponentIfc,
public void setLowColor( int lowColor) { this.lowColor = lowColor;}
public int getLowColor() { return lowColor;}
String pwrAttribute = new String();
String minValueAttr;
String maxValueAttr;
public void setPwrAttribute( String pwrAttribute) { this.pwrAttribute = pwrAttribute;}
public String getPwrAttribute() { return pwrAttribute;}
public void setMinValueAttr( String minValueAttr) { this.minValueAttr = minValueAttr;}
public void setMaxValueAttr( String maxValueAttr) { this.maxValueAttr = maxValueAttr;}
float valueColor;
float valueColorOld;
boolean firstScan = true;
GdhrRefObjectInfo retColor = null;
GdhrRefObjectInfo retMinVal = null;
GdhrRefObjectInfo retMaxVal = null;
boolean colorAttrFound = false;
float minValue = 0;
float maxValue = 100;
......@@ -281,19 +287,44 @@ public class JopBar extends JComponent implements GeComponentIfc,
else
colorAttrFound = true;
}
if ( minValueAttr != null) {
String attrName = dd.getAttrName( minValueAttr);
retMinVal = en.gdh.refObjectInfo( attrName);
}
if ( maxValueAttr != null) {
String attrName = dd.getAttrName( maxValueAttr);
retMaxVal = en.gdh.refObjectInfo( attrName);
}
}
public void dynamicClose() {
if ( colorAttrFound)
en.gdh.unrefObjectInfo( retColor.refid);
if ( retMinVal != null && retMinVal.oddSts())
en.gdh.unrefObjectInfo( retMinVal.refid);
if ( retMaxVal != null && retMinVal.oddSts())
en.gdh.unrefObjectInfo( retMaxVal.refid);
}
public void dynamicUpdate( boolean animationOnly) {
if ( maxValue == minValue)
if ( maxValue == minValue && minValueAttr == null && maxValueAttr == null)
return;
if ( animationOnly)
return;
if ( colorAttrFound) {
if ( shapes[0] == null)
return;
if ( retMinVal != null && retMaxVal != null &&
retMinVal.oddSts() && retMaxVal.oddSts()) {
float minVal = en.gdh.getObjectRefInfoFloat( retMinVal.id);
float maxVal = en.gdh.getObjectRefInfoFloat( retMaxVal.id);
if ( (minVal != minValue || maxVal != maxValue) && maxVal != minVal) {
minValue = minVal;
maxValue = maxVal;
firstScan = true;
}
}
valueColor = en.gdh.getObjectRefInfoFloat( retColor.id);
if ( valueColorOld != valueColor || firstScan) {
float bar_height;
......
/*
* Proview $Id: JopTrend.java,v 1.5 2005-09-01 14:57:50 claes Exp $
* Proview $Id: JopTrend.java,v 1.6 2005-11-02 14:00:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -376,13 +376,21 @@ public class JopTrend extends JComponent implements GeComponentIfc,
public Dimension getPreferredSize() { return size;}
public Dimension getMinimumSize() { return size;}
String[] pwrAttribute = new String[2];
String[] minValueAttr = new String[2];
String[] maxValueAttr = new String[2];
public void setPwrAttribute1( String pwrAttribute) { this.pwrAttribute[0] = pwrAttribute;}
public String getPwrAttribute1() { return pwrAttribute[0];}
public void setPwrAttribute2( String pwrAttribute) { this.pwrAttribute[1] = pwrAttribute;}
public String getPwrAttribute2() { return pwrAttribute[1];}
public void setMinValueAttr1( String minValueAttr1) { this.minValueAttr[0] = minValueAttr1;}
public void setMaxValueAttr1( String maxValueAttr1) { this.maxValueAttr[0] = maxValueAttr1;}
public void setMinValueAttr2( String minValueAttr2) { this.minValueAttr[1] = minValueAttr2;}
public void setMaxValueAttr2( String maxValueAttr2) { this.maxValueAttr[1] = maxValueAttr2;}
float[] valueOld = new float[2];
boolean firstScan = true;
GdhrRefObjectInfo[] retColor = {null, null};
GdhrRefObjectInfo[] retMinVal = {null, null};
GdhrRefObjectInfo[] retMaxVal = {null, null};
boolean[] attrFound = {false, false};
float[] minValue = {0,0};
float[] maxValue = {100, 100};
......@@ -415,8 +423,10 @@ public class JopTrend extends JComponent implements GeComponentIfc,
}
public void reset() {
for ( int j = 0; j < 2; j++) {
for ( int i = 0; i < noOfPoints; i++)
y_values[j][i] = original_height;
if ( y_values[j] != null) {
for ( int i = 0; i < noOfPoints; i++)
y_values[j][i] = original_height;
}
}
repaint();
}
......@@ -432,12 +442,28 @@ public class JopTrend extends JComponent implements GeComponentIfc,
else
attrFound[j] = true;
}
if ( minValueAttr[j] != null && minValueAttr[j].compareTo("") != 0) {
String attrName = dd.getAttrName(minValueAttr[j]);
retMinVal[j] = en.gdh.refObjectInfo( attrName);
if ( retMinVal[j].evenSts())
System.out.println( "refObjectInfoError " + minValueAttr[j]);
}
if ( maxValueAttr[j] != null && maxValueAttr[j].compareTo("") != 0) {
String attrName = dd.getAttrName(maxValueAttr[j]);
retMaxVal[j] = en.gdh.refObjectInfo( attrName);
if ( retMaxVal[j].evenSts())
System.out.println( "refObjectInfoError " + maxValueAttr[j]);
}
}
}
public void dynamicClose() {
for ( int j = 0; j < 2; j++) {
if ( attrFound[j])
en.gdh.unrefObjectInfo( retColor[j].refid);
if ( retMinVal[j] != null && retMinVal[j].oddSts())
en.gdh.unrefObjectInfo( retMinVal[j].refid);
if ( retMaxVal[j] != null && retMaxVal[j].oddSts())
en.gdh.unrefObjectInfo( retMaxVal[j].refid);
}
}
public void dynamicUpdate( boolean animationOnly) {
......@@ -455,6 +481,18 @@ public class JopTrend extends JComponent implements GeComponentIfc,
for ( j = 0; j < 2; j++) {
if ( attrFound[j]) {
if ( retMinVal[j] != null && retMaxVal[j] != null &&
retMinVal[j].oddSts() && retMaxVal[j].oddSts()) {
float minVal = en.gdh.getObjectRefInfoFloat( retMinVal[j].id);
float maxVal = en.gdh.getObjectRefInfoFloat( retMaxVal[j].id);
if ( (minVal != minValue[j] || maxVal != maxValue[j]) && maxVal != minVal) {
minValue[j] = minVal;
maxValue[j] = maxVal;
reset();
}
}
switch( retColor[j].typeId) {
case Pwr.eType_Boolean:
if ( en.gdh.getObjectRefInfoBoolean( retColor[j].id))
......
/*
* Proview $Id: GeDynFillLevel.java,v 1.2 2005-09-01 14:57:50 claes Exp $
* Proview $Id: GeDynFillLevel.java,v 1.3 2005-11-02 14:00:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -29,15 +29,22 @@ public class GeDynFillLevel extends GeDynElem {
double maxValue;
double minPos;
double maxPos;
String minValueAttr;
String maxValueAttr;
boolean attrFound;
PwrtRefId subid;
int p;
float oldValue;
boolean firstScan = true;
int minValueP;
int maxValueP;
PwrtRefId minValueSubid;
PwrtRefId maxValueSubid;
public GeDynFillLevel( GeDyn dyn, String attribute, int color, int direction,
double minValue, double maxValue, double minPos, double maxPos) {
double minValue, double maxValue, double minPos, double maxPos,
String minValueAttr, String maxValueAttr) {
super( dyn, GeDyn.mDynType_FillLevel, GeDyn.mActionType_No);
this.attribute = attribute;
this.color = color;
......@@ -46,9 +53,11 @@ public class GeDynFillLevel extends GeDynElem {
this.maxValue = maxValue;
this.minPos = minPos;
this.maxPos = maxPos;
this.minValueAttr = minValueAttr;
this.maxValueAttr = maxValueAttr;
}
public void connect() {
if ( minValue == maxValue)
if ( minValue == maxValue && minValueAttr == null && maxValueAttr == null)
return;
String attrName = dyn.getAttrName( attribute);
......@@ -74,14 +83,54 @@ public class GeDynFillLevel extends GeDynElem {
dyn.comp.setLevelFillColor( color);
}
}
minValueP = 0;
if ( minValueAttr != null) {
attrName = dyn.getAttrName( minValueAttr);
if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts())
System.out.println( "FillLevel: " + attrName);
else {
minValueP = ret.id;
minValueSubid = ret.refid;
}
}
}
maxValueP = 0;
if ( maxValueAttr != null) {
attrName = dyn.getAttrName( maxValueAttr);
if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts())
System.out.println( "FillLevel: " + attrName);
else {
maxValueP = ret.id;
maxValueSubid = ret.refid;
}
}
}
}
public void disconnect() {
if ( attrFound)
dyn.en.gdh.unrefObjectInfo( subid);
if ( minValueP != 0)
dyn.en.gdh.unrefObjectInfo( minValueSubid);
if ( maxValueP != 0)
dyn.en.gdh.unrefObjectInfo( maxValueSubid);
}
public void scan() {
if ( !attrFound)
return;
if ( minValueP != 0 && maxValueP != 0) {
double minVal = dyn.en.gdh.getObjectRefInfoFloat( minValueP);
double maxVal = dyn.en.gdh.getObjectRefInfoFloat( maxValueP);
if ( (minVal != minValue || maxVal != maxValue) && maxVal != minVal) {
minValue = minVal;
maxValue = maxVal;
firstScan = true;
}
}
float value = dyn.en.gdh.getObjectRefInfoFloat( p);
if ( !firstScan) {
if ( value == oldValue)
......
/*
* Proview $Id: GeDynValueInput.java,v 1.4 2005-09-01 14:57:50 claes Exp $
* Proview $Id: GeDynValueInput.java,v 1.5 2005-11-02 14:00:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -25,15 +25,20 @@ import javax.swing.*;
public class GeDynValueInput extends GeDynElem {
double minValue;
double maxValue;
String minValueAttr;
String maxValueAttr;
boolean attrFound = false;
int typeId;
GeDynValue valueElement;
public GeDynValueInput( GeDyn dyn, double minValue, double maxValue) {
public GeDynValueInput( GeDyn dyn, double minValue, double maxValue,
String minValueAttr, String maxValueAttr) {
super( dyn, GeDyn.mDynType_No, GeDyn.mActionType_ValueInput);
this.minValue = minValue;
this.maxValue = maxValue;
this.minValueAttr = minValueAttr;
this.maxValueAttr = maxValueAttr;
}
public void connect() {
// Find the value element
......@@ -73,10 +78,42 @@ public class GeDynValueInput extends GeDynElem {
PwrtStatus sts;
try {
double minval = 0;
double maxval = 0;
if ( minValueAttr != null) {
String attrName = dyn.getAttrName( minValueAttr);
int typeId = dyn.getTypeId( minValueAttr);
if ( typeId < 0 || typeId == Pwr.eType_Float32) {
CdhrFloat ret = dyn.en.gdh.getObjectInfoFloat( attrName);
if ( ret.evenSts()) {
System.out.println( "ValueInput " + attrName);
return;
}
minval = ret.value;
}
}
else
minval = minValue;
if ( maxValueAttr != null) {
String attrName = dyn.getAttrName( maxValueAttr);
int typeId = dyn.getTypeId( maxValueAttr);
if ( typeId < 0 || typeId == Pwr.eType_Float32) {
CdhrFloat ret = dyn.en.gdh.getObjectInfoFloat( attrName);
if ( ret.evenSts()) {
System.out.println( "ValueInput " + attrName);
return;
}
maxval = ret.value;
}
}
else
maxval = maxValue;
if ( typeId == Pwr.eType_Float32) {
float inputValue = Float.parseFloat( text.trim());
valueElement.oldValueF = inputValue;
if ( minValue == 0 && maxValue == 0) {
if ( minval == 0 && maxval == 0) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
......@@ -86,8 +123,8 @@ public class GeDynValueInput extends GeDynElem {
System.out.println( "setObjectInfoError " + sts);
}
else {
if ( inputValue >= minValue && inputValue <= maxValue ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( inputValue >= minval && inputValue <= maxval ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
else
......@@ -107,7 +144,7 @@ public class GeDynValueInput extends GeDynElem {
typeId == Pwr.eType_UInt8) {
int inputValue = Integer.parseInt( text.trim(), 10);
valueElement.oldValueI = inputValue;
if ( minValue == 0 && maxValue == 0) {
if ( minval == 0 && maxval == 0) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
......@@ -117,7 +154,7 @@ public class GeDynValueInput extends GeDynElem {
System.out.println( "setObjectInfoError " + sts);
}
else {
if ( inputValue >= minValue && inputValue <= maxValue ) {
if ( inputValue >= minval && inputValue <= maxval ) {
String attrName = dyn.getAttrNameNoSuffix( valueElement.attribute);
if ( !valueElement.localDb)
sts = dyn.en.gdh.setObjectInfo( attrName, inputValue);
......
/*
* Proview $Id: JopBar.java,v 1.5 2005-09-01 14:57:50 claes Exp $
* Proview $Id: JopBar.java,v 1.6 2005-11-02 14:00:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -242,12 +242,18 @@ public class JopBar extends JComponent implements GeComponentIfc,
public void setLowColor( int lowColor) { this.lowColor = lowColor;}
public int getLowColor() { return lowColor;}
String pwrAttribute = new String();
String minValueAttr;
String maxValueAttr;
public void setPwrAttribute( String pwrAttribute) { this.pwrAttribute = pwrAttribute;}
public String getPwrAttribute() { return pwrAttribute;}
public void setMinValueAttr( String minValueAttr) { this.minValueAttr = minValueAttr;}
public void setMaxValueAttr( String maxValueAttr) { this.maxValueAttr = maxValueAttr;}
float valueColor;
float valueColorOld;
boolean firstScan = true;
GdhrRefObjectInfo retColor = null;
GdhrRefObjectInfo retMinVal = null;
GdhrRefObjectInfo retMaxVal = null;
boolean colorAttrFound = false;
float minValue = 0;
float maxValue = 100;
......@@ -281,19 +287,44 @@ public class JopBar extends JComponent implements GeComponentIfc,
else
colorAttrFound = true;
}
if ( minValueAttr != null) {
String attrName = dd.getAttrName( minValueAttr);
retMinVal = en.gdh.refObjectInfo( attrName);
}
if ( maxValueAttr != null) {
String attrName = dd.getAttrName( maxValueAttr);
retMaxVal = en.gdh.refObjectInfo( attrName);
}
}
public void dynamicClose() {
if ( colorAttrFound)
en.gdh.unrefObjectInfo( retColor.refid);
if ( retMinVal != null && retMinVal.oddSts())
en.gdh.unrefObjectInfo( retMinVal.refid);
if ( retMaxVal != null && retMinVal.oddSts())
en.gdh.unrefObjectInfo( retMaxVal.refid);
}
public void dynamicUpdate( boolean animationOnly) {
if ( maxValue == minValue)
if ( maxValue == minValue && minValueAttr == null && maxValueAttr == null)
return;
if ( animationOnly)
return;
if ( colorAttrFound) {
if ( shapes[0] == null)
return;
if ( retMinVal != null && retMaxVal != null &&
retMinVal.oddSts() && retMaxVal.oddSts()) {
float minVal = en.gdh.getObjectRefInfoFloat( retMinVal.id);
float maxVal = en.gdh.getObjectRefInfoFloat( retMaxVal.id);
if ( (minVal != minValue || maxVal != maxValue) && maxVal != minVal) {
minValue = minVal;
maxValue = maxVal;
firstScan = true;
}
}
valueColor = en.gdh.getObjectRefInfoFloat( retColor.id);
if ( valueColorOld != valueColor || firstScan) {
float bar_height;
......
/*
* Proview $Id: JopTrend.java,v 1.5 2005-09-01 14:57:50 claes Exp $
* Proview $Id: JopTrend.java,v 1.6 2005-11-02 14:00:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -376,13 +376,21 @@ public class JopTrend extends JComponent implements GeComponentIfc,
public Dimension getPreferredSize() { return size;}
public Dimension getMinimumSize() { return size;}
String[] pwrAttribute = new String[2];
String[] minValueAttr = new String[2];
String[] maxValueAttr = new String[2];
public void setPwrAttribute1( String pwrAttribute) { this.pwrAttribute[0] = pwrAttribute;}
public String getPwrAttribute1() { return pwrAttribute[0];}
public void setPwrAttribute2( String pwrAttribute) { this.pwrAttribute[1] = pwrAttribute;}
public String getPwrAttribute2() { return pwrAttribute[1];}
public void setMinValueAttr1( String minValueAttr1) { this.minValueAttr[0] = minValueAttr1;}
public void setMaxValueAttr1( String maxValueAttr1) { this.maxValueAttr[0] = maxValueAttr1;}
public void setMinValueAttr2( String minValueAttr2) { this.minValueAttr[1] = minValueAttr2;}
public void setMaxValueAttr2( String maxValueAttr2) { this.maxValueAttr[1] = maxValueAttr2;}
float[] valueOld = new float[2];
boolean firstScan = true;
GdhrRefObjectInfo[] retColor = {null, null};
GdhrRefObjectInfo[] retMinVal = {null, null};
GdhrRefObjectInfo[] retMaxVal = {null, null};
boolean[] attrFound = {false, false};
float[] minValue = {0,0};
float[] maxValue = {100, 100};
......@@ -415,8 +423,10 @@ public class JopTrend extends JComponent implements GeComponentIfc,
}
public void reset() {
for ( int j = 0; j < 2; j++) {
for ( int i = 0; i < noOfPoints; i++)
y_values[j][i] = original_height;
if ( y_values[j] != null) {
for ( int i = 0; i < noOfPoints; i++)
y_values[j][i] = original_height;
}
}
repaint();
}
......@@ -432,12 +442,28 @@ public class JopTrend extends JComponent implements GeComponentIfc,
else
attrFound[j] = true;
}
if ( minValueAttr[j] != null && minValueAttr[j].compareTo("") != 0) {
String attrName = dd.getAttrName(minValueAttr[j]);
retMinVal[j] = en.gdh.refObjectInfo( attrName);
if ( retMinVal[j].evenSts())
System.out.println( "refObjectInfoError " + minValueAttr[j]);
}
if ( maxValueAttr[j] != null && maxValueAttr[j].compareTo("") != 0) {
String attrName = dd.getAttrName(maxValueAttr[j]);
retMaxVal[j] = en.gdh.refObjectInfo( attrName);
if ( retMaxVal[j].evenSts())
System.out.println( "refObjectInfoError " + maxValueAttr[j]);
}
}
}
public void dynamicClose() {
for ( int j = 0; j < 2; j++) {
if ( attrFound[j])
en.gdh.unrefObjectInfo( retColor[j].refid);
if ( retMinVal[j] != null && retMinVal[j].oddSts())
en.gdh.unrefObjectInfo( retMinVal[j].refid);
if ( retMaxVal[j] != null && retMaxVal[j].oddSts())
en.gdh.unrefObjectInfo( retMaxVal[j].refid);
}
}
public void dynamicUpdate( boolean animationOnly) {
......@@ -455,6 +481,18 @@ public class JopTrend extends JComponent implements GeComponentIfc,
for ( j = 0; j < 2; j++) {
if ( attrFound[j]) {
if ( retMinVal[j] != null && retMaxVal[j] != null &&
retMinVal[j].oddSts() && retMaxVal[j].oddSts()) {
float minVal = en.gdh.getObjectRefInfoFloat( retMinVal[j].id);
float maxVal = en.gdh.getObjectRefInfoFloat( retMaxVal[j].id);
if ( (minVal != minValue[j] || maxVal != maxValue[j]) && maxVal != minVal) {
minValue[j] = minVal;
maxValue[j] = maxVal;
reset();
}
}
switch( retColor[j].typeId) {
case Pwr.eType_Boolean:
if ( en.gdh.getObjectRefInfoBoolean( retColor[j].id))
......
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