Fixed parts of the new ProjectIdeaActionPanel that were not working.

This commit is contained in:
anto-gom 2012-03-02 11:42:18 +01:00
parent f3148f7abc
commit 6c4eb10b2b
3 changed files with 14 additions and 7 deletions

@ -5,11 +5,11 @@
<wicket:panel> <wicket:panel>
<div wicket:id="main"></div> <div wicket:id="main"></div>
<wicket:fragment wicket:id="buttonFragment"> <wicket:fragment wicket:id="buttonFragment">
<button wicket:id="manualMatchButton">Match manually</button> <button wicket:id="manualSetReviewerButton">Suggest reviewer</button>
</wicket:fragment> </wicket:fragment>
<wicket:fragment wicket:id="matchFragment"> <wicket:fragment wicket:id="reviewerFragment">
<form wicket:id="matchForm"> <form wicket:id="reviewerForm">
Supervisor: <div wicket:id="supervisorTextField"></div> Supervisor: <div wicket:id="reviewerTextField"></div>
<button type="submit" style="float: right;">Save</button> <button type="submit" style="float: right;">Save</button>
<button wicket:id="cancelButton" style="float: right;">Cancel</button> <button wicket:id="cancelButton" style="float: right;">Cancel</button>
</form> </form>

@ -31,7 +31,7 @@ public class AdminEditProjectIdeaPanel extends Panel {
if (match != null) { if (match != null) {
watsonPanel = new ManualWatsonPanel("mainPanel", model); watsonPanel = new ManualWatsonPanel("mainPanel", model);
actionPanel = new ProjectIdeaActionPanel("mainPanel", new PropertyModel<Match>(model, "match")); actionPanel = new ProjectIdeaActionPanel("mainPanel", model);
currentPanel = watsonPanel; currentPanel = watsonPanel;
currentPanel.setOutputMarkupId(true); currentPanel.setOutputMarkupId(true);
watsonPanel.setOutputMarkupId(true); watsonPanel.setOutputMarkupId(true);

@ -5,13 +5,17 @@ import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel; import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model; import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean; import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.SciProSession; import se.su.dsv.scipro.SciProSession;
import se.su.dsv.scipro.admin.panels.ManualMatchPanel; import se.su.dsv.scipro.admin.panels.ManualMatchPanel;
import se.su.dsv.scipro.admin.panels.ManualSetReviewerPanel;
import se.su.dsv.scipro.match.dao.interfaces.MatchDao; import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
import se.su.dsv.scipro.match.dao.interfaces.ProjectIdeaDao;
import se.su.dsv.scipro.match.dataobject.Match; import se.su.dsv.scipro.match.dataobject.Match;
import se.su.dsv.scipro.match.dataobject.Match.Status; import se.su.dsv.scipro.match.dataobject.Match.Status;
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
public class ProjectIdeaActionPanel extends Panel { public class ProjectIdeaActionPanel extends Panel {
@ -20,13 +24,16 @@ public class ProjectIdeaActionPanel extends Panel {
@SpringBean @SpringBean
private MatchDao matchDao; private MatchDao matchDao;
private ManualMatchPanel manualMatchPanel; private ManualMatchPanel manualMatchPanel;
private ManualSetReviewerPanel manualSetReviewerPanel;
public ProjectIdeaActionPanel(String id, final IModel<Match> matchModel) { public ProjectIdeaActionPanel(String id, final IModel<ProjectIdea> projectIdeaModel) {
super(id); super(id);
final IModel<Match> matchModel = new PropertyModel<Match>(projectIdeaModel, "match");
add(new ProjectIdeaRemoveAuthorPanel("removeAuthorPanel", new Model(matchModel.getObject().getProjectIdea())).setVisible(matchModel.getObject().getProjectIdea().getAuthors().size()>1)); add(new ProjectIdeaRemoveAuthorPanel("removeAuthorPanel", new Model(matchModel.getObject().getProjectIdea())).setVisible(matchModel.getObject().getProjectIdea().getAuthors().size()>1));
Form<Match> form = new Form<Match>("form", matchModel); Form<Match> form = new Form<Match>("form", matchModel);
form.add(manualMatchPanel = new ManualMatchPanel("manualMatchPanel", matchModel)); form.add(manualMatchPanel = new ManualMatchPanel("manualMatchPanel", matchModel));
form.add(manualSetReviewerPanel = new ManualSetReviewerPanel("manualSetReviewerPanel", projectIdeaModel));
form.add(new Button("sendBackButton") { form.add(new Button("sendBackButton") {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;