aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2013-07-26 09:42:38 (EDT)
committerDirk Fauth2013-07-26 09:42:38 (EDT)
commit60c140d697672465dbf9b1e74e26921452ef0d10 (patch)
treedda0258f7cfd5bb80ab9cccb3aaa8b50ddab94e8
parente3130e1378435ab4e250dad5594930d20c9c4ad0 (diff)
downloadorg.eclipse.nebula-60c140d697672465dbf9b1e74e26921452ef0d10.zip
org.eclipse.nebula-60c140d697672465dbf9b1e74e26921452ef0d10.tar.gz
org.eclipse.nebula-60c140d697672465dbf9b1e74e26921452ef0d10.tar.bz2
Bug 413813 - Correct adding and removing GanttSections
-rw-r--r--widgets/ganttchart/org.eclipse.nebula.widgets.ganttchart/src/org/eclipse/nebula/widgets/ganttchart/GanttComposite.java27
1 files changed, 25 insertions, 2 deletions
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 4b08f8f..247dc9f 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
@@ -918,7 +918,17 @@ public final class GanttComposite extends Canvas implements MouseListener, Mouse
* @param section Section to add
*/
public void addSection(final GanttSection section) {
- internalAddSection(section);
+ internalAddSection(-1, section);
+ }
+
+ /**
+ * Adds a GanttSection to the chart.
+ *
+ * @param section Section to add
+ * @param index the index to add the Section at
+ */
+ public void addSection(final GanttSection section, int index) {
+ internalAddSection(index, section);
}
/**
@@ -5177,15 +5187,28 @@ public final class GanttComposite extends Canvas implements MouseListener, Mouse
flagForceFullUpdate();
}
- private void internalAddSection(final GanttSection section) {
+ private void internalAddSection(final int index, final GanttSection section) {
if (!_ganttSections.contains(section)) {
+ if (index == -1) {
_ganttSections.add(section);
+ } else {
+ _ganttSections.add(index, section);
+ }
+ //if section is added also add the events that belong to that section
+ for (Iterator it = section.getEvents().iterator(); it.hasNext();) {
+ internalAddEvent(-1, (GanttEvent)it.next());
+ }
}
flagForceFullUpdate();
}
private void internalRemoveSection(final GanttSection section) {
+ //if section is removed also remove the events that belong to that section
+ for (Iterator it = section.getEvents().iterator(); it.hasNext();) {
+ internalRemoveEvent((GanttEvent)it.next());
+ }
+
_ganttSections.remove(section);
flagForceFullUpdate();