X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=plugins%2Forg.argeo.slc.client.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fclient%2Fui%2Fdecorators%2FResultFailedDecorator.java;h=e6f7a96c10af34596ef36d2846867a7beff043ca;hb=58e0e18d64a2080680a9f8397b0dfa2894519910;hp=1d021e2a3ddd3be1b4e8be4cab0fc17bc1d5ca0c;hpb=e8997305e4d5fe939e2e4ec55195afdc0d488bbc;p=gpl%2Fargeo-slc.git diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java index 1d021e2a3..e6f7a96c1 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2012 Mathieu Baudier + * Copyright (C) 2007-2012 Argeo GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,17 @@ */ package org.argeo.slc.client.ui.decorators; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +import javax.jcr.Node; +import javax.jcr.RepositoryException; + +import org.argeo.slc.SlcException; import org.argeo.slc.client.ui.ClientUiPlugin; import org.argeo.slc.client.ui.model.ResultParent; +import org.argeo.slc.client.ui.model.SingleResultNode; +import org.argeo.slc.jcr.SlcNames; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.DecorationOverlayIcon; import org.eclipse.jface.viewers.IDecoration; @@ -30,8 +37,11 @@ import org.eclipse.ui.ISharedImages; public class ResultFailedDecorator extends LabelProvider implements ILabelDecorator { - private final static Log log = LogFactory - .getLog(ResultFailedDecorator.class); + // private final static Log log = LogFactory + // .getLog(ResultFailedDecorator.class); + + private final static DateFormat dateFormat = new SimpleDateFormat( + "yyyy-MM-dd HH:mm"); public ResultFailedDecorator() { super(); @@ -45,8 +55,6 @@ public class ResultFailedDecorator extends LabelProvider implements // decorates resource icon with basic decorations provided // by Eclipse if (object instanceof ResultParent) { - log.debug("decorate : " + ((ResultParent) object).getName() - + " - passed : " + ((ResultParent) object).isPassed()); if (!((ResultParent) object).isPassed()) { ImageDescriptor desc = ClientUiPlugin.getDefault() .getWorkbench().getSharedImages() @@ -62,6 +70,22 @@ public class ResultFailedDecorator extends LabelProvider implements // Method to decorate Text public String decorateText(String label, Object object) { - return null; + if (object instanceof SingleResultNode) { + SingleResultNode srNode = (SingleResultNode) object; + Node node = srNode.getNode(); + String decoration = null; + try { + if (node.hasProperty(SlcNames.SLC_COMPLETED)) + decoration = dateFormat.format(node + .getProperty(SlcNames.SLC_COMPLETED).getDate() + .getTime()); + } catch (RepositoryException re) { + throw new SlcException( + "Unexpected error defining text decoration for result", re); + } + return label + " [" + decoration + "]"; + } else + return null; } + }