source: java/main/src/main/java/com/framsticks/gui/ImageProvider.java @ 90

Last change on this file since 90 was 90, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

CHANGELOG:
Make ProcedureParam? hold only ValueParams?.

Use id instead of names when naming gui components internally.

Basic procedure calling in GUI.

The actual procedure call is currently only backed
by the ObjectInstance?.

Add UnimplementedException?.

Improve naming of various gui elements.

Allow easy navigating in FEST Swing testing.

Add optional explicit order attribute to FramsClassAnnotation?.

That's because java reflection does return declared members
in any specific order. That ordering is needed only for
classes that have no representation in framsticks and need
a deterministic ordering of params.

Add ControlOwner? interface.

Add test for procedure calling in Browser.

First version of ParamAnnotation? for procedures.

Development of ProcedureParam?.

Add draft version of ProcedureParam? implementation in ReflectionAccess?.

Allow viewing FramsClasses? in gui Browser.

Extract ResourceBuilder? from ModelBuilder?.

Remove internalId from Param.

It was currently completely not utilised. Whether it is still needed
after introduction of ParamAnnotation? is arguable.

Add remaining param attributes to ParamAnnotation?.

Change AutoBuilder? semantics.

AutoBuilder? returns list of objects that are to be appended
with methods @AutoAppendAnnotation?.

This allows to omit explicit addition of ModelPackage? to instance
if the instance uses ModelBuilder? (registration of ModelPackage? comes
from schema).

Fix params ordering problem in auto created FramsClasses?.

Improve ObjectInstance?.

Several fixes to ModelBuilder?.

Improve test for ObjectInstance? in Browser.

Make initialization of robot static.

With robot recreated for second browser test, the test hanged
deep in AWT.

Add base convenience base test for Browser tests.

More tests to ObjectInstance?.

Rename Dispatcher.invokeLater() to dispatch().

Add assertDispatch.

It allows assertions in other threads, than TestNGInvoker.
Assertions are gathered after each method invocation and rethrown.

Use timeOut annotation attribute for tests involving some waiting.

Remove firstTask method (merge with joinableStart).

Clean up leftovers.

Remove unused FavouritesXMLFactory (the reading part is already
completely done with generic XmlLoader?, and writing part will be done
based on the same approach if needed).
Move UserFavourite? to the com.framsticks.gui.configuration package.

Remove GenotypeBrowser? as to specific.

This functionality will be available in ObjectInstance?.

Add interface ParamsPackage?.

Package containing registration of Java classes meant to use with
ReflectionAccess? may be in Instance using configuration.

Minor changes.

Make Group immutable.

Add AutoBuilder? interface extending Builder - only those would
be used to automatically build from XML.

Fix groups in FramsClass?.

Minor naming cleanup in Registry.

Add ModelComponent? interface.

All class creating the Model are implementing that interface.

Extract Model.build into ModelBuilder?.

ModelBuilder? will be compatible with other builders
and allow using it from configuration.

Fix NeuroConnection?.

Add synchronous get operation for dispatchers.

Rename JoinableMonitor? to Monitor.

Add ObjectInstance?.

This class is mainly for demonstration
and testing purposes.

Improve FramsServer? runner.

  • improve ExternalProcess? runner,
  • runner can kill the server but also react properly, when the server exists on it's own,
  • set default path to search for framsticks server installation,
  • add LoggingOutputListener?.
File size: 3.1 KB
Line 
1/**
2 *
3 */
4package com.framsticks.gui;
5
6import org.apache.log4j.Logger;
7
8import javax.swing.*;
9import java.util.HashMap;
10import java.util.LinkedHashMap;
11
12/**
13 * Class provides icons images.
14 */
15public class ImageProvider {
16
17        private final static Logger log = Logger.getLogger(ImageProvider.class.getName());
18
19
20        /**
21         * HashMap stores icons. Key is icon path, Value is icon.
22         */
23        private static HashMap<String, ImageIcon> icons = new LinkedHashMap<String, ImageIcon>();
24
25        public static final String IMAGE = "image.png";
26        public static final String LOGO = "logo.png";
27
28        //public static final String FOLDER_OPEN = "folder_open.png";
29        //public static final String FOLDER_CLOSED = "folder_close.png";
30        //public static final String NODE = "node.png";
31
32        public static final String SERVER = "server.png";
33
34        public static final String CLI = "cli.png";
35        public static final String EVENT = "event.png";
36        public static final String SIMULATOR = "simulator.png";
37
38        public static final String WORLD = "World.png";
39        public static final String GENEPOOLS = "genepools.png";
40        public static final String GENEPOOLS_GROUP = "genepoolsgroup.png";
41        public static final String POPULATIONS = "populations.png";
42        public static final String POPULATION_GROUP = "populationgroup.png";
43        public static final String STATISTIC = "statistic.png";
44        public static final String EXPERIMENT = "experiment.png";
45
46        public static final String CREATURES_GROUP = "CreaturesGroup.png";
47        public static final String CREATURE = "Creature.png";
48
49        public static final String GENOTYPES_GROUP = "GenotypeGroup.png";
50        public static final String GENOTYPES = "Genotype.png";
51
52        public static final String JOINT_GROUP = "l_Joint.png";
53        public static final String JOINT = "Joint.png";
54        public static final String MECH_JOINT_GROUP = "l_MechJoint.png";
55        public static final String MECH_JOINT = "MechJoint.png";
56        public static final String PART_GROUP = "l_Part.png";
57        public static final String PART = "Part.png";
58        public static final String MECH_PART_GROUP = "l_MechPart.png";
59        public static final String MECH_PART = "MechPart.png";
60        public static final String NEURON_GROUP = "l_Neuro.png";
61        public static final String NEURON = "Neuro.png";
62        public static final String NEURON_DEF_GROUP = "l_NeuroDef.png";
63        public static final String NEURON_DEF = "NeuroDef.png";
64
65        public static final String FAVORITES = "stats.png";
66        public static final String FAVORITE_FIELDS = "FavouriteFields.png";
67
68        public static final String SIM_START = "sim_start.png";
69        public static final String SIM_STEP = "sim_step.png";
70        public static final String SIM_STOP = "sim_stop.png";
71
72        /**
73         * Loads image icon with the given getName(path).
74         *
75         * @param imageName Name of the image(including extension) which will be loaded.
76         * @return Loaded image.
77         */
78        public static ImageIcon loadImage(final String imageName) {
79                if (icons.containsKey(imageName)) {
80                        return icons.get(imageName);
81                }
82                String resourceName = "/shared/res/network/" + imageName;
83                try {
84                        ImageIcon icon = new ImageIcon(ImageProvider.class.getResource(resourceName));
85                        icons.put(imageName, icon);
86                        return icon;
87                } catch (Exception ignored) {
88                        log.error("failed to read icon: " + resourceName);
89                }
90                return null;
91        }
92}
Note: See TracBrowser for help on using the repository browser.