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
28e5658c
Commit
28e5658c
authored
Apr 09, 2018
by
Simon Barner
Browse files
- Reduce DIAGRAM_HORIZONTAL_SPACING to 2
- Ensure that minimum horizontal and vertical sizes are 1 refs 3371
parent
4ace00b7
Changes
5
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/.ratings
View file @
28e5658c
AbstractObjectToDraw.java a1bbb2390af2b4485ec1dc7ad2fd316d305dbe5c GREEN
AbstractObjectToDraw.java a1bbb2390af2b4485ec1dc7ad2fd316d305dbe5c GREEN
LabelToDraw.java 999a987f051ecf08965832c43c6164b20cb0431a GREEN
LabelToDraw.java 999a987f051ecf08965832c43c6164b20cb0431a GREEN
LineToDraw.java 96fb75373891873a51b557fece736f1c337069fc GREEN
LineToDraw.java 96fb75373891873a51b557fece736f1c337069fc GREEN
ScheduleModelElementToDraw.java
ec0d380a07267a61a3cb6be697e6d2b88aefcb5f GREEN
ScheduleModelElementToDraw.java
8d3da6f399fb33bfc243a5519345ee9d36953304 YELLOW
ScheduleView.java 3c0165545106c338f3a00449b09b4e219bf94a29 GREEN
ScheduleView.java 3c0165545106c338f3a00449b09b4e219bf94a29 GREEN
ScheduleViewCanvas.java
7d0388840f39494728dd4cb385aa3809fd41fb97 GREEN
ScheduleViewCanvas.java
c47deedbcc39fee8008ecad8ab0392f76b6ad4d8 YELLOW
ScheduleViewColors.java a5544e371ea55d1d6cec99cd119bdddfef3d1239 GREEN
ScheduleViewColors.java a5544e371ea55d1d6cec99cd119bdddfef3d1239 GREEN
ScheduleViewGraphModel.java
87262d9477f30db55c551e6096fcc6272c6e594f GREEN
ScheduleViewGraphModel.java
218aadb5dd480a2a0f8ff72ced6bc8816181911d YELLOW
ScheduleViewLayoutData.java
f082ccd901fd2331a4d374c69afed12343f1aa72 GREEN
ScheduleViewLayoutData.java
c192e6d12806bac9df98c7e25faa45607023bef0 YELLOW
ScheduleViewModel.java 5f6a9a99f00ee4bbc8b6e07b60e2cffc0e5ac9bb GREEN
ScheduleViewModel.java 5f6a9a99f00ee4bbc8b6e07b60e2cffc0e5ac9bb GREEN
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/ScheduleModelElementToDraw.java
View file @
28e5658c
...
@@ -72,7 +72,8 @@ public class ScheduleModelElementToDraw extends AbstractObjectToDraw {
...
@@ -72,7 +72,8 @@ public class ScheduleModelElementToDraw extends AbstractObjectToDraw {
int
x2
=
x
+
width
;
int
x2
=
x
+
width
;
x
=
max
(
x
,
-
1
);
x
=
max
(
x
,
-
1
);
width
=
min
(
x2
-
x
,
maxWidth
);
// Ensure that width is in the range [1; maxWidth]
width
=
max
(
min
(
x2
-
x
,
maxWidth
),
1
);
Rectangle
rectangle
=
new
Rectangle
(
x
,
y
,
width
,
height
);
Rectangle
rectangle
=
new
Rectangle
(
x
,
y
,
width
,
height
);
if
(
scheduleModelElement
.
hasBorder
())
{
if
(
scheduleModelElement
.
hasBorder
())
{
gc
.
setAlpha
(
190
);
gc
.
setAlpha
(
190
);
...
...
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/ScheduleViewCanvas.java
View file @
28e5658c
...
@@ -17,6 +17,8 @@ package org.fortiss.af3.schedule.ui.ganttchartview;
...
@@ -17,6 +17,8 @@ package org.fortiss.af3.schedule.ui.ganttchartview;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
lang
.
Math
.
min
;
import
static
java
.
lang
.
Math
.
min
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_HORIZONTAL_SPACING
;
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
.
MATH_CONTEXT_DOUBLE_MAXIMUM_PRECISION
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
utils
.
ScheduleViewUtils
.
getDuration
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
utils
.
ScheduleViewUtils
.
getDuration
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
utils
.
ScheduleViewUtils
.
getPhase
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
utils
.
ScheduleViewUtils
.
getPhase
;
...
@@ -436,6 +438,11 @@ public class ScheduleViewCanvas extends Canvas {
...
@@ -436,6 +438,11 @@ public class ScheduleViewCanvas extends Canvas {
}
}
}
}
/** Returns the Y coordinate of the i-th horizontal line. */
private
int
getHorizontalLineY
(
int
i
)
{
return
(
int
)(
DIAGRAM_OFFSET_Y
+
i
*
scheduleLayoutData
.
getDiagramHeightOfSchedule
()
-
DIAGRAM_HORIZONTAL_SPACING
/
2.0
);
}
/** Draws the coordinate system. */
/** Draws the coordinate system. */
private
void
drawCoordinateSystem
(
GC
gc
)
{
private
void
drawCoordinateSystem
(
GC
gc
)
{
Rectangle
clientArea
=
getClientArea
();
Rectangle
clientArea
=
getClientArea
();
...
@@ -447,7 +454,7 @@ public class ScheduleViewCanvas extends Canvas {
...
@@ -447,7 +454,7 @@ public class ScheduleViewCanvas extends Canvas {
// Y axis
// Y axis
int
diagramX
=
scheduleLayoutData
.
objectSpaceToDiagramSpaceX
(
BigDecimal
.
ZERO
);
int
diagramX
=
scheduleLayoutData
.
objectSpaceToDiagramSpaceX
(
BigDecimal
.
ZERO
);
int
diagramY
=
scheduleLayoutData
.
objectSpaceToDiagramSpaceY
(
BigDecimal
.
ZERO
);
int
diagramY
=
getHorizontalLineY
(
scheduleModel
.
getSchedules
().
size
()
);
int
diagramY2
=
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
;
int
diagramY2
=
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
;
gc
.
drawLine
(
diagramX
,
diagramY
+
2
*
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramX
,
gc
.
drawLine
(
diagramX
,
diagramY
+
2
*
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramX
,
diagramY2
);
diagramY2
);
...
@@ -472,9 +479,7 @@ public class ScheduleViewCanvas extends Canvas {
...
@@ -472,9 +479,7 @@ public class ScheduleViewCanvas extends Canvas {
// Draw horizontal lines after every schedule
// Draw horizontal lines after every schedule
gc
.
setForeground
(
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_NORMAL_SHADOW
));
gc
.
setForeground
(
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_NORMAL_SHADOW
));
for
(
int
i
=
1
;
i
<
scheduleModel
.
getSchedules
().
size
();
++
i
)
{
for
(
int
i
=
1
;
i
<
scheduleModel
.
getSchedules
().
size
();
++
i
)
{
int
diagramHorizotalLineY
=
int
diagramHorizotalLineY
=
getHorizontalLineY
(
i
);
(
int
)(
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
+
i
*
scheduleLayoutData
.
getDiagramHeightOfSchedule
()
-
ScheduleViewLayoutData
.
DIAGRAM_HORIZONTAL_SPACING
/
2.0
);
gc
.
drawLine
(
diagramX
-
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
gc
.
drawLine
(
diagramX
-
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramHorizotalLineY
,
diagramX2
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramHorizotalLineY
,
diagramX2
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
...
@@ -513,12 +518,12 @@ public class ScheduleViewCanvas extends Canvas {
...
@@ -513,12 +518,12 @@ public class ScheduleViewCanvas extends Canvas {
// interval line
// interval line
int
diagramLabelX
=
scheduleLayoutData
.
objectSpaceToDiagramSpaceX
(
i
);
int
diagramLabelX
=
scheduleLayoutData
.
objectSpaceToDiagramSpaceX
(
i
);
gc
.
drawLine
(
diagramLabelX
,
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
-
gc
.
drawLine
(
diagramLabelX
,
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
-
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramLabelX
,
diagramY
+
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
,
diagramLabelX
,
diagramY
+
3
*
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
// draw x axis label
// draw x axis label
gc
.
drawText
(
gc
.
drawText
(
df
.
format
(
i
.
setScale
(
ScheduleViewLayoutData
.
MAXIMUM_PRECISION
-
1
,
df
.
format
(
i
.
setScale
(
ScheduleViewLayoutData
.
MAXIMUM_PRECISION
-
1
,
BigDecimal
.
ROUND_DOWN
))
+
""
,
diagramLabelX
,
diagramY
+
BigDecimal
.
ROUND_DOWN
))
+
""
,
diagramLabelX
,
diagramY
+
3
*
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH
);
}
}
...
...
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/ScheduleViewGraphModel.java
View file @
28e5658c
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
+--------------------------------------------------------------------------*/
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.schedule.ui.ganttchartview
;
package
org.fortiss.af3.schedule.ui.ganttchartview
;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
math
.
BigDecimal
.
valueOf
;
import
static
java
.
math
.
BigDecimal
.
valueOf
;
import
static
java
.
math
.
RoundingMode
.
HALF_UP
;
import
static
java
.
math
.
RoundingMode
.
HALF_UP
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
LabelToDraw
.
createLabel
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
LabelToDraw
.
createLabel
;
...
@@ -23,6 +24,7 @@ import static org.fortiss.af3.schedule.ui.ganttchartview.LineToDraw.drawLine;
...
@@ -23,6 +24,7 @@ import static org.fortiss.af3.schedule.ui.ganttchartview.LineToDraw.drawLine;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleModelElementToDraw
.
createScheduleModelElement
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleModelElementToDraw
.
createScheduleModelElement
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleModelElementToDraw
.
drawScheduleModelElement
;
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
.
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_Y
;
import
static
org
.
fortiss
.
af3
.
schedule
.
ui
.
ganttchartview
.
ScheduleViewLayoutData
.
DIAGRAM_OFFSET_Y
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -199,7 +201,7 @@ public class ScheduleViewGraphModel {
...
@@ -199,7 +201,7 @@ public class ScheduleViewGraphModel {
BigDecimal
multiply
=
valueOf
(
diagramHeight
).
multiply
(
startingPoint_Y
);
BigDecimal
multiply
=
valueOf
(
diagramHeight
).
multiply
(
startingPoint_Y
);
int
intValue
=
multiply
.
setScale
(
0
,
HALF_UP
).
intValue
();
int
intValue
=
multiply
.
setScale
(
0
,
HALF_UP
).
intValue
();
int
y
=
DIAGRAM_OFFSET_Y
+
intValue
;
int
y
=
DIAGRAM_OFFSET_Y
+
intValue
;
int
height
=
diagramHeight
-
ScheduleViewLayoutData
.
DIAGRAM_HORIZONTAL_SPACING
;
int
height
=
max
(
1
,
diagramHeight
-
DIAGRAM_HORIZONTAL_SPACING
)
;
if
(
object
instanceof
LabelToDraw
&&
period
==
0
)
{
if
(
object
instanceof
LabelToDraw
&&
period
==
0
)
{
int
x
=
scheduleLayoutData
.
getDiagramOrigin
().
x
;
int
x
=
scheduleLayoutData
.
getDiagramOrigin
().
x
;
...
...
org.fortiss.af3.schedule.ui/trunk/src/org/fortiss/af3/schedule/ui/ganttchartview/ScheduleViewLayoutData.java
View file @
28e5658c
...
@@ -61,7 +61,7 @@ public class ScheduleViewLayoutData {
...
@@ -61,7 +61,7 @@ public class ScheduleViewLayoutData {
public
static
final
int
DIAGRAM_OFFSET_LABEL
=
100
;
public
static
final
int
DIAGRAM_OFFSET_LABEL
=
100
;
/** Absolute horizontal spacing between objects (in diagram space). */
/** Absolute horizontal spacing between objects (in diagram space). */
public
static
final
int
DIAGRAM_HORIZONTAL_SPACING
=
3
2
;
public
static
final
int
DIAGRAM_HORIZONTAL_SPACING
=
2
;
/** Y offset of canvas (in diagram space). */
/** Y offset of canvas (in diagram space). */
public
static
final
int
DIAGRAM_OFFSET_Y
=
50
;
public
static
final
int
DIAGRAM_OFFSET_Y
=
50
;
...
@@ -224,7 +224,7 @@ public class ScheduleViewLayoutData {
...
@@ -224,7 +224,7 @@ public class ScheduleViewLayoutData {
diagramWidthOfGraph
=
diagramWidthOfGraph
=
scaleLengthObjectSpaceToDiagramSpaceX
(
objectWidthOfGraph
)
+
marginWidth
;
scaleLengthObjectSpaceToDiagramSpaceX
(
objectWidthOfGraph
)
+
marginWidth
;
diagramHeightOfSchedule
=
diagramHeightOfSchedule
=
(
int
)((
clientArea
.
height
-
2
*
DIAGRAM_OFFSET_Y
)
/
(
double
)
schedules
.
size
());
max
(
1
,
(
int
)((
clientArea
.
height
-
2
*
DIAGRAM_OFFSET_Y
)
/
(
double
)
schedules
.
size
())
)
;
}
}
/** Returns scalingUserX. */
/** Returns scalingUserX. */
...
...
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