package org.simantics.district.network.visualisations.triggers; import java.awt.Color; public class VisualisationTrigger { private String moduleName; private String attributeName; private double threshold; private Color color; public VisualisationTrigger(String moduleName, String attributeName, double threshold, String colorHex) { this.moduleName = moduleName; this.attributeName = attributeName; this.threshold = threshold; this.color = hex2Rgb(colorHex); } public String getModuleName() { return moduleName; } public String getAttributeName() { return attributeName; } public double getThreshold() { return threshold; } public Color getColor() { return color; } /** * * @param colorStr e.g. "#FFFFFF" * @return */ private static Color hex2Rgb(String colorStr) { return new Color( Integer.valueOf( colorStr.substring( 1, 3 ), 16 ), Integer.valueOf( colorStr.substring( 3, 5 ), 16 ), Integer.valueOf( colorStr.substring( 5, 7 ), 16 ) ); } }