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
03583387
Commit
03583387
authored
Feb 14, 2014
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Web, open graph from pwg-files as default, methods for pwg-graphs added
parent
5099a6fc
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
342 additions
and
111 deletions
+342
-111
java/aapp/pwrxtt/src/MainActivity.java
java/aapp/pwrxtt/src/MainActivity.java
+3
-0
java/jpwr/jop/src/FlowFrame.java
java/jpwr/jop/src/FlowFrame.java
+1
-1
java/jpwr/jop/src/JopMethods.java
java/jpwr/jop/src/JopMethods.java
+7
-7
java/jpwr/jop/src/JopOp.java
java/jpwr/jop/src/JopOp.java
+4
-4
java/jpwr/jop/src/JopSpider.java
java/jpwr/jop/src/JopSpider.java
+50
-63
java/jpwr/jopg/src/Dyn.java
java/jpwr/jopg/src/Dyn.java
+17
-3
java/jpwr/jopg/src/Glow.java
java/jpwr/jopg/src/Glow.java
+1
-0
java/jpwr/jopg/src/Graph.java
java/jpwr/jopg/src/Graph.java
+8
-1
java/jpwr/jopg/src/GraphApplIfc.java
java/jpwr/jopg/src/GraphApplIfc.java
+1
-0
java/jpwr/jopg/src/GraphIfc.java
java/jpwr/jopg/src/GraphIfc.java
+1
-0
java/jpwr/jopg/src/GrowCmn.java
java/jpwr/jopg/src/GrowCmn.java
+2
-1
java/jpwr/jopg/src/GrowCtx.java
java/jpwr/jopg/src/GrowCtx.java
+19
-0
java/jpwr/jopg/src/GrowFrame.java
java/jpwr/jopg/src/GrowFrame.java
+135
-30
java/jpwr/jopg/src/GrowFrameApplIfc.java
java/jpwr/jopg/src/GrowFrameApplIfc.java
+1
-0
java/jpwr/jopg/src/GrowWindow.java
java/jpwr/jopg/src/GrowWindow.java
+6
-1
src/wbl/pwrb/src/pwrb_c_applink.wb_load
src/wbl/pwrb/src/pwrb_c_applink.wb_load
+86
-0
No files found.
java/aapp/pwrxtt/src/MainActivity.java
View file @
03583387
...
...
@@ -2083,6 +2083,9 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
return
gdh
.
isAuthorized
(
access
);
}
public
void
openPopupMenu
(
String
object
,
double
x
,
double
y
)
{
}
public
void
invalidateView
()
{
view
.
invalidate
();
}
...
...
java/jpwr/jop/src/FlowFrame.java
View file @
03583387
...
...
@@ -147,7 +147,7 @@ public class FlowFrame extends JFrame implements JopUtilityIfc, GdhApplIfc {
URL
fileURL
=
new
URL
(
filename
);
InputStream
in
=
fileURL
.
openStream
();
// in = new BufferedInputStream(in);
InputStreamReader
r2
=
new
InputStreamReader
(
in
);
InputStreamReader
r2
=
new
InputStreamReader
(
in
,
"ISO-8859-1"
);
reader
=
new
BufferedReader
(
r2
);
}
catch
(
Exception
e
)
{
...
...
java/jpwr/jop/src/JopMethods.java
View file @
03583387
...
...
@@ -283,14 +283,14 @@ public class JopMethods {
CdhrString
actionRet
=
gdh
.
getObjectInfoString
(
attr
);
if
(
actionRet
.
evenSts
())
return
;
int
idx
=
actionRet
.
str
.
lastIndexOf
(
'.'
);
String
action
;
if
(
idx
!=
-
1
)
action
=
actionRet
.
str
.
substring
(
0
,
1
).
toUpperCase
()
+
actionRet
.
str
.
substring
(
1
,
idx
);
else
action
=
actionRet
.
str
.
substring
(
0
,
1
).
toUpperCase
()
+
actionRet
.
str
.
substring
(
1
);
if
(
actionRet
.
str
.
endsWith
(
".class"
))
{
int
idx
=
actionRet
.
str
.
lastIndexOf
(
'.'
);
action
=
actionRet
.
str
.
substring
(
0
,
1
).
toUpperCase
()
+
actionRet
.
str
.
substring
(
1
,
idx
);
}
else
{
action
=
actionRet
.
str
;
}
String
instance
=
null
;
attr
=
xttgraph
.
str
+
".Object"
;
...
...
java/jpwr/jop/src/JopOp.java
View file @
03583387
...
...
@@ -38,12 +38,12 @@ public class JopOp {
if
(
args
.
length
>
0
)
System
.
out
.
println
(
"Arg: "
+
args
[
0
]);
try
{
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager
.
setLookAndFeel
(
UIManager
.
getCrossPlatformLookAndFeelClassName
());
// UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
UIManager
.
setLookAndFeel
(
"javax.swing.plaf.metal.MetalLookAndFeel"
);
// UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"setLookAndFeel exception"
);
// e.printStackTrace();
}
new
JopOp
();
byte
[]
buff
=
new
byte
[
100
];
...
...
java/jpwr/jop/src/JopSpider.java
View file @
03583387
...
...
@@ -76,6 +76,9 @@ public class JopSpider {
public
void
frameClosed
(
Object
utility
)
{
session
.
removeUtility
(
utility
);
}
public
void
openPopupMenu
(
String
object
,
Object
invoker
,
int
x
,
int
y
)
{
JopSpider
.
openPopupMenu
(
session
,
object
,
invoker
,
x
,
y
);
}
}
public
JopSpider
(
int
op_qcom_qix
)
{
...
...
@@ -97,16 +100,12 @@ public class JopSpider {
// Send qcom qix to jop
String
set_cmd
=
"set jop_queid "
+
qcom_qix
;
System
.
out
.
println
(
"qcom put"
);
PwrtStatus
sts
=
qcom
.
put
(
op_qcom_qix
,
op_qcom_nid
,
set_cmd
);
System
.
out
.
println
(
"qcom put finished"
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"Qcom put error: "
+
sts
.
getSts
());
new
JopSpiderCmd
(
session
);
// loadFrame("Frame");
// loadFrame("Frame");
}
static
public
void
setSystemName
(
String
systemName
)
{
...
...
@@ -116,6 +115,11 @@ System.out.println( "qcom put finished");
return
systemName
;
}
static
void
openPopupMenu
(
JopSession
session
,
String
object
,
Object
invoker
,
int
x
,
int
y
)
{
new
JopMethodsMenu
(
session
,
object
,
JopUtility
.
GRAPH
,
(
Component
)
invoker
,
x
,
y
);
}
static
CliTable
[]
cliTable
=
new
CliTable
[]
{
new
CliTable
(
"OPEN"
,
new
String
[]
{
"cli_arg1"
,
"cli_arg2"
,
"/NAME"
,
"/FILE"
,
"/SCROLLBAR"
,
"/WIDTH"
,
"/HEIGHT"
,
"/MENU"
,
"/NAVIGATOR"
,
...
...
@@ -202,6 +206,7 @@ System.out.println( "qcom put finished");
boolean
scrollbar
=
cli
.
qualifierFound
(
"/SCROLLBAR"
);
if
(
cli
.
qualifierFound
(
"/OBJECT"
))
{
// XttGraph object
String
objectValue
=
cli
.
getQualValue
(
"/OBJECT"
);
String
objectName
;
String
appletName
;
...
...
@@ -257,76 +262,47 @@ System.out.println( "qcom put finished");
local_cmd
=
true
;
}
else
{
if
(
true
/* session.isOpWindowApplet() */
)
{
String
frameName
=
null
;
String
instanceValue
=
null
;
boolean
classGraph
=
false
;
// No XttGraph
String
frameName
=
null
;
String
instanceValue
=
null
;
boolean
classGraph
=
false
;
if
(
cli
.
qualifierFound
(
"/INSTANCE"
))
{
if
(
cli
.
qualifierFound
(
"/INSTANCE"
))
{
instanceValue
=
cli
.
getQualValue
(
"/INSTANCE"
);
classGraph
=
cli
.
qualifierFound
(
"/CLASSGRAPH"
);
boolean
parent
=
cli
.
qualifierFound
(
"/PARENT"
);
if
(
parent
)
{
int
idx
=
instanceValue
.
lastIndexOf
(
'.'
);
if
(
idx
!=
-
1
&&
idx
!=
0
)
instanceValue
=
instanceValue
.
substring
(
0
,
idx
);
System
.
out
.
println
(
"open graph /parent: "
+
instanceValue
);
int
idx
=
instanceValue
.
lastIndexOf
(
'.'
);
if
(
idx
!=
-
1
&&
idx
!=
0
)
instanceValue
=
instanceValue
.
substring
(
0
,
idx
);
System
.
out
.
println
(
"open graph /parent: "
+
instanceValue
);
}
}
if
(
!
classGraph
)
{
}
if
(
!
classGraph
)
{
if
(
!
cli
.
qualifierFound
(
"cli_arg2"
))
{
System
.
out
.
println
(
"Syntax error"
);
return
0
;
System
.
out
.
println
(
"Syntax error"
);
return
0
;
}
frameName
=
cli
.
getQualValue
(
"cli_arg2"
).
toLowerCase
();
frameName
=
frameName
.
substring
(
0
,
1
).
toUpperCase
()
+
frameName
.
substring
(
1
);
System
.
out
.
println
(
"Open frame "
+
frameName
);
}
session
.
openGraphFrame
(
frameName
,
instanceValue
,
scrollbar
,
classGraph
);
}
/*************
else {
String frameName = null;
if ( ! cli.qualifierFound("cli_arg2")) {
System.out.println("Syntax error");
return 0;
}
frameName = cli.getQualValue("cli_arg2").toLowerCase();
frameName
=
cli
.
getQualValue
(
"cli_arg2"
);
if
(
Character
.
isUpperCase
(
frameName
.
charAt
(
0
)))
{
// If first char is upper, open as java class
frameName
=
frameName
.
toLowerCase
();
frameName
=
frameName
.
substring
(
0
,
1
).
toUpperCase
()
+
frameName
.
substring
(
1
);
if ( cli.qualifierFound("/INSTANCE")) {
String instanceValue =
cli.getQualValue("/INSTANCE").toLowerCase();
boolean parent = cli.qualifierFound("/PARENT");
if ( parent) {
int idx = instanceValue.lastIndexOf( '.');
if ( idx != -1 && idx != 0)
instanceValue = instanceValue.substring( 0, idx);
System.out.println( "open graph /parent: " + instanceValue);
}
String tempFile = frameName + "_" +
instanceValue.replace('','a').replace('','a').replace('','o');
PwrtStatus psts =
gdh.createInstanceFile(
"$pwrp_websrv/"+frameName+".html",
tempFile+".html", instanceValue);
if ( psts.evenSts()) {
System.out.println("createInstanceFile error");
return 0;
else
{
// If first char is lower, open as pwg-file
if
(
frameName
.
indexOf
(
".pwg"
)
==
-
1
)
frameName
=
frameName
+
".pwg"
;
}
frameName = tempFile;
}
System.out.println( "Loading applet \"" + frameName + "\"");
openURL( session, frameName, newFrame, null, null);
local_cmd = true;
System
.
out
.
println
(
"Open frame "
+
frameName
);
}
***/
}
session
.
openGraphFrame
(
frameName
,
instanceValue
,
scrollbar
,
classGraph
);
}
}
else
{
// Application
...
...
@@ -348,6 +324,7 @@ System.out.println( "qcom put finished");
}
}
if
(
cli
.
qualifierFound
(
"/OBJECT"
))
{
// XttGraph object
String
objectValue
=
cli
.
getQualValue
(
"/OBJECT"
);
String
objectName
;
String
appletName
;
...
...
@@ -401,10 +378,20 @@ System.out.println( "qcom put finished");
frameName
=
frameName
+
".pwg"
;
}
else
if
(
cli
.
qualifierFound
(
"cli_arg2"
))
{
frameName
=
cli
.
getQualValue
(
"cli_arg2"
).
toLowerCase
();
frameName
=
cli
.
getQualValue
(
"cli_arg2"
);
if
(
Character
.
isUpperCase
(
frameName
.
charAt
(
0
)))
{
// If first char is upper, open as java class
frameName
=
frameName
.
toLowerCase
();
frameName
=
frameName
.
substring
(
0
,
1
).
toUpperCase
()
+
frameName
=
frameName
.
substring
(
0
,
1
).
toUpperCase
()
+
frameName
.
substring
(
1
);
}
else
{
// If first char is lower, open as pwg-file
if
(
frameName
.
indexOf
(
".pwg"
)
==
-
1
)
frameName
=
frameName
+
".pwg"
;
}
}
else
{
System
.
out
.
println
(
"Syntax error"
);
...
...
java/jpwr/jopg/src/Dyn.java
View file @
03583387
...
...
@@ -591,7 +591,7 @@ public class Dyn {
public
static
final
int
ePwrStatus_Error
=
3
;
public
static
final
int
ePwrStatus_Fatal
=
4
;
public
static
final
boolean
debug
=
tru
e
;
public
static
final
boolean
debug
=
fals
e
;
Vector
<
DynElem
>
elements
=
new
Vector
<
DynElem
>();
GraphIfc
graph
;
...
...
@@ -3204,6 +3204,9 @@ public class Dyn {
if
(
token
.
hasMoreTokens
())
attribute
=
token
.
nextToken
();
break
;
case
Dyn
.
eSave_ValueInput_unselect
:
unselect
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Dyn
.
eSave_ValueInput_min_value
:
min_value
=
new
Double
(
token
.
nextToken
()).
doubleValue
();
break
;
...
...
@@ -6314,6 +6317,18 @@ public class Dyn {
ref_object
=
x
.
ref_object
;
}
public
int
action
(
GlowArrayElem
object
,
GlowEvent
e
)
{
if
(
!
dyn
.
graph
.
isAuthorized
(
dyn
.
access
))
return
1
;
switch
(
e
.
event
)
{
case
Glow
.
eEvent_MB3Press
:
dyn
.
graph
.
openPopupMenu
(
ref_object
,
e
.
x
,
e
.
y
);
break
;
}
return
1
;
}
public
void
open
(
BufferedReader
reader
)
{
String
line
;
StringTokenizer
token
;
...
...
@@ -7423,9 +7438,8 @@ public class Dyn {
case
Glow
.
eEvent_MB1Click
:
if
(
(
dyn
.
action_type1
&
Dyn
.
mActionType1_Confirm
)
!=
0
)
break
;
String
command
=
null
;
if
(
!
graph_object
.
equals
(
""
))
if
(
!
(
graph_object
==
null
||
graph_object
.
equals
(
""
)
))
command
=
new
String
(
"open graph/object="
+
graph_object
);
else
{
// Open classgraph for popup menu object
...
...
java/jpwr/jopg/src/Glow.java
View file @
03583387
...
...
@@ -1498,4 +1498,5 @@ public class Glow {
public
static
final
int
eEvent_SliderMoveStart
=
11
;
public
static
final
int
eEvent_SliderMoved
=
12
;
public
static
final
int
eEvent_SliderMoveEnd
=
13
;
public
static
final
int
eEvent_MB3Press
=
14
;
}
java/jpwr/jopg/src/Graph.java
View file @
03583387
...
...
@@ -343,7 +343,8 @@ public class Graph implements GraphIfc, GrowApplIfc {
while
(
(
idx
=
str
.
indexOf
(
"$object"
))
!=
-
1
)
{
if
(
appl
!=
null
)
{
String
oname
=
appl
.
getObject
();
// String oname = appl.getObject();
String
oname
=
cmn
.
getOwner
();
str
=
str
.
substring
(
0
,
idx
)
+
oname
+
str
.
substring
(
idx
+
7
);
}
}
...
...
@@ -412,6 +413,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
// Note! no break
case
Glow
.
eEvent_MB1Up
:
case
Glow
.
eEvent_MB1Down
:
case
Glow
.
eEvent_MB3Press
:
case
Glow
.
eEvent_ValueChanged
:
case
Glow
.
eEvent_SliderMoveStart
:
case
Glow
.
eEvent_SliderMoveEnd
:
...
...
@@ -492,6 +494,11 @@ public class Graph implements GraphIfc, GrowApplIfc {
appl
.
openValueInputDialog
(
dyn
,
text
,
object
);
}
public
void
openPopupMenu
(
String
object
,
double
x
,
double
y
)
{
if
(
appl
!=
null
)
appl
.
openPopupMenu
(
object
,
x
,
y
);
}
public
String
get_reference_name
(
String
name
)
{
// TODO
return
null
;
...
...
java/jpwr/jopg/src/GraphApplIfc.java
View file @
03583387
...
...
@@ -40,6 +40,7 @@ public interface GraphApplIfc {
public
int
command
(
String
cmd
);
public
void
openConfirmDialog
(
Object
dyn
,
String
text
,
Object
object
);
public
void
openValueInputDialog
(
Object
dyn
,
String
text
,
Object
object
);
public
void
openPopupMenu
(
String
object
,
double
x
,
double
y
);
public
int
getWidth
();
public
int
getHeight
();
public
String
getObject
();
...
...
java/jpwr/jopg/src/GraphIfc.java
View file @
03583387
...
...
@@ -57,6 +57,7 @@ public interface GraphIfc {
public
void
closeGraph
();
public
void
openConfirmDialog
(
Object
dyn
,
String
text
,
Object
object
);
public
void
openValueInputDialog
(
Object
dyn
,
String
text
,
Object
object
);
public
void
openPopupMenu
(
String
object
,
double
x
,
double
y
);
public
String
get_reference_name
(
String
name
);
public
Object
getCurrentSlider
();
public
void
setCurrentSlider
(
GrowSlider
currentSlider
);
...
...
java/jpwr/jopg/src/GrowCmn.java
View file @
03583387
...
...
@@ -120,7 +120,7 @@ public class GrowCmn {
public
GrowCmn
(
GrowCtxIfc
ctx
,
GrowApplIfc
appl
)
{
this
.
ctx
=
ctx
;
this
.
appl
=
appl
;
this
.
debug
=
tru
e
;
this
.
debug
=
fals
e
;
this
.
antiAliasing
=
true
;
mw
.
window_width
=
getWidth
();
mw
.
window_height
=
getHeight
();
...
...
@@ -155,4 +155,5 @@ public class GrowCmn {
public
int
getAppMotion
()
{
return
app_motion
;
}
}
java/jpwr/jopg/src/GrowCtx.java
View file @
03583387
...
...
@@ -788,6 +788,12 @@ public class GrowCtx implements GrowCtxIfc {
draw
();
}
public
void
zoomAbsolute
(
double
factor
)
{
cmn
.
mw
.
zoom_factor_x
=
factor
;
cmn
.
mw
.
zoom_factor_y
=
factor
;
draw
();
}
public
void
scroll
(
int
delta_x
,
int
delta_y
)
{
cmn
.
mw
.
offset_x
+=
delta_x
;
cmn
.
mw
.
offset_y
+=
delta_y
;
...
...
@@ -837,6 +843,19 @@ public class GrowCtx implements GrowCtxIfc {
public
void
setSliderActive
(
boolean
active
)
{
sliderActive
=
active
;
}
public
void
setDefaultLayout
(
int
width
,
int
height
)
{
if
(
cmn
.
x0
>=
cmn
.
x1
||
cmn
.
y0
>=
cmn
.
y1
)
return
;
cmn
.
mw
.
zoom_factor_x
=
Math
.
min
(
width
/(
cmn
.
x1
-
cmn
.
x0
),
height
/(
cmn
.
y1
-
cmn
.
y0
));
cmn
.
mw
.
zoom_factor_y
=
cmn
.
mw
.
zoom_factor_x
;
cmn
.
mw
.
offset_x
=
(
int
)(
cmn
.
x0
*
cmn
.
mw
.
zoom_factor_x
);
cmn
.
mw
.
offset_y
=
(
int
)(
cmn
.
y0
*
cmn
.
mw
.
zoom_factor_y
);
draw
();
}
}
...
...
java/jpwr/jopg/src/GrowFrame.java
View file @
03583387
...
...
@@ -49,6 +49,8 @@ import java.net.*;
import
java.applet.*
;
public
class
GrowFrame
extends
JFrame
implements
GraphApplIfc
,
ActionListener
{
static
final
int
BORDER_WIDTH
=
5
;
static
final
int
BORDER_HEIGHT
=
40
;
JScrollPane
scrollPane
;
JPanel
contentPane
;
LocalPanel
localPanel
=
new
LocalPanel
();
...
...
@@ -72,6 +74,13 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
String
instance
;
GrowFrameApplIfc
appl
;
GrowFrame
frame
;
boolean
drawn
=
false
;
double
baseZoomFactor
=
0
;
int
defaultWidth
=
0
;
int
defaultHeight
=
0
;
double
aspectRatio
=
0
;
Dimension
prevSize
;
int
skipResize
=
0
;
public
GrowFrame
(
String
file
,
Gdh
gdh
,
String
instance
,
GrowFrameApplIfc
appl
,
Object
root
)
{
this
.
root
=
root
;
...
...
@@ -113,13 +122,12 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
URL
fileURL
=
new
URL
(
filename
);
InputStream
in
=
fileURL
.
openStream
();
// in = new BufferedInputStream(in);
InputStreamReader
r2
=
new
InputStreamReader
(
in
);
InputStreamReader
r2
=
new
InputStreamReader
(
in
,
"ISO-8859-1"
);
reader
=
new
BufferedReader
(
r2
);
// Read size info
reader
.
mark
(
1000
);
String
line
;
int
defaultWidth
=
0
;
int
defaultHeight
=
0
;
try
{
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
...
...
@@ -136,16 +144,27 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
System
.
out
.
println
(
"GraphFrame size "
+
defaultWidth
+
" "
+
defaultHeight
);
if
(
defaultWidth
!=
0
&&
defaultHeight
!=
0
)
{
size
=
new
Dimension
(
defaultWidth
+
5
,
defaultHeight
+
40
);
size
=
new
Dimension
(
defaultWidth
+
BORDER_WIDTH
,
defaultHeight
+
BORDER_HEIGHT
);
System
.
out
.
println
(
"defaultWidth: "
+
defaultWidth
+
" defaultHeight "
+
defaultHeight
);
setSize
(
size
);
aspectRatio
=
(
double
)
defaultWidth
/
defaultHeight
;
prevSize
=
new
Dimension
(
defaultWidth
,
defaultHeight
);
}
else
{
reader
.
reset
();
/* reader.close();
InputStream in3 = fileURL.openStream();
InputStreamReader r3 = new InputStreamReader(in, "ISO-8859-1");
reader = new BufferedReader( r3);
*/
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Unable to open file"
);
}
}
else
{
// Not applet
if
(
fname
.
lastIndexOf
(
'/'
)
==
-
1
)
{
if
(
fname
.
startsWith
(
"pwr_c_"
))
filename
=
"$pwr_exe/"
+
fname
;
...
...
@@ -158,7 +177,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
System
.
out
.
println
(
"Fname: "
+
filename
);
try
{
reader
=
new
BufferedReader
(
new
FileReader
(
filename
));
reader
=
new
BufferedReader
(
new
InputStreamReader
(
new
FileInputStream
(
filename
),
"ISO-8859-1"
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Unable to open file "
+
filename
);
...
...
@@ -166,10 +185,9 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
// Read size info
String
line
;
int
defaultWidth
=
0
;
int
defaultHeight
=
0
;
try
{
reader
.
mark
(
1000
);
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
line
=
reader
.
readLine
();
if
(
line
==
null
||
!
line
.
startsWith
(
"0! "
))
...
...
@@ -186,7 +204,23 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
if
(
defaultWidth
!=
0
&&
defaultHeight
!=
0
)
{
size
=
new
Dimension
(
defaultWidth
+
5
,
defaultHeight
+
40
);
setSize
(
size
);
}
aspectRatio
=
(
double
)
defaultWidth
/
defaultHeight
;
prevSize
=
new
Dimension
(
defaultWidth
,
defaultHeight
);
}
else
{
try
{
reader
.
reset
();
/*
reader.close();
reader = new BufferedReader( new InputStreamReader(new FileInputStream(filename), "ISO-8859-1"));
*/
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Unable to open file "
+
filename
);
return
;
}
}
}
// if ( gdh == null)
...
...
@@ -196,32 +230,60 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
graph
.
setOwner
(
instance
);
graph
.
open
(
reader
);
setSize
();
System
.
out
.
println
(
"After open "
+
defaultWidth
+
" "
+
defaultHeight
);
if
(
defaultWidth
==
0
||
defaultHeight
==
0
)
setSize
();
enableEvents
(
AWTEvent
.
WINDOW_EVENT_MASK
);
setDefaultCloseOperation
(
DISPOSE_ON_CLOSE
);
MouseAdapter
adapter
=
new
MouseAdapter
()
{
public
void
mouseClicked
(
MouseEvent
e
)
{
GlowEvent
event
=
new
GlowEvent
();
event
.
x
=
(
e
.
getX
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_x
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
;
event
.
y
=
(
e
.
getY
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_y
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_y
;
event
.
event
=
Glow
.
eEvent_MB1Click
;
graph
.
ctx
.
eventHandler
(
event
);
System
.
out
.
println
(
"GrowFrame click "
+
e
.
getModifiers
()
+
" "
+
MouseEvent
.
BUTTON1_MASK
);
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
)
{
System
.
out
.
println
(
"GrowFrame click MB1"
+
e
.
getModifiers
()
+
" "
+
MouseEvent
.
BUTTON1_MASK
);
GlowEvent
event
=
new
GlowEvent
();
event
.
x
=
(
e
.
getX
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_x
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
;
event
.
y
=
(
e
.
getY
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_y
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_y
;
event
.
event
=
Glow
.
eEvent_MB1Click
;
graph
.
ctx
.
eventHandler
(
event
);
}
else
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON3_MASK
)
!=
0
)
{
System
.
out
.
println
(
"GrowFrame click MB3"
+
e
.
getModifiers
()
+
" "
+
MouseEvent
.
BUTTON3_MASK
);
GlowEvent
event
=
new
GlowEvent
();
event
.
x
=
(
e
.
getX
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_x
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
;
event
.
y
=
(
e
.
getY
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_y
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_y
;
event
.
event
=
Glow
.
eEvent_MB3Press
;
graph
.
ctx
.
eventHandler
(
event
);
}
}
public
void
mousePressed
(
MouseEvent
e
)
{
GlowEvent
event
=
new
GlowEvent
();
event
.
x
=
(
e
.
getX
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_x
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
;
event
.
y
=
(
e
.
getY
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_y
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_y
;
event
.
event
=
Glow
.
eEvent_MB1Down
;
graph
.
ctx
.
eventHandler
(
event
);
/*
if ( e.isPopupTrigger()) {
System.out.println("GrowFrame MB3");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.event = Glow.eEvent_MB3Press;
graph.ctx.eventHandler( event);
}
else */
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
)
{
GlowEvent
event
=
new
GlowEvent
();
event
.
x
=
(
e
.
getX
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_x
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
;
event
.
y
=
(
e
.
getY
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_y
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_y
;
event
.
event
=
Glow
.
eEvent_MB1Down
;
graph
.
ctx
.
eventHandler
(
event
);
}
}
public
void
mouseReleased
(
MouseEvent
e
)
{
GlowEvent
event
=
new
GlowEvent
();
event
.
x
=
(
e
.
getX
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_x
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
;
event
.
y
=
(
e
.
getY
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_y
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_y
;
event
.
event
=
Glow
.
eEvent_MB1Up
;
graph
.
ctx
.
eventHandler
(
event
);
}
if
((
e
.
getModifiers
()
&
MouseEvent
.
BUTTON1_MASK
)
!=
0
)
{
GlowEvent
event
=
new
GlowEvent
();
event
.
x
=
(
e
.
getX
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_x
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
;
event
.
y
=
(
e
.
getY
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_y
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_y
;
event
.
event
=
Glow
.
eEvent_MB1Up
;
graph
.
ctx
.
eventHandler
(
event
);
}
}
public
void
mouseMoved
(
MouseEvent
e
)
{
GlowEvent
event
=
new
GlowEvent
();
event
.
x
=
(
e
.
getX
()
+
graph
.
ctx
.
cmn
.
mw
.
offset_x
)
/
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
;
...
...
@@ -237,6 +299,35 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
graph
.
ctx
.
eventHandler
(
event
);
}
};
this
.
addComponentListener
(
new
ComponentAdapter
()
{
public
void
componentResized
(
ComponentEvent
e
)
{
if
(
drawn
&&
aspectRatio
!=
0
)
{
int
w
=
getWidth
()
-
BORDER_WIDTH
;
int
h
=
getHeight
()
-
BORDER_HEIGHT
;
if
(
skipResize
>
0
)
{
skipResize
--;
prevSize
=
new
Dimension
(
w
,
h
);
graph
.
ctx
.
setDefaultLayout
(
w
,
h
);
return
;
}
double
ratio
=
(
double
)
w
/
h
;
if
(
(
w
>
400
&&
Math
.
abs
(
ratio
-
aspectRatio
)
>
0.05
)
||
(
w
>
200
&&
w
<=
400
&&
Math
.
abs
(
ratio
-
aspectRatio
)
>
0.10
)
||
(
w
<=
200
&&
Math
.
abs
(
ratio
-
aspectRatio
)
>
0.15
))
{
h
=
(
int
)
((
double
)
w
/
aspectRatio
);
prevSize
=
new
Dimension
(
w
,
h
);
setSize
(
w
+
BORDER_WIDTH
,
h
+
BORDER_HEIGHT
);
skipResize
=
1
;
}
graph
.
ctx
.
setDefaultLayout
(
w
,
h
);
}
}
});
localPanel
.
addMouseListener
(
adapter
);
localPanel
.
addMouseMotionListener
(
adapter
);
...
...
@@ -245,7 +336,6 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
timer
.
start
();
}
public
int
getWidth
()
{
return
localPanel
.
getWidth
()
+
5
;
}
...
...
@@ -282,6 +372,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
graph
.
gdraw
.
setGraphics
(
g2
);
graph
.
ctx
.
draw
();
drawn
=
true
;
}
}
...
...
@@ -300,7 +391,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
public
int
command
(
String
cmd
)
{
System
.
out
.
println
(
"Ge command : "
+
cmd
);
if
(
appl
!=
null
)
return
appl
.
command
(
cmd
);
return
appl
.
command
(
cmd
);
return
0
;
}
...
...
@@ -472,6 +563,14 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
}
public
void
openPopupMenu
(
String
object
,
double
x
,
double
y
)
{
if
(
appl
!=
null
)
{
appl
.
openPopupMenu
(
object
,
this
,
(
int
)(
x
*
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_x
-
graph
.
ctx
.
cmn
.
mw
.
offset_x
),
(
int
)(
y
*
graph
.
ctx
.
cmn
.
mw
.
zoom_factor_y
-
graph
.
ctx
.
cmn
.
mw
.
offset_y
));
}
}
public
String
getObject
()
{
return
instance
;
}
...
...
@@ -490,12 +589,17 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
if
(
idx2
>
idx
)
idx
=
idx2
;
String
path
=
current_str
.
substring
(
0
,
idx
+
1
);
idx
=
fname
.
indexOf
(
'/'
);
if
(
idx
!=
-
1
)
fname
=
fname
.
substring
(
idx
);
filename
=
path
+
fname
;
System
.
out
.
println
(
"Opening file "
+
filename
);
URL
fileURL
=
new
URL
(
filename
);
InputStream
in
=
fileURL
.
openStream
();
// in = new BufferedInputStream(in);
InputStreamReader
r2
=
new
InputStreamReader
(
in
);
InputStreamReader
r2
=
new
InputStreamReader
(
in
,
"ISO-8859-1"
);
reader
=
new
BufferedReader
(
r2
);
}
catch
(
Exception
e
)
{
...
...
@@ -515,7 +619,8 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
System
.
out
.
println
(
"Fname: "
+
filename
);
try
{
reader
=
new
BufferedReader
(
new
FileReader
(
filename
));
//reader = new BufferedReader(new FileReader(filename));
reader
=
new
BufferedReader
(
new
InputStreamReader
(
new
FileInputStream
(
filename
),
"ISO-8859-1"
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Unable to open file "
+
filename
);
...
...
java/jpwr/jopg/src/GrowFrameApplIfc.java
View file @
03583387
...
...
@@ -40,4 +40,5 @@ package jpwr.jopg;
public
interface
GrowFrameApplIfc
{
public
int
command
(
String
cmd
);
public
void
frameClosed
(
Object
utility
);
public
void
openPopupMenu
(
String
object
,
Object
invoker
,
int
x
,
int
y
);
}
java/jpwr/jopg/src/GrowWindow.java
View file @
03583387
...
...
@@ -275,7 +275,7 @@ public class GrowWindow extends GrowRect implements GrowScrollBarIfc {
windowCmn
.
mw
.
subwindow_scale
=
cmn
.
mw
.
subwindow_scale
*
window_scale
;
windowCmn
.
mw
.
zoom_factor_x
=
windowCmn
.
mw
.
zoom_factor_y
=
cmn
.
mw
.
zoom_factor_x
*
windowCmn
.
mw
.
subwindow_scale
;
configureScrollbars
();
}
...
...
@@ -450,6 +450,8 @@ public class GrowWindow extends GrowRect implements GrowScrollBarIfc {
v_value
=
wctx_y0
*
windowCmn
.
mw
.
subwindow_scale
;
}
}
else
v_value
=
wctx_y0
*
windowCmn
.
mw
.
subwindow_scale
;
if
(
horizontal_scrollbar
!=
0
&&
h_scrollbar
==
null
)
{
x0
=
x_left
;
...
...
@@ -479,6 +481,9 @@ public class GrowWindow extends GrowRect implements GrowScrollBarIfc {
h_value
=
wctx_x0
*
windowCmn
.
mw
.
subwindow_scale
;
}
}
else
h_value
=
wctx_x0
*
windowCmn
.
mw
.
subwindow_scale
;
}
public
void
verticalScrollValueChanged
(
double
value
)
{
...
...
src/wbl/pwrb/src/pwrb_c_applink.wb_load
0 → 100644
View file @
03583387
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 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.
!
! pwrb_c_appgraph.wb_load -- Defines the class AppGraph.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Defines a link in an android application.
! Defines a link in an android application.
! AppLink objects should be positioned as children to a WebHandler object.
!
!
! @b See also
! @classlink WebHandler pwrb_webhandler.html
!*/
Object AppLink $ClassDef 616
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 1
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "AppLink"
EndBody
!/**
! The URL.
!*/
Object URL $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$URL"
EndBody
EndObject
!/**
! Icon text for the link.
!*/
Object Text $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Icon image for the link.
! The default location is $pwrp_exe.
!*/
Object Image $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
EndObject
EndObject
EndSObject
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