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

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

HIGHLIGHTS:

  • add <include/> to configuration
  • add side notes to tree
    • used to store arbitrary information alongside the tree structure
  • migrate to log4j2
    • supports lazy string evaluation of passed arguments
  • improve GUI tree
    • it stays in synchronization with actual state (even in high load test scenario)
  • improve panel management in GUI
  • make loading objects in GUI more lazy
  • offload parsing to connection receiver thread
    • info parsing
    • first step of objects parsing
  • fix connection parsing bug (eof in long values)
  • support zero-arguments procedure in table view

CHANGELOG:
Implement procedure calls from table view.

Refactorization around procedures in tables.

Add table editor for buttons.

Render buttons in the the list view.

Further improve Columns.

Add Column class for TableModel?.

Accept also non-arguments ProcedureParams? in tableView.

Increase maximal TextAreaControl? size.

Add tooltip to ProcedureControl?.

Fix bug of interpreting eofs in long values by connection reader.

Further rework connection parsing.

Simplify client connection processing.

Test ListChange? modification.

Test ListChange? events with java server.

Add TestChild?.

Fix bug with fast deregistering when connecting to running server.

Another minor refactorization in TreeOperations?.

Fix bug in SimpleAbstractAccess? loading routine.

Another minor improvement.

Minor change.

Make reading of List objects two-phase.

Another minor change.

Dispatch parsing into receiver thread.

Another step.

Enclose passing value in ObjectParam? case in closure.

Minor step.

Minor change on way to offload parsing.

Temporarily comment out single ValueParam? get.

It will be generalized to multi ValueParam?.

Process info in receiver thread.

Add DispatchingExceptionHandler?.

Make waits in browser test longer.

Use FETCHED_MARK.

It is honored in GUI, where it used to decide whether to get values

after user action.

It is set in standard algorithm for processing fetched values.

Add remove operation to side notes.

Make loading more lazy.

Improve loading policy.

On node choose load itself, on node expansion, load children.

Minor improvement.

Fix bug with panel interleaving.

Minor improvements.

Improve panel management.

More cleaning around panels.

Reorganize panels.

Further improve tree.

Fix bug in TreeModel?.

Remove children from TreeNode?.

Implement TreeNode? hashCode and equals.

Make TreeNode? delegate equals and hashcode to internal reference.

Move listeners from TreeNode? to side notes.

Store path.textual as a side note.

Side note params instead of accesses for objects.

More refactorizations.

In TreeNode? bindAccess based on side notes.

Minor step.

Hide createAccess.

Rename AccessInterface? to Access.

Minor changes.

Several improvements in high load scenarios.

Change semantics of ArrayListAccess?.set(index, null);

It now removes the element, making list shorter
(it was set to null before).

Add path remove handler.

Handle exceptions in Connection.

Update .gitignore

Configure logging to file.

Move registration to TreeModel?.

Further refactorization.

Minor refactorization.

Minor improvements.

Use specialized event also for Modify action of ListChange?.

Use remove events.

Use the insertion events for tree.

Further improve tree refreshing.

Further improve reacting on events in GUI.

Fix problem with not adding objects on addition list change.

Migrate to log4j lazy String construction interface.

Migrate imports to log4j2.

Drop dependency on adapter to version 1.2.

Switch log4j implementation to log4j2.

Add dirty mark to the NodeAtFrame?.

Make selecting in AccessInterfaces? type safe.

Ignore containers size settings in Model and Genotype.

Use tree side notes to remember local changes and panels.

Add sideNotes to tree.

They will be used to store various accompanying information
right in the tree.

Use ReferenceIdentityMap? from apache in TreeNode?.

It suits the need perfectly (weak semantics on both key and value).

Make ArrayListParam? do not react size changes.

Guard in TableModel? before not yet loaded objects.

Add <include/> clause and AutoInjector?.

Extract common columns configuration to separate xml,
that can be included by other configurations.

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