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
6fd84081
Commit
6fd84081
authored
Jun 18, 2015
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java table, support for cell selection added
parent
588f1ffd
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
192 additions
and
6 deletions
+192
-6
java/jpwr/jopg/src/Dyn.java
java/jpwr/jopg/src/Dyn.java
+98
-1
java/jpwr/jopg/src/Glow.java
java/jpwr/jopg/src/Glow.java
+1
-0
java/jpwr/jopg/src/GlowEventTable.java
java/jpwr/jopg/src/GlowEventTable.java
+44
-0
java/jpwr/jopg/src/Graph.java
java/jpwr/jopg/src/Graph.java
+1
-1
java/jpwr/jopg/src/GrowCtx.java
java/jpwr/jopg/src/GrowCtx.java
+19
-0
java/jpwr/jopg/src/GrowCtxIfc.java
java/jpwr/jopg/src/GrowCtxIfc.java
+2
-0
java/jpwr/jopg/src/GrowTable.java
java/jpwr/jopg/src/GrowTable.java
+26
-4
java/jpwr/jopg/src/os_templ/hw_templ/makefile
java/jpwr/jopg/src/os_templ/hw_templ/makefile
+1
-0
No files found.
java/jpwr/jopg/src/Dyn.java
View file @
6fd84081
...
@@ -6062,6 +6062,9 @@ public class Dyn {
...
@@ -6062,6 +6062,9 @@ public class Dyn {
int
columns
;
int
columns
;
int
rows
;
int
rows
;
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
int
[]
sel_p
;
int
[]
sel_elements
;
PwrtRefId
[]
sel_subid
;
public
DynTable
(
Dyn
dyn
)
{
public
DynTable
(
Dyn
dyn
)
{
super
(
dyn
,
Dyn
.
mDynType1_Table
,
0
,
0
,
0
,
Dyn
.
eDynPrio_Table
);
super
(
dyn
,
Dyn
.
mDynType1_Table
,
0
,
0
,
0
,
Dyn
.
eDynPrio_Table
);
...
@@ -6274,6 +6277,9 @@ public class Dyn {
...
@@ -6274,6 +6277,9 @@ public class Dyn {
cFormat
=
new
GlowCFormat
[
columns
];
cFormat
=
new
GlowCFormat
[
columns
];
for
(
int
i
=
0
;
i
<
columns
;
i
++)
for
(
int
i
=
0
;
i
<
columns
;
i
++)
cFormat
[
i
]
=
new
GlowCFormat
(
format
[
i
]);
cFormat
[
i
]
=
new
GlowCFormat
(
format
[
i
]);
sel_p
=
new
int
[
columns
];
sel_subid
=
new
PwrtRefId
[
columns
];
sel_elements
=
new
int
[
columns
];
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
DynParsedAttrName
pname
=
dyn
.
parseAttrName
(
attribute
[
i
]);
DynParsedAttrName
pname
=
dyn
.
parseAttrName
(
attribute
[
i
]);
...
@@ -6374,6 +6380,32 @@ public class Dyn {
...
@@ -6374,6 +6380,32 @@ public class Dyn {
}
}
// Connect select array
sel_p
[
i
]
=
0
;
pname
=
dyn
.
parseAttrName
(
sel_attribute
[
i
]);
if
(
pname
==
null
||
pname
.
name
.
equals
(
""
))
continue
;
if
(
pname
.
type
!=
Pwr
.
eType_Boolean
)
continue
;
switch
(
pname
.
database
)
{
case
GraphIfc
.
eDatabase_Gdh
:
ret
=
dyn
.
graph
.
getGdh
().
refObjectInfo
(
pname
.
tname
);
if
(
ret
.
oddSts
())
{
if
(
ret
.
getElements
()
==
0
)
break
;
sel_p
[
i
]
=
ret
.
id
;
sel_subid
[
i
]
=
ret
.
refid
;
sel_elements
[
i
]
=
ret
.
getElements
();
if
(
sel_elements
[
i
]
>
elements
[
i
])
sel_elements
[
i
]
=
elements
[
i
];
}
break
;
default
:
;
}
}
}
object
.
setTableInfo
(
info
);
object
.
setTableInfo
(
info
);
...
@@ -6420,6 +6452,10 @@ public class Dyn {
...
@@ -6420,6 +6452,10 @@ public class Dyn {
oldValueS
[
i
]
=
null
;
oldValueS
[
i
]
=
null
;
break
;
break
;
}
}
if
(
sel_p
[
i
]
!=
0
)
{
dyn
.
graph
.
getGdh
().
unrefObjectInfo
(
sel_subid
[
i
]);
sel_p
[
i
]
=
0
;
}
}
}
}
}
...
@@ -6454,7 +6490,7 @@ public class Dyn {
...
@@ -6454,7 +6490,7 @@ public class Dyn {
object
.
setValue
(
new
String
(
"1"
),
i
,
j
);
object
.
setValue
(
new
String
(
"1"
),
i
,
j
);
else
else
object
.
setValue
(
new
String
(
"0"
),
i
,
j
);
object
.
setValue
(
new
String
(
"0"
),
i
,
j
);
object
.
setValue
(
new
String
(
sb
),
i
,
j
);
//
object.setValue(new String(sb), i, j);
oldValueB
[
i
][
j
]
=
val
[
j
];
oldValueB
[
i
][
j
]
=
val
[
j
];
}
}
}
}
...
@@ -6569,9 +6605,70 @@ public class Dyn {
...
@@ -6569,9 +6605,70 @@ public class Dyn {
}
}
}
}
// Examine select array
boolean
sel_found
=
false
;
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
if
(
sel_p
[
i
]
==
0
)
continue
;
boolean
[]
val
=
dyn
.
graph
.
getGdh
().
getObjectRefInfoBooleanArray
(
sel_p
[
i
],
sel_elements
[
i
]);
for
(
int
j
=
0
;
j
<
sel_elements
[
i
];
j
++)
{
if
(
val
[
j
])
{
sel_found
=
true
;
object
.
setSelectedCell
(
i
,
j
);
}
}
}
if
(
!
sel_found
)
object
.
setSelectedCell
(
-
1
,
-
1
);
if
(
firstScan
)
if
(
firstScan
)
firstScan
=
false
;
firstScan
=
false
;
}
}
public
int
action
(
GlowArrayElem
o
,
GlowEvent
e
)
{
if
(
!
dyn
.
graph
.
isAuthorized
(
dyn
.
access
))
return
1
;
GrowTable
object
=
(
GrowTable
)
o
;
switch
(
e
.
event
)
{
case
Glow
.
eEvent_MB1Click
:
int
column
,
row
;
boolean
value
;
if
(
e
.
type
!=
Glow
.
eEventType_Table
)
break
;
GlowEventTable
event
=
(
GlowEventTable
)
e
;
row
=
object
.
getSelectedCellRow
();
column
=
object
.
getSelectedCellColumn
();
if
(
row
>=
0
&&
sel_p
[
column
]
!=
0
)
{
// Reset previously selected
DynParsedAttrName
pname
=
dyn
.
parseAttrName
(
sel_attribute
[
column
]);
if
(
pname
==
null
||
pname
.
name
.
equals
(
""
))
break
;
value
=
false
;
String
aname
=
pname
.
name
+
"["
+
row
+
"]"
;
PwrtStatus
sts
=
dyn
.
graph
.
getGdh
().
setObjectInfo
(
aname
,
value
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"Table error: "
+
pname
.
name
);
}
if
(
sel_p
[
event
.
column
]
!=
0
&&
!(
event
.
column
==
column
&&
event
.
row
==
row
))
{
// Set new selected, if not same as previous selected
DynParsedAttrName
pname
=
dyn
.
parseAttrName
(
sel_attribute
[
event
.
column
]);
if
(
pname
==
null
||
pname
.
name
.
equals
(
""
))
break
;
value
=
true
;
String
aname
=
pname
.
name
+
"["
+
event
.
row
+
"]"
;
PwrtStatus
sts
=
dyn
.
graph
.
getGdh
().
setObjectInfo
(
aname
,
value
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"Table error: "
+
pname
.
name
);
else
object
.
setSelectedCell
(
event
.
column
,
event
.
row
);
}
break
;
}
return
1
;
}
}
}
public
class
DynStatusColor
extends
DynElem
{
public
class
DynStatusColor
extends
DynElem
{
...
...
java/jpwr/jopg/src/Glow.java
View file @
6fd84081
...
@@ -1491,6 +1491,7 @@ public class Glow {
...
@@ -1491,6 +1491,7 @@ public class Glow {
public
static
final
int
eEventType_Object
=
0
;
public
static
final
int
eEventType_Object
=
0
;
public
static
final
int
eEventType_Menu
=
1
;
public
static
final
int
eEventType_Menu
=
1
;
public
static
final
int
eEventType_Toolbar
=
2
;
public
static
final
int
eEventType_Toolbar
=
2
;
public
static
final
int
eEventType_Table
=
3
;
public
static
final
int
eEvent_MB1Click
=
0
;
public
static
final
int
eEvent_MB1Click
=
0
;
public
static
final
int
eEvent_MB1Up
=
2
;
public
static
final
int
eEvent_MB1Up
=
2
;
...
...
java/jpwr/jopg/src/GlowEventTable.java
0 → 100644
View file @
6fd84081
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 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.jopg
;
public
class
GlowEventTable
extends
GlowEvent
{
public
int
column
;
public
int
row
;
public
GlowEventTable
()
{}
}
java/jpwr/jopg/src/Graph.java
View file @
6fd84081
...
@@ -434,7 +434,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
...
@@ -434,7 +434,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
int
sts
;
int
sts
;
Dyn
dyn
=
(
Dyn
)((
GlowArrayElem
)
e
.
object
).
getUserData
();
Dyn
dyn
=
(
Dyn
)((
GlowArrayElem
)
e
.
object
).
getUserData
();
if
(
dyn
!=
null
)
if
(
dyn
!=
null
)
sts
=
dyn
.
action
((
G
rowNode
)
e
.
object
,
e
);
sts
=
dyn
.
action
((
G
lowArrayElem
)
e
.
object
,
e
);
}
}
break
;
break
;
case
Glow
.
eEvent_MenuActivated
:
case
Glow
.
eEvent_MenuActivated
:
...
...
java/jpwr/jopg/src/GrowCtx.java
View file @
6fd84081
...
@@ -439,6 +439,25 @@ public class GrowCtx implements GrowCtxIfc {
...
@@ -439,6 +439,25 @@ public class GrowCtx implements GrowCtxIfc {
return
1
;
return
1
;
}
}
public
int
send_table_callback
(
GlowArrayElem
object
,
int
event
,
double
x
,
double
y
,
int
column
,
int
row
)
{
/* Send a table callback */
GlowEventTable
e
=
new
GlowEventTable
();
e
.
event
=
event
;
e
.
type
=
Glow
.
eEventType_Table
;
//e.x_pixel = (int)( x * mw.zoom_factor_x) - mw.offset_x;
//e.y_pixel = (int)( y * mw.zoom_factor_y) - mw.offset_y;
e
.
x
=
x
;
e
.
y
=
y
;
e
.
object_type
=
object
.
type
();
e
.
object
=
object
;
e
.
column
=
column
;
e
.
row
=
row
;
cmn
.
appl
.
eventHandler
(
e
);
return
1
;
}
public
int
eventHandler
(
GlowEvent
e
,
double
fx
,
double
fy
)
{
public
int
eventHandler
(
GlowEvent
e
,
double
fx
,
double
fy
)
{
return
eventHandler
(
e
);
return
eventHandler
(
e
);
}
}
...
...
java/jpwr/jopg/src/GrowCtxIfc.java
View file @
6fd84081
...
@@ -51,6 +51,8 @@ public interface GrowCtxIfc {
...
@@ -51,6 +51,8 @@ public interface GrowCtxIfc {
double
x
,
double
y
);
double
x
,
double
y
);
public
int
send_toolbar_callback
(
GlowArrayElem
object
,
int
category
,
int
idx
,
int
type
,
public
int
send_toolbar_callback
(
GlowArrayElem
object
,
int
category
,
int
idx
,
int
type
,
double
x
,
double
y
);
double
x
,
double
y
);
public
int
send_table_callback
(
GlowArrayElem
object
,
int
event
,
double
x
,
double
y
,
int
column
,
int
row
);
public
void
insert
(
GlowArrayElem
e
);
public
void
insert
(
GlowArrayElem
e
);
public
void
remove
(
GlowArrayElem
e
);
public
void
remove
(
GlowArrayElem
e
);
public
void
pop
(
GlowArrayElem
e
);
public
void
pop
(
GlowArrayElem
e
);
...
...
java/jpwr/jopg/src/GrowTable.java
View file @
6fd84081
...
@@ -81,8 +81,8 @@ public class GrowTable extends GrowRect implements GrowScrollBarIfc {
...
@@ -81,8 +81,8 @@ public class GrowTable extends GrowRect implements GrowScrollBarIfc {
int
[]
column_adjustment
=
new
int
[
Glow
.
TABLE_MAX_COL
];
int
[]
column_adjustment
=
new
int
[
Glow
.
TABLE_MAX_COL
];
int
value_size
;
int
value_size
;
String
[]
cell_value
;
String
[]
cell_value
;
int
selected_cell_row
;
int
selected_cell_row
=
-
1
;
int
selected_cell_column
;
int
selected_cell_column
=
-
1
;
int
select_drawtype
;
int
select_drawtype
;
int
input_focus
;
int
input_focus
;
int
header_text_bold
;
int
header_text_bold
;
...
@@ -882,8 +882,8 @@ public class GrowTable extends GrowRect implements GrowScrollBarIfc {
...
@@ -882,8 +882,8 @@ public class GrowTable extends GrowRect implements GrowScrollBarIfc {
}
}
}
}
//
if ( row != -1 && column != -1)
if
(
row
!=
-
1
&&
column
!=
-
1
)
// ((GrowCtx *)ctx)->send_table_callback( this,
event, fx, fy, column, row);
cmn
.
ctx
.
send_table_callback
(
this
,
event
.
event
,
fx
,
fy
,
column
,
row
);
break
;
break
;
}
}
default
:
;
default
:
;
...
@@ -912,4 +912,26 @@ public class GrowTable extends GrowRect implements GrowScrollBarIfc {
...
@@ -912,4 +912,26 @@ public class GrowTable extends GrowRect implements GrowScrollBarIfc {
public
void
setValue
(
String
value
,
int
col
,
int
row
)
{
public
void
setValue
(
String
value
,
int
col
,
int
row
)
{
cell_value
[
col
*
rows
+
row
]
=
value
;
cell_value
[
col
*
rows
+
row
]
=
value
;
}
}
public
void
setSelectedCell
(
int
column
,
int
row
)
{
if
(
selected_cell_column
==
column
&&
selected_cell_row
==
row
)
return
;
if
(
column
>=
columns
||
row
>=
rows
)
return
;
selected_cell_column
=
column
;
selected_cell_row
=
row
;
draw
();
}
public
int
getSelectedCellRow
()
{
return
selected_cell_row
;
}
public
int
getSelectedCellColumn
()
{
if
(
selected_cell_row
==
-
1
)
return
-
1
;
return
selected_cell_column
;
}
}
}
java/jpwr/jopg/src/os_templ/hw_templ/makefile
View file @
6fd84081
...
@@ -44,6 +44,7 @@ local_java_sources := \
...
@@ -44,6 +44,7 @@ local_java_sources := \
GlowBackgroundObject.java,
\
GlowBackgroundObject.java,
\
GlowEventMenu.java,
\
GlowEventMenu.java,
\
GlowEventToolbar.java,
\
GlowEventToolbar.java,
\
GlowEventTable.java,
\
GrowCtxIfc.java,
\
GrowCtxIfc.java,
\
GrowCmn.java,
\
GrowCmn.java,
\
GlowNodeClass.java,
\
GlowNodeClass.java,
\
...
...
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