2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalsdk.analytics.gmap.map;
22 import java.awt.Color;
23 import java.util.ArrayList;
24 import java.util.HashMap;
27 public class ColorProperties {
30 private Map<String, Object> colorProperties;
31 private ArrayList<String> nodeLegends;
32 private ArrayList<String> lineLegends;
34 public ColorProperties(NovaMap map) {
36 colorProperties = new HashMap<String, Object>();
39 public void setColor(String type, String color) {
40 //colorProperties.put(type + "_COLOR", color);
41 String[] rgb = color.split(",");
42 colorProperties.put(type + "_COLOR",
43 new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
44 Integer.parseInt(rgb[2])));
47 // public void setColor(String type, int number, String color) {
48 // Object object = colorProperties.get(type + ":" + number + "_COLOR");
50 // if (object != null) {
51 // Color oldColor = (Color) object;
53 // if (!color.equals(oldColor.getRed() + "," + oldColor.getGreen() + "," + oldColor.getBlue())) {
54 // String[] rgb = color.split(",");
55 // colorProperties.put(type + ":" + number + "_COLOR",
56 // new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
57 // Integer.parseInt(rgb[2])));
61 // String[] rgb = color.split(",");
62 // colorProperties.put(type + ":" + number + "_COLOR",
63 // new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
64 // Integer.parseInt(rgb[2])));
68 // public Color getColor(String type, int number) {
69 // return (Color) colorProperties.get(type + ":" + number + "_COLOR");
72 public Color getColor(String type) {
73 return (Color) colorProperties.get(type + "_COLOR");
76 public void setShape(String type, String shape) {
77 colorProperties.put(type + "_SHAPE", shape);
80 public void setShape(String type, int number, String shape) {
81 colorProperties.put(type + ":" + number + "_SHAPE", shape);
84 public String getShape(String type) {
85 return (String) colorProperties.get(type + "_SHAPE");
88 public String getShape(String type, int number) {
89 return (String) colorProperties.get(type + ":" + number + "_SHAPE");
92 public void setSize(String type, String size) {
93 colorProperties.put(type + "_SIZE", size);
96 public void setSize(String type, int number, String size) {
97 colorProperties.put(type + ":" + number + "_SIZE", size);
100 public int getSize(String type) {
101 Object object = colorProperties.get(type + "_SIZE");
103 if (object == null) {
107 return Integer.parseInt(object.toString());
110 public int getSize(String type, int number) {
111 Object object = colorProperties.get(type + ":" + number + "_SIZE");
113 if (object == null) {
117 return Integer.parseInt(object.toString());