Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
5964a7aa
Commit
5964a7aa
authored
Jun 15, 2012
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java piechart and barchart implemented
parent
39bfb511
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1312 additions
and
34 deletions
+1312
-34
java/jpwr/jop/src/JopBarChart.java
java/jpwr/jop/src/JopBarChart.java
+445
-0
java/jpwr/jop/src/JopPie.java
java/jpwr/jop/src/JopPie.java
+497
-0
java/jpwr/jop/src/os_templ/hw_templ/makefile
java/jpwr/jop/src/os_templ/hw_templ/makefile
+2
-0
xtt/lib/ge/src/ge_graph.h
xtt/lib/ge/src/ge_graph.h
+16
-0
xtt/lib/ge/src/ge_graph_javabean.cpp
xtt/lib/ge/src/ge_graph_javabean.cpp
+86
-22
xtt/lib/glow/src/glow_exportjbean.cpp
xtt/lib/glow/src/glow_exportjbean.cpp
+197
-0
xtt/lib/glow/src/glow_exportjbean.h
xtt/lib/glow/src/glow_exportjbean.h
+32
-0
xtt/lib/glow/src/glow_growbarchart.cpp
xtt/lib/glow/src/glow_growbarchart.cpp
+19
-6
xtt/lib/glow/src/glow_growpie.cpp
xtt/lib/glow/src/glow_growpie.cpp
+18
-6
No files found.
java/jpwr/jop/src/JopBarChart.java
0 → 100644
View file @
5964a7aa
/*
* 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
javax.swing.Timer
;
import
java.awt.event.*
;
import
jpwr.rt.*
;
public
class
JopBarChart
extends
JComponent
implements
GeComponentIfc
,
JopDynamic
,
JopConfirm
,
ActionListener
{
Dimension
size
;
Timer
timer
=
new
Timer
(
500
,
this
);
Object
root
;
JopSession
session
;
JopEngine
en
;
public
GeDyn
dd
=
new
GeDyn
(
this
);
public
JopBarChart
(
JopSession
session
)
{
this
.
session
=
session
;
dd
.
setSession
(
session
);
size
=
new
Dimension
(
102
,
36
);
timer
.
start
();
oldValueF
=
new
float
[
BARCHART_MAX_BARSEGMENTS
][];
}
public
void
actionPerformed
(
ActionEvent
e
)
{
boolean
engine_found
=
false
;
root
=
getTopLevelAncestor
();
if
(
root
!=
null
)
{
if
(
root
instanceof
JopApplet
)
session
=
((
JopApplet
)
root
).
session
;
else
if
(
root
instanceof
JopFrame
)
session
=
((
JopFrame
)
root
).
session
;
en
=
session
.
getEngine
();
if
(
!
en
.
isReady
())
return
;
en
.
add
(
this
);
engine_found
=
true
;
}
if
(
engine_found
)
{
timer
.
stop
();
timer
=
null
;
if
(
dd
.
actionType
!=
0
&&
en
.
gdh
.
isAuthorized
(
dd
.
access
))
{
this
.
addMouseListener
(
new
MouseAdapter
()
{
public
void
mouseReleased
(
MouseEvent
e
)
{
if
(
e
.
isPopupTrigger
())
dd
.
action
(
GeDyn
.
eEvent_MB3Press
,
e
);
else
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
&&
en
.
gdh
.
isAuthorized
(
dd
.
access
))
dd
.
action
(
GeDyn
.
eEvent_MB1Up
,
e
);
}
public
void
mousePressed
(
MouseEvent
e
)
{
if
(
e
.
isPopupTrigger
())
dd
.
action
(
GeDyn
.
eEvent_MB3Press
,
e
);
else
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
&&
en
.
gdh
.
isAuthorized
(
dd
.
access
))
dd
.
action
(
GeDyn
.
eEvent_MB1Down
,
e
);
}
public
void
mouseClicked
(
MouseEvent
e
)
{
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
&&
en
.
gdh
.
isAuthorized
(
dd
.
access
))
dd
.
action
(
GeDyn
.
eEvent_MB1Click
,
e
);
}
});
}
}
}
public
void
confirmNo
()
{}
public
void
confirmYes
()
{
PwrtStatus
sts
;
String
attrName
;
dd
.
confirmedAction
(
GeDyn
.
eEvent_MB1Click
,
null
);
}
// GeComponents Ifc
public
void
tsetFillColor
(
int
fillColor
)
{}
public
void
tsetColorTone
(
int
colorTone
)
{}
public
void
tsetBorderColor
(
int
borderColor
)
{}
public
void
tsetTextColor
(
int
borderColor
)
{}
public
void
setColorInverse
(
int
colorInverse
)
{}
public
void
resetFillColor
()
{}
public
void
resetColorTone
()
{}
public
void
resetBorderColor
()
{}
public
void
resetTextColor
()
{}
public
String
getAnnot1
()
{
return
new
String
();}
public
void
setVisibility
(
int
visibility
)
{}
public
void
setAnnot1
(
String
s
)
{}
public
void
setLastPage
()
{}
public
void
setFirstPage
()
{}
public
void
setPage
(
int
page
)
{}
public
int
setNextPage
()
{
return
1
;}
public
int
setPreviousPage
()
{
return
1
;}
public
Object
getDd
()
{
return
dd
;}
public
void
setFillLevel
(
float
fillLevel
)
{}
public
void
setLevelDirection
(
int
levelDirection
)
{}
public
void
setLevelColorTone
(
int
levelColorTone
)
{}
public
void
setLevelFillColor
(
int
levelFillColor
)
{}
public
static
final
int
BARCHART_MAX_BARSEGMENTS
=
12
;
int
verticalLines
=
0
;
int
horizontalLines
=
0
;
int
lineColor
=
9999
;
int
fillColor
=
9999
;
int
borderColor
=
9999
;
int
drawFill
=
0
;
int
drawBorder
=
0
;
int
lineWidth
=
1
;
int
barBorderWidth
=
1
;
float
[][]
segmentSize
=
new
float
[
BARCHART_MAX_BARSEGMENTS
][];
float
minValue
=
0
;
float
maxValue
=
100
;
float
[][]
oldValueF
;
public
void
setVerticalLines
(
int
verticalLines
)
{
this
.
verticalLines
=
verticalLines
;
}
public
void
setHorizontalLines
(
int
horizontalLines
)
{
this
.
horizontalLines
=
horizontalLines
;
}
public
void
setLineColor
(
int
lineColor
)
{
this
.
lineColor
=
lineColor
;
}
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
setDrawFill
(
int
drawFill
)
{
this
.
drawFill
=
drawFill
;
}
public
int
getDrawFill
()
{
return
drawFill
;
}
public
void
setDrawBorder
(
int
drawBorder
)
{
this
.
drawBorder
=
drawBorder
;
}
public
int
getDrawBorder
()
{
return
drawBorder
;
}
public
void
setLineWidth
(
int
lineWidth
)
{
this
.
lineWidth
=
lineWidth
;
}
public
int
getLineWidth
()
{
return
lineWidth
;
}
public
void
setBarBorderWidth
(
int
barBorderWidth
)
{
this
.
barBorderWidth
=
barBorderWidth
;
}
public
int
getBarBorderWidth
()
{
return
barBorderWidth
;
}
public
int
bars
;
public
int
barSegments
;
public
int
[]
barColors
;
public
double
rotate
;
public
int
shadow
;
public
double
shadowWidth
;
public
int
gradient
;
public
int
gc1
;
public
int
gc2
;
public
void
setBars
(
int
bars
)
{
this
.
bars
=
bars
;}
public
void
setBarSegments
(
int
barSegments
)
{
this
.
barSegments
=
barSegments
;}
public
void
setBarColors
(
int
[]
barColors
)
{
this
.
barColors
=
barColors
;}
public
void
setRotate
(
double
rotate
)
{
this
.
rotate
=
rotate
;}
public
double
getRotate
()
{
return
rotate
;}
public
void
setShadow
(
int
shadow
)
{
this
.
shadow
=
shadow
;}
public
void
setShadowWidth
(
double
shadowWidth
)
{
this
.
shadowWidth
=
shadowWidth
;}
public
void
setGradient
(
int
gradient
)
{
this
.
gradient
=
gradient
;}
public
void
setGc1
(
int
gc1
)
{
this
.
gc1
=
gc1
;}
public
void
setGc2
(
int
gc2
)
{
this
.
gc2
=
gc2
;}
Shape
[]
shapes
;
Shape
[]
borderShapes
;
Shape
[]
lineShapes
;
public
void
paint
(
Graphics
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
original_width
=
0
;
float
original_height
=
0
;
float
oldWidth
;
float
oldHeight
;
boolean
update
=
true
;
public
void
paintComponent
(
Graphics
g1
)
{
Graphics2D
g
=
(
Graphics2D
)
g1
;
float
width
=
getWidth
();
float
height
=
getHeight
();
AffineTransform
save
=
g
.
getTransform
();
float
barWidth
=
width
/
bars
;
int
i
;
int
j
;
boolean
updateSize
=
false
;
if
(
original_width
==
0
&&
original_height
==
0
)
{
original_width
=
width
;
original_height
=
height
;
shapes
=
new
Shape
[
bars
*
barSegments
];
borderShapes
=
new
Shape
[
bars
];
lineShapes
=
new
Shape
[
1
+
horizontalLines
+
verticalLines
];
}
if
(
oldWidth
!=
width
||
oldHeight
!=
height
)
{
oldWidth
=
width
;
oldHeight
=
height
;
updateSize
=
true
;
}
if
(
updateSize
)
{
lineShapes
[
0
]
=
new
Rectangle2D
.
Float
(
0
F
,
0
F
,
width
,
height
);
for
(
i
=
0
;
i
<
verticalLines
;
i
++)
lineShapes
[
1
+
i
]
=
new
Line2D
.
Float
(
width
/
(
verticalLines
+
1
)
*
(
i
+
1
),
0
F
,
width
/
(
verticalLines
+
1
)
*
(
i
+
1
),
height
);
for
(
i
=
0
;
i
<
horizontalLines
;
i
++)
lineShapes
[
1
+
verticalLines
+
i
]
=
new
Line2D
.
Float
(
0
F
,
height
/
(
horizontalLines
+
1
)
*
(
i
+
1
),
width
,
height
/
(
horizontalLines
+
1
)
*
(
i
+
1
));
}
if
(
update
||
updateSize
)
{
update
=
false
;
float
x1
=
0
;
float
y1
=
height
;
float
x2
=
barWidth
;
float
y2
=
height
;
for
(
i
=
0
;
i
<
bars
;
i
++)
{
y1
=
height
;
y2
=
height
;
for
(
j
=
0
;
j
<
barSegments
;
j
++)
{
if
(
segmentSize
[
j
]
==
null
)
continue
;
if
(
segmentSize
[
j
][
i
]
==
0
||
y2
<=
0
)
{
shapes
[
i
*
barSegments
+
j
]
=
null
;
continue
;
}
y1
-=
segmentSize
[
j
][
i
]
/
(
maxValue
-
minValue
)
*
height
;
if
(
y1
<
0
)
y1
=
0
;
shapes
[
i
*
barSegments
+
j
]
=
new
Rectangle2D
.
Float
(
x1
,
y1
,
x2
-
x1
,
y2
-
y1
);
y2
=
y1
;
}
borderShapes
[
i
]
=
new
Rectangle2D
.
Float
(
x1
,
y1
,
barWidth
,
height
-
y1
);
x1
=
x2
;
x2
+=
barWidth
;
}
}
//g.transform( AffineTransform.getScaleInstance( width/original_width,
// height/original_height));
g
.
setColor
(
GeColor
.
getColor
(
0
,
fillColor
));
g
.
fill
(
lineShapes
[
0
]);
for
(
i
=
0
;
i
<
bars
;
i
++)
{
for
(
j
=
0
;
j
<
barSegments
;
j
++)
{
if
(
shapes
[
i
*
barSegments
+
j
]
==
null
)
continue
;
g
.
setStroke
(
new
BasicStroke
((
float
)
lineWidth
));
if
(
gradient
==
GeGradient
.
eGradient_No
)
{
g
.
setColor
(
GeColor
.
getColor
(
0
,
barColors
[
j
]));
g
.
fill
(
shapes
[
i
*
barSegments
+
j
]);
}
else
{
GeGradient
.
paint
(
g
,
gradient
,
gc1
,
gc2
,
i
*
barWidth
,
0
F
,
barWidth
,
height
,
false
,
barColors
[
j
],
0
,
0
,
0
,
0
,
barColors
[
j
],
false
);
g
.
fill
(
shapes
[
i
*
barSegments
+
j
]);
}
}
}
g
.
setColor
(
GeColor
.
getColor
(
0
,
lineColor
));
for
(
i
=
0
;
i
<
verticalLines
;
i
++)
g
.
draw
(
lineShapes
[
1
+
i
]);
for
(
i
=
0
;
i
<
horizontalLines
;
i
++)
g
.
draw
(
lineShapes
[
1
+
verticalLines
+
i
]);
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
for
(
i
=
0
;
i
<
bars
;
i
++)
g
.
draw
(
borderShapes
[
i
]);
g
.
draw
(
lineShapes
[
0
]);
//g.setTransform(save);
}
public
Dimension
getPreferredSize
()
{
return
size
;}
public
Dimension
getMinimumSize
()
{
return
size
;}
int
lowColor
=
0
;
public
void
setLowColor
(
int
lowColor
)
{
this
.
lowColor
=
lowColor
;}
public
int
getLowColor
()
{
return
lowColor
;}
String
[]
pwrAttribute
=
new
String
[
BARCHART_MAX_BARSEGMENTS
];
public
void
setPwrAttribute
(
String
[]
pwrAttribute
)
{
this
.
pwrAttribute
=
pwrAttribute
;}
public
String
[]
getPwrAttribute
()
{
return
pwrAttribute
;}
float
valueColor
;
float
valueColorOld
;
boolean
firstScan
=
true
;
GdhrRefObjectInfo
[]
retAttr
=
new
GdhrRefObjectInfo
[
BARCHART_MAX_BARSEGMENTS
];
public
void
setMinValue
(
float
minValue
)
{
this
.
minValue
=
minValue
;
}
public
float
getMinValue
()
{
return
minValue
;
}
public
void
setMaxValue
(
float
maxValue
)
{
this
.
maxValue
=
maxValue
;
}
public
float
getMaxValue
()
{
return
maxValue
;
}
public
Object
dynamicGetRoot
()
{
return
root
;
}
public
void
update
()
{
valueColorOld
=
-
10000
;
dynamicUpdate
(
false
);
}
public
void
dynamicOpen
()
{
if
(
en
.
isInstance
())
dd
.
setInstance
(
en
.
getInstance
());
for
(
int
i
=
0
;
i
<
barSegments
;
i
++)
{
if
(
pwrAttribute
[
i
]
!=
null
)
{
String
attrName
=
dd
.
getAttrName
(
pwrAttribute
[
i
]);
retAttr
[
i
]
=
en
.
gdh
.
refObjectInfo
(
attrName
);
if
(
retAttr
[
i
].
evenSts
())
{
System
.
out
.
println
(
"refObjectInfoError attribute["
+
i
+
"]"
);
pwrAttribute
[
i
]
=
null
;
}
if
(
retAttr
[
i
].
typeId
==
Pwr
.
eType_Float32
)
oldValueF
[
i
]
=
new
float
[
bars
];
else
pwrAttribute
[
i
]
=
null
;
}
}
}
public
void
dynamicClose
()
{
for
(
int
i
=
0
;
i
<
BARCHART_MAX_BARSEGMENTS
;
i
++)
{
if
(
pwrAttribute
[
i
]
!=
null
)
en
.
gdh
.
unrefObjectInfo
(
retAttr
[
i
].
refid
);
}
}
public
void
dynamicUpdate
(
boolean
animationOnly
)
{
if
(
maxValue
==
minValue
)
return
;
if
(
animationOnly
)
return
;
for
(
int
i
=
0
;
i
<
barSegments
;
i
++)
{
if
(
pwrAttribute
[
i
]
!=
null
)
segmentSize
[
i
]
=
en
.
gdh
.
getObjectRefInfoFloatArray
(
retAttr
[
i
].
id
,
retAttr
[
i
].
elements
);
else
{
if
(
segmentSize
[
i
]
==
null
)
segmentSize
[
i
]
=
new
float
[
bars
];
else
{
for
(
int
j
=
0
;
j
<
bars
;
j
++)
segmentSize
[
i
][
j
]
=
0
;
}
}
}
update
=
false
;
for
(
int
i
=
0
;
i
<
barSegments
;
i
++)
{
if
(
pwrAttribute
[
i
]
==
null
)
continue
;
for
(
int
j
=
0
;
j
<
bars
;
j
++)
{
if
(
segmentSize
[
i
][
j
]
!=
oldValueF
[
i
][
j
])
{
oldValueF
[
i
][
j
]
=
segmentSize
[
i
][
j
];
update
=
true
;
}
}
}
if
(
update
||
firstScan
)
repaint
();
if
(
firstScan
)
firstScan
=
false
;
}
public
void
repaintForeground
()
{
Graphics
g
=
getGraphics
();
if
(
g
==
null
)
{
System
.
out
.
println
(
"repaintForeground: can't get Graphic object"
);
return
;
}
paintComponent
(
g
);
paintChildren
(
g
);
}
}
java/jpwr/jop/src/JopPie.java
0 → 100644
View file @
5964a7aa
/*
* 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
javax.swing.Timer
;
import
java.awt.event.*
;
import
jpwr.rt.*
;
public
class
JopPie
extends
JComponent
implements
GeComponentIfc
,
JopDynamic
,
JopConfirm
,
ActionListener
{
Dimension
size
;
Timer
timer
=
new
Timer
(
500
,
this
);
Object
root
;
JopSession
session
;
JopEngine
en
;
public
GeDyn
dd
=
new
GeDyn
(
this
);
public
JopPie
(
JopSession
session
)
{
this
.
session
=
session
;
dd
.
setSession
(
session
);
size
=
new
Dimension
(
102
,
36
);
timer
.
start
();
}
public
void
actionPerformed
(
ActionEvent
e
)
{
boolean
engine_found
=
false
;
root
=
getTopLevelAncestor
();
if
(
root
!=
null
)
{
if
(
root
instanceof
JopApplet
)
session
=
((
JopApplet
)
root
).
session
;
else
if
(
root
instanceof
JopFrame
)
session
=
((
JopFrame
)
root
).
session
;
en
=
session
.
getEngine
();
if
(
!
en
.
isReady
())
return
;
en
.
add
(
this
);
engine_found
=
true
;
}
if
(
engine_found
)
{
timer
.
stop
();
timer
=
null
;
if
(
dd
.
actionType
!=
0
&&
en
.
gdh
.
isAuthorized
(
dd
.
access
))
{
this
.
addMouseListener
(
new
MouseAdapter
()
{
public
void
mouseReleased
(
MouseEvent
e
)
{
if
(
e
.
isPopupTrigger
())
dd
.
action
(
GeDyn
.
eEvent_MB3Press
,
e
);
else
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
&&
en
.
gdh
.
isAuthorized
(
dd
.
access
))
dd
.
action
(
GeDyn
.
eEvent_MB1Up
,
e
);
}
public
void
mousePressed
(
MouseEvent
e
)
{
if
(
e
.
isPopupTrigger
())
dd
.
action
(
GeDyn
.
eEvent_MB3Press
,
e
);
else
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
&&
en
.
gdh
.
isAuthorized
(
dd
.
access
))
dd
.
action
(
GeDyn
.
eEvent_MB1Down
,
e
);
}
public
void
mouseClicked
(
MouseEvent
e
)
{
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
&&
en
.
gdh
.
isAuthorized
(
dd
.
access
))
dd
.
action
(
GeDyn
.
eEvent_MB1Click
,
e
);
}
});
}
}
}
public
void
confirmNo
()
{}
public
void
confirmYes
()
{
PwrtStatus
sts
;
String
attrName
;
dd
.
confirmedAction
(
GeDyn
.
eEvent_MB1Click
,
null
);
}
// GeComponents Ifc
public
void
tsetFillColor
(
int
fillColor
)
{}
public
void
tsetColorTone
(
int
colorTone
)
{}
public
void
tsetBorderColor
(
int
borderColor
)
{}
public
void
tsetTextColor
(
int
borderColor
)
{}
public
void
setColorInverse
(
int
colorInverse
)
{}
public
void
resetFillColor
()
{}
public
void
resetColorTone
()
{}
public
void
resetBorderColor
()
{}
public
void
resetTextColor
()
{}
public
String
getAnnot1
()
{
return
new
String
();}
public
void
setVisibility
(
int
visibility
)
{}
public
void
setAnnot1
(
String
s
)
{}
public
void
setLastPage
()
{}
public
void
setFirstPage
()
{}
public
void
setPage
(
int
page
)
{}
public
int
setNextPage
()
{
return
1
;}
public
int
setPreviousPage
()
{
return
1
;}
public
Object
getDd
()
{
return
dd
;}
public
void
setFillLevel
(
float
fillLevel
)
{}
public
void
setLevelDirection
(
int
levelDirection
)
{}
public
void
setLevelColorTone
(
int
levelColorTone
)
{}
public
void
setLevelFillColor
(
int
levelFillColor
)
{}
public
static
final
int
PIE_MAX_SECTORS
=
12
;
float
angle1
=
0
;
float
angle2
=
360
;
int
fillColor
=
9999
;
int
borderColor
=
9999
;
int
sectors
=
0
;
int
[]
sectorColors
;
int
drawFill
=
0
;
int
drawBorder
=
0
;
int
lineWidth
=
1
;
int
barBorderWidth
=
1
;
float
[]
sectorSize
=
new
float
[
PIE_MAX_SECTORS
+
1
];
float
[]
oldValueF
=
new
float
[
PIE_MAX_SECTORS
];
float
minValue
=
0
;
float
maxValue
=
100
;
public
void
setAngle1
(
float
angle1
)
{
this
.
angle1
=
angle1
;
}
public
void
setAngle2
(
float
angle2
)
{
this
.
angle2
=
angle2
;
}
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
setSectors
(
int
sectors
)
{
this
.
sectors
=
sectors
;
}
public
int
getSectors
()
{
return
sectors
;
}
public
void
setSectorColors
(
int
[]
sectorColors
)
{
this
.
sectorColors
=
sectorColors
;
}
public
int
[]
getSectorColors
()
{
return
sectorColors
;
}
public
void
setDrawFill
(
int
drawFill
)
{
this
.
drawFill
=
drawFill
;
}
public
int
getDrawFill
()
{
return
drawFill
;
}
public
void
setDrawBorder
(
int
drawBorder
)
{
this
.
drawBorder
=
drawBorder
;
}
public
int
getDrawBorder
()
{
return
drawBorder
;
}
public
void
setLineWidth
(
int
lineWidth
)
{
this
.
lineWidth
=
lineWidth
;
}
public
int
getLineWidth
()
{
return
lineWidth
;
}
public
void
setBarBorderWidth
(
int
barBorderWidth
)
{
this
.
barBorderWidth
=
barBorderWidth
;
}
public
int
getBarBorderWidth
()
{
return
barBorderWidth
;
}
public
double
rotate
;
public
int
shadow
;
public
double
shadowWidth
;
public
int
gradient
;
public
int
gc1
;
public
int
gc2
;
public
void
setRotate
(
double
rotate
)
{
this
.
rotate
=
rotate
;}
public
double
getRotate
()
{
return
rotate
;}
public
void
setShadow
(
int
shadow
)
{
this
.
shadow
=
shadow
;}
public
void
setShadowWidth
(
double
shadowWidth
)
{
this
.
shadowWidth
=
shadowWidth
;}
public
void
setGradient
(
int
gradient
)
{
this
.
gradient
=
gradient
;}
public
void
setGc1
(
int
gc1
)
{
this
.
gc1
=
gc1
;}
public
void
setGc2
(
int
gc2
)
{
this
.
gc2
=
gc2
;}
Shape
[]
shapes
;
public
void
paint
(
Graphics
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
original_width
=
0
;
float
original_height
=
0
;
float
oldWidth
;
float
oldHeight
;
boolean
update
=
true
;
public
void
paintComponent
(
Graphics
g1
)
{
Graphics2D
g
=
(
Graphics2D
)
g1
;
float
width
=
getWidth
();
float
height
=
getHeight
();
AffineTransform
save
=
g
.
getTransform
();
float
a1
=
angle1
;
float
a2
;
int
i
;
if
(
original_width
==
0
&&
original_height
==
0
)
{
original_width
=
width
;
original_height
=
height
;
if
(
shadow
!=
0
)
shapes
=
new
Shape
[
2
*
PIE_MAX_SECTORS
+
2
];
else
shapes
=
new
Shape
[
PIE_MAX_SECTORS
+
1
];
}
if
(
oldWidth
!=
width
||
oldHeight
!=
height
)
{
oldWidth
=
width
;
oldHeight
=
height
;
update
=
true
;
}
if
(
update
)
{
update
=
false
;
for
(
i
=
0
;
i
<=
sectors
;
i
++)
{
if
(
i
==
sectors
)
{
if
(
a1
>=
angle1
+
angle2
)
{
if
(
shadow
!=
0
&&
gradient
!=
GeGradient
.
eGradient_No
)
{
shapes
[
2
*
i
]
=
null
;
shapes
[
2
*
i
+
1
]
=
null
;
}
else
shapes
[
i
]
=
null
;
break
;
}
a2
=
angle1
+
angle2
-
a1
;
}
else
{
if
(
sectorSize
[
i
]
<=
minValue
)
{
if
(
shadow
!=
0
&&
gradient
!=
GeGradient
.
eGradient_No
)
{
shapes
[
2
*
i
]
=
null
;
shapes
[
2
*
i
+
1
]
=
null
;
}
else
shapes
[
i
]
=
null
;
continue
;
}
if
(
a1
>=
angle2
+
angle1
)
{
if
(
shadow
!=
0
&&
gradient
!=
GeGradient
.
eGradient_No
)
{
shapes
[
2
*
i
]
=
null
;
shapes
[
2
*
i
+
1
]
=
null
;
}
else
shapes
[
i
]
=
null
;
break
;
}
a2
=
sectorSize
[
i
]
/
(
maxValue
-
minValue
)
*
angle2
;
if
(
a1
+
a2
>
angle1
+
angle2
)
a2
=
angle1
+
angle2
-
a1
;
}
if
(
shadow
!=
0
&&
gradient
!=
GeGradient
.
eGradient_No
)
{
shapes
[
2
*
i
]
=
new
Arc2D
.
Float
(
0
F
,
0
F
,
width
,
height
,
a1
,
a2
,
Arc2D
.
PIE
);
shapes
[
2
*
i
+
1
]
=
new
Arc2D
.
Float
(
(
float
)
shadowWidth
,
(
float
)
shadowWidth
,
(
float
)(
width
-
2
*
shadowWidth
),
(
float
)(
height
-
2
*
shadowWidth
),
a1
,
a2
,
Arc2D
.
PIE
);
}
else
shapes
[
i
]
=
new
Arc2D
.
Float
(
0
F
,
0
F
,
width
,
height
,
a1
,
a2
,
Arc2D
.
PIE
);
a1
+=
a2
;
}
for
(
i
=
i
+
1
;
i
<=
sectors
;
i
++)
{
if
(
shadow
!=
0
&&
gradient
!=
GeGradient
.
eGradient_No
)
{
shapes
[
2
*
i
]
=
null
;
shapes
[
2
*
i
+
1
]
=
null
;
}
else
shapes
[
i
]
=
null
;
}
}
//g.transform( AffineTransform.getScaleInstance( width/original_width,
// height/original_height));
for
(
i
=
0
;
i
<=
sectors
;
i
++)
{
if
(
shadow
!=
0
&&
gradient
!=
GeGradient
.
eGradient_No
)
{
if
(
shapes
[
2
*
i
]
==
null
)
continue
;
g
.
setStroke
(
new
BasicStroke
((
float
)
lineWidth
));
if
(
i
==
sectors
)
{
GeGradient
.
paint
(
g
,
gradient
,
gc1
,
gc2
,
0
F
,
0
F
,
width
,
height
,
false
,
fillColor
,
0
,
0
,
0
,
0
,
fillColor
,
false
);
g
.
fill
(
shapes
[
2
*
i
]);
GeGradient
.
paint
(
g
,
GeGradient
.
eGradient_DiagonalUpperLeft
,
gc1
,
gc2
,
0
F
,
0
F
,
width
,
height
,
false
,
fillColor
,
0
,
0
,
0
,
0
,
fillColor
,
false
);
g
.
fill
(
shapes
[
2
*
i
+
1
]);
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
g
.
draw
(
shapes
[
2
*
i
]);
}
else
{
GeGradient
.
paint
(
g
,
gradient
,
gc1
,
gc2
,
0
F
,
0
F
,
width
,
height
,
false
,
sectorColors
[
i
],
0
,
0
,
0
,
0
,
sectorColors
[
i
],
false
);
g
.
fill
(
shapes
[
2
*
i
]);
GeGradient
.
paint
(
g
,
GeGradient
.
eGradient_DiagonalUpperLeft
,
gc1
,
gc2
,
0
F
,
0
F
,
width
,
height
,
false
,
sectorColors
[
i
],
0
,
0
,
0
,
0
,
sectorColors
[
i
],
false
);
g
.
fill
(
shapes
[
2
*
i
+
1
]);
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
g
.
draw
(
shapes
[
2
*
i
]);
}
}
else
{
if
(
shapes
[
i
]
==
null
)
continue
;
g
.
setStroke
(
new
BasicStroke
((
float
)
lineWidth
));
if
(
gradient
==
GeGradient
.
eGradient_No
)
{
if
(
i
==
sectors
)
{
g
.
setColor
(
GeColor
.
getColor
(
0
,
fillColor
));
g
.
fill
(
shapes
[
i
]);
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
g
.
draw
(
shapes
[
i
]);
}
else
{
g
.
setColor
(
GeColor
.
getColor
(
0
,
sectorColors
[
i
]));
g
.
fill
(
shapes
[
i
]);
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
g
.
draw
(
shapes
[
i
]);
}
}
else
{
if
(
i
==
sectors
)
{
GeGradient
.
paint
(
g
,
gradient
,
gc1
,
gc2
,
0
F
,
0
F
,
width
,
height
,
false
,
fillColor
,
0
,
0
,
0
,
0
,
fillColor
,
false
);
g
.
fill
(
shapes
[
i
]);
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
g
.
draw
(
shapes
[
i
]);
}
else
{
GeGradient
.
paint
(
g
,
gradient
,
gc1
,
gc2
,
0
F
,
0
F
,
width
,
height
,
false
,
sectorColors
[
i
],
0
,
0
,
0
,
0
,
sectorColors
[
i
],
false
);
g
.
fill
(
shapes
[
i
]);
g
.
setColor
(
GeColor
.
getColor
(
0
,
borderColor
));
g
.
draw
(
shapes
[
i
]);
}
}
}
}
//g.setTransform(save);
}
public
Dimension
getPreferredSize
()
{
return
size
;}
public
Dimension
getMinimumSize
()
{
return
size
;}
int
lowColor
=
0
;
public
void
setLowColor
(
int
lowColor
)
{
this
.
lowColor
=
lowColor
;}
public
int
getLowColor
()
{
return
lowColor
;}
String
[]
pwrAttribute
=
new
String
[
PIE_MAX_SECTORS
];
public
void
setPwrAttribute
(
String
[]
pwrAttribute
)
{
this
.
pwrAttribute
=
pwrAttribute
;}
public
String
[]
getPwrAttribute
()
{
return
pwrAttribute
;}
int
fixRange
=
0
;
float
valueColor
;
float
valueColorOld
;
boolean
firstScan
=
true
;
GdhrRefObjectInfo
[]
retAttr
=
new
GdhrRefObjectInfo
[
PIE_MAX_SECTORS
];
public
void
setFixRange
(
int
fixRange
)
{
this
.
fixRange
=
fixRange
;
}
public
void
setMinValue
(
float
minValue
)
{
this
.
minValue
=
minValue
;
}
public
float
getMinValue
()
{
return
minValue
;
}
public
void
setMaxValue
(
float
maxValue
)
{
this
.
maxValue
=
maxValue
;
}
public
float
getMaxValue
()
{
return
maxValue
;
}
public
Object
dynamicGetRoot
()
{
return
root
;
}
public
void
update
()
{
valueColorOld
=
-
10000
;
dynamicUpdate
(
false
);
}
public
void
dynamicOpen
()
{
if
(
en
.
isInstance
())
dd
.
setInstance
(
en
.
getInstance
());
for
(
int
i
=
0
;
i
<
PIE_MAX_SECTORS
;
i
++)
{
if
(
pwrAttribute
[
i
]
!=
null
)
{
String
attrName
=
dd
.
getAttrName
(
pwrAttribute
[
i
]);
retAttr
[
i
]
=
en
.
gdh
.
refObjectInfo
(
attrName
);
if
(
retAttr
[
i
].
evenSts
())
{
System
.
out
.
println
(
"refObjectInfoError attribute["
+
i
+
"]"
);
pwrAttribute
[
i
]
=
null
;
}
}
}
}
public
void
dynamicClose
()
{
for
(
int
i
=
0
;
i
<
PIE_MAX_SECTORS
;
i
++)
{
if
(
pwrAttribute
[
i
]
!=
null
)
en
.
gdh
.
unrefObjectInfo
(
retAttr
[
i
].
refid
);
}
}
public
void
dynamicUpdate
(
boolean
animationOnly
)
{
if
(
maxValue
==
minValue
)
return
;
if
(
animationOnly
)
return
;
for
(
int
i
=
0
;
i
<
PIE_MAX_SECTORS
;
i
++)
{
if
(
pwrAttribute
[
i
]
!=
null
)
sectorSize
[
i
]
=
en
.
gdh
.
getObjectRefInfoFloat
(
retAttr
[
i
].
id
);
else
sectorSize
[
i
]
=
0
;
}
if
(
fixRange
!=
1
)
{
float
sum
=
0
;
for
(
int
i
=
0
;
i
<
PIE_MAX_SECTORS
;
i
++)
sum
+=
sectorSize
[
i
];
if
(
sum
==
0
)
{
for
(
int
i
=
0
;
i
<
PIE_MAX_SECTORS
;
i
++)
sectorSize
[
i
]
=
0
;
}
else
{
for
(
int
i
=
0
;
i
<
PIE_MAX_SECTORS
;
i
++)
sectorSize
[
i
]
=
sectorSize
[
i
]
/
sum
*
(
maxValue
-
minValue
);
}
}
update
=
false
;
for
(
int
i
=
0
;
i
<
sectors
;
i
++)
{
if
(
sectorSize
[
i
]
!=
oldValueF
[
i
])
{
oldValueF
[
i
]
=
sectorSize
[
i
];
update
=
true
;
}
}
if
(
update
||
firstScan
)
repaint
();
if
(
firstScan
)
firstScan
=
false
;
}
public
void
repaintForeground
()
{
Graphics
g
=
getGraphics
();
if
(
g
==
null
)
{
System
.
out
.
println
(
"repaintForeground: can't get Graphic object"
);
return
;
}
paintComponent
(
g
);
paintChildren
(
g
);
}
}
java/jpwr/jop/src/os_templ/hw_templ/makefile
View file @
5964a7aa
...
...
@@ -34,6 +34,8 @@ local_java_sources := \
JopTrend.java
\
JopAxis.java
\
JopAxisarc.java
\
JopPie.java
\
JopBarChart.java
\
GeTable.java
\
GeDynElem.java
\
GeDynDigLowColor.java
\
...
...
xtt/lib/ge/src/ge_graph.h
View file @
5964a7aa
...
...
@@ -1082,6 +1082,22 @@ class Graph {
*/
int
export_TrendTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
);
//! Export java code for dynamics of a pie object.
/*!
\param fp Output file.
\param object Object.
\param cnt Index for javabean name.
*/
int
export_PieTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
);
//! Export java code for dynamics of a barchart object.
/*!
\param fp Output file.
\param object Object.
\param cnt Index for javabean name.
*/
int
export_BarChartTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
);
//! Export java code for dynamics of a table object.
/*!
\param fp Output file.
...
...
xtt/lib/ge/src/ge_graph_javabean.cpp
View file @
5964a7aa
...
...
@@ -1483,6 +1483,10 @@ int Graph::export_gejava_nodeclass( ofstream& fp, grow_tNodeClass nodeclass)
export_BarTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowTrend
)
export_TrendTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowPie
)
export_PieTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowBarChart
)
export_BarChartTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowTable
)
export_TableTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowSlider
)
...
...
@@ -1627,6 +1631,10 @@ int Graph::export_javaframe( char *filename, char *bean_name, int applet,
export_BarTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowTrend
)
export_TrendTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowPie
)
export_PieTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowBarChart
)
export_BarChartTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowTable
)
export_TableTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowSlider
)
...
...
@@ -1882,6 +1890,10 @@ int Graph::export_gejava( char *filename, char *bean_name, int applet, int html)
export_BarTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowTrend
)
export_TrendTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowPie
)
export_PieTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowBarChart
)
export_BarChartTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowTable
)
export_TableTraceAttr
(
fp
,
*
object_p
,
i
);
else
if
(
grow_GetObjectType
(
*
object_p
)
==
glow_eObjectType_GrowSlider
)
...
...
@@ -2284,19 +2296,6 @@ int Graph::export_BarTraceAttr( ofstream& fp, grow_tObject object, int cnt)
dyn
->
export_java
(
object
,
fp
,
var_name
);
}
#if 0
grow_GetTraceAttr( object, &trace_data);
strcpy( var_name, class_name);
var_name[0] = _tolower(var_name[0]);
sprintf( &var_name[strlen(var_name)], "%d", cnt);
if ( strcmp( trace_data->data[0], "") != 0)
{
fp <<
" " << var_name << ".setPwrAttribute(\"" << trace_data->data[0] << "\");" << endl;
}
#endif
return
1
;
}
...
...
@@ -2344,24 +2343,87 @@ int Graph::export_TrendTraceAttr( ofstream& fp, grow_tObject object, int cnt)
dyn
->
export_java
(
object
,
fp
,
var_name
);
}
return
1
;
}
#if 0
grow_GetTraceAttr( object, &trace_data);
int
Graph
::
export_PieTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
)
{
GeDyn
*
dyn
;
char
class_name
[]
=
"JopPie"
;
char
var_name
[
40
];
grow_GetUserData
(
object
,
(
void
**
)
&
dyn
);
strcpy
(
var_name
,
class_name
);
var_name
[
0
]
=
_tolower
(
var_name
[
0
]);
sprintf
(
&
var_name
[
strlen
(
var_name
)],
"%d"
,
cnt
);
if ( strcmp( trace_data->data[0], "") != 0)
{
if ( strcmp( trace_data->data[0], "") != 0)
for
(
GeDynElem
*
elem
=
dyn
->
elements
;
elem
;
elem
=
elem
->
next
)
{
if
(
elem
->
dyn_type
==
ge_mDynType_Pie
)
{
fp
<<
" " << var_name << ".setPwrAttribute1(\"" << trace_data->data[0] << "\");" << endl;
if ( strcmp( trace_data->data[1], "") != 0)
" "
<<
var_name
<<
".setPwrAttribute(new String[]{"
;
for
(
int
i
=
0
;
i
<
PIE_MAX_SECTORS
;
i
++
)
{
if
(
strcmp
(
((
GePie
*
)
elem
)
->
attribute
[
i
],
""
)
!=
0
)
fp
<<
"
\"
"
<<
((
GePie
*
)
elem
)
->
attribute
[
i
]
<<
"
\"
"
;
else
fp
<<
"null"
;
if
(
i
!=
PIE_MAX_SECTORS
-
1
)
fp
<<
","
;
}
fp
<<
"});"
<<
endl
<<
" "
<<
var_name
<<
".setFixRange("
<<
((
GePie
*
)
elem
)
->
fix_range
<<
");"
<<
endl
;
}
break
;
}
if
(
dyn
->
total_action_type
&
~
ge_mActionType_Inherit
)
{
fp
<<
" " << var_name << ".setPwrAttribute2(\"" << trace_data->data[1] << "\");" << endl;
" "
<<
var_name
<<
".dd.setActionType("
<<
(
int
)
dyn
->
total_action_type
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".dd.setAccess("
<<
(
int
)
dyn
->
access
<<
");"
<<
endl
;
dyn
->
export_java
(
object
,
fp
,
var_name
);
}
#endif
return
1
;
}
int
Graph
::
export_BarChartTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
)
{
GeDyn
*
dyn
;
char
class_name
[]
=
"JopBarChart"
;
char
var_name
[
40
];
grow_GetUserData
(
object
,
(
void
**
)
&
dyn
);
strcpy
(
var_name
,
class_name
);
var_name
[
0
]
=
_tolower
(
var_name
[
0
]);
sprintf
(
&
var_name
[
strlen
(
var_name
)],
"%d"
,
cnt
);
for
(
GeDynElem
*
elem
=
dyn
->
elements
;
elem
;
elem
=
elem
->
next
)
{
if
(
elem
->
dyn_type
==
ge_mDynType_BarChart
)
{
fp
<<
" "
<<
var_name
<<
".setPwrAttribute(new String[]{"
;
for
(
int
i
=
0
;
i
<
BARCHART_MAX_BARSEGMENTS
;
i
++
)
{
if
(
strcmp
(
((
GeBarChart
*
)
elem
)
->
attribute
[
i
],
""
)
!=
0
)
fp
<<
"
\"
"
<<
((
GeBarChart
*
)
elem
)
->
attribute
[
i
]
<<
"
\"
"
;
else
fp
<<
"null"
;
if
(
i
!=
BARCHART_MAX_BARSEGMENTS
-
1
)
fp
<<
","
;
}
fp
<<
"});"
<<
endl
;
}
break
;
}
if
(
dyn
->
total_action_type
&
~
ge_mActionType_Inherit
)
{
fp
<<
" "
<<
var_name
<<
".dd.setActionType("
<<
(
int
)
dyn
->
total_action_type
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".dd.setAccess("
<<
(
int
)
dyn
->
access
<<
");"
<<
endl
;
dyn
->
export_java
(
object
,
fp
,
var_name
);
}
return
1
;
}
...
...
@@ -2399,6 +2461,8 @@ int Graph::export_ObjectTraceAttr( ofstream& fp, grow_tObject object, int cnt) {
int
Graph
::
export_GejavaObjectTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
)
{
return
1
;}
int
Graph
::
export_BarTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
){
return
1
;}
int
Graph
::
export_TrendTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
)
{
return
1
;}
int
Graph
::
export_PieTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
){
return
1
;}
int
Graph
::
export_BarChartTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
){
return
1
;}
int
Graph
::
export_TableTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
)
{
return
1
;}
int
Graph
::
export_SliderTraceAttr
(
ofstream
&
fp
,
grow_tObject
object
,
int
cnt
)
{
return
1
;}
...
...
xtt/lib/glow/src/glow_exportjbean.cpp
View file @
5964a7aa
...
...
@@ -45,6 +45,8 @@
#include "glow_growctx.h"
#include "glow_grownode.h"
#include "glow_exportjbean.h"
#include "glow_growpie.h"
#include "glow_growbarchart.h"
#define glow_cJBean_Offset 2
#define glow_cJBean_SizeCorr 2
...
...
@@ -3892,6 +3894,201 @@ void GlowExportJBean::axisarc( double x1, double y1, double x2, double y2,
}
}
void
GlowExportJBean
::
pie
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
int
angle1
,
int
angle2
,
glow_eDrawType
border_drawtype
,
glow_eDrawType
fill_drawtype
,
int
fill
,
int
border
,
int
sectors
,
glow_eDrawType
*
sector_colors
,
double
min_value
,
double
max_value
,
int
line_width
,
double
rotate
,
double
shadow_width
,
int
shadow
,
glow_eGradient
gradient
,
int
gc1
,
int
gc2
,
glow_eExportPass
pass
,
int
*
shape_cnt
,
int
node_cnt
,
ofstream
&
fp
)
{
double
dim_x0
,
dim_x1
,
dim_y0
,
dim_y1
;
char
var_name
[
40
];
char
class_name
[]
=
"JopPie"
;
strcpy
(
var_name
,
class_name
);
var_name
[
0
]
=
_tolower
(
var_name
[
0
]);
sprintf
(
&
var_name
[
strlen
(
var_name
)],
"%d"
,
node_cnt
);
switch
(
pass
)
{
case
glow_eExportPass_Shape
:
break
;
case
glow_eExportPass_Declare
:
{
fp
<<
" "
<<
class_name
<<
" "
<<
var_name
<<
";"
<<
endl
;
break
;
}
case
glow_eExportPass_Attributes
:
{
((
GrowCtx
*
)
ctx
)
->
measure_javabean
(
&
dim_x1
,
&
dim_x0
,
&
dim_y1
,
&
dim_y0
);
fp
<<
" "
<<
var_name
<<
" = new "
<<
class_name
<<
"(session);"
<<
endl
<<
" "
<<
var_name
<<
".setBounds(new Rectangle("
<<
(
int
)(
x1
-
dim_x0
+
glow_cJBean_Offset
)
<<
","
<<
(
int
)(
y1
-
dim_y0
+
glow_cJBean_Offset
)
<<
","
<<
(
int
)(
x2
-
x1
)
<<
","
<<
(
int
)(
y2
-
y1
)
<<
"));"
<<
" "
<<
var_name
<<
".setAngle1("
<<
angle1
<<
"F);"
<<
endl
<<
" "
<<
var_name
<<
".setAngle2("
<<
angle2
<<
"F);"
<<
endl
;
if
(
fill_drawtype
!=
glow_eDrawType_No
)
fp
<<
" "
<<
var_name
<<
".setFillColor("
<<
(
int
)
fill_drawtype
<<
");"
<<
endl
;
if
(
border_drawtype
!=
glow_eDrawType_No
)
fp
<<
" "
<<
var_name
<<
".setBorderColor("
<<
(
int
)
border_drawtype
<<
");"
<<
endl
;
else
fp
<<
" "
<<
var_name
<<
".setBorderColor( 0);"
<<
endl
;
if
(
fill
)
fp
<<
" "
<<
var_name
<<
".setDrawFill(1);"
<<
endl
;
if
(
border
)
fp
<<
" "
<<
var_name
<<
".setDrawBorder(1);"
<<
endl
;
fp
<<
" "
<<
var_name
<<
".setSectors("
<<
sectors
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setSectorColors(new int[] {"
;
for
(
int
i
=
0
;
i
<
PIE_MAX_SECTORS
;
i
++
)
{
fp
<<
sector_colors
[
i
];
if
(
i
!=
PIE_MAX_SECTORS
-
1
)
fp
<<
","
;
}
fp
<<
"});"
<<
endl
;
fp
<<
" "
<<
var_name
<<
".setLineWidth("
<<
line_width
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setMinValue("
<<
min_value
<<
"F);"
<<
endl
<<
" "
<<
var_name
<<
".setMaxValue("
<<
max_value
<<
"F);"
<<
endl
<<
" "
<<
var_name
<<
".setRotate("
<<
rotate
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setShadow("
<<
shadow
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setShadowWidth("
<<
shadow_width
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setGradient("
<<
(
int
)
gradient
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setGc1("
<<
gc1
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setGc2("
<<
gc2
<<
");"
<<
endl
;
if
(
is_nodeclass
)
fp
<<
" add("
<<
var_name
<<
");"
<<
endl
;
else
fp
<<
" localPanel.add("
<<
var_name
<<
", new Proportion("
<<
var_name
<<
".getBounds(), dsize));"
<<
endl
;
break
;
}
case
glow_eExportPass_Draw
:
break
;
default:
;
}
}
void
GlowExportJBean
::
barchart
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
glow_eDrawType
border_drawtype
,
glow_eDrawType
fill_drawtype
,
int
fill
,
int
border
,
int
bars
,
int
barsegments
,
glow_eDrawType
*
bar_colors
,
double
min_value
,
double
max_value
,
int
line_width
,
double
rotate
,
double
shadow_width
,
int
shadow
,
glow_eGradient
gradient
,
int
gc1
,
int
gc2
,
int
vertical_lines
,
int
horizontal_lines
,
glow_eDrawType
line_color
,
glow_eExportPass
pass
,
int
*
shape_cnt
,
int
node_cnt
,
ofstream
&
fp
)
{
double
dim_x0
,
dim_x1
,
dim_y0
,
dim_y1
;
char
var_name
[
40
];
char
class_name
[]
=
"JopBarChart"
;
strcpy
(
var_name
,
class_name
);
var_name
[
0
]
=
_tolower
(
var_name
[
0
]);
sprintf
(
&
var_name
[
strlen
(
var_name
)],
"%d"
,
node_cnt
);
switch
(
pass
)
{
case
glow_eExportPass_Shape
:
break
;
case
glow_eExportPass_Declare
:
{
fp
<<
" "
<<
class_name
<<
" "
<<
var_name
<<
";"
<<
endl
;
break
;
}
case
glow_eExportPass_Attributes
:
{
((
GrowCtx
*
)
ctx
)
->
measure_javabean
(
&
dim_x1
,
&
dim_x0
,
&
dim_y1
,
&
dim_y0
);
fp
<<
" "
<<
var_name
<<
" = new "
<<
class_name
<<
"(session);"
<<
endl
<<
" "
<<
var_name
<<
".setBounds(new Rectangle("
<<
(
int
)(
x1
-
dim_x0
+
glow_cJBean_Offset
)
<<
","
<<
(
int
)(
y1
-
dim_y0
+
glow_cJBean_Offset
)
<<
","
<<
(
int
)(
x2
-
x1
)
<<
","
<<
(
int
)(
y2
-
y1
)
<<
"));"
<<
endl
;
if
(
fill_drawtype
!=
glow_eDrawType_No
)
fp
<<
" "
<<
var_name
<<
".setFillColor("
<<
(
int
)
fill_drawtype
<<
");"
<<
endl
;
if
(
border_drawtype
!=
glow_eDrawType_No
)
fp
<<
" "
<<
var_name
<<
".setBorderColor("
<<
(
int
)
border_drawtype
<<
");"
<<
endl
;
else
fp
<<
" "
<<
var_name
<<
".setBorderColor( 0);"
<<
endl
;
if
(
fill
)
fp
<<
" "
<<
var_name
<<
".setDrawFill(1);"
<<
endl
;
if
(
border
)
fp
<<
" "
<<
var_name
<<
".setDrawBorder(1);"
<<
endl
;
fp
<<
" "
<<
var_name
<<
".setBars("
<<
bars
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setBarSegments("
<<
barsegments
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setBarColors(new int[] {"
;
for
(
int
i
=
0
;
i
<
BARCHART_MAX_BARSEGMENTS
;
i
++
)
{
fp
<<
bar_colors
[
i
];
if
(
i
!=
BARCHART_MAX_BARSEGMENTS
-
1
)
fp
<<
","
;
}
fp
<<
"});"
<<
endl
;
fp
<<
" "
<<
var_name
<<
".setLineWidth("
<<
line_width
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setMinValue("
<<
min_value
<<
"F);"
<<
endl
<<
" "
<<
var_name
<<
".setMaxValue("
<<
max_value
<<
"F);"
<<
endl
<<
" "
<<
var_name
<<
".setRotate("
<<
rotate
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setShadow("
<<
shadow
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setShadowWidth("
<<
shadow_width
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setGradient("
<<
(
int
)
gradient
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setGc1("
<<
gc1
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setGc2("
<<
gc2
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setVerticalLines("
<<
vertical_lines
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setHorizontalLines("
<<
horizontal_lines
<<
");"
<<
endl
<<
" "
<<
var_name
<<
".setLineColor("
<<
(
int
)
line_color
<<
");"
<<
endl
;
if
(
is_nodeclass
)
fp
<<
" add("
<<
var_name
<<
");"
<<
endl
;
else
fp
<<
" localPanel.add("
<<
var_name
<<
", new Proportion("
<<
var_name
<<
".getBounds(), dsize));"
<<
endl
;
break
;
}
case
glow_eExportPass_Draw
:
break
;
default:
;
}
}
void
GlowExportJBean
::
window
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
char
*
filename
,
int
vertical_scrollbar
,
int
horizontal_scrollbar
,
char
*
owner
,
...
...
xtt/lib/glow/src/glow_exportjbean.h
View file @
5964a7aa
...
...
@@ -194,6 +194,38 @@ class GlowExportJBean {
int
text_idx
,
char
*
format
,
glow_eExportPass
pass
,
int
*
shape_cnt
,
int
node_cnt
,
ofstream
&
fp
);
void
pie
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
int
angle1
,
int
angle2
,
glow_eDrawType
border_drawtype
,
glow_eDrawType
fill_drawtype
,
int
fill
,
int
border
,
int
sectors
,
glow_eDrawType
*
sector_color
,
double
min_value
,
double
max_value
,
int
line_width
,
double
rotate
,
double
shadow_width
,
int
shadow
,
glow_eGradient
gradient
,
int
gc1
,
int
gc2
,
glow_eExportPass
pass
,
int
*
shape_cnt
,
int
node_cnt
,
ofstream
&
fp
);
void
barchart
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
glow_eDrawType
border_drawtype
,
glow_eDrawType
fill_drawtype
,
int
fill
,
int
border
,
int
bars
,
int
barsegments
,
glow_eDrawType
*
bar_color
,
double
min_value
,
double
max_value
,
int
line_width
,
double
rotate
,
double
shadow_width
,
int
shadow
,
glow_eGradient
gradient
,
int
gc1
,
int
gc2
,
int
vertical_lines
,
int
horizontal_lines
,
glow_eDrawType
line_color
,
glow_eExportPass
pass
,
int
*
shape_cnt
,
int
node_cnt
,
ofstream
&
fp
);
void
window
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
char
*
filename
,
int
vertical_scrollbar
,
...
...
xtt/lib/glow/src/glow_growbarchart.cpp
View file @
5964a7aa
...
...
@@ -551,6 +551,8 @@ void GrowBarChart::export_javabean( GlowTransform *t, void *node,
{
double
x1
,
y1
,
x2
,
y2
,
ll_x
,
ll_y
,
ur_x
,
ur_y
;
double
rotation
;
double
ish
;
int
gc1
,
gc2
;
if
(
!
t
)
{
...
...
@@ -577,12 +579,23 @@ void GrowBarChart::export_javabean( GlowTransform *t, void *node,
else
rotation
=
(
trf
.
rot
()
/
360
-
floor
(
trf
.
rot
()
/
360
))
*
360
;
#if 0
((GrowCtx *)ctx)->export_jbean->barchart( ll_x, ll_y, ur_x, ur_y, angle1, angle2,
draw_type, text_color_drawtype, min_value, max_value, lines, longquotient, valuequotient,
linelength, line_width, rotation, bold, idx, format,
ish
=
shadow_width
/
100
*
min
(
ur_x
-
ll_x
,
ur_y
-
ll_y
);
if
(
gradient_contrast
>=
0
)
{
gc1
=
gradient_contrast
/
2
;
gc2
=
-
int
(
float
(
gradient_contrast
)
/
2
+
0.6
);
}
else
{
gc1
=
int
(
float
(
gradient_contrast
)
/
2
-
0.6
);
gc2
=
-
gradient_contrast
/
2
;
}
ctx
->
export_jbean
->
barchart
(
ll_x
,
ll_y
,
ur_x
,
ur_y
,
draw_type
,
fill_drawtype
,
fill
,
border
,
bars
,
barsegments
,
bar_color
,
min_value
,
max_value
,
line_width
,
rotation
,
ish
,
shadow
,
gradient
,
gc1
,
gc2
,
vertical_lines
,
horizontal_lines
,
line_color
,
pass
,
shape_cnt
,
node_cnt
,
fp
);
#endif
}
void
GrowBarChart
::
set_conf
(
int
bar_num
,
int
barsegment_num
,
double
min_val
,
double
max_val
,
...
...
xtt/lib/glow/src/glow_growpie.cpp
View file @
5964a7aa
...
...
@@ -523,6 +523,8 @@ void GrowPie::export_javabean( GlowTransform *t, void *node,
{
double
x1
,
y1
,
x2
,
y2
,
ll_x
,
ll_y
,
ur_x
,
ur_y
;
double
rotation
;
double
ish
;
int
gc1
,
gc2
;
if
(
!
t
)
{
...
...
@@ -549,12 +551,22 @@ void GrowPie::export_javabean( GlowTransform *t, void *node,
else
rotation
=
(
trf
.
rot
()
/
360
-
floor
(
trf
.
rot
()
/
360
))
*
360
;
#if 0
((GrowCtx *)ctx)->export_jbean->pie( ll_x, ll_y, ur_x, ur_y, angle1, angle2,
draw_type, text_color_drawtype, min_value, max_value, lines, longquotient, valuequotient,
linelength, line_width, rotation, bold, idx, format,
ish
=
shadow_width
/
100
*
min
(
ur_x
-
ll_x
,
ur_y
-
ll_y
);
if
(
gradient_contrast
>=
0
)
{
gc1
=
gradient_contrast
/
2
;
gc2
=
-
int
(
float
(
gradient_contrast
)
/
2
+
0.6
);
}
else
{
gc1
=
int
(
float
(
gradient_contrast
)
/
2
-
0.6
);
gc2
=
-
gradient_contrast
/
2
;
}
ctx
->
export_jbean
->
pie
(
ll_x
,
ll_y
,
ur_x
,
ur_y
,
angle1
,
angle2
,
draw_type
,
fill_drawtype
,
fill
,
border
,
sectors
,
sector_color
,
min_value
,
max_value
,
line_width
,
rotation
,
ish
,
shadow
,
gradient
,
gc1
,
gc2
,
pass
,
shape_cnt
,
node_cnt
,
fp
);
#endif
}
void
GrowPie
::
set_conf
(
int
sector_num
,
double
min_val
,
double
max_val
,
glow_eDrawType
*
color
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment