]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/image/DefaultImages.java
G2DParentNode handles "undefined" child bounds separately
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / image / DefaultImages.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 /*
13  *
14  * @author Toni Kalajainen
15  */
16 package org.simantics.g2d.image;
17
18 import org.simantics.utils.datastructures.cache.IFactory;
19
20
21 /**
22  * This class contains some built-in images.
23  * 
24  * Usage example.
25  * 
26  *  Image x = DefaultImages.UNKNOWN.get();
27  *  x.paint();
28  *  ...
29  *  x = null;
30  *
31  * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
32  */
33 public class DefaultImages {    
34         
35         public static final IFactory<Image> UNKNOWN2 = get("unknown.png");
36         public static final IFactory<Image> SVG = get("svg.png");
37     public static final IFactory<Image> ERROR_DECORATOR = get("error.svg");
38     public static final IFactory<Image> WARNING_DECORATOR = get("warningDecorator.png");
39         public static final IFactory<Image> COMPOSITION = get("composition.png");
40         public static final IFactory<Image> UNKNOWN = get("unknownDocument.svg");
41         public static final IFactory<Image> WHEEL =  get("wheel2.svg"); 
42         public static final IFactory<Image> GRAB = get("grab.png");
43         public static final IFactory<Image> GRAB32 = get("grab32.png");
44         public static final IFactory<Image> HAND = get("hand.png");
45         public static final IFactory<Image> HAND32 = get("hand32.png");
46         public static final IFactory<Image> HOURGLASS = get("hourglass.svg");
47
48         private static IFactory<Image> get(String filename) {
49                 return 
50                         ProviderUtils.reference(
51                         ProviderUtils.cache(
52                         ProviderUtils.rasterize(
53                         ProviderUtils.at(
54                                 DefaultImages.class.getResource(filename)
55                         ))));           
56         }
57         
58 }