removed unnecessary null checks
This commit is contained in:
parent
f4ae72c27d
commit
27d402bd1e
src/main/java/se/su/dsv/scipro
admin/panels
components
reusable
@ -1,7 +1,6 @@
|
||||
package se.su.dsv.scipro.admin.panels;
|
||||
|
||||
|
||||
import java.util.Iterator;
|
||||
import com.visural.wicket.component.confirmer.ConfirmerAjaxSubmitLink;
|
||||
import org.apache.wicket.Component;
|
||||
import org.apache.wicket.Session;
|
||||
@ -13,11 +12,9 @@ import org.apache.wicket.markup.html.panel.Fragment;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.admin.pages.match.AdminManageProjectIdeaPage;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.facade.ProjectIdeaFacade;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.SupervisorDao;
|
||||
@ -200,8 +197,9 @@ public class ManualMatchPanel extends Panel {
|
||||
private static final long serialVersionUID = 7734889540424308421L;
|
||||
@Override
|
||||
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
|
||||
if (newSelection != null) {
|
||||
if (pTarget != null) {
|
||||
// these checks have already been performed when action is called
|
||||
// if (newSelection != null) {
|
||||
// if (pTarget != null) {
|
||||
final String declineMessage = createDeclineMessage(newSelection, projectIdea, status);
|
||||
if(declineMessage != null && !declineMessage.isEmpty()) {
|
||||
saveButton.setMessageContentHTML(declineMessage);
|
||||
@ -210,8 +208,8 @@ public class ManualMatchPanel extends Panel {
|
||||
saveButton.setMessageContentHTML(createConfirmationMessage(newSelection, status));
|
||||
pTarget.addComponent(saveButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ import se.su.dsv.scipro.match.dao.interfaces.SupervisorDao;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
import se.su.dsv.scipro.reusable.EmployeeAutoComplete;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ManualSetReviewerPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -167,12 +165,13 @@ public class ManualSetReviewerPanel extends Panel {
|
||||
|
||||
@Override
|
||||
public void action(AjaxRequestTarget pTarget, Employee newSelection) {
|
||||
if (newSelection != null) {
|
||||
if (pTarget != null) {
|
||||
// these checks have already been performed when action is called
|
||||
// if (newSelection != null) {
|
||||
// if (pTarget != null) {
|
||||
saveButton.setMessageContentHTML(getConfirmMessage(newSelection.getNameAsString(), projectIdea.getTitle()));
|
||||
pTarget.addComponent(saveButton);
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
package se.su.dsv.scipro.components;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
@ -12,14 +8,17 @@ import org.apache.wicket.markup.html.form.upload.FileUploadField;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
||||
import se.su.dsv.scipro.exceptions.InvalidFileFormatException;
|
||||
import se.su.dsv.scipro.repository.components.FileListSelect;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Reusable upload component, supports straight uploads as well as linking of already existing resources.
|
||||
* The former is handled by implementing onNewUpload(), the latter is handled by implementing getSelectionElements() and onNewSelection().
|
||||
* The former is handled by implementing onNewUpload(), the latter is handled by implementing getSelectionElements() and beforeOnNewSelectionChecker().
|
||||
* This API is quite new and still subject to frequent change.
|
||||
*/
|
||||
public abstract class AbstractUploadForm extends Form<Void> {
|
||||
@ -82,7 +81,7 @@ public abstract class AbstractUploadForm extends Form<Void> {
|
||||
}
|
||||
/**
|
||||
* Protected getter to allow subclass operations.
|
||||
* Returns null if no description has been selected, consider using the handler override "onNewSelection" instead.
|
||||
* Returns null if no description has been selected, consider using the handler override "beforeOnNewSelectionChecker" instead.
|
||||
* @return
|
||||
*/
|
||||
protected FileDescription getSubmittedFileDescription(){
|
||||
@ -151,7 +150,7 @@ public abstract class AbstractUploadForm extends Form<Void> {
|
||||
/**
|
||||
* Implement this method in case you want something special to happen once the upload/selection has been processed.
|
||||
* A prime example is to redirect the user to another page, etc.
|
||||
* Note: this method is only called if no Checked Exceptions are thrown by onNewSelection or onNewUpload
|
||||
* Note: this method is only called if no Checked Exceptions are thrown by beforeOnNewSelectionChecker or onNewUpload
|
||||
*/
|
||||
protected void onFinished(){
|
||||
;
|
||||
|
@ -72,8 +72,7 @@ public abstract class AuthorAutoComplete extends AutoCompleteObjectField<Student
|
||||
return authorDao.getAutoCompleteAuthors(input, 6).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewSelection(AjaxRequestTarget pTarget, Student newSelection) {
|
||||
protected void beforeOnNewSelectionChecker(AjaxRequestTarget pTarget, Student newSelection) {
|
||||
super.onNewSelection(pTarget, newSelection);
|
||||
if (newSelection != null) {
|
||||
if (pTarget != null) {
|
||||
|
@ -70,8 +70,7 @@ public abstract class EmployeeAutoComplete extends AutoCompleteObjectField<Emplo
|
||||
return supervisorDao.getAutoCompleteCapableSupervisors(input, 6).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewSelection(AjaxRequestTarget pTarget, Employee newSelection) {
|
||||
protected void beforeOnNewSelectionChecker(AjaxRequestTarget pTarget, Employee newSelection) {
|
||||
super.onNewSelection(pTarget, newSelection);
|
||||
if (newSelection != null) {
|
||||
if (pTarget != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user