Commit 79d46fce authored by jack engstrm's avatar jack engstrm

Merge branch 'master' of 62.20.65.89:/data1/git/pwr

parents ec799ba0 3a108f36
This diff is collapsed.
......@@ -370,11 +370,27 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getSuperClass
/*
* Class: jpwr_rt_Gdh
* Method: getObjectBodyDef
* Signature: (ILjpwr/rt/PwrtAttrRef;)[Ljpwr/rt/GdhrsAttrDef;
* Signature: (ILjpwr/rt/PwrtAttrRef;)Ljpwr/rt/GdhrsAttrDef;
*/
JNIEXPORT jobjectArray JNICALL Java_jpwr_rt_Gdh_getObjectBodyDef
(JNIEnv *, jobject, jint, jobject);
/*
* Class: jpwr_rt_Gdh
* Method: getCircBuffInfo
* Signature: (Ljpwr/rt/CircBuffInfo;)I
*/
JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_getCircBuffInfo
(JNIEnv *, jobject, jobject);
/*
* Class: jpwr_rt_Gdh
* Method: updateCircBuffInfo
* Signature: (Ljpwr/rt/CircBuffInfo[];I)I
*/
JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_updateCircBuffInfo
(JNIEnv *, jobject, jobject, jint);
#ifdef __cplusplus
}
#endif
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import jpwr.jop.*;
import java.beans.Beans;
/** RatioLayout.java -- Layout manager for Java containers
*
* This layout manager allows you to specify ratios of x,y,width,height
* using a Proportion object.
*
* For example,
*
* setLayout(new RatioLayout());
* add( myObject, new Proportion(myObject.getBounds(), this.getSize()));
*
* @author Mats Trovik inspired by RatioLayout.java by Terence Parr
*
*/
public class RatioLayout implements LayoutManager2 {
// track the ratios for each object of form "xratio,yratio;wratio,hratio"
//Vector<Proportion> ratios = new Vector<Proportion>(1);
Vector ratios = new Vector(1);
// track the components also so we can remove associated modifier
// if necessary.
//Vector<Component> components = new Vector<Component>(1);
Vector components = new Vector(1);
public void addLayoutComponent(String r, Component comp) {
}
// The used method for adding components.
public void addLayoutComponent(Component comp, Object o){
Proportion r = (Proportion) o;
ratios.addElement(r);
components.addElement(comp);
}
//Maximum layout size depends on the target (as opposed to the normal case)
public Dimension maximumLayoutSize(Container target){
return target.getSize();
}
public float getLayoutAlignmentX(Container target){
//The layout is left aligned
return (float) 0.0;
}
public float getLayoutAlignmentY(Container target){
//the layout is top aligned
return (float) 0.0;
}
//Reset the Layout
public void invalidateLayout(Container target){
// This is called more frequently in 1.5...
// ratios = new Vector(1);
//components = new Vector(1);
}
// Remove component from Layout
public void removeLayoutComponent(Component comp) {
int i = components.indexOf(comp);
if ( i!=-1 ) {
ratios.removeElementAt(i);
components.removeElementAt(i);
}
}
public Dimension preferredLayoutSize(Container target) {
return target.getSize();
}
public Dimension minimumLayoutSize(Container target) {
return target.getSize();
}
public void layoutContainer(Container target) {
Insets insets = target.getInsets();
int ncomponents = target.getComponentCount();
Dimension d = target.getSize();
//make sure to not draw over the insets.(Java standard)
d.width -= insets.left+insets.right;
d.height -= insets.top+insets.bottom;
System.out.println( "RatioLayout: width " + d.width + " height " + d.height);
//Layout each component
for (int i = 0 ; i < ncomponents ; i++) {
Component comp = target.getComponent(i);
Proportion compProp;
try {
compProp = (Proportion)ratios.elementAt(i);
}
catch (ArrayIndexOutOfBoundsException e){
break;
}
//Set the width and height according to the ratio specified when
//the component was added.
int w = (int)(d.width*compProp.rw);
int h = (int)(d.height*compProp.rh);
// set x & y to the ratio specified when the component was added.
//These values will be changed if the comonent is a slider or
//a moving GeComponent.
int x = (int) (d.width*compProp.rx);
int y = (int) (d.height*compProp.ry);
if(comp instanceof GeComponent){
GeComponent tempComp= (GeComponent) comp;
//If the component is of type mDynType_Move...
if((tempComp.dd.dynType & GeDyn.mDynType_Move) != 0){
if (compProp.firstDraw){
// ... and it's drawn for the first time, store the
//parent's dimension in Proportion.previous,
compProp.firstDraw=false;
compProp.previous.setSize(d.width,d.height);
}
else{
/*... and it's drawn for at least the 2nd time, the
*place where to draw it is caculated from the ratio
*between the the current dimensions of the parent and
*the previous dimensions (before resize)
*of the parent multiplied with the position of the
*object. Care is taken to only adjust the position in
*the direction(s) specified by the GeDynMove.moveX(Y)Attribute.
*The current dimensions of the parent are stored
*in Proportion.previous.*/
for(int j=0;j<tempComp.dd.elements.length;j++)
{
if(tempComp.dd.elements[j] instanceof GeDynMove){
Rectangle compLoc = comp.getBounds();
if ((! ((GeDynMove)tempComp.dd.elements[j]).moveXAttribute.equals(""))){
double rx = (1.0*d.width /compProp.previous.width );
x = (int) (compLoc.x*rx);
}
if ((! ((GeDynMove)tempComp.dd.elements[j]).moveYAttribute.equals(""))){
double ry = (1.0*d.height/compProp.previous.height);
y = (int) (compLoc.y*ry);
}
}
compProp.previous.setSize(d.width,d.height);
}
}
}
//If the component is a slider...
else if((tempComp.dd.actionType & GeDyn.mActionType_Slider) != 0){
if (compProp.firstDraw){
// ... and it's drawn for the first time, store the
//parent's dimension in Proportion.previous,
compProp.firstDraw=false;
compProp.previous.setSize(d.width,d.height);
}
else{
/*... and it's drawn for at least the 2nd time,
*the direction of the slider is checked.
*The ratio between the target width or height
*(after resize) and the previous width or
*height is used to calculate the position
*fitting the new size. The current dimensions
*of the parent are stored in Proportion.previous.*/
for(int j=0;j<tempComp.dd.elements.length;j++)
{
if(tempComp.dd.elements[j] instanceof GeDynSlider){
Rectangle compLoc = comp.getBounds();
if (
((GeDynSlider)tempComp.dd.elements[j]).direction == Ge.DIRECTION_LEFT
||
((GeDynSlider)tempComp.dd.elements[j]).direction == Ge.DIRECTION_RIGHT){
double rx = (1.0*d.width /compProp.previous.width );
x = (int) (compLoc.x*rx);
}
else if (
((GeDynSlider)tempComp.dd.elements[j]).direction == Ge.DIRECTION_UP
||
((GeDynSlider)tempComp.dd.elements[j]).direction == Ge.DIRECTION_DOWN){
double ry = (1.0*d.height/compProp.previous.height);
y = (int) (compLoc.y*ry);
}
}
}
compProp.previous.setSize(d.width,d.height);
}
}
}
//Place the component.
comp.setBounds(x+insets.left,y+insets.top,w,h);
//Resize the font of JTextFields.
if (comp instanceof JTextField){
comp.setFont(comp.getFont().deriveFont((float)(1.0*h*6/10)));
}
}
}
public String toString() {
return getClass().getName();
}
}
......@@ -127,6 +127,9 @@ public class JopAxis extends JComponent {
public Font getFont() {
return font;
}
public void reconfigure() {
shapes = null;
}
public double rotate;
public void setRotate( double rotate) { this.rotate = rotate;}
public double getRotate() { return rotate;}
......@@ -313,7 +316,6 @@ public class JopAxis extends JComponent {
if ( 45.0 <= rotate && rotate < 135.0) {
g.translate( -height, 0.0);
g.rotate( - Math.PI * rotate/180, height, 0.0);
g.transform( AffineTransform.getScaleInstance( height/width, width/height));
}
else if ( 135.0 <= rotate && rotate < 225.0)
{
......@@ -357,6 +359,10 @@ public class JopAxis extends JComponent {
public float getMinValue() {
return minValue;
}
public void setFixHeight( float fixHeight) {
size.setSize( size.getWidth(), fixHeight);
setSize(size);
}
}
......
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.awt.font.*;
import javax.swing.*;
import java.awt.event.*;
import jpwr.rt.*;
public class JopCurveAxis extends JComponent {
Dimension size;
public JopCurveAxis()
{
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
size = new Dimension( 102, 36);
}
int fillColor = 9999;
int borderColor = 9999;
public int originalTextColor = 9999;
public int textColor = 9999;
int lineWidth = 1;
float lineLength;
int lines = 11;
int longQuotient = 1;
int valueQuotient = 1;
GeCFormat cFormat;
Font font;
public void setFillColor( int fillColor) {
this.fillColor = fillColor;
}
public int getFillColor() {
return fillColor;
}
public void setBorderColor( int borderColor) {
this.borderColor = borderColor;
}
public int getBorderColor() {
return borderColor;
}
public void setTextColor( int textColor) {
this.textColor = textColor;
this.originalTextColor = textColor;
}
public int getTextColor() {
return textColor;
}
public void setLineWidth( int lineWidth) {
this.lineWidth = lineWidth;
}
public int getLineWidth() {
return lineWidth;
}
public void setLineLength( float lineLength) {
this.lineLength = lineLength;
}
public float getLineLength() {
return lineLength;
}
public void setLines( int lines) {
this.lines = lines;
}
public int getLines() {
return lines;
}
public void setLongQuotient( int longQuotient) {
this.longQuotient = longQuotient;
}
public int getLongQuotient() {
return longQuotient;
}
public void setValueQuotient( int valueQuotient) {
this.valueQuotient = valueQuotient;
}
public int getValueQuotient() {
return valueQuotient;
}
public void setFormat( String format) {
this.cFormat = new GeCFormat(format);
}
public void setFont( Font font) {
this.font = font;
}
public Font getFont() {
return font;
}
public void reconfigure() {
shapes = null;
}
public double rotate;
public void setRotate( double rotate) { this.rotate = rotate;}
public double getRotate() { return rotate;}
Shape[] shapes = null;
Line2D.Float[] hLines;
public void paint(Graphics g1) {
super.paint(g1);
Graphics2D g = (Graphics2D) g1;
Component c;
Point p;
paintComponent(g);
for ( int i = 0; i < getComponentCount(); i++) {
AffineTransform save = g.getTransform();
c = getComponent(i);
p = c.getLocation();
g.translate((int)p.getX(), (int)p.getY());
c.paint(g);
g.setTransform(save);
}
}
float hTextPosX[];
float hTextPosY[];
String hText[];
float oldHeight;
float heightOrig = 0;
float widthOrig = 0;
public void paintComponent(Graphics g1) {
int i, j;
Graphics2D g = (Graphics2D) g1;
float width = getWidth();
float height = getHeight();
AffineTransform save = g.getTransform();
float delta;
float value;
boolean drawText = (minValue != maxValue);
if ( heightOrig == 0) {
heightOrig = height;
widthOrig = width;
}
//g.setFont( font);
g.setFont( font.deriveFont( width / widthOrig * font.getSize()));
if ( shapes == null || height != oldHeight) {
float lineLen = this.lineLength * width / widthOrig;
shapes = new Shape[1];
FontRenderContext frc = g.getFontRenderContext();
if ( lines > 0)
{
hLines = new Line2D.Float[lines];
if ( drawText) {
hText = new String[lines/valueQuotient + 1];
hTextPosY = new float[lines/valueQuotient + 1];
hTextPosX = new float[lines/valueQuotient + 1];
}
if ( 135.0 <= rotate && rotate < 225.0) {
shapes[0] = new Line2D.Float(0F, 0F, 0F, height);
delta = height / ( lines - 1);
for ( i = 0; i < lines; i++) {
if ( i % longQuotient == 0)
hLines[i] = new Line2D.Float( 0F, delta * i,
lineLen, delta * i);
else
hLines[i] = new Line2D.Float( 0F,
delta * i, 2F/3F*lineLen, delta * i);
if ( drawText && i % valueQuotient == 0) {
if ( maxValue > minValue)
value = minValue + (maxValue - minValue) / ( lines - 1) * i;
else
value = minValue - (minValue - maxValue) / ( lines - 1) * i;
hText[i/valueQuotient] =
cFormat.format( value, new StringBuffer()).toString();
Rectangle2D textBounds =
g.getFont().getStringBounds( hText[i/valueQuotient], frc);
float textHeight = (float) textBounds.getHeight();
if ( i == 0)
hTextPosY[i/valueQuotient] = height;
else if ( i == lines - 1)
hTextPosY[i/valueQuotient] = 0F + textHeight/2;
else
hTextPosY[i/valueQuotient] = height - delta * i + textHeight/4;
hTextPosX[i/valueQuotient] = lineLen;
}
}
}
}
}
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
if ( isOpaque()) {
g.setColor(GeColor.getColor(0, fillColor));
g.fill( new Rectangle2D.Float( 0F, 0F, width, height));
}
g.setStroke( new BasicStroke((float)lineWidth));
g.setColor(GeColor.getColor(0, borderColor));
g.draw( shapes[0]);
for ( i = 0; i < lines; i++)
g.draw( hLines[i]);
if ( drawText) {
for ( i = 0; i < lines; i++) {
if ( i % valueQuotient == 0) {
g.drawString( hText[i/valueQuotient], hTextPosX[i/valueQuotient],
hTextPosY[i/valueQuotient]);
}
}
}
oldHeight = height;
}
public Dimension getPreferredSize() { return size;}
public Dimension getMinimumSize() { return size;}
float minValue = 0;
float maxValue = 100;
public void setMinValue( float minValue) {
this.minValue = minValue;
}
public void setMaxValue( float maxValue) {
this.maxValue = maxValue;
}
public float getMaxValue() {
return maxValue;
}
public float getMinValue() {
return minValue;
}
public void setFixHeight( float fixHeight) {
size.setSize( size.getWidth(), fixHeight);
setSize(size);
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import jpwr.jop.*;
import java.beans.Beans;
/** JopCurveAxisLayout.java -- Layout manager for Java containers
*
* This layout manager allows you to specify ratios of x,y,width,height
* using a Proportion object.
*
* For example,
*
* setLayout(new JopCurveAxisLayout());
* add( myObject, new Proportion(myObject.getBounds(), this.getSize()));
*
* @author Mats Trovik inspired by RatioLayout.java by Terence Parr
*
*/
public class JopCurveAxisLayout implements LayoutManager2 {
// track the ratios for each object of form "xratio,yratio;wratio,hratio"
//Vector<Proportion> ratios = new Vector<Proportion>(1);
Vector ratios = new Vector(1);
// track the components also so we can remove associated modifier
// if necessary.
//Vector<Component> components = new Vector<Component>(1);
Vector components = new Vector(1);
public void addLayoutComponent(String r, Component comp) {
}
// The used method for adding components.
public void addLayoutComponent(Component comp, Object o){
Proportion r = (Proportion) o;
ratios.addElement(r);
components.addElement(comp);
}
//Maximum layout size depends on the target (as opposed to the normal case)
public Dimension maximumLayoutSize(Container target){
return target.getSize();
}
public float getLayoutAlignmentX(Container target){
//The layout is left aligned
return (float) 0.0;
}
public float getLayoutAlignmentY(Container target){
//the layout is top aligned
return (float) 0.0;
}
//Reset the Layout
public void invalidateLayout(Container target){
// This is called more frequently in 1.5...
// ratios = new Vector(1);
//components = new Vector(1);
}
// Remove component from Layout
public void removeLayoutComponent(Component comp) {
int i = components.indexOf(comp);
if ( i!=-1 ) {
ratios.removeElementAt(i);
components.removeElementAt(i);
}
}
public Dimension preferredLayoutSize(Container target) {
return target.getSize();
}
public Dimension minimumLayoutSize(Container target) {
return target.getSize();
}
int origHeight = 0;
public void layoutContainer(Container target) {
Insets insets = target.getInsets();
int ncomponents = target.getComponentCount();
Dimension d = target.getSize();
//make sure to not draw over the insets.(Java standard)
d.width -= insets.left+insets.right;
d.height -= insets.top+insets.bottom;
//System.out.println( "AxisLayout: width " + d.width + " height " + d.height + " origH " + origHeight);
if ( origHeight == 0)
origHeight = d.height;
//Layout each component
for (int i = 0 ; i < ncomponents ; i++) {
Component comp = target.getComponent(i);
Proportion compProp;
try {
compProp = (Proportion)ratios.elementAt(i);
}
catch (ArrayIndexOutOfBoundsException e){
break;
}
//Set the width and height according to the ratio specified when
//the component was added.
int w = comp.getWidth();
int h = d.height;
// set x & y to the ratio specified when the component was added.
//These values will be changed if the comonent is a slider or
//a moving GeComponent.
int x = (int) comp.getX();
int y = (int) (comp.getY() * (double)d.height / origHeight);
if ( i == ncomponents - 1)
w = d.width - x;
else
h -= 43;
//System.out.println( "Comp: w " + w + " h " + h + " x " + x + " y " + y);
//Place the component.
comp.setBounds(x+insets.left,y+insets.top,w,h);
//Resize the font of JTextFields.
if (comp instanceof JTextField){
comp.setFont(comp.getFont().deriveFont((float)(1.0*h*6/10)));
}
}
}
public String toString() {
return getClass().getName();
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import jpwr.jop.*;
import java.beans.Beans;
/** JopCurveChartLayout.java -- Layout manager for Java containers
*
* This layout manager allows you to specify ratios of x,y,width,height
* using a Proportion object.
*
* For example,
*
* setLayout(new JopCurveChartLayout());
* add( myObject, new Proportion(myObject.getBounds(), this.getSize()));
*
* @author Mats Trovik inspired by RatioLayout.java by Terence Parr
*
*/
public class JopCurveChartLayout implements LayoutManager2 {
// track the ratios for each object of form "xratio,yratio;wratio,hratio"
//Vector<Proportion> ratios = new Vector<Proportion>(1);
Vector ratios = new Vector(1);
// track the components also so we can remove associated modifier
// if necessary.
//Vector<Component> components = new Vector<Component>(1);
Vector components = new Vector(1);
public static final int AXIS_HEIGHT = 28;
public void addLayoutComponent(String r, Component comp) {
}
// The used method for adding components.
public void addLayoutComponent(Component comp, Object o){
Proportion r = (Proportion) o;
ratios.addElement(r);
components.addElement(comp);
}
//Maximum layout size depends on the target (as opposed to the normal case)
public Dimension maximumLayoutSize(Container target){
return target.getSize();
}
public float getLayoutAlignmentX(Container target){
//The layout is left aligned
return (float) 0.0;
}
public float getLayoutAlignmentY(Container target){
//the layout is top aligned
return (float) 0.0;
}
//Reset the Layout
public void invalidateLayout(Container target){
// This is called more frequently in 1.5...
// ratios = new Vector(1);
//components = new Vector(1);
}
// Remove component from Layout
public void removeLayoutComponent(Component comp) {
int i = components.indexOf(comp);
if ( i!=-1 ) {
ratios.removeElementAt(i);
components.removeElementAt(i);
}
}
public Dimension preferredLayoutSize(Container target) {
return target.getSize();
}
public Dimension minimumLayoutSize(Container target) {
return target.getSize();
}
int origHeight = 0;
public void layoutContainer(Container target) {
Insets insets = target.getInsets();
int ncomponents = target.getComponentCount();
Dimension d = target.getSize();
//make sure to not draw over the insets.(Java standard)
d.width -= insets.left+insets.right;
d.height -= insets.top+insets.bottom;
//System.out.println( "ChartLayout: width " + d.width + " height " + d.height + " origH " + origHeight);
if ( origHeight == 0)
origHeight = d.height;
//Layout each component
for (int i = 0 ; i < ncomponents ; i++) {
Component comp = target.getComponent(i);
Proportion compProp;
try {
compProp = (Proportion)ratios.elementAt(i);
}
catch (ArrayIndexOutOfBoundsException e){
break;
}
//Set the width and height according to the ratio specified when
//the component was added.
int w = comp.getWidth();
int h;
int y;
if ( i == 0) {
h = d.height - AXIS_HEIGHT;
y = 0;
}
else {
h = AXIS_HEIGHT;
y = d.height - AXIS_HEIGHT;
}
// set x & y to the ratio specified when the component was added.
//These values will be changed if the comonent is a slider or
//a moving GeComponent.
int x = (int) comp.getX();
// int y = (int) (comp.getY() * (double)d.height / origHeight);
//System.out.println( "CompChart: w " + w + " h " + h + " x " + x + " y " + y);
//Place the component.
comp.setBounds(x+insets.left,y+insets.top,w,h);
//Resize the font of JTextFields.
if (comp instanceof JTextField){
comp.setFont(comp.getFont().deriveFont((float)(1.0*h*6/10)));
}
}
}
public String toString() {
return getClass().getName();
}
}
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import jpwr.rt.*;
public interface JopCurveIfc {
public void close();
}
......@@ -103,10 +103,10 @@ public class JopMethods {
return false; // NYI
}
else if ( method.equals("Trend")) {
return false; // NYI
return trendFilter();
}
else if ( method.equals("Fast")) {
return false; // NYI
return fastFilter();
}
else if ( method.equals("Photo")) {
return false; // NYI
......@@ -161,13 +161,13 @@ public class JopMethods {
// NYI
}
else if ( method.equals("Trend")) {
// NYI
trend();
}
else if ( method.equals("Fast")) {
// NYI
fast();
}
else if ( method.equals("Photo")) {
// NYI
photo();
}
else if ( method.equals("Note")) {
// NYI
......@@ -318,6 +318,70 @@ public class JopMethods {
session.executeCommand( cmd);
}
public boolean trendFilter() {
CdhrClassId cret = gdh.getObjectClass( aref.getObjid());
if ( cret.evenSts()) return false;
if ( cret.classId == Pwrb.cClass_DsTrend ||
cret.classId == Pwrb.cClass_DsTrendCurve ||
cret.classId == Pwrb.cClass_PlotGroup)
return true;
String attr = object + ".DefTrend";
CdhrString sret = gdh.getObjectInfoString( attr);
if ( sret.evenSts())
return false;
if ( sret.str.equals(""))
return false;
return true;
}
public void trend() {
CdhrClassId cret = gdh.getObjectClass( aref.getObjid());
if ( cret.evenSts()) return;
if ( cret.classId == Pwrb.cClass_DsTrend ||
cret.classId == Pwrb.cClass_DsTrendCurve ||
cret.classId == Pwrb.cClass_PlotGroup) {
String cmd = "open trend /name=" + object;
System.out.println( "trend: " + cmd);
session.executeCommand( cmd);
return;
}
String attr = object + ".DefTrend";
CdhrString deftrend = gdh.getObjectInfoString( attr);
if ( deftrend.evenSts()) return;
String cmd = "open trend /name=" + deftrend;
System.out.println( "trend: " + cmd);
session.executeCommand( cmd);
}
public boolean fastFilter() {
CdhrClassId cret = gdh.getObjectClass( aref.getObjid());
if ( cret.evenSts()) return false;
if ( cret.classId == Pwrb.cClass_DsFastCurve)
return true;
return false;
}
public void fast() {
CdhrClassId cret = gdh.getObjectClass( aref.getObjid());
if ( cret.evenSts()) return;
if ( cret.classId == Pwrb.cClass_DsFastCurve) {
String cmd = "open fast /name=" + object;
System.out.println( "fast: " + cmd);
session.executeCommand( cmd);
}
}
public boolean dataSheetFilter() {
String attr = object + ".DataSheet";
CdhrString sret = gdh.getObjectInfoString( attr);
......@@ -429,7 +493,6 @@ public class JopMethods {
else
// Java name equals class name
name = sret.str.substring(0,1).toUpperCase() + sret.str.substring(1).toLowerCase();
System.out.println( "classGraphFilter: " + name + ", class: " + sret.str);
try {
Class clazz = Class.forName( name);
......
......@@ -76,62 +76,72 @@ public class JopMethodsMenu implements ActionListener, PopupMenuListener,
JMenuItem item;
if ( methods.openGraphFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Graph")));
popup.add( item = new JMenuItem( JopLang.transl("Graph")));
item.addActionListener( this);
}
if ( methods.openObjectGraphFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Object Graph")));
popup.add( item = new JMenuItem( JopLang.transl("Object Graph")));
item.addActionListener( this);
}
if ( methods.trendFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Trend")));
item.addActionListener( this);
}
if ( methods.fastFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Fast")));
item.addActionListener( this);
}
if ( methods.helpFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Help")));
popup.add( item = new JMenuItem( JopLang.transl("Help")));
item.addActionListener( this);
}
if ( methods.photoFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Photo")));
popup.add( item = new JMenuItem( JopLang.transl("Photo")));
item.addActionListener( this);
}
if ( methods.dataSheetFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("DataSheet")));
popup.add( item = new JMenuItem( JopLang.transl("DataSheet")));
item.addActionListener( this);
}
if ( methods.rtNavigatorFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Navigator")));
popup.add( item = new JMenuItem( JopLang.transl("Navigator")));
item.addActionListener( this);
}
if ( methods.openTraceFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Open Plc")));
popup.add( item = new JMenuItem( JopLang.transl("Open Plc")));
item.addActionListener( this);
}
if ( methods.openCrossrefFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Crossreferences")));
popup.add( item = new JMenuItem( JopLang.transl("Crossreferences")));
item.addActionListener( this);
}
if ( methods.helpClassFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Help Class")));
popup.add( item = new JMenuItem( JopLang.transl("Help Class")));
item.addActionListener( this);
}
if ( methods.circuitDiagramFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("CircuitDiagram")));
popup.add( item = new JMenuItem( JopLang.transl("CircuitDiagram")));
item.addActionListener( this);
}
if ( methods.histEventFilter()){
popup.add(item= new JMenuItem( JopLang.transl("Hist Event...")));
popup.add(item= new JMenuItem( JopLang.transl("Hist Event...")));
item.addActionListener( this);
}
if ( methods.simulateFilter()){
popup.add(item= new JMenuItem( JopLang.transl("Simulate")));
popup.add(item= new JMenuItem( JopLang.transl("Simulate")));
item.addActionListener( this);
}
popup.addPopupMenuListener( this);
......@@ -154,6 +164,12 @@ public class JopMethodsMenu implements ActionListener, PopupMenuListener,
else if ( event.getActionCommand().equals(JopLang.transl("Graph"))) {
methods.openGraph();
}
else if ( event.getActionCommand().equals(JopLang.transl("Trend"))) {
methods.trend();
}
else if ( event.getActionCommand().equals(JopLang.transl("Fast"))) {
methods.fast();
}
else if ( event.getActionCommand().equals(JopLang.transl("Help"))) {
methods.help();
}
......
......@@ -160,6 +160,14 @@ public class JopSession {
public void setOpWindowLanguage( int language ){
((JopSessionIfc) sessionRep).setOpWindowLanguage( language);
}
public void openTrend( String[] trendList) {
((JopSessionIfc) sessionRep).openTrend( trendList);
}
public void openFast( String fastObject) {
((JopSessionIfc) sessionRep).openFast( fastObject);
}
}
......
......@@ -64,4 +64,6 @@ public interface JopSessionIfc {
public void openSearch(String object);
public void setOpWindowLabelText( String text );
public void setOpWindowLanguage( int language );
public void openTrend( String[] trendList);
public void openFast( String fastObject);
}
......@@ -396,12 +396,22 @@ public class JopSessionRep implements JopSessionIfc {
else if ( isOpWindowFrame())
((JopOpWindowFrame)root).setLabelText( text);
}
public void setOpWindowLanguage( int language) {
if ( isOpWindowApplet())
((JopOpWindowApplet)root).setLanguage( language);
else if ( isOpWindowFrame())
((JopOpWindowFrame)root).setLanguage( language);
}
public void openTrend( String[] trendList) {
new JopXttTrend( session, trendList);
}
public void openFast( String fastObject) {
new JopXttFast( session, fastObject);
}
}
......
......@@ -136,6 +136,8 @@ System.out.println( "qcom put finished");
String jgraph = "JGRAPH";
String graph = "GRAPH";
String url = "URL";
String trend = "TREND";
String fast = "FAST";
String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase();
if ( jgraph.length() >= cli_arg1.length() &&
jgraph.substring(0,cli_arg1.length()).equals(cli_arg1)) {
......@@ -369,9 +371,37 @@ System.out.println( "qcom put finished");
openURL( session, urlValue, newFrame, frameName, null);
}
}
else if ( root instanceof JFrame) {
System.out.println( "Not yet implemented");
}
}
else if ( trend.length() >= cli_arg1.length() &&
trend.substring(0,cli_arg1.length()).equals(cli_arg1)) {
// Command is "OPEN TREND"
String name;
if ( cli.qualifierFound("cli_arg2"))
name = cli.getQualValue("cli_arg2");
else
name = cli.getQualValue("/NAME");
StringTokenizer tokens = new StringTokenizer( name, ",");
int cnt = tokens.countTokens();
String[] trendList = new String[cnt];
for ( int i = 0; i < cnt; i++)
trendList[i] = tokens.nextToken();
session.openTrend( trendList);
}
else if ( fast.length() >= cli_arg1.length() &&
fast.substring(0,cli_arg1.length()).equals(cli_arg1)) {
// Command is "OPEN FAST"
String name;
if ( cli.qualifierFound("cli_arg2"))
name = cli.getQualValue("cli_arg2");
else
name = cli.getQualValue("/NAME");
session.openFast( name);
}
else {
System.out.println( "Unknown command");
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import javax.swing.table.*;
import javax.swing.border.*;
import javax.swing.Timer;
import java.net.URL;
import jpwr.rt.*;
public class JopXttFast implements ActionListener, JopCurveIfc {
public static final int XTT_FAST_MAX = 20;
public static final int FAST_CURVES = 10;
public static final int mFunction_ManTrigg = 1;
public static final int mFunction_LevelTrigg = 2;
public static final int mFunction_BeforeTrigg = 4;
public static final int mFunction_AlwaysPrepared = 8;
public static final int mFunction_User = 16;
JopSession session;
JopEngine engine;
Object root;
Timer timer;
JopCurve curve;
int fast_cnt = 2;
int min_interval_idx;
int max_time;
int min_interval;
int[] interval = new int[XTT_FAST_MAX];
int[] last_buffer = new int[XTT_FAST_MAX];
int[] last_next_index = new int[XTT_FAST_MAX];
JopCurveData gcd;
int fast_tid;
String[] buffers = new String[XTT_FAST_MAX];
String timeBuffer;
int[] element_type = new int[XTT_FAST_MAX];
float[] yMinValue = new float[XTT_FAST_MAX];
float[] yMaxValue = new float[XTT_FAST_MAX];
boolean[] fixScale = new boolean[XTT_FAST_MAX];
int update_time;
String fastObject;
int noOfPoints;
int fastFunction;
boolean newCurve;
boolean oldNewCurve;
public JopXttFast( String fastObject) {
engine = new JopEngine( 1000, (Object)this);
session = new JopSession( engine, (Object)this);
this.fastObject = fastObject;
init();
}
public JopXttFast( JopSession session, String fastObject) {
this.session = session;
engine = session.getEngine();
this.fastObject = fastObject;
init();
}
public void close() {
timer.stop();
}
void init() {
int i, j, k;
int start_idx;
int fast_buff_size = 478;
timer = new Timer( 1000, this);
if ( fast_cnt == 0) {
System.out.println("Error in fast configuration");
return;
}
CdhrObjid oret = engine.gdh.nameToObjid( fastObject);
if ( oret.evenSts()) {
System.out.println("Error in fast configuration");
return;
}
CdhrClassId cret = engine.gdh.getObjectClass( oret.objid);
if ( cret.evenSts()) {
System.out.println("Error in fast configuration");
return;
}
fast_tid = cret.classId;
if ( fast_tid == Pwrb.cClass_DsFastCurve) {
int[] actual_data_size = new int[XTT_FAST_MAX];
double fmin_interval = 0;
int tcp_i;
int object_cnt = fast_cnt;
float displayTime;
float displayUpdateTime;
float scanTime;
int noOfSample;
int displayResolution;
int timeResolution;
CdhrFloat fret;
// Get current status of the fast object
CdhrInt iret = engine.gdh.getObjectInfoInt( fastObject + ".NoOfPoints");
if ( iret.evenSts())
return;
noOfPoints = iret.value;
iret = engine.gdh.getObjectInfoInt( fastObject + ".Function");
if ( iret.evenSts()) return;
fastFunction = iret.value;
CdhrBoolean bret = engine.gdh.getObjectInfoBoolean( fastObject + ".Active");
if ( bret.evenSts()) return;
boolean active = bret.value;
CdhrString sret = engine.gdh.getObjectInfoString( fastObject + ".TimeBuffer");
if ( sret.evenSts()) return;
timeBuffer = sret.str;
// Create data for time axis
gcd = new JopCurveData( JopCurveData.eDataType_DsTrend);
gcd.x_data[0] = new double[noOfPoints];
gcd.x_name = new String("Time");
gcd.x_axis_type[0] = JopCurveData.eAxis_x;
CdhrFloatArray faret;
if ( !active) {
faret = engine.gdh.getObjectInfoFloatArray( timeBuffer, noOfPoints);
if ( faret.evenSts()) {
System.out.println("Time buffer error, " + timeBuffer);
return;
}
for ( j = 0; j < noOfPoints; j++) {
gcd.x_data[0][j] = faret.value[j];
}
}
fast_cnt = 0;
for ( i = 0; i < FAST_CURVES; i++) {
bret = engine.gdh.getObjectInfoBoolean( fastObject + ".CurveValid[" + i + "]");
if ( bret.evenSts())
return;
boolean curveValid = bret.value;
if ( curveValid) {
gcd.y_data[fast_cnt] = new double[noOfPoints];
fret = engine.gdh.getObjectInfoFloat( fastObject + ".YMinValue[" + fast_cnt + "]");
if ( fret.evenSts()) return;
yMinValue[fast_cnt] = fret.value;
fret = engine.gdh.getObjectInfoFloat( fastObject + ".YMaxValue[" + fast_cnt + "]");
if ( fret.evenSts()) return;
yMaxValue[fast_cnt] = fret.value;
sret = engine.gdh.getObjectInfoString( fastObject + ".Attribute[" + fast_cnt + "]");
if ( sret.evenSts()) return;
String attrName = sret.str;
int offs = attrName.lastIndexOf('.');
String Unit;
if ( offs != -1) {
sret = engine.gdh.getObjectInfoString( attrName.substring(0,offs) + ".Unit");
if ( sret.oddSts())
Unit = sret.str;
else
Unit = new String();
}
else
Unit = new String();
sret = engine.gdh.getObjectInfoString( fastObject + ".Buffers[" + fast_cnt + "]");
if ( sret.evenSts()) return;
buffers[fast_cnt] = sret.str;
gcd.y_axis_type[fast_cnt] = JopCurveData.eAxis_y;
gcd.y_name[fast_cnt] = attrName;
gcd.rows[fast_cnt] = noOfPoints;
gcd.y_unit[i] = Unit;
if ( !active) {
faret = engine.gdh.getObjectInfoFloatArray( buffers[fast_cnt], noOfPoints);
if ( faret.evenSts()) {
System.out.println("Fast object error, " + fastObject);
return;
}
for ( j = 0; j < noOfPoints; j++)
gcd.y_data[fast_cnt][j] = faret.value[j];
}
fast_cnt++;
}
}
gcd.cols = fast_cnt;
}
gcd.x_reverse = true;
gcd.get_borders();
gcd.get_default_axis();
gcd.select_color(false);
for ( i = 0; i < fast_cnt; i++) {
if ( !(yMinValue[i] == 0F && yMaxValue[i] == 0F)) {
fixScale[i] = true;
gcd.scale( gcd.y_axis_type[i], i, gcd.y_value_type[i],
yMinValue[i], yMaxValue[i], false, false);
}
}
curve = new JopCurve( session, this, gcd);
curve.setFillCurve(false);
timer.start();
}
public void actionPerformed( ActionEvent e) {
fast_scan();
}
private void fast_scan() {
if ( fast_tid == Pwrb.cClass_DsFastCurve) {
int size = 0;
int i, j;
boolean active;
CdhrBoolean bret = engine.gdh.getObjectInfoBoolean( fastObject + ".New");
if ( bret.evenSts())
return;
newCurve = bret.value;
if ( newCurve && !oldNewCurve) {
bret = engine.gdh.getObjectInfoBoolean( fastObject + ".Active");
if ( bret.evenSts())
return;
active = bret.value;
if ( active) return;
CdhrFloatArray faret;
faret = engine.gdh.getObjectInfoFloatArray( timeBuffer, noOfPoints);
if ( faret.evenSts()) {
System.out.println("Time buffer error, " + timeBuffer);
return;
}
for ( j = 0; j < noOfPoints; j++) {
gcd.x_data[0][j] = faret.value[j];
}
for ( i = 0; i < fast_cnt; i++) {
faret = engine.gdh.getObjectInfoFloatArray( buffers[i], noOfPoints);
if ( faret.evenSts()) {
System.out.println("Fast object error, " + fastObject);
return;
}
for ( j = 0; j < noOfPoints; j++)
gcd.y_data[i][j] = faret.value[j];
}
gcd.get_borders();
gcd.get_default_axis();
for ( i = 0; i < fast_cnt; i++) {
if ( fixScale[i])
gcd.scale( gcd.y_axis_type[i], i, gcd.y_value_type[i],
yMinValue[i], yMaxValue[i], false, false);
}
curve.updateAxis();
}
oldNewCurve = newCurve;
}
}
public static void main(String[] args)
{
boolean debug = false;
for(int i = 0; i < args.length; i++)
{
if(args[i].equals("-d") || args[i].equals("-D"))
{
debug = true;
}
}
JopXttFast fast = new JopXttFast("H28-Fast");
}
}
This diff is collapsed.
......@@ -1304,7 +1304,27 @@ public class XttTree extends JPanel
Logg.loggToApplet("Select an object");
return;
}
String cmd = "open graph/class/inst=" + name;
int cid = 0;
CdhrObjid oret = gdh.nameToObjid(name);
if ( oret.oddSts()) {
CdhrClassId cret = gdh.getObjectClass(oret.objid);
if ( cret.oddSts())
cid = cret.getClassId();
}
String cmd;
switch ( cid) {
case Pwrb.cClass_DsTrend:
case Pwrb.cClass_DsTrendCurve:
case Pwrb.cClass_PlotGroup:
cmd = "open trend/name=" + name;
break;
case Pwrb.cClass_DsFastCurve:
cmd = "open fast/name=" + name;
break;
default:
cmd = "open graph/class/inst=" + name;
}
session.executeCommand(cmd);
}
catch(Exception e) {
......
......@@ -29,6 +29,7 @@ local_java_sources := \
GeDyn.java \
GeComponent.java \
GeTextField.java \
GeGradient.java \
GeSlider.java \
JopBar.java \
JopTrend.java \
......@@ -78,6 +79,9 @@ local_java_sources := \
JopXYCurve.java \
Proportion.java\
RatioLayout.java \
JopCurveAxis.java \
JopCurveAxisLayout.java \
JopCurveChartLayout.java \
AspectRatioListener.java \
JopSpiderFrame.java \
JopLoginFrame.java \
......@@ -92,7 +96,6 @@ local_java_sources := \
JopUtilities.java \
GeImage.java \
GeFrameThin.java \
GeGradient.java \
Flow.java \
FlowCtxInterface.java \
FlowCmn.java \
......@@ -128,6 +131,11 @@ local_java_sources := \
XttTree.java \
JopXttApplet.java \
JopXttFrame.java \
JopCurveData.java \
JopCurveIfc.java \
JopCurve.java \
JopXttTrend.java \
JopXttFast.java \
EventTableModel.java \
EventTableCellRender.java \
MhTable.java \
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.rt;
public class CircBuffInfo
{
public PwrtAttrRef circAref;
public int resolution;
public int samples;
public String description;
public Object bufp;
public int size;
public int firstIdx;
public int lastIdx;
public int offset;
public int elementType;
public int status;
public CircBuffInfo() {
}
public int getCircArefOix() { return circAref.getOix();}
public int getCircArefVid() { return circAref.getVid();}
public int getCircArefBody() { return circAref.getBody();}
public int getCircArefOffset() { return circAref.getOffset();}
public int getCircArefSize() { return circAref.getSize();}
public int getCircArefFlags() { return circAref.getFlags();}
public int getResolution() { return resolution;}
public int getSamples() { return samples;}
public int getElementType() { return elementType;}
public int getFirstIdx() { return firstIdx;}
public int getLastIdx() { return lastIdx;}
public int getOffset() { return offset;}
}
......@@ -450,6 +450,8 @@ public class Gdh {
public native CdhrString getMsgText( int sts);
public native CdhrClassId getSuperClass( int classid, PwrtObjid objid);
public native GdhrsAttrDef[] getObjectBodyDef(int classid, PwrtAttrRef aref);
public native int getCircBuffInfo(CircBuffInfo info);
public native int updateCircBuffInfo(CircBuffInfo[] info, int info_size);
// public native GdhrGetXttObj[] getAllXttChildrenNative(PwrtObjid objid);
}
......
......@@ -111,6 +111,8 @@ public class GdhServer
public final static int GET_ALL_CLASS_ATTRIBUTES_STRING = 56;
public final static int GET_OBJECT_INFO_FLOAT_ARRAY = 57;
public final static int GET_OBJECT_INFO_INT_ARRAY = 58;
public final static int GET_CIRCBUFF_INFO = 59;
public final static int UPDATE_CIRCBUFF_INFO = 60;
public final static int PORT = 4445;
......@@ -589,7 +591,7 @@ public class GdhServer
}
catch(IOException e)
{
System.out.println("setObjectInfoString: IO exception");
System.out.println("getObjectInfoString: IO exception");
}
break;
case GET_OBJECT_INFO_OBJID:
......@@ -1793,6 +1795,118 @@ public class GdhServer
System.out.println("GET_SUBSCRIPTIONS: IO exception");
}
break;
case GET_CIRCBUFF_INFO:
try
{
CircBuffInfo info = new CircBuffInfo();
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
info.circAref = new PwrtAttrRef(objid, body, offset, size, flags);
info.samples = in.readInt();
info.resolution = in.readInt();
info.elementType = in.readInt();
gdh.getCircBuffInfo( info);
out.writeInt(info.status);
if ( info.status % 2 != 0) {
out.writeInt(info.size);
out.writeInt(info.firstIdx);
out.writeInt(info.lastIdx);
out.writeInt(info.offset);
out.writeInt(info.samples);
switch( info.elementType) {
case Pwr.eType_Float32:
for ( int j = 0; j < info.size; j++)
out.writeFloat(((float[])info.bufp)[j]);
break;
case Pwr.eType_Int32:
case Pwr.eType_UInt32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
for ( int j = 0; j < info.size; j++)
out.writeInt(((int[])info.bufp)[j]);
break;
default: ;
}
}
out.flush();
}
catch(IOException e)
{
System.out.println("getCircBuffInfo: IO exception");
}
break;
case UPDATE_CIRCBUFF_INFO:
try
{
int info_size = in.readInt();
CircBuffInfo[] info = new CircBuffInfo[info_size];
for ( i = 0; i < info_size; i++) {
info[i] = new CircBuffInfo();
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
info[i].circAref = new PwrtAttrRef(objid, body, offset, size, flags);
info[i].samples = in.readInt();
info[i].resolution = in.readInt();
info[i].elementType = in.readInt();
info[i].firstIdx = in.readInt();
info[i].lastIdx = in.readInt();
info[i].offset = in.readInt();
}
gdh.updateCircBuffInfo( info, info_size);
out.writeInt(info[0].status);
if ( info[0].status % 2 != 0) {
for ( i = 0; i < info_size; i++) {
out.writeInt(info[i].size);
out.writeInt(info[i].firstIdx);
out.writeInt(info[i].lastIdx);
out.writeInt(info[i].offset);
out.writeInt(info[i].samples);
switch( info[i].elementType) {
case Pwr.eType_Float32:
for ( int j = 0; j < info[i].size; j++)
out.writeFloat(((float[])info[i].bufp)[j]);
break;
case Pwr.eType_UInt32:
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
for ( int j = 0; j < info[i].size; j++)
out.writeInt(((int[])info[i].bufp)[j]);
break;
default: ;
}
}
}
out.flush();
}
catch(IOException e)
{
System.out.println("updateCircBuffInfo: IO exception");
}
break;
default:
errh.error("Received unknown function : " + function);
}
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.rt;
import java.io.Serializable;
public class GdhrCircBuffInfo implements Serializable
{
public CircBuffInfo info;
public int sts;
public GdhrCircBuffInfo( CircBuffInfo info,
int sts)
{
this.info = info;
this.sts = sts;
}
public boolean evenSts() { return (sts % 2 == 0);}
public boolean oddSts() { return (sts % 2 == 1);}
public int getSts() { return sts;}
}
......@@ -158,10 +158,12 @@ public class Pwrb {
public static final int cClass_drive = 131896;
public static final int cClass_DsFast = 131904;
public static final int cClass_DsFastConf = 131912;
public static final int cClass_DsFastCurve = 133616;
public static final int cClass_DsHist = 131920;
public static final int cClass_DsHistServer = 131928;
public static final int cClass_DsTrend = 131936;
public static final int cClass_DsTrendConf = 131944;
public static final int cClass_DsTrendCurve = 135816;
public static final int cClass_DSup = 131952;
public static final int cClass_Dv = 131960;
public static final int cClass_DvArea = 131968;
......
......@@ -33,6 +33,8 @@ local_java_sources = \
CdhrObjAttr.java \
PwrsParInfo.java \
GdhrsAttrDef.java \
CircBuffInfo.java \
GdhrCircBuffInfo.java \
Gdh.java \
Sub.java \
SubElement.java \
......
......@@ -100,6 +100,8 @@ public class Gdh
public final static int GET_ALL_CLASS_ATTRIBUTES_STRING = 56;
public final static int GET_OBJECT_INFO_FLOAT_ARRAY = 57;
public final static int GET_OBJECT_INFO_INT_ARRAY = 58;
public final static int GET_CIRCBUFF_INFO = 59;
public final static int UPDATE_CIRCBUFF_INFO = 60;
......@@ -1855,16 +1857,133 @@ public class Gdh
}
}
public int getCircBuffInfo(CircBuffInfo info)
{
try {
out.writeInt(GET_CIRCBUFF_INFO);
out.writeInt(info.circAref.objid.oix);
out.writeInt(info.circAref.objid.vid);
out.writeInt(info.circAref.body);
out.writeInt(info.circAref.offset);
out.writeInt(info.circAref.size);
out.writeInt(info.circAref.flags);
out.writeInt(info.samples);
out.writeInt(info.resolution);
out.writeInt(info.elementType);
out.flush();
int sts = in.readInt();
if(sts % 2 == 0) {
info.status = sts;
return 0;
}
info.size = in.readInt();
info.firstIdx = in.readInt();
info.lastIdx = in.readInt();
info.offset = in.readInt();
info.samples = in.readInt();
switch ( info.elementType) {
case Pwr.eType_Float32: {
float[] buf = new float[info.size];
for ( int i = 0; i < info.size; i++)
buf[i] = in.readFloat();
info.bufp = buf;
break;
}
case Pwr.eType_UInt32:
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8: {
int[] buf = new int[info.size];
for ( int i = 0; i < info.size; i++)
buf[i] = in.readInt();
info.bufp = buf;
break;
}
default: ;
}
}
catch(IOException e) {
info.status = __IO_EXCEPTION;
return 0;
}
return 1;
}
public int updateCircBuffInfo(CircBuffInfo[] info, int info_size)
{
try {
out.writeInt(UPDATE_CIRCBUFF_INFO);
out.writeInt(info_size);
for ( int i = 0; i < info_size; i++) {
out.writeInt(info[i].circAref.objid.oix);
out.writeInt(info[i].circAref.objid.vid);
out.writeInt(info[i].circAref.body);
out.writeInt(info[i].circAref.offset);
out.writeInt(info[i].circAref.size);
out.writeInt(info[i].circAref.flags);
out.writeInt(info[i].samples);
out.writeInt(info[i].resolution);
out.writeInt(info[i].elementType);
out.writeInt(info[i].firstIdx);
out.writeInt(info[i].lastIdx);
out.writeInt(info[i].offset);
}
out.flush();
int sts = in.readInt();
if(sts % 2 == 0) {
System.out.println( "updateCircBuffInfo: sts " + sts);
info[0].status = sts;
return 0;
}
for ( int i = 0; i < info_size; i++) {
info[i].size = in.readInt();
info[i].firstIdx = in.readInt();
info[i].lastIdx = in.readInt();
info[i].offset = in.readInt();
info[i].samples = in.readInt();
switch( info[i].elementType) {
case Pwr.eType_Float32: {
float[] buf = new float[info[i].size];
for ( int j = 0; j < info[i].size; j++)
buf[j] = in.readFloat();
info[i].bufp = buf;
break;
}
case Pwr.eType_UInt32:
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8: {
int[] buf = new int[info[i].size];
for ( int j = 0; j < info[i].size; j++)
buf[j] = in.readInt();
info[i].bufp = buf;
break;
}
default: ;
}
}
}
catch(IOException e) {
info[0].status = __IO_EXCEPTION;
return 0;
}
return 1;
}
public void logString(String str)
{
try
{
try {
out.writeInt(LOG_STRING);
out.writeUTF(str);
out.flush();
}
catch(IOException e)
{
catch(IOException e) {
}
}
......@@ -1891,8 +2010,7 @@ public class Gdh
{
String suffix;
int idx1 = attrName.indexOf("##");
if(idx1 < 0)
{
if(idx1 < 0) {
return Pwr.eType_Boolean;
}
......
......@@ -289,6 +289,7 @@ bck_LoadBackup ()
if (dh.valid) {
/* Find object */
strcpy(objectname, "");
if (dh.dynamic) {
strp = strchr(namep, '.'); /* always is a full object! */
......@@ -311,6 +312,8 @@ bck_LoadBackup ()
strcat(objectname, namep);
sts = gdh_SetObjectInfo(objectname, datap, dh.size);
}
else
strcpy(objectname, cdh_ObjidToString( 0, dh.objid, 1));
}
} /* valid segment */
......
......@@ -848,7 +848,8 @@ vol_OidToObject (
if (op == NULL) {
if (lo_flags & gdb_mLo_remote) {
vp = hash_Search(sts, gdbroot->vid_ht, &oid.vid);
if (vp == NULL) pwr_Return(NULL, sts, GDH__NOSUCHVOL);
if (vp == NULL) pwr_Return(NULL, sts, GDH__NOSUCHOBJ);
if (vp->l.flags.b.isNative) pwr_Return(NULL, sts, GDH__NOTMOUNTED);
if (!vp->l.flags.b.isMounted) pwr_Return(NULL, sts, GDH__NOTMOUNTED);
if (vp->l.flags.m & lo_flags) {
......
#!/bin/bash
ource /etc/pwrp_profile
source /etc/pwrp_profile
$pwr_exe/rt_rtt
#!/bin/bash
ource /etc/pwrp_profile
source /etc/pwrp_profile
$pwr_exe/rt_rtt
if [ "$pwra_db" == "" ]; then
source /etc/pwrp_profile
fi
pwrp()
{
source $pwra_db/pwra_env.sh $@
}
alias sdf="source $pwra_db/pwra_env.sh set project"
alias pwrc="wb_cmd"
alias pwrs="wb_start.sh pwrp pwrp"
alias pwra="wb -p pwrp pwrp"
1
100 V2.0.0
101 24
2
200 common
201 0
202 1
203 15
204
3
300 pwrp
301 aaupl/kQs1p3U
302 4129168825
303 16
305
304 Proview project user
307
306
308
99
3
300 op1
301 aa.d10HWuKdCo
302 4294843775
303 17
305
304 Operator with Operator1 privilege
307
306
308
99
3
300 op2
301 aa.d10HWuKdCo
302 4294843711
303 18
305
304 Operator with Operator2 privilege
307
306
308
99
3
300 op3
301 aa.d10HWuKdCo
302 4294843583
303 19
305
304 Operator with Operator3 privilege
307
306
308
99
3
300 op4
301 aa.d10HWuKdCo
302 4294843327
303 20
305
304 Operator with Operator4 privilege
307
306
308
99
99
99
!**Menu ClassVolumes { //
!**Menu BaseClasses { //
NMps 0.0.1.1 PwrBase
TLog 0.0.1.2 PwrBase
SSAB 0.0.1.3 PwrBase
Remote 0.0.1.4 PwrBase
BaseComponent 0.0.0.10 PwrBase
Profibus 0.0.250.7 PwrBase
OtherManufacturer 0.2.250.1 PwrBase
ABB 0.0.250.2 PwrBase
Siemens 0.0.250.3 PwrBase
Telemecanique 0.0.250.4 PwrBase
SsabOx 0.0.250.5 PwrBase
KlocknerMoeller 0.0.250.6 PwrBase
Inor 0.0.250.8 PwrBase
!**}
!**}
#! /bin/bash
#
#
#
pwra_set_func()
{
local cmd
local baseroot
local project
if [ -z $1 ]; then
echo "Qualifier is missing"
return
fi
cmd="base"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
# Command is "set base"
basename=$2
basename=${basename//\./\\.}
baseroot=`eval cat $pwra_db/pwr_projectlist.dat | grep "\b"$basename"\b" | grep "\b"base"\b" | awk '{print $3}'`
if [ -z $baseroot ]; then
echo "Unable to find base '$2'"
return
fi
baseroot=${baseroot%/}
if [ ! -e "$baseroot" ]; then
echo "Base $baseroot doesn't exist"
elif [ "$3" != "cross" ]; then
if [ ! -e $baseroot/$os/$hw/exp/exe/pwrp_env.sh ]; then
echo "Not a base directory: $baseroot"
return
fi
source $baseroot/$os/$hw/exp/exe/pwrp_env.sh set baseroot $baseroot
fi
return
fi
cmd="baseroot"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
# Command is "set baseroot"
baseroot=$2
baseroot=${baseroot%/}
if [ ! -e "$baseroot" ]; then
echo "Base $baseroot doesn't exist"
else
if [ ! -e $baseroot/$os/$hw/exp/exe/pwrp_env.sh ]; then
echo "Not a base directory: $baseroot"
return
fi
source $baseroot/$os/$hw/exp/exe/pwrp_env.sh set baseroot $baseroot
fi
return
fi
cmd="project"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
# Command is "set project"
project=$2
basename=`eval cat $pwra_db/pwr_projectlist.dat | grep "^"$project"\b" | awk '{print $2}'`
basename=${basename//\./\\.}
if [ -z $basename ]; then
echo "Unable to find project '$2'"
return
fi
baseroot=`eval cat $pwra_db/pwr_projectlist.dat | grep "\b"$basename"\b" | grep "\b"base"\b" | awk '{print $3}'`
if [ -z $baseroot ]; then
echo "Unable to find base '$2'"
return
fi
baseroot=${baseroot%/}
if [ ! -e "$baseroot" ]; then
echo "Base $baseroot doesn't exist"
else
if [ ! -e $baseroot/$os/$hw/exp/exe/pwrp_env.sh ]; then
echo "Not a base directory: $baseroot"
return
fi
source $baseroot/$os/$hw/exp/exe/pwrp_env.sh set baseroot $baseroot
source $baseroot/$os/$hw/exp/exe/pwrp_env.sh set project $project
export PS1='\u@\h/$pwrp_projectname/-.\W> '
fi
return
fi
if [ -z $pwr_exe ]; then
echo "No project is defined"
return
fi
source $pwr_exe/pwrp_env.sh set $1 $2 $3
}
pwra_help_func()
{
source $pwr_exe/pwrp_env.sh $@
cat << EOF
pwra_env.sh - Utilities for pwr project environment
help - Display help
set base 'distribution' - Setup environment to proview base distribution
set baseroot 'root' - Setup environment to proview base distribution
EOF
}
pwra_parse ()
{
unamestr=`eval uname`
machine=`eval uname -m`
if [ $unamestr == "Darwin" ]; then
os="os_macos"
hw="hw_x86_64"
elif [ $unamestr == "FreeBSD" ]; then
os="os_freebsd"
hw="hw_x86_64"
else
if [ $machine != "x86_64" ]; then
machine="x86"
fi
os="os_linux"
hw="hw_"$machine
fi
local cmd
cmd="help"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
pwra_help_func $2 $3
return
fi
cmd="set"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
pwra_set_func $2 $3
return
fi
if [ -z $pwr_exe ]; then
echo "No project is defined"
return
fi
source $pwr_exe/pwrp_env.sh $@
}
pwra_parse $@
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
umask 022
# the rest of this file is commented out.
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# set PATH so it includes user's private bin if it exists
#if [ -d ~/bin ] ; then
# PATH=~/bin:"${PATH}"
#fi
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files for examples
source /etc/pwrp_profile
# If running interactively, then:
if [ "$PS1" ]; then
# enable color support of ls and also add handy aliases
eval `dircolors -b`
alias ls='ls --color=auto'
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
# set a fancy prompt
PS1='\u@\h:\w\$ '
# If this is an xterm set the title to user@host:dir
#case $TERM in
#xterm*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# ;;
#*)
# ;;
#esac
fi
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Proview V3.4b (3.4.1-1)
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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