ItEr14S13RFComportamentoGraficoPlanificador: When a task is added the task name receives focus and the viewport scrolls to show it.

This commit is contained in:
Óscar González Fernández 2009-06-29 14:36:11 +02:00 committed by Javier Moran Rua
parent f4f59470c8
commit 9f7024b9d8
2 changed files with 14 additions and 4 deletions

View file

@ -50,7 +50,8 @@ public class ListDetails extends HtmlMacroComponent {
newTask.setName("Nova Tarefa");
newTask.setBeginDate(new Date());
newTask.setEndDate(threeMonthsLater(newTask.getBeginDate()));
addTask(newTask);
TaskDetail newDetail = addTask(newTask);
newDetail.receiveFocus();
getPlanner().addTask(newTask);
}
@ -69,10 +70,11 @@ public class ListDetails extends HtmlMacroComponent {
}
}
private void addTask(TaskBean taskBean) {
private TaskDetail addTask(TaskBean taskBean) {
TaskDetail taskDetail = TaskDetail.create(taskBean);
appendChild(taskDetail);
taskDetail.afterCompose();
return taskDetail;
}
}

View file

@ -133,14 +133,22 @@ public class TaskDetail extends HtmlMacroComponent implements AfterCompose {
public void focusGoUp(int position) {
TaskDetail aboveDetail = getAboveDetail();
if (aboveDetail != null) {
aboveDetail.getTextBoxes()[position].focus();
aboveDetail.receiveFocus(position);
}
}
public void receiveFocus() {
receiveFocus(0);
}
public void receiveFocus(int position) {
this.getTextBoxes()[position].focus();
}
public void focusGoDown(int position) {
TaskDetail belowDetail = getBelowDetail();
if (belowDetail != null) {
belowDetail.getTextBoxes()[position].focus();
belowDetail.receiveFocus(position);
}
}