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 {
@SpringBean

@ -6,16 +6,41 @@
</head>
<body>
<wicket:panel>
<div wicket:id="stateOfMindContainer">
<form wicket:id="form">
<table wicket:id="group">
<tr wicket:id="persons">
<div wicket:id="trafficLightContainer">
<div wicket:id="group">
<div wicket:id="lights">
<table >
<tr >
<td><input type="radio" wicket:id="radio" /></td>
<td> <img wicket:id="image"/></td>
</tr>
</table>
</form>
</div>
<td><img wicket:id="image"/></td>
</tr>
<tr>
</tr>
</table>
</div>
</div>
</div>
</wicket:panel>
</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;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
@ -32,46 +35,53 @@ import edu.emory.mathcs.backport.java.util.Arrays;
*/
public class TrafficLightPanel extends Panel {
private List<TrafficLight> lights;
enum TrafficLight{
GREEN, YELLOW, RED, NOT
}
private static final long serialVersionUID = 8862892008428526067L;
public TrafficLightPanel(String id, WebPage parent) {
super(id);
WebMarkupContainer stateOfMindContainer = new WebMarkupContainer(
"stateOfMindContainer");
add(stateOfMindContainer);
WebMarkupContainer trafficLightContainer = new WebMarkupContainer(
"trafficLightContainer");
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");
stateOfMindContainer.add(f);
RadioGroup<StateOfMind> group = new RadioGroup<StateOfMind>("group");
f.add(group);
ListView<TrafficLight> lightList = new ListView<TrafficLight>("lights", lights) {
private static final long serialVersionUID = 1L;
ListView<StateOfMind> persons = new ListView<StateOfMind>("persons",
Arrays.asList(StateOfMind.values())) {
protected void populateItem(ListItem<StateOfMind> item) {
StateOfMind stateOfMind = item.getModelObject();
item.add(new Radio<StateOfMind>("radio", item.getModel()));
protected void populateItem(ListItem<TrafficLight> item) {
TrafficLight trafficLight = item.getModelObject();
item.add(new Radio<TrafficLight>("radio", item.getModel()));
StaticImage image = null;
if (stateOfMind.equals(StateOfMind.FINE)) {
if (trafficLight.equals(TrafficLight.GREEN)) {
image = new StaticImage("image", new Model<String>(
"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>(
"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>(
"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>(
"images/icons/grey_ball_32.png"));
}
item.add(image);
};
};
group.add(persons);
group.add(lightList);
}
}

@ -10,8 +10,7 @@ package se.su.dsv.scipro.data.enums;
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"),
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"),
NOTAPLICABLE(3, "moo", "moo","som-moo");
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");
private int value;
private String status;

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

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