package main.java.model;

import main.java.framework.api.components.ClassComponent;
import org.abego.treelayout.NodeExtentProvider;

/**
 * ToDo: create javadoc
 *
 * @author Klara Erlebachova
 */
public class ClassExtentProvider implements NodeExtentProvider<ClassComponent> {

    private String widthMetric;
    private String heightMetric;

    public ClassExtentProvider(String widthMetric, String heightMetric) {
        this.widthMetric = widthMetric;
        this.heightMetric = heightMetric;
    }

    @Override
    public double getWidth(ClassComponent classComponent) {
        return classComponent.getMeasures().get(this.widthMetric);
    }

    @Override
    public double getHeight(ClassComponent classComponent) {
        return classComponent.getMeasures().get(this.heightMetric);
    }
}

@@ -124,16 +124,73 @@
 rovider;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0A/**%0A *
@@ -395,16 +395,119 @@
 etric;%0A%0A
+    /** The logger object */%0A    private final Logger log = LoggerFactory.getLogger(this.getClass());%0A%0A
     publ
@@ -747,148 +747,596 @@
     
-return classComponent.getMeasures().get(this.widthMetric);%0A    %7D%0A%0A    @Override%0A    public double getHeight(ClassComponent classComponent) %7B
+if (!classComponent.getMeasures().containsKey(this.widthMetric)) %7B%0A            this.log.warn(%22ClassComponent %22 + classComponent.getFileKey() + %22 does not have measurement for metric %22 + this.widthMetric);%0A        %7D%0A        return classComponent.getMeasures().get(this.widthMetric);%0A    %7D%0A%0A    @Override%0A    public double getHeight(ClassComponent classComponent) %7B%0A        if (!classComponent.getMeasures().containsKey(this.heightMetric)) %7B%0A            this.log.warn(%22ClassComponent %22 + classComponent.getFileKey() + %22 does not have measurement for metric %22 + this.heightMetric);%0A        %7D
 %0A   

verify that requeried measurement is avaliable