checklist foundation
This commit is contained in:
parent
556a610949
commit
d026cfb9d3
src/main/java/se/su/dsv/scipro/checklists/panels
target/work/WicketMockServlet-filestore
@ -8,15 +8,33 @@
|
||||
|
||||
<wicket:panel>
|
||||
<div wicket:id="feedbackPanel"></div>
|
||||
<form wicket:id="form2">
|
||||
<div wicket:id="container">
|
||||
<div wicket:id="questions">
|
||||
<span wicket:id=questionLabel></span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<input wicket:id="question" type="text" />
|
||||
|
||||
</div>
|
||||
<input wicket:id="button2" type="submit" />
|
||||
|
||||
</form>
|
||||
<form wicket:id="form">
|
||||
<div>
|
||||
<input wicket:id="questions" type="text" />
|
||||
|
||||
<input wicket:id="title" type="text" />
|
||||
</div>
|
||||
<input wicket:id="button" type="submit"/>
|
||||
<div wicket:id="radioChoice">
|
||||
<input type="radio" />
|
||||
</div>
|
||||
|
||||
|
||||
<div></div>
|
||||
<input wicket:id="button" type="submit" />
|
||||
</form>
|
||||
<div>
|
||||
<a href="#" wicket:id="newLink">New Link</a>
|
||||
</div>
|
||||
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -1,27 +1,19 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.basic.MultiLineLabel;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.Radio;
|
||||
import org.apache.wicket.markup.html.form.RadioChoice;
|
||||
import org.apache.wicket.markup.html.form.RadioGroup;
|
||||
import org.apache.wicket.markup.html.form.RequiredTextField;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
@ -29,21 +21,10 @@ import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
import se.su.dsv.scipro.data.enums.StateOfMind;
|
||||
import se.su.dsv.scipro.knol.resource.page.StaticImage;
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author fnorbe@dsv.su.se
|
||||
@ -53,15 +34,6 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 8862892008428526067L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListAnswerDao checkListAnswerDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checkListTemplateDao;
|
||||
|
||||
@ -82,36 +54,41 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
feedbackPanel.setOutputMarkupId(true);
|
||||
add(feedbackPanel);
|
||||
Form<CheckListTemplate> form = new Form<CheckListTemplate>("form");
|
||||
Form<CheckListTemplate> form2 = new Form<CheckListTemplate>("form2");
|
||||
final TextField<String> titleField = new RequiredTextField<String>("title",
|
||||
new PropertyModel<String>(this, "title"));
|
||||
final TextField<String> questionField = new RequiredTextField<String>("questions",
|
||||
final TextField<String> questionField = new RequiredTextField<String>("question",
|
||||
new PropertyModel<String>(this, "question"));
|
||||
questionField.setOutputMarkupId(true);
|
||||
RadioChoice<ProjectClass> radioChoice = new RadioChoice<ProjectClass>("view",
|
||||
RadioChoice<ProjectClass> radioChoice = new RadioChoice<ProjectClass>("radioChoice",
|
||||
new PropertyModel<ProjectClass>(this, "projectClass"), projectClassDao.findAll());
|
||||
|
||||
IModel<List<String>> questionModel = new LoadableDetachableModel<List<String>>() {
|
||||
final IModel<List<String>> questionModel = new LoadableDetachableModel<List<String>>(){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected List<String> load() {
|
||||
// TODO Auto-generated method stub
|
||||
protected List<String> load() {
|
||||
return checkListTemplate.getQuestions();
|
||||
}
|
||||
};
|
||||
|
||||
AjaxLink<Void> printLink = new AjaxLink<Void>("addQuestionLink") {
|
||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
ListView<String> listView = new ListView<String>("questions", questionModel) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
checkListTemplate.getQuestions().add(question);
|
||||
question = "";
|
||||
target.addComponent(questionField);
|
||||
protected void populateItem(ListItem<String> item) {
|
||||
Label question = new Label("questionLabel", item.getModel().getObject());
|
||||
item.add(question);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
container.add(listView);
|
||||
|
||||
|
||||
AjaxButton button = new AjaxButton("button", new Model<String>("Save")) {
|
||||
|
||||
/**
|
||||
@ -125,20 +102,13 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
checkListTemplate.setLevel(projectClass);
|
||||
checkListTemplate.setCreator(SciProSession.get().getUser());
|
||||
checkListTemplate.setName(title);
|
||||
|
||||
checkListTemplate = checkListTemplateDao.save(checkListTemplate);
|
||||
target.addComponent(feedbackPanel);
|
||||
|
||||
}
|
||||
};
|
||||
form.add(titleField);
|
||||
form.add(radioChoice);
|
||||
form.add(button);
|
||||
form.add(questionField);
|
||||
add(form);
|
||||
|
||||
|
||||
|
||||
AjaxLink<Void> newLink = new AjaxLink<Void>("newLink") {
|
||||
|
||||
AjaxButton button2 = new AjaxButton("button2", new Model<String>("Add")) {
|
||||
|
||||
/**
|
||||
*
|
||||
@ -146,13 +116,25 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
checkListTemplate = new CheckListTemplate();
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
|
||||
checkListTemplate.getQuestions().add(new String(question));
|
||||
questionModel.detach();
|
||||
question = "";
|
||||
target.addComponent(questionField);
|
||||
target.addComponent(container);
|
||||
|
||||
}
|
||||
};
|
||||
add(printLink);
|
||||
add(newLink);
|
||||
form.add(titleField);
|
||||
form.add(radioChoice);
|
||||
form.add(button);
|
||||
form2.add(questionField);
|
||||
form2.add(container);
|
||||
form2.add(button2);
|
||||
add(form);
|
||||
add(form2);
|
||||
//add(addQuestionLink);
|
||||
|
||||
};
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user