Commit eb4b2236 authored by claes's avatar claes

Dimmed and HostObject dynamics

parent 9e2fb5c7
......@@ -8,5 +8,8 @@ public class Ge {
public static final int DIRECTION_LEFT = 2;
public static final int DIRECTION_UP = 3;
public static final int DIRECTION_DOWN = 4;
public static final int VISIBILITY_VISIBLE = 0;
public static final int VISIBILITY_INVISIBLE = 1;
public static final int VISIBILITY_DIMMED = 2;
public static final float cJBean_Offset = 2;
}
......@@ -585,7 +585,7 @@ public class GeColor {
public static int getDrawtype( int local_drawtype, int color_tone, int color_shift,
int color_intensity,
int color_brightness, int color_inverse, int default_color) {
int color_brightness, int color_inverse, int default_color, boolean dimmed) {
int drawtype;
int base_drawtype;
int incr;
......@@ -665,6 +665,18 @@ public class GeColor {
if ( drawtype >= 10)
drawtype = drawtype + 10 - 2 * (drawtype % 10) - 1;
}
if ( dimmed) {
if ( drawtype == 0)
drawtype = 25;
else if ( 26 <= drawtype && drawtype <= 29)
drawtype = drawtype - 4;
else if ( 36 <= drawtype && drawtype <= 39)
drawtype = drawtype - 4;
else if ( 46 <= drawtype && drawtype <= 49)
drawtype = drawtype - 4;
else if ( 56 <= drawtype && drawtype <= 59)
drawtype = drawtype - 4;
}
if ( drawtype < 0 || drawtype >= 300) {
System.out.println("** Invalid drawtype");
drawtype = 0;
......@@ -679,10 +691,10 @@ public class GeColor {
}
public static Color getColor( int local_drawtype, int color_tone, int color_shift,
int color_intensity,
int color_brightness, int color_inverse, int default_color) {
int color_intensity, int color_brightness, int color_inverse,
int default_color, boolean dimmed) {
int drawtype = getDrawtype( local_drawtype, color_tone, color_shift, color_intensity,
color_brightness, color_inverse, default_color);
color_brightness, color_inverse, default_color, dimmed);
if ( colors[drawtype] == null)
colors[drawtype] = rgbColor( drawtype);
return colors[drawtype];
......
......@@ -52,6 +52,8 @@ public class GeComponent extends JComponent implements GeComponentIfc,
if ( dd.actionType != 0 && en.gdh.isAuthorized( dd.access)) {
this.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if ( dimmed)
return;
if ( e.isPopupTrigger())
dd.action( GeDyn.eEvent_MB3Press, e);
else if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 &&
......@@ -60,6 +62,8 @@ public class GeComponent extends JComponent implements GeComponentIfc,
}
public void mousePressed(MouseEvent e) {
if ( dimmed)
return;
if ( e.isPopupTrigger())
dd.action( GeDyn.eEvent_MB3Press, e);
else if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 &&
......@@ -67,6 +71,8 @@ public class GeComponent extends JComponent implements GeComponentIfc,
dd.action( GeDyn.eEvent_MB1Down, e);
}
public void mouseClicked(MouseEvent e) {
if ( dimmed)
return;
if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 &&
en.gdh.isAuthorized( dd.access))
dd.action( GeDyn.eEvent_MB1Click, e);
......@@ -75,7 +81,7 @@ public class GeComponent extends JComponent implements GeComponentIfc,
if ( (dd.actionType & GeDyn.mActionType_Slider) != 0) {
this.addMouseMotionListener( new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
if ( actionDisabled)
if ( actionDisabled || dimmed)
return;
if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 &&
en.gdh.isAuthorized( dd.access))
......@@ -104,6 +110,24 @@ public class GeComponent extends JComponent implements GeComponentIfc,
public void resetColorTone() { colorTone = originalColorTone; }
public void resetBorderColor() { borderColor = originalBorderColor;}
public void resetTextColor() { textColor = originalTextColor;}
public void setVisibility( int visibility) {
switch ( visibility) {
case Ge.VISIBILITY_VISIBLE:
visible = true;
dimmed = false;
break;
case Ge.VISIBILITY_INVISIBLE:
visible = false;
dimmed = false;
repaint();
break;
case Ge.VISIBILITY_DIMMED:
visible = true;
dimmed = true;
repaint();
break;
}
}
public String getAnnot1() { return annot1;}
public void setAnnot1( String s) { annot1 = s;}
public Object getDd() { return dd;}
......@@ -139,6 +163,8 @@ public class GeComponent extends JComponent implements GeComponentIfc,
public int levelColorTone = 0;
public int levelFillColor = 0;
public int shadow = 0;
public boolean visible = true;
public boolean dimmed = false;
public void setColorTone( int colorTone) {
this.colorTone = colorTone;
originalColorTone = colorTone;
......
......@@ -15,6 +15,7 @@ public interface GeComponentIfc {
public void setLevelDirection( int levelDirection);
public void setLevelColorTone( int levelColorTone);
public void setLevelFillColor( int levelFillColor);
public void setVisibility( int visibility);
public String getAnnot1();
public void setAnnot1( String annot1);
public void setLastPage();
......
......@@ -30,6 +30,7 @@ public class GeDyn {
public static final int mDynType_AnalogText = 1 << 23;
public static final int mDynType_Table = 1 << 24;
public static final int mDynType_StatusColor = 1 << 25;
public static final int mDynType_HostObject = 1 << 26;
public static final int mActionType_No = 0;
public static final int mActionType_Inherit = 1 << 0;
......@@ -75,17 +76,16 @@ public class GeDyn {
public GeDynElemIfc[] elements;
public GeComponentIfc comp;
public String instance;
public String hostObject;
public boolean ignoreColor;
public boolean resetColor;
public boolean repaintNow;
public JopSession session;
public JopEngine en;
public boolean invisible;
public boolean invisibleOld;
public double rotate;
public double x0;
public double y0;
public double rotate;
public double x0;
public double y0;
public GeDyn( Object comp) {
this.comp = (GeComponentIfc) comp;
......@@ -113,6 +113,9 @@ public class GeDyn {
public void setInstance( String instance) {
this.instance = instance;
}
public void setHostObject( String hostObject) {
this.hostObject = hostObject;
}
public void setElements( GeDynElemIfc[] elements) {
this.elements = elements;
}
......@@ -161,11 +164,35 @@ public class GeDyn {
}
public String getAttrName( String str) {
if ( str.toLowerCase().startsWith("$node")) {
int nix;
if ( instance == null)
nix = 0;
else {
CdhrObjid cdhr_inst = en.gdh.nameToObjid( instance);
nix = cdhr_inst.objid.vid;
}
CdhrObjid cdhr_node = en.gdh.getNodeObject(nix);
if ( cdhr_node.evenSts()) return str;
CdhrString cdhr_ns = en.gdh.objidToName( cdhr_node.objid, Cdh.mName_volumeStrict);
if ( cdhr_ns.evenSts()) return str;
String s = RtUtilities.strReplace( str, "$node", cdhr_ns.str);
return s;
}
if ( instance == null) {
if ( str.startsWith("!"))
return str.substring(1);
else
return str;
if ( hostObject == null) {
if ( str.startsWith("!"))
return str.substring(1);
else
return str;
}
else {
String s = RtUtilities.strReplace( str, "$hostobject", hostObject);
if ( s.startsWith("!"))
return s.substring(1);
else
return s;
}
}
else {
String s = RtUtilities.strReplace( str, "$object", instance);
......@@ -179,8 +206,12 @@ public class GeDyn {
public String getAttrNameNoSuffix( String str) {
int startIdx;
String s;
if ( instance == null)
s = str;
if ( instance == null) {
if ( hostObject == null)
s = str;
else
s = RtUtilities.strReplace( str, "$hostobject", hostObject);
}
else
s = RtUtilities.strReplace( str, "$object", instance);
......
package jpwr.jop;
import jpwr.rt.*;
public class GeDynHostObject extends GeDynElem {
public GeDynHostObject( GeDyn dyn, String hostObject) {
super( dyn, GeDyn.mDynType_HostObject, GeDyn.mActionType_No);
dyn.setHostObject( hostObject);
}
public void connect() {
}
public void disconnect() {
}
public void scan() {
}
}
......@@ -3,29 +3,42 @@ import jpwr.rt.*;
public class GeDynInvisible extends GeDynElem {
String attribute;
int dimmed;
boolean attrFound;
PwrtRefId subid;
int typeId;
int p;
boolean inverted;
boolean oldValue;
boolean oldValueB;
String oldValueS;
boolean firstScan = true;
boolean cmd = false;
boolean valueCmd = false;
public GeDynInvisible( GeDyn dyn, String attribute) {
public GeDynInvisible( GeDyn dyn, String attribute, int dimmed) {
super( dyn, GeDyn.mDynType_Invisible, GeDyn.mActionType_No);
this.attribute = attribute;
this.dimmed = dimmed;
}
public void connect() {
String attrName = dyn.getAttrName( attribute);
if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts())
System.out.println( "DigInvisible: " + attrName);
if ( attrName.toLowerCase().startsWith("$cmd(")) {
cmd = true;
valueCmd = false;
}
else {
attrFound = true;
p = ret.id;
subid = ret.refid;
inverted = GeDyndata.getAttrInverted( attribute);
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts())
System.out.println( "DigInvisible: " + attrName);
else {
attrFound = true;
p = ret.id;
subid = ret.refid;
typeId = ret.typeId;
inverted = GeDyndata.getAttrInverted( attribute);
}
}
}
}
......@@ -34,26 +47,65 @@ public class GeDynInvisible extends GeDynElem {
dyn.en.gdh.unrefObjectInfo( subid);
}
public void scan() {
if ( cmd) {
if ( firstScan) {
if ( dimmed == 0)
dyn.comp.setVisibility( Ge.VISIBILITY_INVISIBLE);
else
dyn.comp.setVisibility( Ge.VISIBILITY_DIMMED);
firstScan = false;
}
return;
}
if ( !attrFound)
return;
boolean value = dyn.en.gdh.getObjectRefInfoBoolean( p);
if ( !firstScan) {
if ( value == oldValue) {
// No change since last time
return;
switch ( typeId) {
case Pwr.eType_Boolean: {
boolean value = dyn.en.gdh.getObjectRefInfoBoolean( p);
if ( !firstScan) {
if ( value == oldValueB) {
// No change since last time
return;
}
}
else
firstScan = false;
if ( (!inverted && value) || (inverted && !value)) {
if ( dimmed == 0)
dyn.comp.setVisibility( Ge.VISIBILITY_INVISIBLE);
else
dyn.comp.setVisibility( Ge.VISIBILITY_DIMMED);
}
else {
dyn.comp.setVisibility( Ge.VISIBILITY_VISIBLE);
}
dyn.repaintNow = true;
oldValueB = value;
break;
}
else
firstScan = false;
case Pwr.eType_String: {
String value0;
value0 = dyn.en.gdh.getObjectRefInfoString( p, typeId);
if ( (!inverted && value) || (inverted && !value)) {
dyn.invisible = true;
if ( firstScan || value0.compareTo( oldValueS) != 0) {
if ( value0.compareTo("") == 0) {
if ( dimmed == 0)
dyn.comp.setVisibility( Ge.VISIBILITY_INVISIBLE);
else
dyn.comp.setVisibility( Ge.VISIBILITY_DIMMED);
}
else {
dyn.comp.setVisibility( Ge.VISIBILITY_VISIBLE);
}
dyn.repaintNow = true;
oldValueS = value0;
if ( firstScan)
firstScan = false;
}
break;
}
else {
dyn.invisible = false;
}
dyn.repaintNow = true;
oldValue = value;
}
}
......
......@@ -6,12 +6,24 @@ import javax.swing.*;
public class GeDynTipText extends GeDynElem {
String text;
boolean attrFound = false;
public GeDynTipText( GeDyn dyn, String text) {
super( dyn, GeDyn.mDynType_No, GeDyn.mActionType_TipText);
this.text = text;
}
public void connect() {
((JComponent)dyn.comp).setToolTipText( text);
if ( text.charAt(0) == '&') {
String attrName = dyn.getAttrName( text.substring(1));
CdhrString cdhr = dyn.en.gdh.getObjectInfoString( attrName);
if ( cdhr.evenSts()) return;
((JComponent)dyn.comp).setToolTipText( cdhr.str);
attrFound = true;
}
else
((JComponent)dyn.comp).setToolTipText( text);
}
public void disconnect() {
}
......
......@@ -92,19 +92,19 @@ public class GeFrameThin extends GeComponent {
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(78, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor));
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor, false));
g.draw( shapes[0]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(78, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor));
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor, false));
g.draw( shapes[1]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(40, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor));
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor, false));
g.draw( shapes[2]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(40, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor));
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor, false));
g.draw( shapes[3]);
g.setTransform(save);
}
......
......@@ -206,7 +206,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
this.fillColor = fillColor;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
......@@ -214,7 +214,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
public void tsetColorTone( int colorTone) {
this.colorTone = colorTone;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, GeColor.NO_COLOR);
colorShift, colorIntensity, colorBrightness, colorInverse, GeColor.NO_COLOR, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
......@@ -225,7 +225,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
public void resetFillColor() {
fillColor = originalFillColor;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
......@@ -233,13 +233,14 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
public void resetColorTone() {
colorTone = originalColorTone;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
}
public void resetBorderColor() {}
public void resetTextColor() {}
public void setVisibility( int visibility) {}
public String getAnnot1() { return "";}
public void setAnnot1( String s) {}
public void setLastPage() {}
......@@ -326,7 +327,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
dd.connect();
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
......
......@@ -133,13 +133,13 @@ public class GeTextField extends JTextField implements GeComponentIfc,
this.fillColor = fillColor;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
setBackground( normalColor);
}
public void tsetColorTone( int colorTone) {
this.colorTone = colorTone;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, GeColor.NO_COLOR);
colorShift, colorIntensity, colorBrightness, colorInverse, GeColor.NO_COLOR, false);
setBackground( normalColor);
}
public void setShadow( int shadow) {}
......@@ -149,13 +149,13 @@ public class GeTextField extends JTextField implements GeComponentIfc,
public void resetFillColor() {
fillColor = originalFillColor;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
setBackground( normalColor);
}
public void resetColorTone() {
colorTone = originalColorTone;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
setBackground( normalColor);
}
public void resetBorderColor() {}
......@@ -176,6 +176,7 @@ public class GeTextField extends JTextField implements GeComponentIfc,
public void setLevelDirection( int levelDirection) {}
public void setLevelColorTone( int levelColorTone) {}
public void setLevelFillColor( int levelFillColor) {}
public void setVisibility( int visibility) {}
Font annot1Font = new Font("Helvetica", Font.BOLD, 14);
public Font annotFont = annot1Font;
......@@ -265,7 +266,7 @@ public class GeTextField extends JTextField implements GeComponentIfc,
dd.connect();
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
setBackground( normalColor);
}
public void dynamicClose() {
......
......@@ -192,13 +192,13 @@ public class JopButtontoggle extends JComponent implements JopDynamic, ActionLis
Math.PI * rotate/180,((double)original_width)/2, ((double)original_height)/2));
g.transform( AffineTransform.getScaleInstance( scaleWidth, scaleHeight));
g.setColor(GeColor.getColor(22, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor));
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false));
g.fill( shapes[0]);
g.setColor(GeColor.getColor(20, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor));
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false));
g.fill( shapes[1]);
g.setColor(GeColor.getColor(23, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor));
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false));
g.fill( shapes[2]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(0, borderColor));
......
......@@ -141,7 +141,7 @@ public class JopFilter extends JComponent implements JopDynamic, ActionListener{
Math.PI * rotate/180,((double)original_width)/2, ((double)original_height)/2));
g.transform( AffineTransform.getScaleInstance( scaleWidth, scaleHeight));
g.setColor(GeColor.getColor(21, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor));
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false));
g.fill( shapes[0]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(0, borderColor));
......
......@@ -140,7 +140,7 @@ System.out.println( "qcom put finished");
// Replace * by node object
if ( objectValue.charAt(0) == '*') {
CdhrObjid cdhr_node = gdh.getNodeObject();
CdhrObjid cdhr_node = gdh.getNodeObject(0);
if ( cdhr_node.evenSts())
return;
CdhrString cdhr_nodestr = gdh.objidToName( cdhr_node.objid, Cdh.mName_volumeStrict);
......
......@@ -8,5 +8,8 @@ public class Ge {
public static final int DIRECTION_LEFT = 2;
public static final int DIRECTION_UP = 3;
public static final int DIRECTION_DOWN = 4;
public static final int VISIBILITY_VISIBLE = 0;
public static final int VISIBILITY_INVISIBLE = 1;
public static final int VISIBILITY_DIMMED = 2;
public static final float cJBean_Offset = 2;
}
......@@ -585,7 +585,7 @@ public class GeColor {
public static int getDrawtype( int local_drawtype, int color_tone, int color_shift,
int color_intensity,
int color_brightness, int color_inverse, int default_color) {
int color_brightness, int color_inverse, int default_color, boolean dimmed) {
int drawtype;
int base_drawtype;
int incr;
......@@ -665,6 +665,18 @@ public class GeColor {
if ( drawtype >= 10)
drawtype = drawtype + 10 - 2 * (drawtype % 10) - 1;
}
if ( dimmed) {
if ( drawtype == 0)
drawtype = 25;
else if ( 26 <= drawtype && drawtype <= 29)
drawtype = drawtype - 4;
else if ( 36 <= drawtype && drawtype <= 39)
drawtype = drawtype - 4;
else if ( 46 <= drawtype && drawtype <= 49)
drawtype = drawtype - 4;
else if ( 56 <= drawtype && drawtype <= 59)
drawtype = drawtype - 4;
}
if ( drawtype < 0 || drawtype >= 300) {
System.out.println("** Invalid drawtype");
drawtype = 0;
......@@ -679,10 +691,10 @@ public class GeColor {
}
public static Color getColor( int local_drawtype, int color_tone, int color_shift,
int color_intensity,
int color_brightness, int color_inverse, int default_color) {
int color_intensity, int color_brightness, int color_inverse,
int default_color, boolean dimmed) {
int drawtype = getDrawtype( local_drawtype, color_tone, color_shift, color_intensity,
color_brightness, color_inverse, default_color);
color_brightness, color_inverse, default_color, dimmed);
if ( colors[drawtype] == null)
colors[drawtype] = rgbColor( drawtype);
return colors[drawtype];
......
......@@ -52,6 +52,8 @@ public class GeComponent extends JComponent implements GeComponentIfc,
if ( dd.actionType != 0 && en.gdh.isAuthorized( dd.access)) {
this.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if ( dimmed)
return;
if ( e.isPopupTrigger())
dd.action( GeDyn.eEvent_MB3Press, e);
else if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 &&
......@@ -60,6 +62,8 @@ public class GeComponent extends JComponent implements GeComponentIfc,
}
public void mousePressed(MouseEvent e) {
if ( dimmed)
return;
if ( e.isPopupTrigger())
dd.action( GeDyn.eEvent_MB3Press, e);
else if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 &&
......@@ -67,6 +71,8 @@ public class GeComponent extends JComponent implements GeComponentIfc,
dd.action( GeDyn.eEvent_MB1Down, e);
}
public void mouseClicked(MouseEvent e) {
if ( dimmed)
return;
if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 &&
en.gdh.isAuthorized( dd.access))
dd.action( GeDyn.eEvent_MB1Click, e);
......@@ -75,7 +81,7 @@ public class GeComponent extends JComponent implements GeComponentIfc,
if ( (dd.actionType & GeDyn.mActionType_Slider) != 0) {
this.addMouseMotionListener( new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
if ( actionDisabled)
if ( actionDisabled || dimmed)
return;
if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 &&
en.gdh.isAuthorized( dd.access))
......@@ -104,6 +110,24 @@ public class GeComponent extends JComponent implements GeComponentIfc,
public void resetColorTone() { colorTone = originalColorTone; }
public void resetBorderColor() { borderColor = originalBorderColor;}
public void resetTextColor() { textColor = originalTextColor;}
public void setVisibility( int visibility) {
switch ( visibility) {
case Ge.VISIBILITY_VISIBLE:
visible = true;
dimmed = false;
break;
case Ge.VISIBILITY_INVISIBLE:
visible = false;
dimmed = false;
repaint();
break;
case Ge.VISIBILITY_DIMMED:
visible = true;
dimmed = true;
repaint();
break;
}
}
public String getAnnot1() { return annot1;}
public void setAnnot1( String s) { annot1 = s;}
public Object getDd() { return dd;}
......@@ -139,6 +163,8 @@ public class GeComponent extends JComponent implements GeComponentIfc,
public int levelColorTone = 0;
public int levelFillColor = 0;
public int shadow = 0;
public boolean visible = true;
public boolean dimmed = false;
public void setColorTone( int colorTone) {
this.colorTone = colorTone;
originalColorTone = colorTone;
......
......@@ -15,6 +15,7 @@ public interface GeComponentIfc {
public void setLevelDirection( int levelDirection);
public void setLevelColorTone( int levelColorTone);
public void setLevelFillColor( int levelFillColor);
public void setVisibility( int visibility);
public String getAnnot1();
public void setAnnot1( String annot1);
public void setLastPage();
......
......@@ -30,6 +30,7 @@ public class GeDyn {
public static final int mDynType_AnalogText = 1 << 23;
public static final int mDynType_Table = 1 << 24;
public static final int mDynType_StatusColor = 1 << 25;
public static final int mDynType_HostObject = 1 << 26;
public static final int mActionType_No = 0;
public static final int mActionType_Inherit = 1 << 0;
......@@ -75,17 +76,16 @@ public class GeDyn {
public GeDynElemIfc[] elements;
public GeComponentIfc comp;
public String instance;
public String hostObject;
public boolean ignoreColor;
public boolean resetColor;
public boolean repaintNow;
public JopSession session;
public JopEngine en;
public boolean invisible;
public boolean invisibleOld;
public double rotate;
public double x0;
public double y0;
public double rotate;
public double x0;
public double y0;
public GeDyn( Object comp) {
this.comp = (GeComponentIfc) comp;
......@@ -113,6 +113,9 @@ public class GeDyn {
public void setInstance( String instance) {
this.instance = instance;
}
public void setHostObject( String hostObject) {
this.hostObject = hostObject;
}
public void setElements( GeDynElemIfc[] elements) {
this.elements = elements;
}
......@@ -161,11 +164,35 @@ public class GeDyn {
}
public String getAttrName( String str) {
if ( str.toLowerCase().startsWith("$node")) {
int nix;
if ( instance == null)
nix = 0;
else {
CdhrObjid cdhr_inst = en.gdh.nameToObjid( instance);
nix = cdhr_inst.objid.vid;
}
CdhrObjid cdhr_node = en.gdh.getNodeObject(nix);
if ( cdhr_node.evenSts()) return str;
CdhrString cdhr_ns = en.gdh.objidToName( cdhr_node.objid, Cdh.mName_volumeStrict);
if ( cdhr_ns.evenSts()) return str;
String s = RtUtilities.strReplace( str, "$node", cdhr_ns.str);
return s;
}
if ( instance == null) {
if ( str.startsWith("!"))
return str.substring(1);
else
return str;
if ( hostObject == null) {
if ( str.startsWith("!"))
return str.substring(1);
else
return str;
}
else {
String s = RtUtilities.strReplace( str, "$hostobject", hostObject);
if ( s.startsWith("!"))
return s.substring(1);
else
return s;
}
}
else {
String s = RtUtilities.strReplace( str, "$object", instance);
......@@ -179,8 +206,12 @@ public class GeDyn {
public String getAttrNameNoSuffix( String str) {
int startIdx;
String s;
if ( instance == null)
s = str;
if ( instance == null) {
if ( hostObject == null)
s = str;
else
s = RtUtilities.strReplace( str, "$hostobject", hostObject);
}
else
s = RtUtilities.strReplace( str, "$object", instance);
......
package jpwr.jop;
import jpwr.rt.*;
public class GeDynHostObject extends GeDynElem {
public GeDynHostObject( GeDyn dyn, String hostObject) {
super( dyn, GeDyn.mDynType_HostObject, GeDyn.mActionType_No);
dyn.setHostObject( hostObject);
}
public void connect() {
}
public void disconnect() {
}
public void scan() {
}
}
......@@ -3,29 +3,42 @@ import jpwr.rt.*;
public class GeDynInvisible extends GeDynElem {
String attribute;
int dimmed;
boolean attrFound;
PwrtRefId subid;
int typeId;
int p;
boolean inverted;
boolean oldValue;
boolean oldValueB;
String oldValueS;
boolean firstScan = true;
boolean cmd = false;
boolean valueCmd = false;
public GeDynInvisible( GeDyn dyn, String attribute) {
public GeDynInvisible( GeDyn dyn, String attribute, int dimmed) {
super( dyn, GeDyn.mDynType_Invisible, GeDyn.mActionType_No);
this.attribute = attribute;
this.dimmed = dimmed;
}
public void connect() {
String attrName = dyn.getAttrName( attribute);
if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts())
System.out.println( "DigInvisible: " + attrName);
if ( attrName.toLowerCase().startsWith("$cmd(")) {
cmd = true;
valueCmd = false;
}
else {
attrFound = true;
p = ret.id;
subid = ret.refid;
inverted = GeDyndata.getAttrInverted( attribute);
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
if ( ret.evenSts())
System.out.println( "DigInvisible: " + attrName);
else {
attrFound = true;
p = ret.id;
subid = ret.refid;
typeId = ret.typeId;
inverted = GeDyndata.getAttrInverted( attribute);
}
}
}
}
......@@ -34,26 +47,65 @@ public class GeDynInvisible extends GeDynElem {
dyn.en.gdh.unrefObjectInfo( subid);
}
public void scan() {
if ( cmd) {
if ( firstScan) {
if ( dimmed == 0)
dyn.comp.setVisibility( Ge.VISIBILITY_INVISIBLE);
else
dyn.comp.setVisibility( Ge.VISIBILITY_DIMMED);
firstScan = false;
}
return;
}
if ( !attrFound)
return;
boolean value = dyn.en.gdh.getObjectRefInfoBoolean( p);
if ( !firstScan) {
if ( value == oldValue) {
// No change since last time
return;
switch ( typeId) {
case Pwr.eType_Boolean: {
boolean value = dyn.en.gdh.getObjectRefInfoBoolean( p);
if ( !firstScan) {
if ( value == oldValueB) {
// No change since last time
return;
}
}
else
firstScan = false;
if ( (!inverted && value) || (inverted && !value)) {
if ( dimmed == 0)
dyn.comp.setVisibility( Ge.VISIBILITY_INVISIBLE);
else
dyn.comp.setVisibility( Ge.VISIBILITY_DIMMED);
}
else {
dyn.comp.setVisibility( Ge.VISIBILITY_VISIBLE);
}
dyn.repaintNow = true;
oldValueB = value;
break;
}
else
firstScan = false;
case Pwr.eType_String: {
String value0;
value0 = dyn.en.gdh.getObjectRefInfoString( p, typeId);
if ( (!inverted && value) || (inverted && !value)) {
dyn.invisible = true;
if ( firstScan || value0.compareTo( oldValueS) != 0) {
if ( value0.compareTo("") == 0) {
if ( dimmed == 0)
dyn.comp.setVisibility( Ge.VISIBILITY_INVISIBLE);
else
dyn.comp.setVisibility( Ge.VISIBILITY_DIMMED);
}
else {
dyn.comp.setVisibility( Ge.VISIBILITY_VISIBLE);
}
dyn.repaintNow = true;
oldValueS = value0;
if ( firstScan)
firstScan = false;
}
break;
}
else {
dyn.invisible = false;
}
dyn.repaintNow = true;
oldValue = value;
}
}
......
......@@ -6,12 +6,24 @@ import javax.swing.*;
public class GeDynTipText extends GeDynElem {
String text;
boolean attrFound = false;
public GeDynTipText( GeDyn dyn, String text) {
super( dyn, GeDyn.mDynType_No, GeDyn.mActionType_TipText);
this.text = text;
}
public void connect() {
((JComponent)dyn.comp).setToolTipText( text);
if ( text.charAt(0) == '&') {
String attrName = dyn.getAttrName( text.substring(1));
CdhrString cdhr = dyn.en.gdh.getObjectInfoString( attrName);
if ( cdhr.evenSts()) return;
((JComponent)dyn.comp).setToolTipText( cdhr.str);
attrFound = true;
}
else
((JComponent)dyn.comp).setToolTipText( text);
}
public void disconnect() {
}
......
......@@ -92,19 +92,19 @@ public class GeFrameThin extends GeComponent {
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(78, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor));
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor, false));
g.draw( shapes[0]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(78, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor));
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor, false));
g.draw( shapes[1]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(40, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor));
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor, false));
g.draw( shapes[2]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(40, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor));
colorShift, colorIntensity, colorBrightness, colorInverse, borderColor, false));
g.draw( shapes[3]);
g.setTransform(save);
}
......
......@@ -206,7 +206,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
this.fillColor = fillColor;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
......@@ -214,7 +214,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
public void tsetColorTone( int colorTone) {
this.colorTone = colorTone;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, GeColor.NO_COLOR);
colorShift, colorIntensity, colorBrightness, colorInverse, GeColor.NO_COLOR, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
......@@ -225,7 +225,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
public void resetFillColor() {
fillColor = originalFillColor;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
......@@ -233,13 +233,14 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
public void resetColorTone() {
colorTone = originalColorTone;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
}
public void resetBorderColor() {}
public void resetTextColor() {}
public void setVisibility( int visibility) {}
public String getAnnot1() { return "";}
public void setAnnot1( String s) {}
public void setLastPage() {}
......@@ -326,7 +327,7 @@ public class GeTable extends JScrollPane implements GeComponentIfc,
dd.connect();
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
table.setBackground( normalColor);
if ( hColumn == 1)
headerColumn.setBackground( normalColor);
......
......@@ -133,13 +133,13 @@ public class GeTextField extends JTextField implements GeComponentIfc,
this.fillColor = fillColor;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
setBackground( normalColor);
}
public void tsetColorTone( int colorTone) {
this.colorTone = colorTone;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, GeColor.NO_COLOR);
colorShift, colorIntensity, colorBrightness, colorInverse, GeColor.NO_COLOR, false);
setBackground( normalColor);
}
public void setShadow( int shadow) {}
......@@ -149,13 +149,13 @@ public class GeTextField extends JTextField implements GeComponentIfc,
public void resetFillColor() {
fillColor = originalFillColor;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
setBackground( normalColor);
}
public void resetColorTone() {
colorTone = originalColorTone;
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
setBackground( normalColor);
}
public void resetBorderColor() {}
......@@ -176,6 +176,7 @@ public class GeTextField extends JTextField implements GeComponentIfc,
public void setLevelDirection( int levelDirection) {}
public void setLevelColorTone( int levelColorTone) {}
public void setLevelFillColor( int levelFillColor) {}
public void setVisibility( int visibility) {}
Font annot1Font = new Font("Helvetica", Font.BOLD, 14);
public Font annotFont = annot1Font;
......@@ -265,7 +266,7 @@ public class GeTextField extends JTextField implements GeComponentIfc,
dd.connect();
normalColor = GeColor.getColor( fillColor, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor);
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false);
setBackground( normalColor);
}
public void dynamicClose() {
......
......@@ -192,13 +192,13 @@ public class JopButtontoggle extends JComponent implements JopDynamic, ActionLis
Math.PI * rotate/180,((double)original_width)/2, ((double)original_height)/2));
g.transform( AffineTransform.getScaleInstance( scaleWidth, scaleHeight));
g.setColor(GeColor.getColor(22, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor));
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false));
g.fill( shapes[0]);
g.setColor(GeColor.getColor(20, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor));
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false));
g.fill( shapes[1]);
g.setColor(GeColor.getColor(23, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor));
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false));
g.fill( shapes[2]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(0, borderColor));
......
......@@ -141,7 +141,7 @@ public class JopFilter extends JComponent implements JopDynamic, ActionListener{
Math.PI * rotate/180,((double)original_width)/2, ((double)original_height)/2));
g.transform( AffineTransform.getScaleInstance( scaleWidth, scaleHeight));
g.setColor(GeColor.getColor(21, colorTone,
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor));
colorShift, colorIntensity, colorBrightness, colorInverse, fillColor, false));
g.fill( shapes[0]);
g.setStroke( new BasicStroke(1F));
g.setColor(GeColor.getColor(0, borderColor));
......
......@@ -140,7 +140,7 @@ System.out.println( "qcom put finished");
// Replace * by node object
if ( objectValue.charAt(0) == '*') {
CdhrObjid cdhr_node = gdh.getNodeObject();
CdhrObjid cdhr_node = gdh.getNodeObject(0);
if ( cdhr_node.evenSts())
return;
CdhrString cdhr_nodestr = gdh.objidToName( cdhr_node.objid, Cdh.mName_volumeStrict);
......
......@@ -64,6 +64,7 @@ local_java_sources := \
GeDynOptionMenu.java \
GeDynAnalogText.java \
GeDynTable.java \
GeDynHostObject.java \
Proportion.java\
RatioLayout.java \
AspectRatioListener.java \
......
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