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
8688c61f
Commit
8688c61f
authored
Apr 09, 2018
by
Filip Reaboi
Browse files
GREEN. Many static imports added.
refs 3371
parent
36f10bc3
Changes
7
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/.ratings
View file @
8688c61f
AbstractObjectToDraw.java a1bbb2390af2b4485ec1dc7ad2fd316d305dbe5c GREEN
LabelToDraw.java 999a987f051ecf08965832c43c6164b20cb0431a GREEN
LineToDraw.java 96fb75373891873a51b557fece736f1c337069fc GREEN
ScheduleModelElementToDraw.java
5a647092cd
53e0
120a13b013f4ccda067889cb60 YELLOW
ScheduleModelElementToDraw.java
90ecf2963873f586
53
0
e0
0498379e58b776ee009 GREEN
ScheduleView.java 3c0165545106c338f3a00449b09b4e219bf94a29 GREEN
ScheduleViewCanvas.java
00f5ab7cac8bf9c14756fe6ebd15c5a7b3bdee18 YELLOW
ScheduleViewCanvas.java
4132a8d9718c2f3c8dd95c434faa7674f272214c GREEN
ScheduleViewColors.java a5544e371ea55d1d6cec99cd119bdddfef3d1239 GREEN
ScheduleViewGraphModel.java
218aadb5dd480a2a0f8ff72ced6bc8816181911d YELLOW
ScheduleViewLayoutData.java
e95451d12a58eb40fe722bfc9d5ae79029e8060a YELLOW
ScheduleViewGraphModel.java
51a51ccfe47432249e63b50cd8f4348930d4b441 GREEN
ScheduleViewLayoutData.java
6e8602abd1923c6c8a8aa00772437af7a9f88346 GREEN
ScheduleViewModel.java 5f6a9a99f00ee4bbc8b6e07b60e2cffc0e5ac9bb GREEN
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/ScheduleModelElementToDraw.java
View file @
8688c61f
...
...
@@ -129,7 +129,7 @@ public class ScheduleModelElementToDraw extends AbstractObjectToDraw {
*/
public
static
ScheduleModelElementToDraw
createScheduleModelElement
(
ResourceAllocationFragment
fragment
,
BigDecimal
roundOffset
,
int
y
,
Color
color
)
{
BigDecimal
phase
=
ScheduleUtils
.
getPhase
(
fragment
);
BigDecimal
phase
=
getPhase
(
fragment
);
if
(
phase
==
null
)
{
return
null
;
}
...
...
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/ScheduleViewCanvas.java
View file @
8688c61f
...
...
@@ -18,11 +18,25 @@ package org.fortiss.af3.schedule.ui.ganttchartview;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
lang
.
Math
.
min
;
import
static
java
.
math
.
BigDecimal
.
ONE
;
import
static
java
.
math
.
BigDecimal
.
ROUND_DOWN
;
import
static
java
.
math
.
BigDecimal
.
ROUND_FLOOR
;
import
static
java
.
math
.
BigDecimal
.
ZERO
;
import
static
java
.
util
.
Locale
.
ROOT
;
import
static
org
.
eclipse
.
swt
.
SWT
.
COLOR_BLACK
;
import
static
org
.
eclipse
.
swt
.
SWT
.
COLOR_BLUE
;
import
static
org
.
eclipse
.
swt
.
SWT
.
COLOR_RED
;
import
static
org
.
eclipse
.
swt
.
SWT
.
COLOR_WIDGET_NORMAL_SHADOW
;
import
static
org
.
eclipse
.
swt
.
SWT
.
DOUBLE_BUFFERED
;
import
static
org
.
eclipse
.
swt
.
SWT
.
H_SCROLL
;
import
static
org
.
eclipse
.
swt
.
SWT
.
NO_REDRAW_RESIZE
;
import
static
org
.
eclipse
.
swt
.
SWT
.
Resize
;
import
static
org
.
eclipse
.
swt
.
SWT
.
Selection
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_HORIZONTAL_SPACING
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_LABEL
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_X
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
MATH_CONTEXT_DOUBLE_MAXIMUM_PRECISION
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
MAXIMUM_PRECISION
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
SCALING_USER_X_MAX
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
utils
.
ScheduleViewUtils
.
getDuration
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
utils
.
ScheduleViewUtils
.
getPhase
;
...
...
@@ -32,7 +46,6 @@ import java.math.BigDecimal;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormatSymbols
;
import
java.util.List
;
import
java.util.Locale
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.swt.SWT
;
...
...
@@ -339,7 +352,7 @@ public class ScheduleViewCanvas extends Canvas {
/** Constructor. */
public
ScheduleViewCanvas
(
ScheduleView
scheduleView
,
Composite
parent
,
int
style
)
{
super
(
parent
,
style
|
SWT
.
NO_REDRAW_RESIZE
|
SWT
.
H_SCROLL
|
SWT
.
DOUBLE_BUFFERED
);
super
(
parent
,
style
|
NO_REDRAW_RESIZE
|
H_SCROLL
|
DOUBLE_BUFFERED
);
scheduleModel
=
new
ScheduleViewModel
(
this
);
scheduleLayoutData
=
new
ScheduleViewLayoutData
(
this
);
...
...
@@ -349,10 +362,10 @@ public class ScheduleViewCanvas extends Canvas {
addMouseMoveListener
(
new
MouseMoveListener
());
addMouseListener
(
new
MouseClickListener
(
scheduleView
));
addKeyListener
(
new
KeyListener
());
addListener
(
SWT
.
Resize
,
new
ResizeListener
());
addListener
(
Resize
,
new
ResizeListener
());
final
ScrollBar
hBar
=
getHorizontalBar
();
hBar
.
addListener
(
SWT
.
Selection
,
new
HorizontalScrollBarListener
(
hBar
));
hBar
.
addListener
(
Selection
,
new
HorizontalScrollBarListener
(
hBar
));
}
/**
...
...
@@ -422,7 +435,7 @@ public class ScheduleViewCanvas extends Canvas {
toolTipText
+=
"start: "
+
getPhase
(
object
)
+
"\n"
;
toolTipText
+=
"duration: "
+
getDuration
(
object
);
gc
.
setForeground
(
getDisplay
().
getSystemColor
(
SWT
.
COLOR_BLACK
));
gc
.
setForeground
(
getDisplay
().
getSystemColor
(
COLOR_BLACK
));
gc
.
drawText
(
toolTipText
,
diagramMouseX
+
DIAGRAM_TOOLTIP_OFFSET_X
,
diagramMouseY
);
}
}
...
...
@@ -435,7 +448,7 @@ public class ScheduleViewCanvas extends Canvas {
Rectangle
rectangle
=
new
Rectangle
(
x
,
0
,
width
,
getClientArea
().
height
);
gc
.
setAlpha
(
50
);
gc
.
setBackground
(
getDisplay
().
getSystemColor
(
SWT
.
COLOR_BLUE
));
gc
.
setBackground
(
getDisplay
().
getSystemColor
(
COLOR_BLUE
));
gc
.
fillRectangle
(
rectangle
);
}
}
...
...
@@ -455,9 +468,9 @@ public class ScheduleViewCanvas extends Canvas {
}
// Y axis
int
diagramX
=
scheduleLayoutData
.
objectSpaceToDiagramSpaceX
(
BigDecimal
.
ZERO
);
int
diagramX
=
scheduleLayoutData
.
objectSpaceToDiagramSpaceX
(
ZERO
);
int
diagramY
=
getHorizontalLineY
(
scheduleModel
.
getSchedules
().
size
());
int
diagramY2
=
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
;
int
diagramY2
=
DIAGRAM_OFFSET_Y
;
gc
.
drawLine
(
diagramX
,
diagramY
+
2
*
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramX
,
diagramY2
);
...
...
@@ -478,7 +491,7 @@ public class ScheduleViewCanvas extends Canvas {
diagramX2
,
diagramY
);
// Draw horizontal lines after every schedule
gc
.
setForeground
(
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_NORMAL_SHADOW
));
gc
.
setForeground
(
getDisplay
().
getSystemColor
(
COLOR_WIDGET_NORMAL_SHADOW
));
for
(
int
i
=
1
;
i
<
scheduleModel
.
getSchedules
().
size
();
++
i
)
{
int
diagramHorizotalLineY
=
getHorizontalLineY
(
i
);
...
...
@@ -497,16 +510,16 @@ public class ScheduleViewCanvas extends Canvas {
.
scaleLengthDiagramSpaceToObjectSpaceX
(
-
scheduleLayoutData
.
getDiagramOrigin
().
x
)
.
divide
(
modelLabelInterval_bd
,
MATH_CONTEXT_DOUBLE_MAXIMUM_PRECISION
)
.
setScale
(
0
,
BigDecimal
.
ROUND_FLOOR
).
multiply
(
modelLabelInterval_bd
);
.
setScale
(
0
,
ROUND_FLOOR
).
multiply
(
modelLabelInterval_bd
);
BigDecimal
modelEndCoordinateLabel
=
numHyperPeriods
.
multiply
(
maf
).
min
(
scheduleLayoutData
.
scaleLengthDiagramSpaceToObjectSpaceX
(
clientArea
.
width
-
scheduleLayoutData
.
getDiagramOrigin
().
x
));
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
,
DecimalFormatSymbols
.
getInstance
(
Locale
.
ROOT
));
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
,
DecimalFormatSymbols
.
getInstance
(
ROOT
));
int
decimals
=
MathUtils
.
getPrecision
(
scheduleLayoutData
.
getModelLabelInterval
(),
ScheduleViewLayoutData
.
MAXIMUM_PRECISION
);
MAXIMUM_PRECISION
);
df
.
setMaximumFractionDigits
(
decimals
);
df
.
setMinimumFractionDigits
(
decimals
);
df
.
setGroupingUsed
(
false
);
...
...
@@ -515,14 +528,12 @@ public class ScheduleViewCanvas extends Canvas {
i
.
add
(
modelLabelInterval_bd
))
{
// interval line
int
diagramLabelX
=
scheduleLayoutData
.
objectSpaceToDiagramSpaceX
(
i
);
gc
.
drawLine
(
diagramLabelX
,
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
-
gc
.
drawLine
(
diagramLabelX
,
DIAGRAM_OFFSET_Y
-
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramLabelX
,
diagramY
+
3
*
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
// draw x axis label
gc
.
drawText
(
df
.
format
(
i
.
setScale
(
ScheduleViewLayoutData
.
MAXIMUM_PRECISION
-
1
,
BigDecimal
.
ROUND_DOWN
))
+
""
,
diagramLabelX
,
diagramY
+
3
*
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
gc
.
drawText
(
df
.
format
(
i
.
setScale
(
MAXIMUM_PRECISION
-
1
,
ROUND_DOWN
))
+
""
,
diagramLabelX
,
diagramY
+
3
*
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
}
// Draw bold vertical lines after every period
...
...
@@ -536,21 +547,19 @@ public class ScheduleViewCanvas extends Canvas {
.
multiply
(
maf
));
if
(
displayPeriodsSchedulableEntities
)
{
drawPeriods
(
scheduleModel
.
getSchedulableEntityPeriods
(),
gc
,
SWT
.
COLOR_BLACK
,
i
,
drawPeriods
(
scheduleModel
.
getSchedulableEntityPeriods
(),
gc
,
COLOR_BLACK
,
i
,
diagramY
);
}
if
(
displayPeriodsSchedules
)
{
drawPeriods
(
scheduleModel
.
getResourceSchedulePeriods
(),
gc
,
SWT
.
COLOR_BLUE
,
i
,
diagramY
);
drawPeriods
(
scheduleModel
.
getResourceSchedulePeriods
(),
gc
,
COLOR_BLUE
,
i
,
diagramY
);
}
// tick / round line
gc
.
setForeground
(
getDisplay
().
getSystemColor
(
SWT
.
COLOR_RED
));
gc
.
setForeground
(
getDisplay
().
getSystemColor
(
COLOR_RED
));
gc
.
drawLine
(
diagramX
,
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
-
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
*
5
,
diagramX
,
diagramY
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
*
8
);
gc
.
drawLine
(
diagramX
,
DIAGRAM_OFFSET_Y
-
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
*
5
,
diagramX
,
diagramY
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
*
8
);
gc
.
drawString
(
"Round "
+
(
i
+
1
),
diagramX
+
5
,
diagramY
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
*
8
-
15
);
}
...
...
@@ -569,12 +578,12 @@ public class ScheduleViewCanvas extends Canvas {
round
).
multiply
(
scheduleModel
.
getMajorFrame
())));
// period line
gc
.
drawLine
(
diagramPeriodX
,
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
-
gc
.
drawLine
(
diagramPeriodX
,
DIAGRAM_OFFSET_Y
-
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramPeriodX
,
offsetY
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
// draw x axis label
gc
.
drawText
(
round
(
period
,
ScheduleViewLayoutData
.
MAXIMUM_PRECISION
)
+
""
,
diagramPeriodX
,
offsetY
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
gc
.
drawText
(
round
(
period
,
MAXIMUM_PRECISION
)
+
""
,
diagramPeriodX
,
offsetY
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
}
}
...
...
@@ -600,8 +609,8 @@ public class ScheduleViewCanvas extends Canvas {
// Based on current middle point, determine new left-most coordinate
BigDecimal
objectVisibleWidthNew
=
scheduleLayoutData
.
getObjectVisibleWidth
();
BigDecimal
objectLeftNew
=
BigDecimal
.
ZERO
.
max
((
middleOld
.
subtract
(
objectVisibleWidthNew
)).
divide
(
BigDecimal
.
valueOf
(
2
),
MATH_CONTEXT_DOUBLE_MAXIMUM_PRECISION
));
ZERO
.
max
((
middleOld
.
subtract
(
objectVisibleWidthNew
)).
divide
(
BigDecimal
.
valueOf
(
2
),
MATH_CONTEXT_DOUBLE_MAXIMUM_PRECISION
));
setHorizontalBarSelection
(
objectLeftNew
);
scheduleGraphModel
.
refresh
();
...
...
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/ScheduleViewGraphModel.java
View file @
8688c61f
...
...
@@ -16,8 +16,12 @@
package
org.fortiss.af3.schedule.ui.ganttchartview
;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
math
.
BigDecimal
.
ZERO
;
import
static
java
.
math
.
BigDecimal
.
valueOf
;
import
static
java
.
math
.
RoundingMode
.
HALF_UP
;
import
static
org
.
eclipse
.
swt
.
SWT
.
COLOR_BLACK
;
import
static
org
.
eclipse
.
swt
.
SWT
.
COLOR_DARK_RED
;
import
static
org
.
eclipse
.
swt
.
SWT
.
COLOR_WHITE
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
LabelToDraw
.
createLabel
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
LabelToDraw
.
drawLabel
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
LineToDraw
.
drawLine
;
...
...
@@ -25,7 +29,9 @@ import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleModelElementToD
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleModelElementToDraw
.
drawScheduleModelElement
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewColors
.
getColor
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_HORIZONTAL_SPACING
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_LABEL
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
;
import
static
org
.
fortiss
.
af3
.
schedule
.
utils
.
ScheduleUtils
.
getHyperPeriod
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
...
...
@@ -34,7 +40,6 @@ import java.util.List;
import
java.util.Map
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.graphics.Font
;
import
org.eclipse.swt.graphics.GC
;
...
...
@@ -43,7 +48,6 @@ import org.eclipse.swt.widgets.Display;
import
org.fortiss.af3.schedule.model.ResourceAllocation
;
import
org.fortiss.af3.schedule.model.ResourceAllocationFragment
;
import
org.fortiss.af3.schedule.model.Schedule
;
import
org.fortiss.af3.schedule.utils.ScheduleUtils
;
/**
* Model of Gantt Chart representation of a set of {@link Schedule}s.
...
...
@@ -122,15 +126,14 @@ public class ScheduleViewGraphModel {
for
(
Schedule
schedule
:
scheduleModel
.
getSchedules
())
{
LabelToDraw
label
=
createLabel
(
schedule
,
y
,
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_LABEL
,
getColor
(
0
),
objectToColor
);
createLabel
(
schedule
,
y
,
DIAGRAM_OFFSET_LABEL
,
getColor
(
0
),
objectToColor
);
if
(
label
!=
null
)
{
graphElementList
.
add
(
label
);
}
BigDecimal
roundOffset
=
BigDecimal
.
ZERO
;
BigDecimal
schedulePeriod
=
ScheduleUtils
.
getHyperPeriod
(
schedule
);
if
(
schedulePeriod
!=
null
&&
schedulePeriod
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
)
{
BigDecimal
schedulePeriod
=
getHyperPeriod
(
schedule
);
if
(
schedulePeriod
!=
null
&&
schedulePeriod
.
compareTo
(
ZERO
)
==
1
)
{
while
(
roundOffset
.
compareTo
(
scheduleModel
.
getMajorFrame
())
==
-
1
)
{
for
(
ResourceAllocation
resourceAllocation
:
schedule
.
getResourceAllocationList
())
{
...
...
@@ -176,9 +179,9 @@ public class ScheduleViewGraphModel {
ScheduleViewModel
scheduleModel
=
canvas
.
getScheduleModel
();
final
Display
display
=
canvas
.
getDisplay
();
Color
colorWhite
=
display
.
getSystemColor
(
SWT
.
COLOR_WHITE
);
Color
colorRed
=
display
.
getSystemColor
(
SWT
.
COLOR_DARK_RED
);
Color
colorBlack
=
display
.
getSystemColor
(
SWT
.
COLOR_BLACK
);
Color
colorWhite
=
display
.
getSystemColor
(
COLOR_WHITE
);
Color
colorRed
=
display
.
getSystemColor
(
COLOR_DARK_RED
);
Color
colorBlack
=
display
.
getSystemColor
(
COLOR_BLACK
);
Rectangle
clientArea
=
canvas
.
getClientArea
();
Font
font
=
canvas
.
getFont
();
...
...
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/ScheduleViewLayoutData.java
View file @
8688c61f
...
...
@@ -196,7 +196,7 @@ public class ScheduleViewLayoutData {
// It is defined by:
// - Point_A = (xa, ya) = (1, MAF / #of stripes to be displayed (here: 10);
// - Point_S = (xs, ys) = (minimum) = (SCALING_USER_X_MAX, smallest value);
BigDecimal
xs
=
BigDecimal
.
valueOf
(
SCALING_USER_X_MAX
);
BigDecimal
xs
=
valueOf
(
SCALING_USER_X_MAX
);
BigDecimal
ys
=
ONE
.
movePointLeft
(
highestRequiredPrecision
);
int
numberOfHyperPeriods
=
scheduleModel
.
getNumberOfHyperPeriods
();
...
...
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/utils/.ratings
View file @
8688c61f
ScheduleUIUtils.java af8dfbb4763296603fa8a0595829f7b460b39cd7 GREEN
ScheduleViewUtils.java
bc21f86a2edfcfae0169ee06550cb0e965f466f3 YELLOW
ScheduleViewUtils.java
adc6d2b145efba578e649044fd0a52efb54466f8 GREEN
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/utils/ScheduleViewUtils.java
View file @
8688c61f
...
...
@@ -15,6 +15,9 @@
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.schedule.ui.utils
;
import
static
java
.
lang
.
Integer
.
highestOneBit
;
import
static
java
.
math
.
BigDecimal
.
valueOf
;
import
java.math.BigDecimal
;
import
org.eclipse.emf.ecore.EObject
;
...
...
@@ -40,7 +43,7 @@ public class ScheduleViewUtils {
* context.
*/
public
static
String
truncateStringToWidth
(
String
text
,
int
width
,
GC
gc
)
{
int
max
=
Integer
.
highestOneBit
(
text
.
length
());
int
max
=
highestOneBit
(
text
.
length
());
int
sum
=
0
;
while
(
max
>
0
)
{
...
...
@@ -134,7 +137,7 @@ public class ScheduleViewUtils {
}
else
if
(
object
instanceof
ResourceAllocationFragment
)
{
return
ScheduleUtils
.
getPhase
((
ResourceAllocationFragment
)
object
);
}
return
BigDecimal
.
valueOf
(-
1
);
return
valueOf
(-
1
);
}
/**
...
...
@@ -148,6 +151,6 @@ public class ScheduleViewUtils {
}
else
if
(
object
instanceof
ResourceAllocationFragment
)
{
return
((
ResourceAllocationFragment
)
object
).
getDuration
();
}
return
BigDecimal
.
valueOf
(-
1
);
return
valueOf
(-
1
);
}
}
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