1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui.common.imagers;
14 import java.util.HashMap;
17 import org.simantics.browsing.ui.content.Imager;
20 * @author Antti Villberg
23 public class ContainerImager<Image> implements Imager {
25 private final Map<String, Image> constants;
27 private Image theImage;
29 public ContainerImager(Map<String, Image> constants, Image image) {
30 this.constants = constants;
31 this.theImage = image;
34 public ContainerImager(Map<String, Image> constants) {
35 this(constants, null);
38 public ContainerImager(Image image) {
39 this(new HashMap<String, Image>(), image);
42 public ContainerImager() {
43 this(new HashMap<String, Image>(), null);
47 public void setImage(String key, Image image) {
51 constants.put(key, image);
54 public void setImage(Image image) {
58 @SuppressWarnings("unchecked")
60 public Image getImage(String key) {
64 return constants.get(key);