changed trafficlightpanel to not use stateofmind

This commit is contained in:
Fredrik Norberg 2011-07-28 15:53:56 +02:00
parent 43c2e13dc3
commit 44c9b82b5a
6 changed files with 68 additions and 33 deletions
src/main
java/se/su/dsv/scipro
webapp/WEB-INF

@ -19,7 +19,7 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
* *
*/ */
@Authorization(authorizedRoles={Roles.SYSADMIN}) @Authorization(authorizedRoles={Roles.SYSADMIN, Roles.ADMIN})
public class AdminProjectPartnerPage extends AbstractAdminPage { public class AdminProjectPartnerPage extends AbstractAdminPage {
@SpringBean @SpringBean

@ -6,16 +6,41 @@
</head> </head>
<body> <body>
<wicket:panel> <wicket:panel>
<div wicket:id="stateOfMindContainer"> <div wicket:id="trafficLightContainer">
<form wicket:id="form"> <div wicket:id="group">
<table wicket:id="group"> <div wicket:id="lights">
<tr wicket:id="persons"> <table >
<tr >
<td><input type="radio" wicket:id="radio" /></td> <td><input type="radio" wicket:id="radio" /></td>
<td> <img wicket:id="image"/></td> <td><img wicket:id="image"/></td>
</tr> </tr>
</table> <tr>
</form>
</div> </tr>
</table>
</div>
</div>
</div>
</wicket:panel> </wicket:panel>
</body> </body>
</html> </html>
<!--
<!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>
<wicket:panel>
<div wicket:id="trafficLightContainer">
<table wicket:id="group">
<tr wicket:id="lights">
<td><input type="radio" wicket:id="radio" /></td>
<td> <img wicket:id="image"/></td>
</tr>
</table>
</div>
</wicket:panel>
</body>
</html> -->

@ -1,5 +1,8 @@
package se.su.dsv.scipro.checklists.panels; package se.su.dsv.scipro.checklists.panels;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.AttributeModifier; import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.AjaxRequestTarget;
@ -32,46 +35,53 @@ import edu.emory.mathcs.backport.java.util.Arrays;
*/ */
public class TrafficLightPanel extends Panel { public class TrafficLightPanel extends Panel {
private List<TrafficLight> lights;
enum TrafficLight{
GREEN, YELLOW, RED, NOT
}
private static final long serialVersionUID = 8862892008428526067L; private static final long serialVersionUID = 8862892008428526067L;
public TrafficLightPanel(String id, WebPage parent) { public TrafficLightPanel(String id, WebPage parent) {
super(id); super(id);
WebMarkupContainer stateOfMindContainer = new WebMarkupContainer( WebMarkupContainer trafficLightContainer = new WebMarkupContainer(
"stateOfMindContainer"); "trafficLightContainer");
add(stateOfMindContainer); add(trafficLightContainer);
lights = new ArrayList<TrafficLight>();
lights.add(TrafficLight.GREEN);lights.add(TrafficLight.YELLOW);lights.add(TrafficLight.RED);lights.add(TrafficLight.NOT);
RadioGroup<TrafficLight> group = new RadioGroup<TrafficLight>("group");
trafficLightContainer.add(group);
Form<StateOfMind> f = new Form<StateOfMind>("form"); ListView<TrafficLight> lightList = new ListView<TrafficLight>("lights", lights) {
stateOfMindContainer.add(f);
RadioGroup<StateOfMind> group = new RadioGroup<StateOfMind>("group"); private static final long serialVersionUID = 1L;
f.add(group);
ListView<StateOfMind> persons = new ListView<StateOfMind>("persons", protected void populateItem(ListItem<TrafficLight> item) {
Arrays.asList(StateOfMind.values())) { TrafficLight trafficLight = item.getModelObject();
protected void populateItem(ListItem<StateOfMind> item) { item.add(new Radio<TrafficLight>("radio", item.getModel()));
StateOfMind stateOfMind = item.getModelObject();
item.add(new Radio<StateOfMind>("radio", item.getModel()));
StaticImage image = null; StaticImage image = null;
if (stateOfMind.equals(StateOfMind.FINE)) { if (trafficLight.equals(TrafficLight.GREEN)) {
image = new StaticImage("image", new Model<String>( image = new StaticImage("image", new Model<String>(
"images/icons/green_ball_32.png")); "images/icons/green_ball_32.png"));
} else if (stateOfMind.equals(StateOfMind.NEEDHELP)) { } else if (trafficLight.equals(TrafficLight.YELLOW)) {
image = new StaticImage("image", new Model<String>( image = new StaticImage("image", new Model<String>(
"images/icons/red_ball_32.png")); "images/icons/red_ball_32.png"));
} else if (stateOfMind.equals(StateOfMind.NEUTRAL)) { } else if (trafficLight.equals(TrafficLight.RED)) {
image = new StaticImage("image", new Model<String>( image = new StaticImage("image", new Model<String>(
"images/icons/yellow_ball_32.png")); "images/icons/yellow_ball_32.png"));
} }
else if (stateOfMind.equals(StateOfMind.NOTAPLICABLE)) { else if (trafficLight.equals(TrafficLight.NOT)) {
image = new StaticImage("image", new Model<String>( image = new StaticImage("image", new Model<String>(
"images/icons/grey_ball_32.png")); "images/icons/grey_ball_32.png"));
} }
item.add(image); item.add(image);
}; };
}; };
group.add(persons); group.add(lightList);
} }
} }

@ -10,8 +10,7 @@ package se.su.dsv.scipro.data.enums;
public enum StateOfMind { public enum StateOfMind {
NEEDHELP(0, "Need Help", "You think you need help to proceed or you are unsure of what to do next.", "som-needhelp"), NEEDHELP(0, "Need Help", "You think you need help to proceed or you are unsure of what to do next.", "som-needhelp"),
NEUTRAL(1, "Neutral", "This is the default option and signals that you don't have a clear standpoint on your status but no imminent help is needed.", "som-neutral"), NEUTRAL(1, "Neutral", "This is the default option and signals that you don't have a clear standpoint on your status but no imminent help is needed.", "som-neutral"),
FINE(2, "Everything is fine", "This means your work proceeds as planned and that no issues regarding the continuation are on the horizon.", "som-fine"), FINE(2, "Everything is fine", "This means your work proceeds as planned and that no issues regarding the continuation are on the horizon.", "som-fine");
NOTAPLICABLE(3, "moo", "moo","som-moo");
private int value; private int value;
private String status; private String status;

@ -27,6 +27,7 @@ public abstract class ProjectPage extends MenuPage implements FilePanelContainer
public ProjectPage(PageParameters pp) { public ProjectPage(PageParameters pp) {
Project activeProject = SciProSession.get().getActiveProject(); Project activeProject = SciProSession.get().getActiveProject();
User u = SciProSession.get().getUser();
if(activeProject == null && (this.getClass() != NoActiveProjectPage.class && this.getClass() != ProjectPartnerPage.class)){ if(activeProject == null && (this.getClass() != NoActiveProjectPage.class && this.getClass() != ProjectPartnerPage.class)){
User user = SciProSession.get().getUser(); User user = SciProSession.get().getUser();

@ -64,8 +64,8 @@
<!-- Use deployment for production, development for development --> <!-- Use deployment for production, development for development -->
<context-param> <context-param>
<param-name>configuration</param-name> <param-name>configuration</param-name>
<!-- <param-value>development</param-value> --> <param-value>development</param-value>
<param-value>deployment</param-value> <!-- <param-value>deployment</param-value>-->
</context-param> </context-param>