• R/O
  • SSH
  • HTTPS

freegantt: Commit


Commit MetaInfo

Révision130 (tree)
l'heure2012-09-18 18:00:15
Auteurmonolith52

Message de Log

リファクタリング途中まで
controllerの引数をrowからindexに変更

Change Summary

Modification

--- trunk/src/jp/sourceforge/freegantt/swing/TaskListTable.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/swing/TaskListTable.java (revision 130)
@@ -181,7 +181,7 @@
181181 int[] selectedRows = getSelectedRows();
182182 for (int s: selectedRows) {
183183 int row = s - deleted;
184- project.getController().removeRow(row);
184+ project.getController().removeIndex(project.getIndexFromRow(row));
185185 deleted ++;
186186 }
187187 } finally {
@@ -201,7 +201,7 @@
201201 if (preSelected + 1 == s) chained ++; else chained = 0;
202202 int row = s + inserted - chained;
203203 Task newTask = new Task();
204- project.getController().insertTaskAtRow(newTask, row);
204+ project.getController().insertTaskAtIndex(newTask, project.getIndexFromRow(row));
205205 inserted ++;
206206 preSelected = s;
207207 }
@@ -351,7 +351,7 @@
351351 for (int l=0; l<lines.length; l++) {
352352 String line = lines[l];
353353 String[] fragments = line.split("\t");
354- project.getController().insertTaskAtRow(new Task(), baseRow + l);
354+ project.getController().insertTaskAtIndex(new Task(), project.getIndexFromRow(baseRow + l));
355355 for (int f=0; f<fragments.length; f++) {
356356 setValueAt(fragments[f], baseRow + l, f);
357357 }
--- trunk/src/jp/sourceforge/freegantt/swing/TaskLineDataPane.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/swing/TaskLineDataPane.java (revision 130)
@@ -68,7 +68,7 @@
6868 /** ドラッグ開始位置 */
6969 Point dragStartPoint;
7070 /** 操作対象タスク */
71- Task targetTask;
71+ int targetRow;
7272 /** 操作中タスク */
7373 Task floatingTask = null;
7474 /** 操作中制約 */
@@ -239,7 +239,7 @@
239239 // 捜査対象のタスクの行数を使用する
240240 int row = project.getRowByTask(task);
241241 if (task == floatingTask) {
242- row = project.getRowByTask(targetTask);
242+ row = targetRow;
243243 }
244244
245245 int dateOffset = (int) CalendarUtil.subDate(task.getStartDate(), taskLinePane
@@ -268,7 +268,7 @@
268268 // 捜査対象のタスクの行数を使用する
269269 int row = project.getRowByTask(task);
270270 if (task == floatingTask) {
271- row = project.getRowByTask(targetTask);
271+ row = targetRow;
272272 }
273273
274274 int dateOffset = (int) ((task.getStartDate().getTimeInMillis() - taskLinePane
@@ -326,7 +326,7 @@
326326 return;
327327 }
328328
329- targetTask = null;
329+ targetRow = -1;
330330 dragOperation = OPERATION_NONE;
331331 dragStartPoint = e.getPoint();
332332
@@ -487,22 +487,21 @@
487487 public class TaskUI {
488488
489489 public boolean mousePressed(MouseEvent e) {
490- Task task = null;
491490 Pair<Integer, Task> operation = getOperation(e);
492491 if (operation.getFirst() == OPERATION_NONE) {
493- targetTask = operation.getSecond();
492+ targetRow = getRowAtPoint(e.getPoint());
494493 dragOperation = operation.getFirst();
495494 return false;
496495 }
497496
498497 if (operation.getFirst() == OPERATION_TASK_CREATE) {
499- task = createTaskOperation(e);
500- targetTask = task;
498+ floatingTask = createTaskOperation(e);
499+ targetRow = getRowAtPoint(e.getPoint());
501500 dragOperation = OPERATION_TASK_PERIOD;
502501 } else {
503- targetTask = operation.getSecond();
502+ targetRow = getRowAtPoint(e.getPoint());
504503 dragOperation = operation.getFirst();
505- floatingTask = targetTask.clone();
504+ floatingTask = project.getTaskAtRow(targetRow).clone();
506505 }
507506 return true;
508507 }
@@ -540,7 +539,7 @@
540539 return true;
541540 } else if (dragOperation == OPERATION_TASK_COMPLETION) {
542541 int offset = e.getX();
543- Rectangle rect = getTaskRect(targetTask);
542+ Rectangle rect = getTaskRect(project.getTaskAtRow(targetRow));
544543 int completion = ((offset - rect.x) * 100 / rect.width / 5) * 5;
545544 completion = Math.min(Math.max(completion, 0), 100);
546545 floatingTask.setCompletion(completion);
@@ -565,7 +564,7 @@
565564 floatingTask.setPeriod(count);
566565 } else if (dragOperation == OPERATION_TASK_COMPLETION) {
567566 int offset = e.getX();
568- Rectangle rect = getTaskRect(targetTask);
567+ Rectangle rect = getTaskRect(project.getTaskAtRow(targetRow));
569568 int completion = ((offset - rect.x) * 100 / rect.width / 5) * 5;
570569 completion = Math.min(Math.max(completion, 0), 100);
571570 floatingTask.setCompletion(completion);
@@ -574,7 +573,7 @@
574573 CompoundEdit compound = new CompoundEdit();
575574 project.getUndoManager().addEdit(compound);
576575 try {
577- project.getController().setTaskAtRow(floatingTask, project.getRowByTask(targetTask));
576+ project.getController().setTaskAtIndex(floatingTask, project.getIndexFromRow(targetRow));
578577 project.update();
579578 } finally {
580579 compound.end();
@@ -626,9 +625,7 @@
626625 task.setStartDate(getEarlyBusinessDayAtPoint(e.getPoint()));
627626 task.setPeriod(0);
628627 task.setRealPeriod(0);
629- floatingTask = task;
630- repaintProject();
631- return project.getController().fillNewTaskAtRow(row);
628+ return task;
632629 }
633630
634631 private void drawTasks(Graphics g) {
@@ -745,7 +742,7 @@
745742 / 100, rect.height);
746743 }
747744
748- if (task != targetTask || dragOperation != OPERATION_TASK_COMPLETION) {
745+ if (project.getRowByTask(task) != targetRow || dragOperation != OPERATION_TASK_COMPLETION) {
749746 StringBuilder builder = new StringBuilder();
750747
751748 if (task.getMember() != null) {
@@ -781,8 +778,8 @@
781778 return true;
782779
783780 if (pressOperation == OPERATION_RESTRICTION_CREATE) {
784- targetTask = task;
785- floatingRestriction = new Restriction(targetTask, null);
781+ targetRow = project.getRowByTask(task);
782+ floatingRestriction = new Restriction(task, null);
786783 dragOperation = OPERATION_RESTRICTION_CREATE;
787784 return true;
788785 } else if (pressOperation == OPERATION_RESTRICTION_DELETE) {
@@ -823,7 +820,7 @@
823820 CompoundEdit compound = new CompoundEdit();
824821 project.getUndoManager().addEdit(compound);
825822 try {
826- project.getController().addRestriction(targetTask, detTask);
823+ project.getController().addRestriction(project.getTaskAtRow(targetRow), detTask);
827824 project.update();
828825 } finally {
829826 compound.end();
--- trunk/src/jp/sourceforge/freegantt/data/model/TaskListTableModel.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/model/TaskListTableModel.java (revision 130)
@@ -128,7 +128,7 @@
128128
129129 Task task = project.getTaskAtRow(rowIndex);
130130 if (task == null) {
131- task = project.getController().fillNewTaskAtRow(rowIndex);
131+ task = project.getController().fillNewTaskAtIndex(project.getIndexFromRow(rowIndex));
132132 }
133133 Task newTask = task.clone();
134134
@@ -173,7 +173,7 @@
173173 break;
174174 }
175175
176- project.getController().setTaskAtRow(newTask, rowIndex);
176+ project.getController().setTaskAtIndex(newTask, project.getIndexFromRow(rowIndex));
177177 project.update();
178178 } finally {
179179 compound.end();
--- trunk/src/jp/sourceforge/freegantt/data/controller/ProjectController.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/controller/ProjectController.java (revision 130)
@@ -65,15 +65,15 @@
6565 * 行を削除する
6666 * @param index
6767 */
68- public void removeRow(int row) {
68+ public void removeIndex(int index) {
6969 CompoundEdit compound = new CompoundEdit();
7070 getUndoManager().addEdit(compound);
7171 try {
7272 setModified(true);
7373
74- Task targetTask = project.getTaskAtRow(row);
74+ Task targetTask = project.getTaskAtIndex(index);
7575 removeDestRestrictions(targetTask);
76- compound.addEdit(new RemoveTaskEdit(project, row));
76+ compound.addEdit(new RemoveTaskEdit(project, index));
7777 if (targetTask != null) project.getTasks().remove(targetTask);
7878 project.update();
7979 } finally {
@@ -87,14 +87,14 @@
8787 * @param newTask
8888 * @param row
8989 */
90- public void insertTaskAtRow(Task newTask, int row) {
90+ public void insertTaskAtIndex(Task newTask, int index) {
9191 CompoundEdit compound = new CompoundEdit();
9292 getUndoManager().addEdit(compound);
9393 try {
9494 setModified(true);
9595
96- getUndoManager().addEdit(new InsertTaskEdit(project, newTask, row));
97- project.getTasks().add(project.getIndexFromRow(row), newTask);
96+ getUndoManager().addEdit(new InsertTaskEdit(project, newTask, index));
97+ project.getTasks().add(index, newTask);
9898 project.update();
9999 } finally {
100100 compound.end();
@@ -109,7 +109,7 @@
109109 * @param task
110110 * @param row
111111 */
112- public void setTaskAtRow(Task newTask, int row) {
112+ public void setTaskAtIndex(Task newTask, int index) {
113113 if (newTask == null) newTask = new Task();
114114 CompoundEdit compound = new CompoundEdit();
115115 getUndoManager().addEdit(compound);
@@ -116,10 +116,9 @@
116116 try {
117117 setModified(true);
118118
119- fillNewTaskAtRow(row);
119+ fillNewTaskAtIndex(index);
120120
121121 // 被参照の付け替え
122- int index = project.getIndexFromRow(row);
123122 Task oldTask = project.getTaskAtIndex(index);
124123 for (Task task: project.getTasks()) {
125124 if (task.getRestrictions().remove(oldTask)) {
@@ -129,7 +128,7 @@
129128
130129 compound.addEdit(new UpdateTaskEdit(project,
131130 newTask,
132- row));
131+ index));
133132 project.getTasks().set(index, newTask);
134133 } finally {
135134 compound.end();
@@ -142,13 +141,12 @@
142141 * @param row
143142 * @return
144143 */
145- public Task fillNewTaskAtRow(int row) {
144+ public Task fillNewTaskAtIndex(int index) {
146145 CompoundEdit compound = new CompoundEdit();
147146 getUndoManager().addEdit(compound);
148147 try {
149148 setModified(true);
150149
151- int index = project.getIndexFromRow(row);
152150 while (project.getTasks().size() <= index) {
153151 Task fillTask = new Task();
154152 compound.addEdit(new CreateTaskEdit(project, fillTask));
@@ -157,7 +155,7 @@
157155 } finally {
158156 compound.end();
159157 }
160- return project.getTaskAtRow(row);
158+ return project.getTaskAtIndex(index);
161159 }
162160
163161
@@ -173,8 +171,8 @@
173171 setModified(true);
174172
175173 compound.addEdit(new CreateRestrictionEdit(project,
176- project.getRowByTask(src),
177- project.getRowByTask(dst)));
174+ project.getIndexByTask(src),
175+ project.getIndexByTask(dst)));
178176 src.addRestriction(dst);
179177 project.update();
180178 project.getTaskTableModel().fireTableChanged();
@@ -195,8 +193,8 @@
195193 setModified(true);
196194
197195 compound.addEdit(new RemoveRestrictioinEdit(project,
198- project.getRowByTask(src),
199- project.getRowByTask(dst)));
196+ project.getIndexByTask(src),
197+ project.getIndexByTask(dst)));
200198 src.removeRestriction(dst);
201199 project.update();
202200 project.getTaskTableModel().fireTableChanged();
@@ -218,7 +216,8 @@
218216 List<Task> srcs = project.getRestrictionSrcTasks(task);
219217 for (Task src: srcs) {
220218 compound.addEdit(new RemoveRestrictioinEdit(project,
221- project.getRowByTask(src), project.getRowByTask(task)));
219+ project.getIndexByTask(src),
220+ project.getIndexByTask(task)));
222221 src.getRestrictions().remove(task);
223222 }
224223 project.update();
@@ -239,7 +238,8 @@
239238
240239 for (Task dst: task.getRestrictions()) {
241240 compound.addEdit(new RemoveRestrictioinEdit(project,
242- project.getRowByTask(task), project.getRowByTask(dst)));
241+ project.getIndexByTask(task),
242+ project.getIndexByTask(dst)));
243243 }
244244 task.getRestrictions().clear();
245245 project.update();
@@ -259,11 +259,11 @@
259259 try {
260260 setModified(true);
261261
262- int row = project.getRowByTask(task);
262+ int index = project.getIndexByTask(task);
263263 Task newTask = task.clone();
264264 newTask.setLevel(task.getLevel() + 1);
265265
266- setTaskAtRow(newTask, row);
266+ setTaskAtIndex(newTask, index);
267267
268268 project.update();
269269 } finally {
@@ -283,11 +283,11 @@
283283 try {
284284 setModified(true);
285285
286- int row = project.getRowByTask(task);
286+ int index = project.getIndexByTask(task);
287287 Task newTask = task.clone();
288288 newTask.setLevel(task.getLevel() - 1);
289289
290- setTaskAtRow(newTask, row);
290+ setTaskAtIndex(newTask, index);
291291
292292 project.update();
293293 } finally {
@@ -342,14 +342,14 @@
342342 * @param calendar
343343 * @param row
344344 */
345- public void addAdditionalHoliday(Calendar calendar, int row) {
345+ public void addAdditionalHoliday(Calendar calendar, int index) {
346346 CompoundEdit compound = new CompoundEdit();
347347 getUndoManager().addEdit(compound);
348348 try {
349349 setModified(true);
350350
351- compound.addEdit(new CreateAdditionalHolidayEdit(project, calendar, row));
352- project.getAdditionalHolidays().add(row, calendar);
351+ compound.addEdit(new CreateAdditionalHolidayEdit(project, calendar, index));
352+ project.getAdditionalHolidays().add(index, calendar);
353353 project.update();
354354 } finally {
355355 compound.end();
@@ -367,14 +367,14 @@
367367 * 個別休日を削除する
368368 * @param row
369369 */
370- public void removeAdditionalHoliday(int row) {
370+ public void removeAdditionalHoliday(int index) {
371371 CompoundEdit compound = new CompoundEdit();
372372 getUndoManager().addEdit(compound);
373373 try {
374374 setModified(true);
375375
376- compound.addEdit(new RemoveAdditionalHolidayEdit(project, row));
377- project.getAdditionalHolidays().remove(row);
376+ compound.addEdit(new RemoveAdditionalHolidayEdit(project, index));
377+ project.getAdditionalHolidays().remove(index);
378378 project.update();
379379 } finally {
380380 compound.end();
@@ -398,14 +398,14 @@
398398 * @param calendar
399399 * @param row
400400 */
401- public void setAdditionalHoliday(Calendar calendar, int row) {
401+ public void setAdditionalHoliday(Calendar calendar, int index) {
402402 CompoundEdit compound = new CompoundEdit();
403403 getUndoManager().addEdit(compound);
404404 try {
405405 setModified(true);
406406
407- compound.addEdit(new UpdateAdditionalHolidayEdit(project, calendar, row));
408- project.getAdditionalHolidays().get(row).setTime(calendar.getTime());
407+ compound.addEdit(new UpdateAdditionalHolidayEdit(project, calendar, index));
408+ project.getAdditionalHolidays().get(index).setTime(calendar.getTime());
409409 project.update();
410410 } finally {
411411 compound.end();
@@ -419,12 +419,12 @@
419419 * @param member
420420 * @param row
421421 */
422- public void addMember(Member member, int row) {
422+ public void addMember(Member member, int index) {
423423 CompoundEdit compound = new CompoundEdit();
424424 getUndoManager().addEdit(compound);
425425 try {
426- compound.addEdit(new CreateMemberEdit(project, member, row));
427- project.getMembers().add(row, member);
426+ compound.addEdit(new CreateMemberEdit(project, member, index));
427+ project.getMembers().add(index, member);
428428 } finally {
429429 compound.end();
430430 project.getMemberTableModel().fireTableChanged();
@@ -436,18 +436,18 @@
436436 * リソースを削除する
437437 * @param row
438438 */
439- public void removeMember(int row) {
439+ public void removeMember(int index) {
440440 CompoundEdit compound = new CompoundEdit();
441441 getUndoManager().addEdit(compound);
442442 try {
443443 setModified(true);
444444
445- compound.addEdit(new RemoveMemberEdit(project, row));
446- Member oldMember = project.getMembers().get(row);
445+ compound.addEdit(new RemoveMemberEdit(project, index));
446+ Member oldMember = project.getMembers().get(index);
447447 for (Task task: project.getTasks()) {
448448 if (task.getMember() == oldMember) task.setMember(null);
449449 }
450- project.getMembers().remove(row);
450+ project.getMembers().remove(index);
451451 } finally {
452452 compound.end();
453453 project.getTaskTableModel().fireTableChanged();
@@ -461,18 +461,18 @@
461461 * @param member
462462 * @param row
463463 */
464- public void setMember(Member member, int row) {
464+ public void setMember(Member member, int index) {
465465 CompoundEdit compound = new CompoundEdit();
466466 getUndoManager().addEdit(compound);
467467 try {
468468 setModified(true);
469469
470- compound.addEdit(new UpdateMemberEdit(project, member, row));
471- Member oldMember = project.getMembers().get(row);
470+ compound.addEdit(new UpdateMemberEdit(project, member, index));
471+ Member oldMember = project.getMembers().get(index);
472472 for (Task task: project.getTasks()) {
473473 if (task.getMember() == oldMember) task.setMember(member);
474474 }
475- project.getMembers().set(row, member);
475+ project.getMembers().set(index, member);
476476 } finally {
477477 compound.end();
478478 project.getTaskTableModel().fireTableChanged();
@@ -622,8 +622,8 @@
622622 * @param b
623623 * @param rowByTask
624624 */
625- public void setTaskGroup(boolean group, int row) {
626- Task task = project.getTaskAtRow(row);
625+ public void setTaskGroup(boolean group, int index) {
626+ Task task = project.getTaskAtIndex(index);
627627 if (task == null) return;
628628 if (task.isGroup() == group) return;
629629
@@ -632,7 +632,7 @@
632632 try {
633633 setModified(true);
634634
635- compound.addEdit(new UpdateTaskGroupEdit(project, group, row));
635+ compound.addEdit(new UpdateTaskGroupEdit(project, group, index));
636636 task.setGroup(group);
637637 } finally {
638638 compound.end();
--- trunk/src/jp/sourceforge/freegantt/data/undo/CreateRestrictionEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/CreateRestrictionEdit.java (revision 130)
@@ -11,13 +11,13 @@
1111 private static final long serialVersionUID = -8271123013131982024L;
1212
1313 Project project;
14- int srcRow;
15- int dstRow;
14+ int srcIndex;
15+ int dstIndex;
1616
17- public CreateRestrictionEdit(Project project, int srcRow, int dstRow) {
17+ public CreateRestrictionEdit(Project project, int srcIndex, int dstIndex) {
1818 this.project = project;
19- this.srcRow = srcRow;
20- this.dstRow = dstRow;
19+ this.srcIndex = srcIndex;
20+ this.dstIndex = dstIndex;
2121 }
2222
2323
@@ -24,8 +24,8 @@
2424 @Override
2525 public void undo() throws CannotUndoException {
2626 super.undo();
27- Task srcTask = project.getTaskAtRow(srcRow);
28- Task dstTask = project.getTaskAtRow(dstRow);
27+ Task srcTask = project.getTaskAtRow(srcIndex);
28+ Task dstTask = project.getTaskAtRow(dstIndex);
2929 project.getController().removeRestriction(srcTask, dstTask);
3030 }
3131
@@ -32,8 +32,8 @@
3232 @Override
3333 public void redo() throws CannotRedoException {
3434 super.redo();
35- Task srcTask = project.getTaskAtRow(srcRow);
36- Task dstTask = project.getTaskAtRow(dstRow);
35+ Task srcTask = project.getTaskAtRow(srcIndex);
36+ Task dstTask = project.getTaskAtRow(dstIndex);
3737 project.getController().addRestriction(srcTask, dstTask);
3838 }
3939
--- trunk/src/jp/sourceforge/freegantt/data/undo/CreateMemberEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/CreateMemberEdit.java (revision 130)
@@ -12,24 +12,24 @@
1212
1313 Project project;
1414 Member newMember;
15- int row;
15+ int index;
1616
17- public CreateMemberEdit(Project project, Member member, int row) {
17+ public CreateMemberEdit(Project project, Member member, int index) {
1818 this.project = project;
1919 this.newMember = member.clone();
20- this.row = row;
20+ this.index = index;
2121 }
2222
2323 @Override
2424 public void undo() throws CannotUndoException {
2525 super.undo();
26- project.getController().removeMember(row);
26+ project.getController().removeMember(index);
2727 }
2828
2929 @Override
3030 public void redo() throws CannotRedoException {
3131 super.redo();
32- project.getController().addMember(newMember, row);
32+ project.getController().addMember(newMember, index);
3333 }
3434
3535 @Override
--- trunk/src/jp/sourceforge/freegantt/data/undo/RemoveRestrictioinEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/RemoveRestrictioinEdit.java (revision 130)
@@ -11,13 +11,13 @@
1111 private static final long serialVersionUID = 4876365331030618017L;
1212
1313 Project project;
14- int srcRow;
15- int dstRow;
14+ int srcIndex;
15+ int dstIndex;
1616
17- public RemoveRestrictioinEdit(Project project, int srcRow, int dstRow) {
17+ public RemoveRestrictioinEdit(Project project, int srcIndex, int dstIndex) {
1818 this.project = project;
19- this.srcRow = srcRow;
20- this.dstRow = dstRow;
19+ this.srcIndex = srcIndex;
20+ this.dstIndex = dstIndex;
2121 }
2222
2323
@@ -24,8 +24,8 @@
2424 @Override
2525 public void undo() throws CannotUndoException {
2626 super.undo();
27- Task srcTask = project.getTaskAtRow(srcRow);
28- Task dstTask = project.getTaskAtRow(dstRow);
27+ Task srcTask = project.getTaskAtIndex(srcIndex);
28+ Task dstTask = project.getTaskAtIndex(dstIndex);
2929 srcTask.getRestrictions().add(dstTask);
3030 project.update();
3131 project.getTaskTableModel().fireTableChanged();
@@ -34,8 +34,8 @@
3434 @Override
3535 public void redo() throws CannotRedoException {
3636 super.redo();
37- Task srcTask = project.getTaskAtRow(srcRow);
38- Task dstTask = project.getTaskAtRow(dstRow);
37+ Task srcTask = project.getTaskAtRow(srcIndex);
38+ Task dstTask = project.getTaskAtRow(dstIndex);
3939 srcTask.getRestrictions().remove(dstTask);
4040 project.update();
4141 project.getTaskTableModel().fireTableChanged();
--- trunk/src/jp/sourceforge/freegantt/data/undo/RemoveAdditionalHolidayEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/RemoveAdditionalHolidayEdit.java (revision 130)
@@ -13,24 +13,24 @@
1313
1414 Project project;
1515 Calendar oldCalendar;
16- int row;
16+ int index;
1717
18- public RemoveAdditionalHolidayEdit(Project project, int row) {
18+ public RemoveAdditionalHolidayEdit(Project project, int index) {
1919 this.project = project;
20- this.row = row;
21- this.oldCalendar = (Calendar)project.getAdditionalHolidays().get(row).clone();
20+ this.index = index;
21+ this.oldCalendar = (Calendar)project.getAdditionalHolidays().get(index).clone();
2222 }
2323
2424 @Override
2525 public void undo() throws CannotUndoException {
2626 super.undo();
27- project.getController().addAdditionalHoliday(oldCalendar, row);
27+ project.getController().addAdditionalHoliday(oldCalendar, index);
2828 }
2929
3030 @Override
3131 public void redo() throws CannotRedoException {
3232 super.redo();
33- project.getController().removeAdditionalHoliday(row);
33+ project.getController().removeAdditionalHoliday(index);
3434 }
3535
3636 @Override
--- trunk/src/jp/sourceforge/freegantt/data/undo/UpdateTaskEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/UpdateTaskEdit.java (revision 130)
@@ -15,36 +15,36 @@
1515
1616 Project project;
1717
18- int row;
18+ int index;
1919 Task oldTask;
20- List<Integer> oldRestrictionRows;
20+ List<Integer> oldRestrictionIndexes;
2121 Task newTask;
22- List<Integer> newRestrictionRows;
22+ List<Integer> newRestrictionIndexes;
2323
24- public UpdateTaskEdit(Project project, Task newTask, int row) {
24+ public UpdateTaskEdit(Project project, Task newTask, int index) {
2525 this.project = project;
2626
27- this.row = row;
28- this.oldTask = project.getTaskAtRow(row).clone();
27+ this.index = index;
28+ this.oldTask = project.getTaskAtIndex(index).clone();
2929 this.newTask = newTask.clone();
30- oldRestrictionRows = collectRestrictionRows(oldTask);
31- newRestrictionRows = collectRestrictionRows(newTask);
30+ oldRestrictionIndexes = collectRestrictionIndexes(oldTask);
31+ newRestrictionIndexes = collectRestrictionIndexes(newTask);
3232 }
3333
34- protected List<Integer> collectRestrictionRows(Task targetTask) {
34+ protected List<Integer> collectRestrictionIndexes(Task targetTask) {
3535 List<Integer> list = new ArrayList<Integer>();
3636 if (targetTask == null) return list;
3737 for (Task task: targetTask.getRestrictions()) {
38- int row = project.getRowByTask(task);
39- if (row >= 0) list.add(row);
38+ int index = project.getIndexByTask(task);
39+ if (index >= 0) list.add(index);
4040 }
4141 return list;
4242 }
4343
44- protected List<Task> collectTasksAtRows(List<Integer> rows) {
44+ protected List<Task> collectTasksAtIndexes(List<Integer> indexes) {
4545 List<Task> tasks = new ArrayList<Task>();
46- for (int row: rows) {
47- Task task = project.getTaskAtRow(row);
46+ for (int index: indexes) {
47+ Task task = project.getTaskAtIndex(index);
4848 if (task != null) tasks.add(task);
4949 }
5050 return tasks;
@@ -53,15 +53,15 @@
5353 @Override
5454 public void undo() throws CannotUndoException {
5555 super.undo();
56- oldTask.setRestrictions(collectTasksAtRows(oldRestrictionRows));
57- project.getController().setTaskAtRow(oldTask, row);
56+ oldTask.setRestrictions(collectTasksAtIndexes(oldRestrictionIndexes));
57+ project.getController().setTaskAtIndex(oldTask, index);
5858 }
5959
6060 @Override
6161 public void redo() throws CannotRedoException {
6262 super.redo();
63- newTask.setRestrictions(collectTasksAtRows(newRestrictionRows));
64- project.getController().setTaskAtRow(newTask, row);
63+ newTask.setRestrictions(collectTasksAtIndexes(newRestrictionIndexes));
64+ project.getController().setTaskAtIndex(newTask, index);
6565 }
6666
6767 @Override
--- trunk/src/jp/sourceforge/freegantt/data/undo/CreateAdditionalHolidayEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/CreateAdditionalHolidayEdit.java (revision 130)
@@ -13,24 +13,24 @@
1313
1414 Project project;
1515 Calendar newCalendar;
16- int row;
16+ int index;
1717
18- public CreateAdditionalHolidayEdit(Project project, Calendar calendar, int row) {
18+ public CreateAdditionalHolidayEdit(Project project, Calendar calendar, int index) {
1919 this.project = project;
2020 this.newCalendar = (Calendar)calendar.clone();
21- this.row = row;
21+ this.index = index;
2222 }
2323
2424 @Override
2525 public void undo() throws CannotUndoException {
2626 super.undo();
27- project.getController().removeAdditionalHoliday(row);
27+ project.getController().removeAdditionalHoliday(index);
2828 }
2929
3030 @Override
3131 public void redo() throws CannotRedoException {
3232 super.redo();
33- project.getController().addAdditionalHoliday(newCalendar, row);
33+ project.getController().addAdditionalHoliday(newCalendar, index);
3434 }
3535
3636 @Override
--- trunk/src/jp/sourceforge/freegantt/data/undo/UpdateMemberEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/UpdateMemberEdit.java (revision 130)
@@ -17,15 +17,15 @@
1717 Project project;
1818 Member newMember;
1919 Member oldMember;
20- int row;
20+ int index;
2121 List<Integer> srcTasks = new ArrayList<Integer>();
2222
2323
24- public UpdateMemberEdit(Project project, Member newMember, int row) {
24+ public UpdateMemberEdit(Project project, Member newMember, int index) {
2525 this.project = project;
2626 this.newMember = newMember.clone();
27- this.oldMember = project.getMembers().get(row);
28- this.row = row;
27+ this.oldMember = project.getMembers().get(index);
28+ this.index = index;
2929 for (int i=0; i<project.getTasks().size(); i++) {
3030 Task task = project.getTasks().get(i);
3131 if (task.getMember() == oldMember) srcTasks.add(i);
@@ -35,13 +35,13 @@
3535 @Override
3636 public void undo() throws CannotUndoException {
3737 super.undo();
38- project.getController().setMember(oldMember, row);
38+ project.getController().setMember(oldMember, index);
3939 }
4040
4141 @Override
4242 public void redo() throws CannotRedoException {
4343 super.redo();
44- project.getController().setMember(newMember, row);
44+ project.getController().setMember(newMember, index);
4545 }
4646
4747 @Override
--- trunk/src/jp/sourceforge/freegantt/data/undo/RemoveTaskEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/RemoveTaskEdit.java (revision 130)
@@ -11,20 +11,20 @@
1111 private static final long serialVersionUID = 1787178891038164920L;
1212
1313 Project project;
14- int row;
14+ int index;
1515 Task oldTask;
1616
17- public RemoveTaskEdit(Project project, int row) {
17+ public RemoveTaskEdit(Project project, int index) {
1818 this.project = project;
1919
20- this.row = row;
21- this.oldTask = project.getTaskAtRow(row);
20+ this.index = index;
21+ this.oldTask = project.getTaskAtIndex(index);
2222 }
2323
2424 @Override
2525 public void undo() throws CannotUndoException {
2626 super.undo();
27- project.getController().insertTaskAtRow(oldTask, row);
27+ project.getController().insertTaskAtIndex(oldTask, index);
2828 project.update();
2929 project.getTaskTableModel().fireTableChanged();
3030 }
@@ -32,7 +32,7 @@
3232 @Override
3333 public void redo() throws CannotRedoException {
3434 super.redo();
35- project.getController().removeRow(row);
35+ project.getController().removeIndex(index);
3636 project.update();
3737 project.getTaskTableModel().fireTableChanged();
3838 }
--- trunk/src/jp/sourceforge/freegantt/data/undo/UpdateTaskGroupEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/UpdateTaskGroupEdit.java (revision 130)
@@ -12,25 +12,25 @@
1212 Project project;
1313 boolean oldGroup;
1414 boolean newGroup;
15- int row;
15+ int index;
1616
17- public UpdateTaskGroupEdit(Project project, boolean newGroup, int row) {
17+ public UpdateTaskGroupEdit(Project project, boolean newGroup, int index) {
1818 this.project = project;
19- this.oldGroup = project.getTaskAtRow(row).isGroup();
19+ this.oldGroup = project.getTaskAtIndex(index).isGroup();
2020 this.newGroup = newGroup;
21- this.row = row;
21+ this.index = index;
2222 }
2323
2424 @Override
2525 public void undo() throws CannotUndoException {
2626 super.undo();
27- project.getController().setTaskGroup(oldGroup, row);
27+ project.getController().setTaskGroup(oldGroup, index);
2828 }
2929
3030 @Override
3131 public void redo() throws CannotRedoException {
3232 super.redo();
33- project.getController().setTaskGroup(newGroup, row);
33+ project.getController().setTaskGroup(newGroup, index);
3434 }
3535
3636 @Override
--- trunk/src/jp/sourceforge/freegantt/data/undo/UpdateAdditionalHolidayEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/UpdateAdditionalHolidayEdit.java (revision 130)
@@ -14,25 +14,25 @@
1414 Project project;
1515 Calendar newCalendar;
1616 Calendar oldCalendar;
17- int row;
17+ int index;
1818
19- public UpdateAdditionalHolidayEdit(Project project, Calendar calendar, int row) {
19+ public UpdateAdditionalHolidayEdit(Project project, Calendar calendar, int index) {
2020 this.project = project;
2121 this.newCalendar = (Calendar)calendar.clone();
22- this.oldCalendar = project.getAdditionalHolidays().get(row);
23- this.row = row;
22+ this.oldCalendar = project.getAdditionalHolidays().get(index);
23+ this.index = index;
2424 }
2525
2626 @Override
2727 public void undo() throws CannotUndoException {
2828 super.undo();
29- project.getController().setAdditionalHoliday(oldCalendar, row);
29+ project.getController().setAdditionalHoliday(oldCalendar, index);
3030 }
3131
3232 @Override
3333 public void redo() throws CannotRedoException {
3434 super.redo();
35- project.getController().setAdditionalHoliday(newCalendar, row);
35+ project.getController().setAdditionalHoliday(newCalendar, index);
3636 }
3737
3838 @Override
--- trunk/src/jp/sourceforge/freegantt/data/undo/RemoveMemberEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/RemoveMemberEdit.java (revision 130)
@@ -16,13 +16,13 @@
1616
1717 Project project;
1818 Member oldMember;
19- int row;
19+ int index;
2020 List<Integer> srcTasks = new ArrayList<Integer>();
2121
22- public RemoveMemberEdit(Project project, int row) {
22+ public RemoveMemberEdit(Project project, int index) {
2323 this.project = project;
24- this.oldMember = project.getMembers().get(row);
25- this.row = row;
24+ this.oldMember = project.getMembers().get(index);
25+ this.index = index;
2626 for (int i=0; i<project.getTasks().size(); i++) {
2727 Task task = project.getTasks().get(i);
2828 if (task.getMember() == oldMember) srcTasks.add(i);
@@ -32,7 +32,7 @@
3232 @Override
3333 public void undo() throws CannotUndoException {
3434 super.undo();
35- project.getController().addMember(oldMember, row);
35+ project.getController().addMember(oldMember, index);
3636 for (Integer index: srcTasks) {
3737 Task task = project.getTasks().get(index);
3838 task.setMember(oldMember);
@@ -43,7 +43,7 @@
4343 @Override
4444 public void redo() throws CannotRedoException {
4545 super.redo();
46- project.getController().removeMember(row);
46+ project.getController().removeMember(index);
4747 }
4848
4949 @Override
--- trunk/src/jp/sourceforge/freegantt/data/undo/InsertTaskEdit.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/undo/InsertTaskEdit.java (revision 130)
@@ -11,13 +11,13 @@
1111 private static final long serialVersionUID = 6954579936773863317L;
1212
1313 Project project;
14- int row;
14+ int index;
1515 Task newTask;
1616
17- public InsertTaskEdit(Project project, Task newTask, int row) {
17+ public InsertTaskEdit(Project project, Task newTask, int index) {
1818 this.project = project;
1919
20- this.row = row;
20+ this.index = index;
2121 this.newTask = newTask.clone();
2222 }
2323
@@ -24,7 +24,7 @@
2424 @Override
2525 public void undo() throws CannotUndoException {
2626 super.undo();
27- project.getController().removeRow(row);
27+ project.getController().removeIndex(index);
2828 project.update();
2929 project.getTaskTableModel().fireTableChanged();
3030 }
@@ -32,7 +32,7 @@
3232 @Override
3333 public void redo() throws CannotRedoException {
3434 super.redo();
35- project.getController().insertTaskAtRow(newTask, row);
35+ project.getController().insertTaskAtIndex(newTask, index);
3636 project.update();
3737 project.getTaskTableModel().fireTableChanged();
3838 }
--- trunk/src/jp/sourceforge/freegantt/data/Project.java (revision 129)
+++ trunk/src/jp/sourceforge/freegantt/data/Project.java (revision 130)
@@ -278,7 +278,7 @@
278278
279279 // 階層の深いものから実質工期を求める
280280 for (Task task: sortedTasks) {
281- getController().setTaskGroup(!getChildTasks(task).isEmpty(), getRowByTask(task));
281+ getController().setTaskGroup(!getChildTasks(task).isEmpty(), getIndexByTask(task));
282282 if (task.isGroup()) {
283283 updateParentPeriod(task);
284284 } else if (task.isMilestone()) {
@@ -312,7 +312,7 @@
312312 }
313313
314314 if (!updateTask.equals(task)) {
315- getController().setTaskAtRow(updateTask, getRowByTask(task));
315+ getController().setTaskAtIndex(updateTask, getIndexByTask(task));
316316 }
317317 }
318318
@@ -338,7 +338,7 @@
338338 updateTask.setRealPeriod(realPeriod);
339339
340340 if (!isFloating && !updateTask.equals(task)) {
341- getController().setTaskAtRow(updateTask, getRowByTask(task));
341+ getController().setTaskAtIndex(updateTask, getIndexByTask(task));
342342 }
343343 }
344344
@@ -398,7 +398,7 @@
398398 if (!updateTask.equals(task)) {
399399 System.out.println("Group Task updated: " + updateTask.getName());
400400 // この仲ではupdateが呼ばれない
401- getController().setTaskAtRow(updateTask, getRowByTask(task));
401+ getController().setTaskAtIndex(updateTask, getIndexByTask(task));
402402 }
403403 }
404404
Afficher sur ancien navigateur de dépôt.