No need to rename the method "onNewSelection" to "action" there were errors in my AC-implementation.

This commit is contained in:
Tom Vahlman 2012-03-29 17:02:48 +02:00
parent f4fff112f1
commit 86ed4d2903
5 changed files with 21 additions and 74 deletions

@ -88,7 +88,7 @@ public abstract class AdminEditProject extends Panel {
private static final long serialVersionUID = 5019499805524407957L;
@Override
public void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
//do nothing
}
@Override

@ -199,42 +199,8 @@ public class ManualMatchPanel extends Panel {
EmployeeAutoComplete createDsvAutocompleteComponent(final ProjectIdea projectIdea, final Match.Status status) {
return new EmployeeAutoComplete("autoComplete") {
private static final long serialVersionUID = 7734889540424308421L;
@Override
public Employee loadObject(Long supervisorId) {
if(supervisorId != null && supervisorId != 0L) {
return supervisorDao.load(supervisorId);
} else {
return null;
}
}
@Override
public Long convertId(String id) {
if(id != null && !id.isEmpty()) {
return Long.valueOf(id);
} else {
return 0L;
}
}
@Override
public Long getId(Employee employee) {
if(employee != null) {
return employee.getId();
} else {
return 0L;
}
}
@Override
public Iterator<Employee> getChoices(String input) {
return supervisorDao.getAutoCompleteCapableSupervisors(input, 6).iterator();
}
@Override
public void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
super.onNewSelection(pTarget, newSelection);
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
if (newSelection != null) {
if (pTarget != null) {
final String declineMessage = createDeclineMessage(newSelection, projectIdea, status);

@ -166,40 +166,7 @@ public class ManualSetReviewerPanel extends Panel {
private static final long serialVersionUID = 8639430940925886127L;
@Override
public Employee loadObject(Long supervisorId) {
if(supervisorId != null && supervisorId != 0L) {
return supervisorDao.load(supervisorId);
} else {
return null;
}
}
@Override
public Long convertId(String id) {
if(id != null && !id.isEmpty()) {
return Long.valueOf(id);
} else {
return 0L;
}
}
@Override
public Long getId(Employee employee) {
if(employee != null) {
return employee.getId();
} else {
return 0L;
}
}
@Override
public Iterator<Employee> getChoices(String input) {
return supervisorDao.getAutoCompleteCapableSupervisors(input, 6).iterator();
}
@Override
public void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
super.onNewSelection(pTarget, newSelection);
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
if (newSelection != null) {
if (pTarget != null) {
saveButton.setMessageContentHTML(getConfirmMessage(newSelection.getNameAsString(), projectIdea.getTitle()));

@ -84,7 +84,7 @@ public abstract class AddRemoveProjectFollowerPanel extends Panel {
private static final long serialVersionUID = 3469224066732295829L;
@Override
public void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
setSelection(null);
ProjectFollower pf = new ProjectFollower();
pf.setProjectRole(ProjectTeamMemberRoles.CO_SUPERVISOR);

@ -18,7 +18,7 @@ import java.util.Iterator;
* private static final long serialVersionUID = 1L;
*
* @Override
* public void action(AjaxRequestTarget pTarget, Employee newSelection) {
* protected void action(AjaxRequestTarget pTarget, Employee newSelection) {
* System.out.println(newSelection.getNameAsString());
* }
*
@ -41,7 +41,6 @@ public abstract class EmployeeAutoComplete extends AutoCompleteObjectField<Emplo
@Override
protected Long getId(Employee e) {
// return e.getId();
if(e != null) {
return e.getId();
} else {
@ -51,7 +50,6 @@ public abstract class EmployeeAutoComplete extends AutoCompleteObjectField<Emplo
@Override
protected Long convertId(String id) {
// return Long.valueOf(id);
if(id != null && !id.isEmpty()) {
return Long.valueOf(id);
} else {
@ -73,10 +71,26 @@ public abstract class EmployeeAutoComplete extends AutoCompleteObjectField<Emplo
return supervisorDao.getAutoCompleteCapableSupervisors(input, 6).iterator();
}
@Override
protected void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
super.onNewSelection(pTarget, newSelection);
if (newSelection != null) {
if (pTarget != null) {
action(pTarget, newSelection);
}
}
}
@Override
protected String getName(Employee item) {
return item.getNameAsString() + " <" + item.getUser().getEmailAddress() + ">";
}
/**
* Override this method for actions to be performed when an object is selected.
*
* @param pTarget ajax
* @param newSelection employee
*/
protected abstract void action(AjaxRequestTarget pTarget, Employee newSelection);
}