If want to rename the method "onNewSelection" to "action" then we probably have to do it in the DSV-component implementation.

This commit is contained in:
Tom Vahlman 2012-03-29 16:28:00 +02:00
parent bbc3e5f8e7
commit f4fff112f1
5 changed files with 13 additions and 42 deletions

@ -75,6 +75,8 @@ public abstract class AdminEditProject extends Panel {
wmc.add(level = new RadioChoice("level", new PropertyModel(model.getObject(), "projectClass"), projectClassDao.findAll()));
wmc.add(studentsPanel = new AddRemoveStudentsPanel("studentPanel", model.getObject().getProjectParticipants()) {
private static final long serialVersionUID = 8432765543881357453L;
@Override
public void onUpdate(AjaxRequestTarget target) {
//do nothing
@ -83,8 +85,10 @@ public abstract class AdminEditProject extends Panel {
//TODO: we need to set this one to the one already set in the project, how?
wmc.add(headsupervisorField = new EmployeeAutoComplete("headsupervisorField") {
private static final long serialVersionUID = 5019499805524407957L;
@Override
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
public void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
//do nothing
}
@Override
@ -96,6 +100,8 @@ public abstract class AdminEditProject extends Panel {
//we need to create any follower object that doesnt already exist with projectfollowerdao AND save project
wmc.add(followerPanel = new AddRemoveProjectFollowerPanel("followerPanel", model.getObject().getProjectFollowers(), model) {
private static final long serialVersionUID = 7192970853400087376L;
@Override
public void onUpdate(AjaxRequestTarget target) {
//do nothing
@ -127,7 +133,7 @@ public abstract class AdminEditProject extends Panel {
error("Add at least one student");
hasFailed = true;
}
if (hasFailed == true){
if (hasFailed){
System.out.println("FAIL");
}
else {

@ -232,23 +232,6 @@ public class ManualMatchPanel extends Panel {
return supervisorDao.getAutoCompleteCapableSupervisors(input, 6).iterator();
}
@Override
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
super.onNewSelection(pTarget, newSelection);
if (newSelection != null) {
if (pTarget != null) {
final String declineMessage = createDeclineMessage(newSelection, projectIdea, status);
if(declineMessage != null && !declineMessage.isEmpty()) {
saveButton.setMessageContentHTML(declineMessage);
pTarget.addComponent(saveButton);
} else {
saveButton.setMessageContentHTML(createConfirmationMessage(newSelection, status));
pTarget.addComponent(saveButton);
}
}
}
}
@Override
public void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
super.onNewSelection(pTarget, newSelection);

@ -198,7 +198,7 @@ public class ManualSetReviewerPanel extends Panel {
}
@Override
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
public void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
super.onNewSelection(pTarget, newSelection);
if (newSelection != null) {
if (pTarget != null) {
@ -218,7 +218,7 @@ public class ManualSetReviewerPanel extends Panel {
* @param reviewerName the name of the suggested reviewer
* @return String the confirmation message
*/
private String getConfirmMessage(final String projectIdeaTitle, final String reviewerName) {
private String getConfirmMessage(final String reviewerName, final String projectIdeaTitle) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Are you sure that you want to suggest ");
stringBuilder.append(reviewerName);

@ -81,18 +81,16 @@ public abstract class AddRemoveProjectFollowerPanel extends Panel {
});
wmc.add(new EmployeeAutoComplete("addnew") {
private static final long serialVersionUID = 3469224066732295829L;
@Override
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
public void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
setSelection(null);
ProjectFollower pf = new ProjectFollower();
pf.setProjectRole(ProjectTeamMemberRoles.CO_SUPERVISOR);
pf.setFollower(newSelection);
pf.setProject(projectIModel.getObject());
followerSet.add(pf);
followerListView.setList(new ArrayList(followerSet));
pTarget.addComponent(wmc);
emptyLabel.setVisible(followerSet.isEmpty());

@ -73,26 +73,10 @@ public abstract class EmployeeAutoComplete extends AutoCompleteObjectField<Emplo
return supervisorDao.getAutoCompleteCapableSupervisors(input, 6).iterator();
}
@Override
public 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
* @param newSelection
*/
public abstract void action(AjaxRequestTarget pTarget, Employee newSelection);
}