Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
f180a804
Commit
f180a804
authored
Jul 20, 2012
by
Florian Hölzl
Browse files
help for advanced operator panels
refs 907
parent
b1fe3232
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.operatorpanel.ui/trunk/src/org/fortiss/af3/operatorpanel/ui/simulator/views/OPVCAreaInput.java
View file @
f180a804
...
...
@@ -28,6 +28,9 @@ import org.eclipse.swt.graphics.Point;
import
org.eclipse.swt.graphics.Rectangle
;
import
org.eclipse.swt.widgets.Canvas
;
import
org.eclipse.swt.widgets.Composite
;
import
org.fortiss.af3.expression.model.types.TBool
;
import
org.fortiss.af3.expression.model.types.TDouble
;
import
org.fortiss.af3.expression.model.types.TInt
;
import
org.fortiss.af3.operatorpanel.model.OPAreaInput
;
import
org.fortiss.af3.operatorpanel.model.OPITermInput
;
...
...
@@ -37,10 +40,14 @@ import org.fortiss.af3.operatorpanel.model.OPITermInput;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
GREEN
Hash:
AA638525EB95EE8A04023BD965FD03FB
* @ConQAT.Rating
YELLOW
Hash:
5D28CE94CBA0BFD0428ABA2957CD62D6
*/
public
class
OPVCAreaInput
extends
OPVCInputControlBase
<
OPAreaInput
,
Canvas
>
{
/** The type texts. */
private
static
final
String
[][]
TYPE_TEXTS
=
{
{
"false"
,
"NoVal"
,
"true"
},
{
"-100"
,
"0"
,
"100"
},
{
"0.0"
,
"0.5"
,
"1.0"
}};
/** Stores the text field control. */
private
JoystickCanvas
joystickCanvas
;
...
...
@@ -109,14 +116,42 @@ public class OPVCAreaInput extends OPVCInputControlBase<OPAreaInput, Canvas> {
e
.
gc
.
setForeground
(
e
.
gc
.
getDevice
().
getSystemColor
(
SWT
.
COLOR_DARK_GRAY
));
e
.
gc
.
setBackground
(
e
.
gc
.
getDevice
().
getSystemColor
(
SWT
.
COLOR_GRAY
));
e
.
gc
.
fillRectangle
(
e
.
x
,
e
.
y
,
w
,
h
);
// grid
e
.
gc
.
drawLine
(
w3
,
0
,
w3
,
h
);
e
.
gc
.
drawLine
(
w
-
w3
,
0
,
w
-
w3
,
h
);
e
.
gc
.
drawLine
(
0
,
h3
,
w
,
h3
);
e
.
gc
.
drawLine
(
0
,
h
-
h3
,
w
,
h
-
h3
);
e
.
gc
.
setForeground
(
e
.
gc
.
getDevice
().
getSystemColor
(
SWT
.
COLOR_BLACK
));
e
.
gc
.
drawRectangle
(
e
.
x
,
e
.
y
,
w
,
h
);
// cursor
e
.
gc
.
setBackground
(
e
.
gc
.
getDevice
().
getSystemColor
(
SWT
.
COLOR_BLACK
));
e
.
gc
.
fillOval
(
value
.
x
-
6
,
value
.
y
-
6
,
12
,
12
);
// text
String
[]
texts
=
getTexts
();
e
.
gc
.
setForeground
(
e
.
gc
.
getDevice
().
getSystemColor
(
SWT
.
COLOR_YELLOW
));
Point
ext
=
e
.
gc
.
textExtent
(
texts
[
0
],
SWT
.
DRAW_TRANSPARENT
);
e
.
gc
.
drawString
(
texts
[
0
],
2
,
h
-
1
-
ext
.
y
,
true
);
ext
=
e
.
gc
.
textExtent
(
texts
[
1
],
SWT
.
DRAW_TRANSPARENT
);
e
.
gc
.
drawString
(
texts
[
1
],
(
w
-
ext
.
x
)
/
2
,
(
h
-
ext
.
y
)
/
2
,
true
);
ext
=
e
.
gc
.
textExtent
(
texts
[
2
],
SWT
.
DRAW_TRANSPARENT
);
e
.
gc
.
drawString
(
texts
[
2
],
w
-
1
-
ext
.
x
,
1
,
true
);
}
/** Returns the texts for the current type of the item. */
private
String
[]
getTexts
()
{
if
(
modelItem
.
getType
()
instanceof
TBool
)
{
return
TYPE_TEXTS
[
0
];
}
if
(
modelItem
.
getType
()
instanceof
TInt
)
{
return
TYPE_TEXTS
[
1
];
}
if
(
modelItem
.
getType
()
instanceof
TDouble
)
{
return
TYPE_TEXTS
[
2
];
}
return
new
String
[]
{
""
,
""
,
""
};
}
/** {@inheritDoc} */
...
...
Write
Preview
Supports
Markdown
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