• R/O
  • SSH
  • HTTPS

freegantt: Commit


Commit MetaInfo

Révision137 (tree)
l'heure2012-09-19 22:56:58
Auteurmonolith52

Message de Log

タスク挿入時のレベル調整

Change Summary

Modification

--- trunk/src/jp/sourceforge/freegantt/swing/TaskListTable.java (revision 136)
+++ trunk/src/jp/sourceforge/freegantt/swing/TaskListTable.java (revision 137)
@@ -203,6 +203,10 @@
203203 if (preSelected + 1 == s) chained ++; else chained = 0;
204204 int row = s + inserted - chained;
205205 Task newTask = new Task();
206+ Task lowerTask = project.getTaskAtRow(row + 1);
207+ if (lowerTask != null) {
208+ newTask.setLevel(lowerTask.getLevel());
209+ }
206210 project.getController().insertTaskAtIndex(newTask, project.getIndexFromRow(row));
207211 inserted ++;
208212 preSelected = s;
--- trunk/src/jp/sourceforge/freegantt/data/controller/ProjectController.java (revision 136)
+++ trunk/src/jp/sourceforge/freegantt/data/controller/ProjectController.java (revision 137)
@@ -242,12 +242,13 @@
242242 compound.end();
243243 }
244244 }
245-
245+
246246 /**
247- * タスクのレベルを上げる
247+ * タスクのレベルを設定する
248248 * @param task
249+ * @param level
249250 */
250- public void levelUpTask(Task task) {
251+ public void setTaskLevel(Task task, int level) {
251252 if (task == null) return;
252253 CompoundEdit compound = new CompoundEdit();
253254 getUndoManager().addEdit(compound);
@@ -256,7 +257,7 @@
256257
257258 int index = project.getIndexByTask(task);
258259 Task newTask = task.clone();
259- newTask.setLevel(task.getLevel() + 1);
260+ newTask.setLevel(level);
260261
261262 setTaskAtIndex(newTask, index);
262263 } finally {
@@ -263,6 +264,15 @@
263264 compound.end();
264265 }
265266 }
267+
268+ /**
269+ * タスクのレベルを上げる
270+ * @param task
271+ */
272+ public void levelUpTask(Task task) {
273+ if (task == null) return;
274+ setTaskLevel(task, task.getLevel() + 1);
275+ }
266276
267277 /**
268278 * タスクのレベルを下げる
@@ -271,19 +281,7 @@
271281 public void levelDownTask(Task task) {
272282 if (task == null) return;
273283 if (task.getLevel() <= 0) return;
274- CompoundEdit compound = new CompoundEdit();
275- getUndoManager().addEdit(compound);
276- try {
277- setModified(true);
278-
279- int index = project.getIndexByTask(task);
280- Task newTask = task.clone();
281- newTask.setLevel(task.getLevel() - 1);
282-
283- setTaskAtIndex(newTask, index);
284- } finally {
285- compound.end();
286- }
284+ setTaskLevel(task, task.getLevel() - 1);
287285 }
288286
289287 /**
Afficher sur ancien navigateur de dépôt.