can I haz colorz

1 parent 45d90475
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
<h:inputText id="barcode" value="#{productView.product.barcode}" /> <h:inputText id="barcode" value="#{productView.product.barcode}" />
<h:message for="barcode" /> <h:message for="barcode" />
<h:outputLabel for="color" value="#{i18n['product.color']}:" />
<h:inputText id="color" value="#{productView.product.color}" />
<h:message for="color" />
<h:outputLabel for="prepaid" value="#{i18n['product.prepaid']}" /> <h:outputLabel for="prepaid" value="#{i18n['product.prepaid']}" />
<h:selectBooleanCheckbox id="prepaid" value="#{productView.product.prepaid}" /> <h:selectBooleanCheckbox id="prepaid" value="#{productView.product.prepaid}" />
<h:message for="prepaid" /> <h:message for="prepaid" />
......
...@@ -233,8 +233,7 @@ public class PlaceMap extends HttpServlet { ...@@ -233,8 +233,7 @@ public class PlaceMap extends HttpServlet {
private static final int BORDER_WIDTH = 2; private static final int BORDER_WIDTH = 2;
private static void drawPlace(Place p, Graphics2D g, User user) { private static void drawPlace(Place p, Graphics2D g, User user) {
if (p.isDisabled()) if (p.isDisabled()) {
{
return; return;
} }
Color color = null; Color color = null;
...@@ -244,29 +243,33 @@ public class PlaceMap extends HttpServlet { ...@@ -244,29 +243,33 @@ public class PlaceMap extends HttpServlet {
if (p.isReservedFor(user)) { if (p.isReservedFor(user)) {
color = SELECTED_COLOR; color = SELECTED_COLOR;
} else if (user.equals(p.getCurrentUser()) } else if (user.equals(p.getCurrentUser())
|| (p.getGroup() != null && user.equals(p.getGroup().getCreator())) || (p.getGroup() != null && user.equals(p.getGroup()
|| (p.getPlaceReserver() != null && user.equals(p.getPlaceReserver().getUser()))) { .getCreator()))
|| (p.getPlaceReserver() != null && user.equals(p
.getPlaceReserver().getUser()))) {
color = OWNED_COLOR; color = OWNED_COLOR;
} else if (p.isTaken()) { } else if (p.isTaken()) {
color = RESERVED_COLOR; color = RESERVED_COLOR;
} else if (p.getProduct().getColor() != null) { } else if (p.getProduct().getColor() != null) {
try { try {
color = Color.decode(p.getProduct().getColor()); color = Color.decode(p.getProduct().getColor());
} catch(NumberFormatException x) { } catch (NumberFormatException x) {
logger.error("Cannot convert string {} to color.", p.getProduct().getColor()); logger.error("Cannot convert string {} to color.", p
.getProduct().getColor());
} }
} }
g.setColor(BORDER_COLOR); g.setColor(BORDER_COLOR);
g.draw(new Rectangle(p.getMapX(), p.getMapY(), p.getWidth(), p.getHeight())); g.draw(new Rectangle(p.getMapX(), p.getMapY(), p.getWidth(), p
.getHeight()));
if (color != null) { if (color != null) {
g.setColor(color); g.setColor(color);
g.fill(new Rectangle(p.getMapX() + BORDER_WIDTH, p.getMapY() + BORDER_WIDTH, p.getWidth() - BORDER_WIDTH, p.getHeight() - BORDER_WIDTH)); g.fill(new Rectangle(p.getMapX() + BORDER_WIDTH, p.getMapY()
+ BORDER_WIDTH, p.getWidth() - BORDER_WIDTH, p.getHeight()
- BORDER_WIDTH));
} }
} }
} }
...@@ -4,7 +4,7 @@ import javax.ejb.EJB; ...@@ -4,7 +4,7 @@ import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.inject.Named; import javax.inject.Named;
import com.sun.imageio.plugins.common.I18N;
import fi.insomnia.bortal.beans.NewsBeanLocal; import fi.insomnia.bortal.beans.NewsBeanLocal;
import fi.insomnia.bortal.enums.apps.ContentPermission; import fi.insomnia.bortal.enums.apps.ContentPermission;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!