changed the profile panel to the new one in the admin manage supervisor gui

This commit is contained in:
Fredrik Friis 2012-02-27 15:42:40 +09:00
parent 45f487f790
commit 55d52cbce0

@ -1,5 +1,7 @@
package se.su.dsv.scipro.user.panels;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.odlabs.wiquery.ui.dialog.Dialog;
import org.springframework.beans.factory.annotation.Autowired;
@ -8,6 +10,7 @@ import org.springframework.stereotype.Service;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.match.dao.interfaces.SupervisorDao;
import se.su.dsv.scipro.supervisor.panels.ProfilePanel;
/**
* Factory intended to ease the creation of user-profile editing panels.
@ -19,19 +22,19 @@ public class UserProfilePanelFactory {
/**
* Creates and returns a suitable user-edit panel depending on what role the supplied user has.
*/
public UserProfilePanel createUserProfilePanelForUser(final String componentId, final User u){
public Panel createUserProfilePanelForUser(final String componentId, final User u){
if(u == null)
throw new IllegalArgumentException("Creating a profile editing panel is not allowed for a null user");
final Employee s = supervisorDao.getFrom(u);
if(s != null)
return new EmployeeProfilePanel(componentId,new Model<Employee>(s));
return new ProfilePanel(componentId,new Model<Employee>(s));
else
return new UserProfilePanel(componentId,new Model<User>(u));
return new EmptyPanel(componentId);
}
/**
* Overloaded version of the above, automatically sets "correct" dimensions for a supplied Dialog.
*/
public UserProfilePanel createUserProfilePanelForUser(final String componentId, final User u, final Dialog dialog){
public Panel createUserProfilePanelForUser(final String componentId, final User u, final Dialog dialog){
if(userIsEmployee(u)){
dialog.setHeight(650);
dialog.setWidth(700);