package net.sourceforge.javydreamercsw.client.ui.tool;

import com.validation.manager.core.db.Requirement;
import com.validation.manager.core.tool.ImageProvider;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.openide.util.lookup.ServiceProvider;

/**
 *
 * @author Javier A. Ortiz Bultron <javier.ortiz.78@gmail.com>
 */
@ServiceProvider(service = ImageProvider.class)
public class RequirementImageProvider implements ImageProvider<Requirement> {

    private static BufferedImage green, red, orange, yellow;

    @Override
    public BufferedImage getIcon(Requirement e, int coverage) throws IOException {
        BufferedImage image;
        if (coverage == 100) {
            if (green == null) {
                green = ImageIO.read(getClass().getResource(
                        "/net/sourceforge/javydreamercsw/vm/client/hierarchy/visualizer/circle_green.png"));
            }
            image = green;
        } else if (coverage < 100 && coverage > 50) {
            if (yellow == null) {
                yellow = ImageIO.read(getClass().getResource(
                        "/net/sourceforge/javydreamercsw/vm/client/hierarchy/visualizer/circle_yellow.png"));
            }
            image = yellow;
        } else if (coverage < 50 && coverage > 25) {
            if (orange == null) {
                orange = ImageIO.read(getClass().getResource(
                        "/net/sourceforge/javydreamercsw/vm/client/hierarchy/visualizer/circle_orange.png"));
            }
            image = orange;
        } else {
            if (red == null) {
                red = ImageIO.read(getClass().getResource(
                        "/net/sourceforge/javydreamercsw/vm/client/hierarchy/visualizer/circle_red.png"));
            }
            image = red;
        }
        return image;
    }

    @Override
    public boolean supported(Object e) {
        return e instanceof Requirement;
    }
}

@@ -226,16 +226,83 @@
 ption;%0D%0A
+import java.util.logging.Level;%0D%0Aimport java.util.logging.Logger;%0D%0A
 import j
@@ -644,16 +644,134 @@
 yellow;%0D
+%0A    private static final Logger LOG%0D%0A            = Logger.getLogger(RequirementImageProvider.class.getSimpleName());%0D
 %0A%0D%0A    @
@@ -825,17 +825,19 @@
 irement 
-e
+req
 , int co
@@ -892,24 +892,164 @@
 age image;%0D%0A
+        LOG.log(Level.FINE, %22Processing coverage: %7B0%7D for Requirement: %7B1%7D%22, %0D%0A                new Object%5B%5D%7Bcoverage, req.getUniqueId()%7D);%0D%0A
         if (

Add some logging.