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
6551d9f8
Commit
6551d9f8
authored
Apr 09, 2018
by
Simon Barner
Browse files
Suppress rendering in case label does not fit width of Gantt chart bar.
refs 3371
parent
5f59bd64
Changes
2
Show whitespace changes
Inline
Side-by-side
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/utils/.ratings
View file @
6551d9f8
ScheduleUIUtils.java af8dfbb4763296603fa8a0595829f7b460b39cd7 GREEN
ScheduleViewUtils.java
7981ad3b6b7a50e4666f362602ef086afd3ff384
YELLOW
ScheduleViewUtils.java
bc21f86a2edfcfae0169ee06550cb0e965f466f3
YELLOW
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/utils/ScheduleViewUtils.java
View file @
6551d9f8
...
...
@@ -62,7 +62,8 @@ public class ScheduleViewUtils {
* and vertically centered within the given <i>bounds</i>.
* <p>
* If the caption and subscript-text do not fit the available width, the caption is truncated
* according to {@link #truncateStringToWidth(String, int, GC)} and appended with "..".
* according to {@link #truncateStringToWidth(String, int, GC)}. If space permits, the truncated
* text is appended with "{@code ..}".
* <p>
* If the caption and subscript-text do not fit the available height, rendering is suppressed.
*
...
...
@@ -74,16 +75,17 @@ public class ScheduleViewUtils {
gc
.
setFont
(
subscriptFont
);
final
Point
subscriptExtent
=
gc
.
stringExtent
(
subscript
);
gc
.
setFont
(
captionFont
);
final
Point
captionExtend
=
gc
.
stringExtent
(
caption
);
if
(
captionExtend
.
y
+
(!
subscript
.
isEmpty
()
?
subscriptExtent
.
y
:
0
)
>
bounds
.
height
+
4
)
{
return
;
}
String
actualName
=
truncateStringToWidth
(
caption
,
bounds
.
width
-
subscriptExtent
.
x
,
gc
);
if
(
actualName
.
length
()
<
caption
.
length
())
{
actualName
=
actualName
.
substring
(
0
,
Math
.
max
(
0
,
actualName
.
length
()
-
1
))
+
".."
;
}
final
Point
nameExtent
=
gc
.
stringExtent
(
actualName
);
final
int
totalWidth
=
nameExtent
.
x
+
subscriptExtent
.
x
;
final
int
totalHeight
=
nameExtent
.
y
+
(!
subscript
.
isEmpty
()
?
subscriptExtent
.
y
:
0
);
if
((
totalWidth
>
bounds
.
width
)
||
(
totalHeight
>
bounds
.
height
+
4
))
{
return
;
}
gc
.
drawString
(
actualName
,
bounds
.
x
+
(
bounds
.
width
-
totalWidth
)
/
2
,
bounds
.
y
+
(
bounds
.
height
-
nameExtent
.
y
)
/
2
,
true
);
gc
.
setFont
(
subscriptFont
);
...
...
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