can I haz colorz

1 parent 45d90475
......@@ -39,6 +39,10 @@
<h:outputLabel for="barcode" value="#{i18n['product.barcode']}:" />
<h:inputText id="barcode" value="#{productView.product.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:selectBooleanCheckbox id="prepaid" value="#{productView.product.prepaid}" />
......
......@@ -233,8 +233,7 @@ public class PlaceMap extends HttpServlet {
private static final int BORDER_WIDTH = 2;
private static void drawPlace(Place p, Graphics2D g, User user) {
if (p.isDisabled())
{
if (p.isDisabled()) {
return;
}
Color color = null;
......@@ -244,29 +243,33 @@ public class PlaceMap extends HttpServlet {
if (p.isReservedFor(user)) {
color = SELECTED_COLOR;
} else if (user.equals(p.getCurrentUser())
|| (p.getGroup() != null && user.equals(p.getGroup().getCreator()))
|| (p.getPlaceReserver() != null && user.equals(p.getPlaceReserver().getUser()))) {
|| (p.getGroup() != null && user.equals(p.getGroup()
.getCreator()))
|| (p.getPlaceReserver() != null && user.equals(p
.getPlaceReserver().getUser()))) {
color = OWNED_COLOR;
} else if (p.isTaken()) {
color = RESERVED_COLOR;
} else if (p.getProduct().getColor() != null) {
try {
color = Color.decode(p.getProduct().getColor());
} catch(NumberFormatException x) {
logger.error("Cannot convert string {} to color.", p.getProduct().getColor());
} catch (NumberFormatException x) {
logger.error("Cannot convert string {} to color.", p
.getProduct().getColor());
}
}
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) {
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;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;
import com.sun.imageio.plugins.common.I18N;
import fi.insomnia.bortal.beans.NewsBeanLocal;
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!