aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2013-06-26 05:48:43 (EDT)
committerDirk Fauth2013-06-26 05:48:43 (EDT)
commit121558560c2e979dbf705ef8248ba5f7a554d123 (patch)
tree49e144b26906a40ac6ec9c2e04b51b785b928a38
parentd514ca3821cdcf6174214e0b59b97ada4f308020 (diff)
downloadorg.eclipse.nebula-121558560c2e979dbf705ef8248ba5f7a554d123.zip
org.eclipse.nebula-121558560c2e979dbf705ef8248ba5f7a554d123.tar.gz
org.eclipse.nebula-121558560c2e979dbf705ef8248ba5f7a554d123.tar.bz2
Added the possibility to specify a period in the chart.
This allows to set a period start and end date and a color, which will result in painting a day line (like the current day indicator) at the start and end date. Doing this a user knows in which date range he is allowed to move events.
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractColorManager.java5
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractSettings.java7
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/GanttComposite.java37
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IColorManager.java9
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/ISettings.java4
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeGrayBlue.java4
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeHighContrastBlack.java5
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeSilver.java4
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeWindowsBlue.java4
9 files changed, 75 insertions, 4 deletions
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractColorManager.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractColorManager.java
index 82d2f4f..1d12d5e 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractColorManager.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractColorManager.java
@@ -321,4 +321,9 @@ public abstract class AbstractColorManager implements IColorManager {
public Color getVerticalInsertMarkerColor() {
return getOriginalLocationColor();
}
+
+ public Color getPeriodLineColor() {
+ return ColorCache.getColor(255, 0, 0);
+ }
+
}
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractSettings.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractSettings.java
index 2447ffe..4365c0c 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractSettings.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractSettings.java
@@ -506,4 +506,11 @@ public abstract class AbstractSettings implements ISettings {
public boolean scrollChartVerticallyOnMouseWheel() {
return true;
}
+ public Calendar getPeriodStart() {
+ return null;
+ }
+
+ public Calendar getPeriodEnd() {
+ return null;
+ }
}
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/GanttComposite.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/GanttComposite.java
index 24c0510..363f957 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/GanttComposite.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/GanttComposite.java
@@ -132,6 +132,8 @@ public final class GanttComposite extends Canvas implements MouseListener, Mouse
// various colors used.. all set in initColors()
private Color _lineTodayColor;
+ private Color _linePeriodColor;
+
private Color _lineColor;
private Color _lineWkDivColor;
@@ -624,6 +626,7 @@ public final class GanttComposite extends Canvas implements MouseListener, Mouse
private void initColors() {
_lineTodayColor = _colorManager.getTodayLineColor();
+ _linePeriodColor = _colorManager.getPeriodLineColor();
_lineColor = _colorManager.getLineColor();
_textColor = _colorManager.getTextColor();
_satTextColor = _colorManager.getSaturdayTextColor();
@@ -2101,7 +2104,20 @@ public final class GanttComposite extends Canvas implements MouseListener, Mouse
}
final Calendar today = Calendar.getInstance(_defaultLocale);
- drawTodayLine(gc, bounds, getStartingXFor(today), today.get(Calendar.DAY_OF_WEEK));
+ drawTodayLine(gc, bounds, getStartingXFor(today), today.get(Calendar.DAY_OF_WEEK), _lineTodayColor);
+
+ if (_settings.getPeriodStart() != null) {
+ drawTodayLine(gc, bounds,
+ getStartingXFor(_settings.getPeriodStart()),
+ _settings.getPeriodStart().get(Calendar.DAY_OF_WEEK),
+ _linePeriodColor);
+ }
+ if (_settings.getPeriodEnd() != null) {
+ drawTodayLine(gc, bounds,
+ getStartingXFor(_settings.getPeriodEnd()),
+ _settings.getPeriodEnd().get(Calendar.DAY_OF_WEEK),
+ _linePeriodColor);
+ }
} else if (_currentView == ISettings.VIEW_YEAR) {
for (int i = 0; i < _verticalLineLocations.size(); i++) {
gc.setForeground(_lineWkDivColor);
@@ -2111,7 +2127,20 @@ public final class GanttComposite extends Canvas implements MouseListener, Mouse
}
final Calendar today = Calendar.getInstance(_defaultLocale);
- drawTodayLine(gc, bounds, getStartingXFor(today), today.get(Calendar.DAY_OF_WEEK));
+ drawTodayLine(gc, bounds, getStartingXFor(today), today.get(Calendar.DAY_OF_WEEK), _lineTodayColor);
+
+ if (_settings.getPeriodStart() != null) {
+ drawTodayLine(gc, bounds,
+ getStartingXFor(_settings.getPeriodStart()),
+ _settings.getPeriodStart().get(Calendar.DAY_OF_WEEK),
+ _linePeriodColor);
+ }
+ if (_settings.getPeriodEnd() != null) {
+ drawTodayLine(gc, bounds,
+ getStartingXFor(_settings.getPeriodEnd()),
+ _settings.getPeriodEnd().get(Calendar.DAY_OF_WEEK),
+ _linePeriodColor);
+ }
}
}
@@ -4157,13 +4186,13 @@ public final class GanttComposite extends Canvas implements MouseListener, Mouse
}
// draws the line showing where today's date is
- private void drawTodayLine(final GC gc, final Rectangle bounds, final int x, final int dayOfWeek) {
+ private void drawTodayLine(final GC gc, final Rectangle bounds, final int x, final int dayOfWeek, final Color lineColor) {
// d-day has no today
if (_currentView == ISettings.VIEW_D_DAY) { return; }
int xStart = x;
- gc.setForeground(_lineTodayColor);
+ gc.setForeground(lineColor);
gc.setLineWidth(_settings.getTodayLineWidth());
gc.setLineStyle(_settings.getTodayLineStyle());
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IColorManager.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IColorManager.java
index db50bb6..8b3bd50 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IColorManager.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IColorManager.java
@@ -491,4 +491,13 @@ public interface IColorManager extends IFillBackgroundColors {
* @return Color
*/
Color getVerticalInsertMarkerColor();
+
+ /**
+ * The color used for drawing the vertical period start and end line that shows where the period
+ * start and end dates are.
+ *
+ * @return Color
+ */
+ Color getPeriodLineColor();
+
}
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/ISettings.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/ISettings.java
index 602c8cc..973c33b 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/ISettings.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/ISettings.java
@@ -1076,4 +1076,8 @@ public interface ISettings {
* @return true to scroll chart vertically. Default is true.
*/
public boolean scrollChartVerticallyOnMouseWheel();
+
+ public Calendar getPeriodStart();
+
+ public Calendar getPeriodEnd();
}
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeGrayBlue.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeGrayBlue.java
index c357dce..a4c6993 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeGrayBlue.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeGrayBlue.java
@@ -321,4 +321,8 @@ public class ColorThemeGrayBlue implements IColorManager {
return getOriginalLocationColor();
}
+ public Color getPeriodLineColor() {
+ return ColorCache.getColor(255, 0, 0);
+ }
+
}
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeHighContrastBlack.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeHighContrastBlack.java
index 3b64bef..1796ec4 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeHighContrastBlack.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeHighContrastBlack.java
@@ -320,4 +320,9 @@ public class ColorThemeHighContrastBlack implements IColorManager {
public Color getVerticalInsertMarkerColor() {
return getOriginalLocationColor();
}
+
+ public Color getPeriodLineColor() {
+ return ColorCache.getColor(255, 0, 0);
+ }
+
}
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeSilver.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeSilver.java
index 82a9974..34a23d9 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeSilver.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeSilver.java
@@ -321,4 +321,8 @@ public class ColorThemeSilver implements IColorManager {
return getOriginalLocationColor();
}
+ public Color getPeriodLineColor() {
+ return ColorCache.getColor(255, 0, 0);
+ }
+
}
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeWindowsBlue.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeWindowsBlue.java
index 1fb5c24..d52b6ec 100644
--- a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeWindowsBlue.java
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/themes/ColorThemeWindowsBlue.java
@@ -324,4 +324,8 @@ public class ColorThemeWindowsBlue implements IColorManager {
return getOriginalLocationColor();
}
+ public Color getPeriodLineColor() {
+ return ColorCache.getColor(255, 0, 0);
+ }
+
}