]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/image/DefaultImages.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / image / DefaultImages.java
diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/image/DefaultImages.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/image/DefaultImages.java
new file mode 100644 (file)
index 0000000..963735c
--- /dev/null
@@ -0,0 +1,58 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+/*\r
+ *\r
+ * @author Toni Kalajainen\r
+ */\r
+package org.simantics.g2d.image;\r
+\r
+import org.simantics.utils.datastructures.cache.IFactory;\r
+\r
+\r
+/**\r
+ * This class contains some built-in images.\r
+ * \r
+ * Usage example.\r
+ * \r
+ *  Image x = DefaultImages.UNKNOWN.get();\r
+ *  x.paint();\r
+ *  ...\r
+ *  x = null;\r
+ *\r
+ * @author Toni Kalajainen <toni.kalajainen@vtt.fi>\r
+ */\r
+public class DefaultImages {   \r
+       \r
+       public static final IFactory<Image> UNKNOWN2 = get("unknown.png");\r
+       public static final IFactory<Image> SVG = get("svg.png");\r
+    public static final IFactory<Image> ERROR_DECORATOR = get("error.svg");\r
+    public static final IFactory<Image> WARNING_DECORATOR = get("warningDecorator.png");\r
+       public static final IFactory<Image> COMPOSITION = get("composition.png");\r
+       public static final IFactory<Image> UNKNOWN = get("unknownDocument.svg");\r
+       public static final IFactory<Image> WHEEL =  get("wheel2.svg"); \r
+       public static final IFactory<Image> GRAB = get("grab.png");\r
+       public static final IFactory<Image> GRAB32 = get("grab32.png");\r
+       public static final IFactory<Image> HAND = get("hand.png");\r
+       public static final IFactory<Image> HAND32 = get("hand32.png");\r
+       public static final IFactory<Image> HOURGLASS = get("hourglass.svg");\r
+\r
+       private static IFactory<Image> get(String filename) {\r
+               return \r
+                       ProviderUtils.reference(\r
+                       ProviderUtils.cache(\r
+                       ProviderUtils.rasterize(\r
+                       ProviderUtils.at(\r
+                               DefaultImages.class.getResource(filename)\r
+                       ))));           \r
+       }\r
+       \r
+}\r