Fix för panel
git-svn-id: svn://svn.dsv.su.se/scipro/scipro/trunk@271 73ecded7-942e-4092-bab0-0e58ef0ee984
This commit is contained in:
parent
1c81638ceb
commit
7d40135d3f
src/main/java/se/su/dsv/scipro/project/panels
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<div wicket:id="stateOfMindPanel"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,24 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.project.panels;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.basepages.PublicPage;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
*
|
||||
*/
|
||||
public class StateOfMindPage extends PublicPage{
|
||||
|
||||
|
||||
public StateOfMindPage(final PageParameters pp) {
|
||||
super(pp);
|
||||
StateOfMindPanel stateOfMindPanel = new StateOfMindPanel("stateOfMindPanel", this);
|
||||
stateOfMindPanel.setOutputMarkupId(true);
|
||||
add(stateOfMindPanel);
|
||||
}
|
||||
|
||||
}
|
@ -3,20 +3,16 @@
|
||||
*/
|
||||
package se.su.dsv.scipro.project.panels;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.core.DefaultJsScopeUiEvent;
|
||||
import org.odlabs.wiquery.ui.slider.AjaxSlider;
|
||||
import org.odlabs.wiquery.ui.slider.AjaxSlider.ISliderAjaxEvent;
|
||||
import org.odlabs.wiquery.ui.slider.Slider;
|
||||
import org.odlabs.wiquery.ui.slider.Slider.Orientation;
|
||||
|
||||
import se.su.dsv.scipro.basepages.PublicPage;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.enums.StateOfMind;
|
||||
@ -35,9 +31,8 @@ public class StateOfMindPanel extends Panel {
|
||||
private ProjectDao projectDao;
|
||||
private Label sliderLabel;
|
||||
private String sliderValue;
|
||||
private final static int NEEDHELPINT = 0, NEUTRALINT = 1, FANTASTICINT = 2;
|
||||
|
||||
public StateOfMindPanel(String id) {
|
||||
public StateOfMindPanel(String id, WebPage parent) {
|
||||
super(id);
|
||||
final Project project = projectDao.load(1L);
|
||||
StateOfMind stateOfMind = project.getStateOfMind();
|
||||
@ -52,13 +47,13 @@ public class StateOfMindPanel extends Panel {
|
||||
// We get the slider value
|
||||
int value = Integer.parseInt(this.getComponent().getRequest()
|
||||
.getParameter("sliderIntValue"));
|
||||
if (value == NEEDHELPINT) {
|
||||
if (value == StateOfMind.NEEDHELP.getValue()) {
|
||||
sliderValue = "Need Help";
|
||||
project.setStateOfMind(StateOfMind.NEEDHELP);
|
||||
} else if (value == NEUTRALINT) {
|
||||
} else if (value == StateOfMind.NEUTRAL.getValue()) {
|
||||
sliderValue = "Neutral";
|
||||
project.setStateOfMind(StateOfMind.NEUTRAL);
|
||||
} else if (value == FANTASTICINT) {
|
||||
} else if (value == StateOfMind.FANTASTIC.getValue()) {
|
||||
sliderValue = "Fantastic";
|
||||
project.setStateOfMind(StateOfMind.FANTASTIC);
|
||||
}
|
||||
@ -66,20 +61,20 @@ public class StateOfMindPanel extends Panel {
|
||||
target.addComponent(sliderLabel);
|
||||
}
|
||||
};
|
||||
add(sliderBehavior);
|
||||
parent.add(sliderBehavior);
|
||||
|
||||
|
||||
switch (stateOfMind) {
|
||||
case NEEDHELP:
|
||||
slider.setValue(NEEDHELPINT);
|
||||
slider.setValue(StateOfMind.NEEDHELP.getValue());
|
||||
sliderValue = "Need Help";
|
||||
break;
|
||||
case NEUTRAL:
|
||||
slider.setValue(NEUTRALINT);
|
||||
slider.setValue(StateOfMind.NEUTRAL.getValue());
|
||||
sliderValue = "Neutral";
|
||||
break;
|
||||
case FANTASTIC:
|
||||
slider.setValue(FANTASTICINT);
|
||||
slider.setValue(StateOfMind.FANTASTIC.getValue());
|
||||
sliderValue = "Fantastic";
|
||||
break;
|
||||
|
||||
@ -98,4 +93,6 @@ public class StateOfMindPanel extends Panel {
|
||||
sliderLabel.setOutputMarkupPlaceholderTag(true);
|
||||
add(sliderLabel);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user