aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2013-06-26 11:17:22 (EDT)
committerDirk Fauth2013-06-26 11:17:22 (EDT)
commit21bab3a0a21b92623059cf74a31df55c305c9251 (patch)
tree9aa4a4cd5db6f36c247f5570a705e159fae10467
parent0c1127c96a45f85ba7561b9b68228be94d3e7da9 (diff)
downloadorg.eclipse.nebula-21bab3a0a21b92623059cf74a31df55c305c9251.zip
org.eclipse.nebula-21bab3a0a21b92623059cf74a31df55c305c9251.tar.gz
org.eclipse.nebula-21bab3a0a21b92623059cf74a31df55c305c9251.tar.bz2
Added support for custom placeholder support
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/AbstractSettings.java4
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/GanttComposite.java18
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/ISettings.java8
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IToolTipContentReplacer.java16
4 files changed, 43 insertions, 3 deletions
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 da501ec..1ca1ecf 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
@@ -507,6 +507,10 @@ public abstract class AbstractSettings implements ISettings {
return true;
}
+ public IToolTipContentReplacer getToolTipContentReplacer() {
+ return null;
+ }
+
public int getMinZoomLevel() {
return ISettings.MIN_ZOOM_LEVEL;
}
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 8c3650c..52f5a13 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
@@ -7748,9 +7748,21 @@ public final class GanttComposite extends Canvas implements MouseListener, Mouse
}
if (at != null) {
- String title = fixTooltipString(at.getTitle(), event.getName(), startDate, endDate, revisedStartText, revisedEndText, days, revisedDays, event.getPercentComplete());
- String content = fixTooltipString(at.getContent(), event.getName(), startDate, endDate, revisedStartText, revisedEndText, days, revisedDays, event.getPercentComplete());
- String help = fixTooltipString(at.getHelpText(), event.getName(), startDate, endDate, revisedStartText, revisedEndText, days, revisedDays, event.getPercentComplete());
+ String title = null;
+ String content = null;
+ String help = null;
+
+ IToolTipContentReplacer ttcr = _settings.getToolTipContentReplacer();
+ if (ttcr != null) {
+ title = ttcr.replaceToolTipPlaceHolder(event, at.getTitle(), dateFormat) ;
+ content = ttcr.replaceToolTipPlaceHolder(event, at.getContent(), dateFormat);
+ help = ttcr.replaceToolTipPlaceHolder(event, at.getHelpText(), dateFormat);
+ }
+ else {
+ title = fixTooltipString(at.getTitle(), event.getName(), startDate, endDate, revisedStartText, revisedEndText, days, revisedDays, event.getPercentComplete());
+ content = fixTooltipString(at.getContent(), event.getName(), startDate, endDate, revisedStartText, revisedEndText, days, revisedDays, event.getPercentComplete());
+ help = fixTooltipString(at.getHelpText(), event.getName(), startDate, endDate, revisedStartText, revisedEndText, days, revisedDays, event.getPercentComplete());
+ }
AdvancedTooltipDialog.makeDialog(at, _colorManager, displayLocation, title, content, help);
} else {
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 0f05e14..287f953 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
@@ -223,6 +223,14 @@ public interface ISettings {
public boolean showToolTips();
/**
+ * Returns the custom tool tip generator which generates the tooltip
+ * out of custom data for a GanttEvent.
+ *
+ * @return
+ */
+ public IToolTipContentReplacer getToolTipContentReplacer();
+
+ /**
* Whether to show date tooltips when events are moved or resized.
*
* @return true if to show tooltips. Default is true.
diff --git a/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IToolTipContentReplacer.java b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IToolTipContentReplacer.java
new file mode 100644
index 0000000..1baec2c
--- /dev/null
+++ b/widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/IToolTipContentReplacer.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Dirk Fauth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.nebula.widgets.ganttchart;
+
+public interface IToolTipContentReplacer {
+
+ String replaceToolTipPlaceHolder(GanttEvent event, String toolTipPattern, String dateFormat);
+}