You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2013-11-23 08:50:27
|
Revision: 9485 http://sourceforge.net/p/gridarta/code/9485 Author: akirschbaum Date: 2013-11-23 08:50:24 +0000 (Sat, 23 Nov 2013) Log Message: ----------- Rename field name. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java 2013-11-23 08:49:52 UTC (rev 9484) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java 2013-11-23 08:50:24 UTC (rev 9485) @@ -48,7 +48,7 @@ private final Object sync = new Object(); @Nullable - private PluginManager<G, A, R> scriptManager; + private PluginManager<G, A, R> pluginManager; @NotNull private final PluginController<G, A, R> pluginController; @@ -79,11 +79,11 @@ @ActionMethod public void editPlugins() { synchronized (sync) { - if (scriptManager == null) { - scriptManager = new PluginManager<G, A, R>(pluginController, pluginModel, pluginParameterViewFactory, resourceIcons); + if (pluginManager == null) { + pluginManager = new PluginManager<G, A, R>(pluginController, pluginModel, pluginParameterViewFactory, resourceIcons); } - scriptManager.show(); + pluginManager.show(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-11-23 08:49:58
|
Revision: 9484 http://sourceforge.net/p/gridarta/code/9484 Author: akirschbaum Date: 2013-11-23 08:49:52 +0000 (Sat, 23 Nov 2013) Log Message: ----------- Do not extend JFrame. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java 2013-11-23 08:44:09 UTC (rev 9483) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java 2013-11-23 08:49:52 UTC (rev 9484) @@ -51,9 +51,12 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class PluginManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JFrame { +public class PluginManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { @NotNull + private final JFrame frame = new JFrame("Editor plugins management"); + + @NotNull private final JList scripts; @NotNull @@ -91,15 +94,14 @@ * @param resourceIcons the resource icons for creating icons */ public PluginManager(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final ResourceIcons resourceIcons) { - super("Editor plugins management"); this.pluginController = pluginController; this.pluginModel = pluginModel; this.pluginParameterViewFactory = pluginParameterViewFactory; this.resourceIcons = resourceIcons; - getContentPane().setLayout(new BorderLayout()); + frame.getContentPane().setLayout(new BorderLayout()); final Container left = new JPanel(new BorderLayout()); - getContentPane().add(left, BorderLayout.WEST); - getContentPane().add(scriptPanel, BorderLayout.CENTER); + frame.getContentPane().add(left, BorderLayout.WEST); + frame.getContentPane().add(scriptPanel, BorderLayout.CENTER); final ListModel listModel = new AbstractListModel() { /** @@ -206,8 +208,8 @@ bottomLeft.add(removeScriptBtn); left.add(bottomLeft, BorderLayout.SOUTH); scripts.setSelectedIndex(0); - pack(); - setVisible(true); + frame.pack(); + frame.setVisible(true); } private void showScript(final Plugin<G, A, R> plugin) { @@ -239,4 +241,12 @@ } } + /** + * Shows the plugin manager window. + */ + public void show() { + frame.pack(); + frame.setVisible(true); + } + } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java 2013-11-23 08:44:09 UTC (rev 9483) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java 2013-11-23 08:49:52 UTC (rev 9484) @@ -19,7 +19,6 @@ package net.sf.gridarta.gui.dialog.plugin; -import java.awt.Window; import javax.swing.Action; import net.sf.gridarta.gui.dialog.plugin.parameter.PluginParameterViewFactory; import net.sf.gridarta.model.archetype.Archetype; @@ -49,7 +48,7 @@ private final Object sync = new Object(); @Nullable - private Window scriptManager; + private PluginManager<G, A, R> scriptManager; @NotNull private final PluginController<G, A, R> pluginController; @@ -84,8 +83,7 @@ scriptManager = new PluginManager<G, A, R>(pluginController, pluginModel, pluginParameterViewFactory, resourceIcons); } - scriptManager.pack(); - scriptManager.setVisible(true); + scriptManager.show(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-11-23 08:44:15
|
Revision: 9483 http://sourceforge.net/p/gridarta/code/9483 Author: akirschbaum Date: 2013-11-23 08:44:09 +0000 (Sat, 23 Nov 2013) Log Message: ----------- Do not extend JPanel. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2013-10-18 07:05:43 UTC (rev 9482) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2013-11-23 08:44:09 UTC (rev 9483) @@ -68,7 +68,7 @@ import org.fife.ui.rtextarea.RTextScrollPane; import org.jetbrains.annotations.NotNull; -public class PluginEditor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JPanel { +public class PluginEditor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { private static final long serialVersionUID = 1L; @@ -79,6 +79,9 @@ private static final Category log = Logger.getLogger(PluginEditor.class); @NotNull + private final JPanel panel = new JPanel(); + + @NotNull private final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory; @NotNull @@ -170,8 +173,8 @@ this.plugin = plugin; this.pluginParameterViewFactory = pluginParameterViewFactory; final JTabbedPane tabs = new JTabbedPane(); - setLayout(new BorderLayout()); - add(tabs); + panel.setLayout(new BorderLayout()); + panel.add(tabs); final Container optionsTab = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; @@ -366,7 +369,7 @@ putRow(gbc, parameter); i++; } - repaint(); + panel.repaint(); } private void newTableComponent(@NotNull final Component c) { @@ -444,4 +447,13 @@ paramTable.add(getParameterView(param).getValueComponent(), gbc); } + /** + * Returns the {@link Component} for this plugin editor. + * @return the component + */ + @NotNull + public Component getComponent() { + return panel; + } + } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java 2013-10-18 07:05:43 UTC (rev 9482) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java 2013-11-23 08:44:09 UTC (rev 9483) @@ -22,7 +22,6 @@ import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; -import java.awt.Component; import java.awt.Container; import java.awt.GridLayout; import java.awt.event.ActionEvent; @@ -227,16 +226,16 @@ if (pluginEditor == null) { pluginEditor = new PluginEditor<G, A, R>(plugin, pluginController, pluginModel, pluginParameterViewFactory, resourceIcons); components.put(plugin, pluginEditor); - scriptPanel.add(pluginEditor, Integer.toString(pluginEditor.hashCode())); + scriptPanel.add(pluginEditor.getComponent(), Integer.toString(pluginEditor.hashCode())); } scriptLayout.show(scriptPanel, Integer.toString(pluginEditor.hashCode())); } private void removeScript(final Plugin<G, A, R> plugin) { - final Component scriptEditor = components.get(plugin); + final PluginEditor<?, ?, ?> scriptEditor = components.get(plugin); if (scriptEditor != null) { components.remove(plugin); - scriptPanel.remove(scriptEditor); + scriptPanel.remove(scriptEditor.getComponent()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-18 07:05:49
|
Revision: 9482 http://sourceforge.net/p/gridarta/code/9482 Author: akirschbaum Date: 2013-10-18 07:05:43 +0000 (Fri, 18 Oct 2013) Log Message: ----------- Fix Ant build script. Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-10-17 21:52:03 UTC (rev 9481) +++ trunk/build.xml 2013-10-18 07:05:43 UTC (rev 9482) @@ -577,11 +577,12 @@ </copy> </target> - <target name="compile-project" description="Compiles the project module." depends="compile-model,compile-utils"> + <target name="compile-project" description="Compiles the project module." depends="compile-model,compile-plugin,compile-utils"> <mkdir dir="${build.dir}/project/app"/> <javac srcdir="src/project/src/main/java" destdir="${build.dir}/project/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> <classpath> <path refid="path.class.model.app"/> + <path refid="path.class.plugin.app"/> <path refid="path.class.utils.app"/> <path refid="path.lib.annotations"/> <path refid="path.lib.japi-swing-action"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 21:52:07
|
Revision: 9481 http://sourceforge.net/p/gridarta/code/9481 Author: akirschbaum Date: 2013-10-17 21:52:03 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Inline functions to avoid duplicate caching of images. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/FaceObjectProviders.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -114,7 +114,7 @@ @NotNull @Override public SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype> newSimpleMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { - return new SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapModel, multiPositionData, isoMapSquareInfo, resourceIcons.getUnknownSquareIcon()); + return new SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapModel, multiPositionData, isoMapSquareInfo, resourceIcons.getResourceIcon(ResourceIcons.SQUARE_UNKNOWN)); } /** @@ -132,7 +132,7 @@ @NotNull @Override public IsoPickmapRenderer<GameObject, MapArchObject, Archetype> newPickmapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid) { - return new IsoPickmapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getUnknownSquareIcon()); + return new IsoPickmapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getResourceIcon(ResourceIcons.SQUARE_UNKNOWN)); } } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -156,7 +156,7 @@ public FlatMapRenderer(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ResourceIcons resourceIcons, @NotNull final SmoothingRenderer smoothingRenderer) { super(mapViewSettings, mapModel, mapGrid, 32, gridMapSquarePainter, gameObjectParser); this.mapModel = mapModel; - emptySquareIcon = resourceIcons.getEmptySquareIcon(); + emptySquareIcon = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_EMPTY); this.filterControl = filterControl; this.mapViewSettings = mapViewSettings; this.smoothingRenderer = smoothingRenderer; Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -146,7 +146,7 @@ */ private void paintSquare(@NotNull final Graphics graphics, @NotNull final Point point) { if (mapModel.getMapSquare(point).isEmpty()) { - resourceIcons.getEmptySquareIcon().paintIcon(this, graphics, point.x * IGUIConstants.SQUARE_WIDTH, point.y * IGUIConstants.SQUARE_HEIGHT); + resourceIcons.getResourceIcon(ResourceIcons.SQUARE_EMPTY).paintIcon(this, graphics, point.x * IGUIConstants.SQUARE_WIDTH, point.y * IGUIConstants.SQUARE_HEIGHT); return; } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -114,7 +114,7 @@ @NotNull @Override public SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype> newSimpleMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { - return new SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapModel, multiPositionData, isoMapSquareInfo, resourceIcons.getUnknownSquareIcon()); + return new SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapModel, multiPositionData, isoMapSquareInfo, resourceIcons.getResourceIcon(ResourceIcons.SQUARE_UNKNOWN)); } /** @@ -132,7 +132,7 @@ @NotNull @Override public IsoPickmapRenderer<GameObject, MapArchObject, Archetype> newPickmapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid) { - return new IsoPickmapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getUnknownSquareIcon()); + return new IsoPickmapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getResourceIcon(ResourceIcons.SQUARE_UNKNOWN)); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -184,13 +184,13 @@ optionsTab.add(new JPanel(), gbc); gbc.gridx = 1; gbc.weightx = 0.02; - final Component autoRunIcon = new JLabel(resourceIcons.getAutoRunSmallIcon()); + final Component autoRunIcon = new JLabel(resourceIcons.getResourceIcon(ResourceIcons.AUTO_RUN_SMALL_ICON)); optionsTab.add(autoRunIcon, gbc); gbc.gridy = 2; - final Component filterIcon = new JLabel(resourceIcons.getFilterSmallIcon()); + final Component filterIcon = new JLabel(resourceIcons.getResourceIcon(ResourceIcons.FILTER_SMALL_ICON)); optionsTab.add(filterIcon, gbc); gbc.gridy = 3; - final Component runPluginIcon = new JLabel(resourceIcons.getRunPluginSmallIcon()); + final Component runPluginIcon = new JLabel(resourceIcons.getResourceIcon(ResourceIcons.RUN_PLUGIN_SMALL_ICON)); optionsTab.add(runPluginIcon, gbc); gbc.gridx = 2; gbc.gridy = 1; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -192,7 +192,7 @@ if (console == null) { console = new JFrame("Beanshell scripts I/O Console"); console.setSize(400, 200); - consolePane = new CloseableTabbedPane(resourceIcons.getCloseTabSmallIcon()); + consolePane = new CloseableTabbedPane(resourceIcons.getResourceIcon(ResourceIcons.CLOSE_TAB_SMALL_ICON)); console.getContentPane().add(consolePane); } console.setVisible(true); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -84,13 +84,13 @@ * @param resourceIcons the resource icons for creating icons */ public GridMapSquarePainter(@NotNull final ResourceIcons resourceIcons) { - selImg = resourceIcons.getMapSelectedIcon().getImage(); - selImgNorth = resourceIcons.getMapSelectedIconNorth().getImage(); - selImgEast = resourceIcons.getMapSelectedIconEast().getImage(); - selImgSouth = resourceIcons.getMapSelectedIconSouth().getImage(); - selImgWest = resourceIcons.getMapSelectedIconWest().getImage(); - preSelImg = resourceIcons.getMapPreSelectedIcon().getImage(); - cursorImg = resourceIcons.getMapCursorIcon().getImage(); + selImg = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_SELECTED_SQUARE).getImage(); + selImgNorth = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_SELECTED_SQUARE_NORTH).getImage(); + selImgEast = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_SELECTED_SQUARE_EAST).getImage(); + selImgSouth = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_SELECTED_SQUARE_SOUTH).getImage(); + selImgWest = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_SELECTED_SQUARE_WEST).getImage(); + preSelImg = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_PRE_SELECTED_SQUARE).getImage(); + cursorImg = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_CURSOR).getImage(); warningSquareImg = resourceIcons.getWarningSquareIcon().getImage(); lightSquare = resourceIcons.getLightSquareIcon().getImage(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -121,9 +121,9 @@ * @param resourceIcons the resource icons for creating icons */ public IsoMapRenderer(final int spawnPointTypeNo, @NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final MapModel<G, A, R> mapModel, @NotNull final MapGrid mapGrid, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final ResourceIcons resourceIcons) { - super(spawnPointTypeNo, mapViewSettings, mapModel, mapGrid, isoMapSquareInfo.getXLen(), 2 * isoMapSquareInfo.getYLen(), multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getUnknownSquareIcon()); + super(spawnPointTypeNo, mapViewSettings, mapModel, mapGrid, isoMapSquareInfo.getXLen(), 2 * isoMapSquareInfo.getYLen(), multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getResourceIcon(ResourceIcons.SQUARE_UNKNOWN)); this.filterControl = filterControl; - emptySquareIcon = resourceIcons.getEmptySquareIcon(); + emptySquareIcon = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_EMPTY); this.mapViewSettings = mapViewSettings; this.isoMapSquareInfo = isoMapSquareInfo; this.filterControl.addConfigListener(filterConfigListener); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -88,7 +88,7 @@ try { setIcon(faceObjectProviders.getFace(archetypeSet.getArchetype(treasureObj.getName()))); } catch (final UndefinedArchetypeException ignored) { - setIcon(resourceIcons.getNoArchSquareIcon()); + setIcon(resourceIcons.getResourceIcon(ResourceIcons.SQUARE_NO_ARCH)); } setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); } @@ -100,7 +100,7 @@ @Override public void visit(@NotNull final NoTreasureObj treasureObj) { setForeground(Color.gray); - setIcon(resourceIcons.getTreasureNoIcon()); + setIcon(resourceIcons.getResourceIcon(ResourceIcons.TREASURE_NO)); } @Override @@ -111,7 +111,7 @@ setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); } else { setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); - setIcon(resourceIcons.getTreasureListIcon()); + setIcon(resourceIcons.getResourceIcon(ResourceIcons.TREASURE_LIST)); } } else { if (treasureObj.getName().equalsIgnoreCase("none")) { @@ -119,7 +119,7 @@ setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); } else { setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); - setIcon(resourceIcons.getTreasureOneListIcon()); + setIcon(resourceIcons.getResourceIcon(ResourceIcons.TREASUREONE_LIST)); } } } @@ -127,7 +127,7 @@ @Override public void visit(@NotNull final YesTreasureObj treasureObj) { setForeground(Color.gray); - setIcon(resourceIcons.getTreasureYesIcon()); + setIcon(resourceIcons.getResourceIcon(ResourceIcons.TREASURE_YES)); } }; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -325,17 +325,17 @@ final AppPreferencesModel appPreferencesModel = editorFactory.createAppPreferencesModel(); final MapViewManager<G, A, R> mapViewManager = new MapViewManager<G, A, R>(); final StatusBar<G, A, R> statusBar = new StatusBar<G, A, R>(projectModel.getMapManager(), mapViewManager, projectModel.getArchetypeSet(), projectModel.getFaceObjects()); - final MapImageCache<G, A, R> mapImageCache = new MapImageCache<G, A, R>(projectModel.getMapManager(), resourceIcons.getDefaultIcon(), resourceIcons.getDefaultPreview(), rendererFactory, editorFactory.getCacheFiles()); + final MapImageCache<G, A, R> mapImageCache = new MapImageCache<G, A, R>(projectModel.getMapManager(), resourceIcons.getResourceIcon(ResourceIcons.DEFAULT_ICON).getImage(), resourceIcons.getResourceIcon(ResourceIcons.DEFAULT_PREVIEW).getImage(), rendererFactory, editorFactory.getCacheFiles()); final MapFolderTree<G, A, R> mapFolderTree = new MapFolderTree<G, A, R>(projectModel.getProjectSettings().getPickmapDir()); - final ImageIcon icon = resourceIcons.getAppIcon(); + final ImageIcon icon = resourceIcons.getResourceIcon(ResourceIcons.APP_ICON); mainViewFrame = new JFrame(ACTION_BUILDER.format("mainWindow.title", getBuildNumberAsString())); final Frame parent = mainViewFrame; final PickmapChooserModel<G, A, R> pickmapChooserModel = new PickmapChooserModel<G, A, R>(); final PickmapChooserView<G, A, R> pickmapChooserView = new PickmapChooserView<G, A, R>(pickmapChooserModel, mapFolderTree, projectModel.getMapArchObjectFactory(), projectModel.getMapReaderFactory(), projectModel.getPickmapManager()); final PickmapSettings pickmapSettings = new DefaultPickmapSettings(); final CFTreasureListTree treasureListTree = new CFTreasureListTree(projectModel.getTreasureTree(), parent, projectModel.getArchetypeSet(), projectModel.getFaceObjectProviders(), resourceIcons); - final ImageIcon noFaceSquareIcon = resourceIcons.getNoFaceSquareIcon(); - final ImageIcon unknownSquareIcon = resourceIcons.getUnknownSquareIcon(); + final ImageIcon noFaceSquareIcon = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_NO_FACE); + final ImageIcon unknownSquareIcon = resourceIcons.getResourceIcon(ResourceIcons.SQUARE_UNKNOWN); final SelectedSquareModel<G, A, R> selectedSquareModel = new SelectedSquareModel<G, A, R>(); final GameObjectMatcher floorMatcher = projectModel.getGameObjectMatchers().getMatcher("system_floor", "floor"); final GameObjectMatcher wallMatcher = projectModel.getGameObjectMatchers().getMatcher("system_wall", "wall"); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/face/FaceObjectProviders.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/face/FaceObjectProviders.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/face/FaceObjectProviders.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -311,16 +311,16 @@ @NotNull private ImageIcon getFace(@Nullable final String faceName, final boolean hasUndefinedArchetype, @NotNull final FaceProvider singleFaceProvider, @NotNull final FaceProvider doubleFaceProvider) { if (hasUndefinedArchetype) { - return resourceIcons.getNoArchSquareIcon(); + return resourceIcons.getResourceIcon(ResourceIcons.SQUARE_NO_ARCH); } if (faceName == null) { - return resourceIcons.getNoFaceSquareIcon(); + return resourceIcons.getResourceIcon(ResourceIcons.SQUARE_NO_FACE); } final FaceObject faceObject = faceObjects.get(faceName); if (faceObject == null) { - return resourceIcons.getNoFaceSquareIcon(); + return resourceIcons.getResourceIcon(ResourceIcons.SQUARE_NO_FACE); } final FaceProvider faceProvider = faceObject.isDouble() ? doubleFaceProvider : singleFaceProvider; @@ -328,7 +328,7 @@ final String effectiveFaceName = alternativeFaceName != null && singleFaceProvider == doubleFaceProvider ? alternativeFaceName : faceName; final ImageIcon face = faceProvider.getImageIconForFacename(effectiveFaceName); if (face == null) { - return resourceIcons.getUnknownSquareIcon(); + return resourceIcons.getResourceIcon(ResourceIcons.SQUARE_UNKNOWN); } return face; Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java 2013-10-17 21:37:32 UTC (rev 9480) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java 2013-10-17 21:52:03 UTC (rev 9481) @@ -29,7 +29,6 @@ import java.util.HashMap; import java.util.Map; import java.util.MissingResourceException; -import javax.swing.Icon; import javax.swing.ImageIcon; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -56,22 +55,31 @@ */ public static final String SYSTEM_DIR = "system/"; + @NotNull public static final String SQUARE_SELECTED_SQUARE = SYSTEM_DIR + "selected_square.png"; + @NotNull public static final String SQUARE_SELECTED_SQUARE_NORTH = SYSTEM_DIR + "selected_square_n.png"; + @NotNull public static final String SQUARE_SELECTED_SQUARE_EAST = SYSTEM_DIR + "selected_square_e.png"; + @NotNull public static final String SQUARE_SELECTED_SQUARE_SOUTH = SYSTEM_DIR + "selected_square_s.png"; + @NotNull public static final String SQUARE_SELECTED_SQUARE_WEST = SYSTEM_DIR + "selected_square_w.png"; + @NotNull public static final String SQUARE_PRE_SELECTED_SQUARE = SYSTEM_DIR + "pre_selected_square.png"; + @NotNull public static final String SQUARE_CURSOR = SYSTEM_DIR + "cursor.png"; + @NotNull public static final String SQUARE_EMPTY = SYSTEM_DIR + "empty.png"; + @NotNull public static final String SQUARE_UNKNOWN = SYSTEM_DIR + "unknown.png"; public static final String SQUARE_WARNING = SYSTEM_DIR + "warning.png"; @@ -82,40 +90,53 @@ */ private static final String SQUARE_LIGHT = SYSTEM_DIR + "light.png"; + @NotNull public static final String SQUARE_NO_FACE = SYSTEM_DIR + "no_face.png"; + @NotNull public static final String SQUARE_NO_ARCH = SYSTEM_DIR + "no_arch.png"; - private static final String TREASURE_LIST = SYSTEM_DIR + "treasure_list.png"; + @NotNull + public static final String TREASURE_LIST = SYSTEM_DIR + "treasure_list.png"; - private static final String TREASUREONE_LIST = SYSTEM_DIR + "treasureone_list.png"; + @NotNull + public static final String TREASUREONE_LIST = SYSTEM_DIR + "treasureone_list.png"; - private static final String TREASURE_YES = SYSTEM_DIR + "treasure_yes.png"; + @NotNull + public static final String TREASURE_YES = SYSTEM_DIR + "treasure_yes.png"; - private static final String TREASURE_NO = SYSTEM_DIR + "treasure_no.png"; + @NotNull + public static final String TREASURE_NO = SYSTEM_DIR + "treasure_no.png"; /** * The default map icon to use if no icon can be created. */ + @NotNull public static final String DEFAULT_ICON = SYSTEM_DIR + "default_icon.png"; /** * The default map preview to use if no icon can be created. */ + @NotNull public static final String DEFAULT_PREVIEW = SYSTEM_DIR + "default_preview.png"; - private static final String CLOSE_TAB_SMALL_ICON = ICON_DIR + "close_tab_small_icon.gif"; + @NotNull + public static final String CLOSE_TAB_SMALL_ICON = ICON_DIR + "close_tab_small_icon.gif"; - private static final String AUTO_RUN_SMALL_ICON = ICON_DIR + "auto_run_small_icon.gif"; + @NotNull + public static final String AUTO_RUN_SMALL_ICON = ICON_DIR + "auto_run_small_icon.gif"; - private static final String FILTER_SMALL_ICON = ICON_DIR + "filter_small_icon.gif"; + @NotNull + public static final String FILTER_SMALL_ICON = ICON_DIR + "filter_small_icon.gif"; - private static final String RUN_PLUGIN_SMALL_ICON = ICON_DIR + "run_plugin_small_icon.gif"; + @NotNull + public static final String RUN_PLUGIN_SMALL_ICON = ICON_DIR + "run_plugin_small_icon.gif"; /** * Application icon definitions (icon-dir). */ - private static final String APP_ICON = ICON_DIR + "app_icon.gif"; + @NotNull + public static final String APP_ICON = ICON_DIR + "app_icon.gif"; /** * The Logger for printing log messages. @@ -129,87 +150,12 @@ private final Map<String, ImageIcon> imageCache = new HashMap<String, ImageIcon>(); @Nullable - private ImageIcon mapSelIcon; - - @Nullable - private ImageIcon mapSelIconNorth; - - @Nullable - private ImageIcon mapSelIconEast; - - @Nullable - private ImageIcon mapSelIconSouth; - - @Nullable - private ImageIcon mapSelIconWest; - - @Nullable - private ImageIcon mapPreSelIcon; - - @Nullable - private ImageIcon mapCursorIcon; - - @Nullable - private Icon emptySquareIcon; - - @Nullable - private ImageIcon unknownSquareIcon; - - @Nullable private ImageIcon warningSquareIcon; @Nullable private ImageIcon lightSquareIcon; - @Nullable - private ImageIcon noFaceSquareIcon; - - @Nullable - private ImageIcon noArchSquareIcon; - /** - * The default icon {@link Image} for map previews. - */ - @Nullable - private Image defaultIcon; - - /** - * The default preview {@link Image} for map icon. - */ - @Nullable - private Image defaultPreview; - - @Nullable - private Icon treasureListIcon; - - @Nullable - private Icon treasureOneListIcon; - - @Nullable - private Icon treasureYesIcon; - - @Nullable - private Icon treasureNoIcon; - - @Nullable - private ImageIcon closeTabSmallIcon; - - @Nullable - private Icon autoRunSmallIcon; - - @Nullable - private Icon filterSmallIcon; - - @Nullable - private Icon runPluginSmallIcon; - - /** - * The application's icon or <code>null</code> if none is available. - */ - @Nullable - private ImageIcon appIcon; - - /** * Returns the image icon for the given icon name. Loads every icon only * once and uses hash table to return the same instance if same icon name is * given. Note: There must not be conflicting icon names from different @@ -265,33 +211,6 @@ @NotNull @SuppressWarnings("NullableProblems") - public ImageIcon getMapCursorIcon() { - if (mapCursorIcon == null) { - mapCursorIcon = getResourceIcon(SQUARE_CURSOR); - } - return mapCursorIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public Icon getEmptySquareIcon() { - if (emptySquareIcon == null) { - emptySquareIcon = getResourceIcon(SQUARE_EMPTY); - } - return emptySquareIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getUnknownSquareIcon() { - if (unknownSquareIcon == null) { - unknownSquareIcon = getResourceIcon(SQUARE_UNKNOWN); - } - return unknownSquareIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") public ImageIcon getWarningSquareIcon() { if (warningSquareIcon == null) { final ImageFilter alphaFilter = AlphaImageFilterInstance.ALPHA_FILTER; @@ -325,191 +244,4 @@ return lightSquareIcon; } - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getNoFaceSquareIcon() { - if (noFaceSquareIcon == null) { - noFaceSquareIcon = getResourceIcon(SQUARE_NO_FACE); - } - return noFaceSquareIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getNoArchSquareIcon() { - if (noArchSquareIcon == null) { - noArchSquareIcon = getResourceIcon(SQUARE_NO_ARCH); - } - return noArchSquareIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getMapSelectedIcon() { - if (mapSelIcon == null) { - mapSelIcon = getResourceIcon(SQUARE_SELECTED_SQUARE); - } - return mapSelIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getMapSelectedIconNorth() { - if (mapSelIconNorth == null) { - mapSelIconNorth = getResourceIcon(SQUARE_SELECTED_SQUARE_NORTH); - } - return mapSelIconNorth; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getMapSelectedIconEast() { - if (mapSelIconEast == null) { - mapSelIconEast = getResourceIcon(SQUARE_SELECTED_SQUARE_EAST); - } - return mapSelIconEast; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getMapSelectedIconSouth() { - if (mapSelIconSouth == null) { - mapSelIconSouth = getResourceIcon(SQUARE_SELECTED_SQUARE_SOUTH); - } - return mapSelIconSouth; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getMapSelectedIconWest() { - if (mapSelIconWest == null) { - mapSelIconWest = getResourceIcon(SQUARE_SELECTED_SQUARE_WEST); - } - return mapSelIconWest; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getMapPreSelectedIcon() { - if (mapPreSelIcon == null) { - mapPreSelIcon = getResourceIcon(SQUARE_PRE_SELECTED_SQUARE); - } - return mapPreSelIcon; - } - - /** - * Returns the default icon {@link Image} for map previews. - * @return the image - */ - @NotNull - @SuppressWarnings("NullableProblems") - public Image getDefaultIcon() { - if (defaultIcon == null) { - final ImageIcon icon = getResourceIcon(DEFAULT_ICON); - defaultIcon = icon.getImage(); - } - assert defaultIcon != null; - return defaultIcon; - } - - /** - * Returns the default preview {@link Image} for map icon. - * @return the image - */ - @NotNull - @SuppressWarnings("NullableProblems") - public Image getDefaultPreview() { - if (defaultPreview == null) { - final ImageIcon icon = getResourceIcon(DEFAULT_PREVIEW); - defaultPreview = icon.getImage(); - } - assert defaultPreview != null; - return defaultPreview; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public Icon getTreasureListIcon() { - if (treasureListIcon == null) { - treasureListIcon = getResourceIcon(TREASURE_LIST); - } - return treasureListIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public Icon getTreasureOneListIcon() { - if (treasureOneListIcon == null) { - treasureOneListIcon = getResourceIcon(TREASUREONE_LIST); - } - return treasureOneListIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public Icon getTreasureYesIcon() { - if (treasureYesIcon == null) { - treasureYesIcon = getResourceIcon(TREASURE_YES); - } - return treasureYesIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public Icon getTreasureNoIcon() { - if (treasureNoIcon == null) { - treasureNoIcon = getResourceIcon(TREASURE_NO); - } - return treasureNoIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public ImageIcon getCloseTabSmallIcon() { - if (closeTabSmallIcon == null) { - closeTabSmallIcon = getResourceIcon(CLOSE_TAB_SMALL_ICON); - } - return closeTabSmallIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public Icon getAutoRunSmallIcon() { - if (autoRunSmallIcon == null) { - autoRunSmallIcon = getResourceIcon(AUTO_RUN_SMALL_ICON); - } - return autoRunSmallIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public Icon getFilterSmallIcon() { - if (filterSmallIcon == null) { - filterSmallIcon = getResourceIcon(FILTER_SMALL_ICON); - } - return filterSmallIcon; - } - - @NotNull - @SuppressWarnings("NullableProblems") - public Icon getRunPluginSmallIcon() { - if (runPluginSmallIcon == null) { - runPluginSmallIcon = getResourceIcon(RUN_PLUGIN_SMALL_ICON); - } - return runPluginSmallIcon; - } - - /** - * Returns the application's icon. - * @return the icon or <code>null</code> if none is available - */ - @Nullable - @SuppressWarnings("NullableProblems") - public ImageIcon getAppIcon() { - if (appIcon == null) { - appIcon = getResourceIcon(APP_ICON); - } - return appIcon; - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 21:37:37
|
Revision: 9480 http://sourceforge.net/p/gridarta/code/9480 Author: akirschbaum Date: 2013-10-17 21:37:32 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Convert if statement into guard. Modified Paths: -------------- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java 2013-10-17 21:36:46 UTC (rev 9479) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java 2013-10-17 21:37:32 UTC (rev 9480) @@ -239,15 +239,15 @@ icon = new ImageIcon(iconURL); } else { final File iconFile = new File(iconName); - if (iconFile.exists()) { - if (log.isDebugEnabled()) { - log.debug("getResourceIcon(" + iconName + "): loading from file: " + iconFile); - } - icon = new ImageIcon(iconFile.getAbsolutePath()); - } else { + if (!iconFile.exists()) { log.warn("Cannot find icon '" + iconName + "'"); throw new MissingResourceException("missing resource: icon " + iconName, ResourceIcons.class.getName(), iconName); } + + if (log.isDebugEnabled()) { + log.debug("getResourceIcon(" + iconName + "): loading from file: " + iconFile); + } + icon = new ImageIcon(iconFile.getAbsolutePath()); } imageCache.put(iconName, icon); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 21:36:50
|
Revision: 9479 http://sourceforge.net/p/gridarta/code/9479 Author: akirschbaum Date: 2013-10-17 21:36:46 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Avoid duplicate cache lookups. Modified Paths: -------------- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java 2013-10-17 21:35:29 UTC (rev 9478) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java 2013-10-17 21:36:46 UTC (rev 9479) @@ -221,11 +221,12 @@ @NotNull public ImageIcon getResourceIcon(@NotNull final String iconName) throws MissingResourceException { // check cache - if (imageCache.containsKey(iconName)) { + final ImageIcon imageIcon = imageCache.get(iconName); + if (imageIcon != null) { if (log.isDebugEnabled()) { log.debug("getResourceIcon(" + iconName + "): return cached"); } - return imageCache.get(iconName); + return imageIcon; } @NotNull final ImageIcon icon; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 21:35:34
|
Revision: 9478 http://sourceforge.net/p/gridarta/code/9478 Author: akirschbaum Date: 2013-10-17 21:35:29 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Merge SystemIcons into ResourceIcons. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/IGUIConstants.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/MapRendererTest.java trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/TestMapRenderer.java trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParserTest.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/IGUIConstants.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/FaceObjectProviders.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypeset/DefaultArchetypeSetTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/artifact/TestParser.java trunk/src/model/src/test/java/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/io/ArchetypeParserTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/io/AttributeListUtilsTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java trunk/src/model/src/test/java/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java Removed Paths: ------------- trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/IGUIConstants.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/IGUIConstants.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/IGUIConstants.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.atrinik; import net.sf.gridarta.gui.utils.GUIConstants; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; /** * Defines common UI constants used in different dialogs and all used icon @@ -73,7 +73,7 @@ String ARTIFACTS_FILE = "artifacts"; // file with artifact definitions - String TILE_NORTH = SystemIcons.SYSTEM_DIR + "north.png"; + String TILE_NORTH = ResourceIcons.SYSTEM_DIR + "north.png"; /** * Name of the files the spell information (names and numbers). Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -31,7 +31,7 @@ import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; @@ -81,10 +81,10 @@ private final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser; /** - * The {@link SystemIcons} for creating icons. + * The {@link ResourceIcons} for creating icons. */ @NotNull - private final SystemIcons systemIcons; + private final ResourceIcons resourceIcons; /** * Creates a new instance. @@ -96,16 +96,16 @@ * @param gridMapSquarePainter the grid square painter to use * @param gameObjectParser the game object parser for creating tooltip * information - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final SystemIcons systemIcons) { + public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ResourceIcons resourceIcons) { this.mapViewSettings = mapViewSettings; this.filterControl = filterControl; this.multiPositionData = multiPositionData; this.isoMapSquareInfo = isoMapSquareInfo; this.gridMapSquarePainter = gridMapSquarePainter; this.gameObjectParser = gameObjectParser; - this.systemIcons = systemIcons; + this.resourceIcons = resourceIcons; } /** @@ -114,7 +114,7 @@ @NotNull @Override public SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype> newSimpleMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { - return new SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapModel, multiPositionData, isoMapSquareInfo, systemIcons.getUnknownSquareIcon()); + return new SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapModel, multiPositionData, isoMapSquareInfo, resourceIcons.getUnknownSquareIcon()); } /** @@ -123,7 +123,7 @@ @NotNull @Override public IsoMapRenderer<GameObject, MapArchObject, Archetype> newMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid) { - return new IsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, filterControl, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, systemIcons); + return new IsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, filterControl, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons); } /** @@ -132,7 +132,7 @@ @NotNull @Override public IsoPickmapRenderer<GameObject, MapArchObject, Archetype> newPickmapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid) { - return new IsoPickmapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, systemIcons.getUnknownSquareIcon()); + return new IsoPickmapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getUnknownSquareIcon()); } } Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -94,7 +94,7 @@ import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.actions.AtrinikServerActions; import net.sf.gridarta.var.atrinik.gui.map.renderer.DefaultRendererFactory; @@ -395,8 +395,8 @@ */ @NotNull @Override - public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons, @NotNull final SmoothFaces smoothFaces) { - return new DefaultRendererFactory(mapViewSettings, filterControl, multiPositionData, isoMapSquareInfo, new GridMapSquarePainter(systemIcons), gameObjectParser, systemIcons); + public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final ResourceIcons resourceIcons, @NotNull final SmoothFaces smoothFaces) { + return new DefaultRendererFactory(mapViewSettings, filterControl, multiPositionData, isoMapSquareInfo, new GridMapSquarePainter(resourceIcons), gameObjectParser, resourceIcons); } /** Modified: trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/MapRendererTest.java =================================================================== --- trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/MapRendererTest.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/MapRendererTest.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -37,7 +37,7 @@ import net.sf.gridarta.model.mapmodel.TestMapModelCreator; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.NamedGameObjectMatcher; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import org.jetbrains.annotations.NotNull; import org.junit.Assert; import org.junit.Test; @@ -271,10 +271,10 @@ final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); final IsoMapSquareInfo isoMapSquareInfo = new IsoMapSquareInfo(1, 1, 1, 1); final MultiPositionData multiPositionData = new MultiPositionData(isoMapSquareInfo); - final SystemIcons systemIcons = mapModelCreator.getSystemIcons(); - final GridMapSquarePainter gridMapSquarePainter = new GridMapSquarePainter(systemIcons); + final ResourceIcons resourceIcons = mapModelCreator.getResourceIcons(); + final GridMapSquarePainter gridMapSquarePainter = new GridMapSquarePainter(resourceIcons); final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser = mapModelCreator.newGameObjectParser(); - return new TestMapRenderer(mapViewSettings, filterControl, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, systemIcons); + return new TestMapRenderer(mapViewSettings, filterControl, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons); } } Modified: trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/TestMapRenderer.java =================================================================== --- trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/TestMapRenderer.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/TestMapRenderer.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -34,7 +34,7 @@ import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import org.jetbrains.annotations.NotNull; /** @@ -67,10 +67,10 @@ * @param gridMapSquarePainter the grid square painter to use * @param gameObjectParser the game object parser for creating tooltip * information - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public TestMapRenderer(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<TestGameObject, TestMapArchObject, TestArchetype> filterControl, @NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final MapGrid mapGrid, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser, @NotNull final SystemIcons systemIcons) { - super(100, mapViewSettings, filterControl, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, systemIcons); + public TestMapRenderer(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<TestGameObject, TestMapArchObject, TestArchetype> filterControl, @NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final MapGrid mapGrid, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser, @NotNull final ResourceIcons resourceIcons) { + super(100, mapViewSettings, filterControl, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons); } /** Modified: trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParserTest.java =================================================================== --- trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParserTest.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParserTest.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -37,7 +37,6 @@ import net.sf.gridarta.model.io.AbstractArchetypeParser; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.utils.ResourceIcons; -import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.archetype.DefaultArchetypeFactory; import net.sf.gridarta.var.atrinik.model.gameobject.DefaultGameObjectFactory; @@ -143,8 +142,7 @@ protected AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ? extends AbstractArchetypeBuilder<GameObject, MapArchObject, Archetype>> newArchetypeParser() { final FaceObjects faceObjects = new DefaultFaceObjects(true); final ResourceIcons resourceIcons = new ResourceIcons(); - final SystemIcons systemIcons = new SystemIcons(resourceIcons); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, resourceIcons); final AnimationObjects animationObjects = new DefaultAnimationObjects(); final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -28,7 +28,7 @@ import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.smoothface.SmoothFaces; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; @@ -78,10 +78,10 @@ private final FaceObjectProviders faceObjectProviders; /** - * The {@link SystemIcons} for creating icons. + * The {@link ResourceIcons} for creating icons. */ @NotNull - private final SystemIcons systemIcons; + private final ResourceIcons resourceIcons; /** * Creates a new instance. @@ -93,16 +93,16 @@ * information * @param faceObjectProviders the face object providers for looking up * faces - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final SmoothFaces smoothFaces, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { + public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final SmoothFaces smoothFaces, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final ResourceIcons resourceIcons) { this.mapViewSettings = mapViewSettings; this.filterControl = filterControl; this.smoothFaces = smoothFaces; this.gridMapSquarePainter = gridMapSquarePainter; this.gameObjectParser = gameObjectParser; this.faceObjectProviders = faceObjectProviders; - this.systemIcons = systemIcons; + this.resourceIcons = resourceIcons; } /** @@ -112,7 +112,7 @@ @Override public SimpleFlatMapRenderer newSimpleMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { final SmoothingRenderer smoothingRenderer = new SmoothingRenderer(mapModel, smoothFaces, faceObjectProviders); - return new SimpleFlatMapRenderer(mapModel, systemIcons, smoothingRenderer); + return new SimpleFlatMapRenderer(mapModel, resourceIcons, smoothingRenderer); } /** @@ -122,7 +122,7 @@ @Override public FlatMapRenderer newMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid) { final SmoothingRenderer smoothingRenderer = new SmoothingRenderer(mapModel, smoothFaces, faceObjectProviders); - return new FlatMapRenderer(mapViewSettings, filterControl, mapModel, mapGrid, gridMapSquarePainter, gameObjectParser, systemIcons, smoothingRenderer); + return new FlatMapRenderer(mapViewSettings, filterControl, mapModel, mapGrid, gridMapSquarePainter, gameObjectParser, resourceIcons, smoothingRenderer); } /** Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -41,7 +41,7 @@ import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; @@ -150,13 +150,13 @@ * @param gridMapSquarePainter the grid square painter to use * @param gameObjectParser the game object parser for creating tooltip * information - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons * @param smoothingRenderer the smoothing renderer to use */ - public FlatMapRenderer(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final SystemIcons systemIcons, @NotNull final SmoothingRenderer smoothingRenderer) { + public FlatMapRenderer(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ResourceIcons resourceIcons, @NotNull final SmoothingRenderer smoothingRenderer) { super(mapViewSettings, mapModel, mapGrid, 32, gridMapSquarePainter, gameObjectParser); this.mapModel = mapModel; - emptySquareIcon = systemIcons.getEmptySquareIcon(); + emptySquareIcon = resourceIcons.getEmptySquareIcon(); this.filterControl = filterControl; this.mapViewSettings = mapViewSettings; this.smoothingRenderer = smoothingRenderer; Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -28,8 +28,8 @@ import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.Size2D; -import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; @@ -56,10 +56,10 @@ private final MapModel<GameObject, MapArchObject, Archetype> mapModel; /** - * The {@link SystemIcons} for creating icons. + * The {@link ResourceIcons} for creating icons. */ @NotNull - private final SystemIcons systemIcons; + private final ResourceIcons resourceIcons; /** * Temporary variable. @@ -77,13 +77,13 @@ /** * Creates a new instance. * @param mapModel the map model to render - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons * @param smoothingRenderer the smoothing renderer to use */ - public SimpleFlatMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final SystemIcons systemIcons, @NotNull final SmoothingRenderer smoothingRenderer) { + public SimpleFlatMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final ResourceIcons resourceIcons, @NotNull final SmoothingRenderer smoothingRenderer) { super(mapModel, null); this.mapModel = mapModel; - this.systemIcons = systemIcons; + this.resourceIcons = resourceIcons; this.smoothingRenderer = smoothingRenderer; } @@ -146,7 +146,7 @@ */ private void paintSquare(@NotNull final Graphics graphics, @NotNull final Point point) { if (mapModel.getMapSquare(point).isEmpty()) { - systemIcons.getEmptySquareIcon().paintIcon(this, graphics, point.x * IGUIConstants.SQUARE_WIDTH, point.y * IGUIConstants.SQUARE_HEIGHT); + resourceIcons.getEmptySquareIcon().paintIcon(this, graphics, point.x * IGUIConstants.SQUARE_WIDTH, point.y * IGUIConstants.SQUARE_HEIGHT); return; } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -89,7 +89,7 @@ import net.sf.gridarta.utils.ConfigFileUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GuiFileFilters; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.crossfire.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -285,9 +285,9 @@ */ @NotNull @Override - public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons, @NotNull final SmoothFaces smoothFaces) { - final GridMapSquarePainter gridMapSquarePainter = new GridMapSquarePainter(systemIcons); - return new DefaultRendererFactory(mapViewSettings, filterControl, smoothFaces, gridMapSquarePainter, gameObjectParser, faceObjectProviders, systemIcons); + public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final ResourceIcons resourceIcons, @NotNull final SmoothFaces smoothFaces) { + final GridMapSquarePainter gridMapSquarePainter = new GridMapSquarePainter(resourceIcons); + return new DefaultRendererFactory(mapViewSettings, filterControl, smoothFaces, gridMapSquarePainter, gameObjectParser, faceObjectProviders, resourceIcons); } /** Modified: trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java =================================================================== --- trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -25,7 +25,6 @@ import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.utils.ResourceIcons; -import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.archetype.DefaultArchetype; import org.jetbrains.annotations.NotNull; @@ -60,8 +59,7 @@ public GameObjectCreator() { final FaceObjects faceObjects = new DefaultFaceObjects(false); final ResourceIcons resourceIcons = new ResourceIcons(); - final SystemIcons systemIcons = new SystemIcons(resourceIcons); - faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); + faceObjectProviders = new FaceObjectProviders(1, faceObjects, resourceIcons); animationObjects = new DefaultAnimationObjects(); archetype = new DefaultArchetype("arch", faceObjectProviders, animationObjects); } Modified: trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java =================================================================== --- trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -36,7 +36,6 @@ import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.utils.ResourceIcons; -import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.archetype.DefaultArchetypeFactory; import net.sf.gridarta.var.crossfire.model.gameobject.DefaultGameObjectFactory; @@ -102,8 +101,7 @@ protected AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ? extends AbstractArchetypeBuilder<GameObject, MapArchObject, Archetype>> newArchetypeParser() { final FaceObjects faceObjects = new DefaultFaceObjects(false); final ResourceIcons resourceIcons = new ResourceIcons(); - final SystemIcons systemIcons = new SystemIcons(resourceIcons); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, resourceIcons); final AnimationObjects animationObjects = new DefaultAnimationObjects(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects); final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/IGUIConstants.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/IGUIConstants.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/IGUIConstants.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.daimonin; import net.sf.gridarta.gui.utils.GUIConstants; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; /** * Defines common UI constants used in different dialogs and all used icon @@ -73,7 +73,7 @@ String ARTIFACTS_FILE = "artifacts"; // file with artifact definitions - String TILE_NORTH = SystemIcons.SYSTEM_DIR + "north.png"; + String TILE_NORTH = ResourceIcons.SYSTEM_DIR + "north.png"; /** * Name of the files the spell information (names and numbers). Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -31,7 +31,7 @@ import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; @@ -81,10 +81,10 @@ private final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser; /** - * The {@link SystemIcons} for creating icons. + * The {@link ResourceIcons} for creating icons. */ @NotNull - private final SystemIcons systemIcons; + private final ResourceIcons resourceIcons; /** * Creates a new instance. @@ -96,16 +96,16 @@ * @param gridMapSquarePainter the grid square painter to use * @param gameObjectParser the game object parser for creating tooltip * information - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final SystemIcons systemIcons) { + public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ResourceIcons resourceIcons) { this.mapViewSettings = mapViewSettings; this.filterControl = filterControl; this.multiPositionData = multiPositionData; this.isoMapSquareInfo = isoMapSquareInfo; this.gridMapSquarePainter = gridMapSquarePainter; this.gameObjectParser = gameObjectParser; - this.systemIcons = systemIcons; + this.resourceIcons = resourceIcons; } /** @@ -114,7 +114,7 @@ @NotNull @Override public SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype> newSimpleMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { - return new SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapModel, multiPositionData, isoMapSquareInfo, systemIcons.getUnknownSquareIcon()); + return new SimpleIsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapModel, multiPositionData, isoMapSquareInfo, resourceIcons.getUnknownSquareIcon()); } /** @@ -123,7 +123,7 @@ @NotNull @Override public IsoMapRenderer<GameObject, MapArchObject, Archetype> newMapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid) { - return new IsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, filterControl, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, systemIcons); + return new IsoMapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, filterControl, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons); } /** @@ -132,7 +132,7 @@ @NotNull @Override public IsoPickmapRenderer<GameObject, MapArchObject, Archetype> newPickmapRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final MapGrid mapGrid) { - return new IsoPickmapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, systemIcons.getUnknownSquareIcon()); + return new IsoPickmapRenderer<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT, mapViewSettings, mapModel, mapGrid, multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getUnknownSquareIcon()); } } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -94,7 +94,7 @@ import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -394,8 +394,8 @@ */ @NotNull @Override - public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons, @NotNull final SmoothFaces smoothFaces) { - return new DefaultRendererFactory(mapViewSettings, filterControl, multiPositionData, isoMapSquareInfo, new GridMapSquarePainter(systemIcons), gameObjectParser, systemIcons); + public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final ResourceIcons resourceIcons, @NotNull final SmoothFaces smoothFaces) { + return new DefaultRendererFactory(mapViewSettings, filterControl, multiPositionData, isoMapSquareInfo, new GridMapSquarePainter(resourceIcons), gameObjectParser, resourceIcons); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -39,7 +39,7 @@ import net.sf.gridarta.utils.ActionUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.FileChooserUtils; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; @@ -126,13 +126,13 @@ /** * Creates a new instance. */ - public PluginController(@NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameters pluginParameters, @NotNull final Component parent, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final File pluginsDir, @NotNull final SystemIcons systemIcons) { + public PluginController(@NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameters pluginParameters, @NotNull final Component parent, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final File pluginsDir, @NotNull final ResourceIcons resourceIcons) { this.parent = parent; this.filterControl = filterControl; this.pluginModel = pluginModel; this.pluginParameters = pluginParameters; this.pluginsDir = pluginsDir; - view = new PluginView<G, A, R>(this, pluginModel, pluginParameterViewFactory, systemIcons); + view = new PluginView<G, A, R>(this, pluginModel, pluginParameterViewFactory, resourceIcons); pluginModel.addPluginModelListener(pluginModelListener); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -60,7 +60,7 @@ import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.parameter.NoSuchParameterException; import net.sf.gridarta.plugin.parameter.PluginParameter; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; @@ -163,9 +163,9 @@ * Create a visual JComponent used to edit the given script. * @param plugin the script object to edit * @param pluginController the associated script control instance - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public PluginEditor(@NotNull final Plugin<G, A, R> plugin, @NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { + public PluginEditor(@NotNull final Plugin<G, A, R> plugin, @NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final ResourceIcons resourceIcons) { this.pluginModel = pluginModel; this.plugin = plugin; this.pluginParameterViewFactory = pluginParameterViewFactory; @@ -184,13 +184,13 @@ optionsTab.add(new JPanel(), gbc); gbc.gridx = 1; gbc.weightx = 0.02; - final Component autoRunIcon = new JLabel(systemIcons.getAutoRunSmallIcon()); + final Component autoRunIcon = new JLabel(resourceIcons.getAutoRunSmallIcon()); optionsTab.add(autoRunIcon, gbc); gbc.gridy = 2; - final Component filterIcon = new JLabel(systemIcons.getFilterSmallIcon()); + final Component filterIcon = new JLabel(resourceIcons.getFilterSmallIcon()); optionsTab.add(filterIcon, gbc); gbc.gridy = 3; - final Component runPluginIcon = new JLabel(systemIcons.getRunPluginSmallIcon()); + final Component runPluginIcon = new JLabel(resourceIcons.getRunPluginSmallIcon()); optionsTab.add(runPluginIcon, gbc); gbc.gridx = 2; gbc.gridy = 1; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -48,7 +48,7 @@ import net.sf.gridarta.plugin.Plugin; import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.PluginModelListener; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -73,10 +73,10 @@ private final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory; /** - * The {@link SystemIcons} for creating icons. + * The {@link ResourceIcons} for creating icons. */ @NotNull - private final SystemIcons systemIcons; + private final ResourceIcons resourceIcons; //TODO fix a memory leak. If a script is remove, it stays in hash map along with it's visual component @@ -89,14 +89,14 @@ * Creates a PluginManager. * @param pluginController the script controller to base this script manager * on - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public PluginManager(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { + public PluginManager(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final ResourceIcons resourceIcons) { super("Editor plugins management"); this.pluginController = pluginController; this.pluginModel = pluginModel; this.pluginParameterViewFactory = pluginParameterViewFactory; - this.systemIcons = systemIcons; + this.resourceIcons = resourceIcons; getContentPane().setLayout(new BorderLayout()); final Container left = new JPanel(new BorderLayout()); getContentPane().add(left, BorderLayout.WEST); @@ -225,7 +225,7 @@ PluginEditor<G, A, R> pluginEditor = components.get(plugin); if (pluginEditor == null) { - pluginEditor = new PluginEditor<G, A, R>(plugin, pluginController, pluginModel, pluginParameterViewFactory, systemIcons); + pluginEditor = new PluginEditor<G, A, R>(plugin, pluginController, pluginModel, pluginParameterViewFactory, resourceIcons); components.put(plugin, pluginEditor); scriptPanel.add(pluginEditor, Integer.toString(pluginEditor.hashCode())); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -27,7 +27,7 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.utils.EditorAction; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; @@ -61,27 +61,27 @@ private final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory; /** - * The {@link SystemIcons} for creating icons. + * The {@link ResourceIcons} for creating icons. */ @NotNull - private final SystemIcons systemIcons; + private final ResourceIcons resourceIcons; /** * Creates a new instance. - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public PluginManagerFactory(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { + public PluginManagerFactory(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final ResourceIcons resourceIcons) { this.pluginController = pluginController; this.pluginModel = pluginModel; this.pluginParameterViewFactory = pluginParameterViewFactory; - this.systemIcons = systemIcons; + this.resourceIcons = resourceIcons; } @ActionMethod public void editPlugins() { synchronized (sync) { if (scriptManager == null) { - scriptManager = new PluginManager<G, A, R>(pluginController, pluginModel, pluginParameterViewFactory, systemIcons); + scriptManager = new PluginManager<G, A, R>(pluginController, pluginModel, pluginParameterViewFactory, resourceIcons); } scriptManager.pack(); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -45,7 +45,7 @@ import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.PluginModelListener; import net.sf.gridarta.plugin.parameter.PluginParameter; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -76,10 +76,10 @@ private final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory; /** - * The {@link SystemIcons} for creating icons. + * The {@link ResourceIcons} for creating icons. */ @NotNull - private final SystemIcons systemIcons; + private final ResourceIcons resourceIcons; /** * The menu to add script commands to. @@ -132,15 +132,15 @@ * Creates a PluginView. * @param pluginController controller of this PluginView * @param pluginModel the script model - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons * @warning Creating a view from a controller instead of a model is error * prone. */ - public PluginView(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { + public PluginView(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final ResourceIcons resourceIcons) { this.pluginController = pluginController; this.pluginModel = pluginModel; this.pluginParameterViewFactory = pluginParameterViewFactory; - this.systemIcons = systemIcons; + this.resourceIcons = resourceIcons; pluginModel.addPluginModelListener(pluginModelListener); } @@ -192,7 +192,7 @@ if (console == null) { console = new JFrame("Beanshell scripts I/O Console"); console.setSize(400, 200); - consolePane = new CloseableTabbedPane(systemIcons.getCloseTabSmallIcon()); + consolePane = new CloseableTabbedPane(resourceIcons.getCloseTabSmallIcon()); console.getContentPane().add(consolePane); } console.setVisible(true); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -23,7 +23,7 @@ import java.awt.Image; import java.awt.image.ImageObserver; import net.sf.gridarta.model.mapgrid.MapGrid; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import org.jetbrains.annotations.NotNull; /** @@ -81,18 +81,18 @@ /** * Creates a new instance. - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public GridMapSquarePainter(@NotNull final SystemIcons systemIcons) { - selImg = systemIcons.getMapSelectedIcon().getImage(); - selImgNorth = systemIcons.getMapSelectedIconNorth().getImage(); - selImgEast = systemIcons.getMapSelectedIconEast().getImage(); - selImgSouth = systemIcons.getMapSelectedIconSouth().getImage(); - selImgWest = systemIcons.getMapSelectedIconWest().getImage(); - preSelImg = systemIcons.getMapPreSelectedIcon().getImage(); - cursorImg = systemIcons.getMapCursorIcon().getImage(); - warningSquareImg = systemIcons.getWarningSquareIcon().getImage(); - lightSquare = systemIcons.getLightSquareIcon().getImage(); + public GridMapSquarePainter(@NotNull final ResourceIcons resourceIcons) { + selImg = resourceIcons.getMapSelectedIcon().getImage(); + selImgNorth = resourceIcons.getMapSelectedIconNorth().getImage(); + selImgEast = resourceIcons.getMapSelectedIconEast().getImage(); + selImgSouth = resourceIcons.getMapSelectedIconSouth().getImage(); + selImgWest = resourceIcons.getMapSelectedIconWest().getImage(); + preSelImg = resourceIcons.getMapPreSelectedIcon().getImage(); + cursorImg = resourceIcons.getMapCursorIcon().getImage(); + warningSquareImg = resourceIcons.getWarningSquareIcon().getImage(); + lightSquare = resourceIcons.getLightSquareIcon().getImage(); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2013-10-17 21:05:52 UTC (rev 9477) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2013-10-17 21:35:29 UTC (rev 9478) @@ -38,7 +38,7 @@ import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.ResourceIcons; import org.jetbrains.annotations.NotNull; /** @@ -118,12 +118,12 @@ * @param gridMapSquarePainter the grid square painter to use * @param gameObjectParser the game object parser for creating tooltip * information - * @param systemIcons the system icons for creating icons + * @param resourceIcons the resource icons for creating icons */ - public IsoMapRenderer(final int spawnPointTypeNo, @NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final MapModel<G, A, R> mapModel, @NotNull final MapGrid mapGrid, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final SystemIcons systemIcons) { - super(spawnPointTypeNo, mapViewSettings, mapModel, mapGrid, isoMapSquareInfo.getXLen(), 2 * isoMapSquareInfo.getYLen(), multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, systemIcons.getUnknownSquareIcon()); + public IsoMapRenderer(final int spawnPointTypeNo, @NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final MapModel<G, A, R> mapModel, @NotNull final MapGrid mapGrid, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final ResourceIcons resourceIcons) { + super(spawnPointTypeNo, mapViewSettings, mapModel, mapGrid, isoMapSquareInfo.getXLen(), 2 * isoMapSquareInfo.getYLen(), multiPositionData, isoMapSquareInfo, gridMapSquarePainter, gameObjectParser, resourceIcons.getUnknownSquareIcon()); this.filterControl = filterControl; - emptySquareIcon = systemIcons.getEmptySquareIcon(); + empty... [truncated message content] |
From: <aki...@us...> - 2013-10-17 21:05:57
|
Revision: 9477 http://sourceforge.net/p/gridarta/code/9477 Author: akirschbaum Date: 2013-10-17 21:05:52 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Move code from EditorFactory implementations to GUIMainControl. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-17 20:45:31 UTC (rev 9476) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-17 21:05:52 UTC (rev 9477) @@ -22,7 +22,6 @@ import java.awt.Component; import java.io.IOException; import java.net.URL; -import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; @@ -95,7 +94,6 @@ import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; -import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.actions.AtrinikServerActions; @@ -562,9 +560,10 @@ /** * {@inheritDoc} */ + @NotNull @Override - public ImageIcon getCompassIcon(@NotNull final ResourceIcons resourceIcons) { - return resourceIcons.getResourceIcon(IGUIConstants.TILE_NORTH); + public String getCompassIconName() { + return IGUIConstants.TILE_NORTH; } /** Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-17 20:45:31 UTC (rev 9476) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-17 21:05:52 UTC (rev 9477) @@ -20,7 +20,6 @@ package net.sf.gridarta.var.crossfire.maincontrol; import java.awt.Component; -import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; @@ -90,7 +89,6 @@ import net.sf.gridarta.utils.ConfigFileUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GuiFileFilters; -import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.gui.map.renderer.DefaultRendererFactory; @@ -453,8 +451,9 @@ /** * {@inheritDoc} */ + @Nullable @Override - public ImageIcon getCompassIcon(@NotNull final ResourceIcons resourceIcons) { + public String getCompassIconName() { return null; } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-17 20:45:31 UTC (rev 9476) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-17 21:05:52 UTC (rev 9477) @@ -22,7 +22,6 @@ import java.awt.Component; import java.io.IOException; import java.net.URL; -import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; @@ -95,7 +94,6 @@ import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; -import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory; @@ -561,9 +559,10 @@ /** * {@inheritDoc} */ + @NotNull @Override - public ImageIcon getCompassIcon(@NotNull final ResourceIcons resourceIcons) { - return resourceIcons.getResourceIcon(IGUIConstants.TILE_NORTH); + public String getCompassIconName() { + return IGUIConstants.TILE_NORTH; } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-17 20:45:31 UTC (rev 9476) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-17 21:05:52 UTC (rev 9477) @@ -20,7 +20,6 @@ package net.sf.gridarta.maincontrol; import java.awt.Component; -import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; @@ -60,7 +59,6 @@ import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.project.ProjectFactory; import net.sf.gridarta.utils.EditorAction; -import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.prefs.PreferencesGroup; import org.jetbrains.annotations.NotNull; @@ -251,12 +249,11 @@ boolean isAllowRandomMapParameters(); /** - * Returns the icon to display in the selected square view. - * @param resourceIcons the gui utils for creating icons - * @return the icon or {@code null} to display no icon + * Returns the icon name to display in the selected square view. + * @return the icon name or {@code null} to display no icon */ @Nullable - ImageIcon getCompassIcon(@NotNull ResourceIcons resourceIcons); + String getCompassIconName(); /** * Returns the filename of the editor's .jar file. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 20:45:31 UTC (rev 9476) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 21:05:52 UTC (rev 9477) @@ -541,7 +541,9 @@ mainViewFrame.add(new MainToolbar(editorSettings).getComponent(), BorderLayout.NORTH); mainViewFrame.add(statusBar, BorderLayout.SOUTH); mainView.addTab(gameObjectTab); - mainView.addTab(new Tab("selectedSquare", new SelectedSquareView<G, A, R>(selectedSquareModel, gameObjectAttributesDialogFactory, objectChooser, mapViewManager, mapViewSettings, editorFactory.getCompassIcon(resourceIcons), projectModel.getFaceObjectProviders(), unknownSquareIcon, moveSquareUpAction, moveSquareDownAction, moveSquareTopAction, moveSquareBottomAction, moveSquareEnvAction, moveSquareInvAction), Location.RIGHT, false, 1, true)); + final String compassIconName = editorFactory.getCompassIconName(); + final ImageIcon compassIcon = compassIconName == null ? null : resourceIcons.getResourceIcon(compassIconName); + mainView.addTab(new Tab("selectedSquare", new SelectedSquareView<G, A, R>(selectedSquareModel, gameObjectAttributesDialogFactory, objectChooser, mapViewManager, mapViewSettings, compassIcon, projectModel.getFaceObjectProviders(), unknownSquareIcon, moveSquareUpAction, moveSquareDownAction, moveSquareTopAction, moveSquareBottomAction, moveSquareEnvAction, moveSquareInvAction), Location.RIGHT, false, 1, true)); mainView.addTab(new Tab("tools", toolPalette, Location.LEFT, false, 2, false)); mainView.addTab(new Tab("objects", objectChooser, Location.LEFT, false, 3, true)); final JMenu windowMenu = MenuUtils.getMenu(menuBar, "window"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 20:45:35
|
Revision: 9476 http://sourceforge.net/p/gridarta/code/9476 Author: akirschbaum Date: 2013-10-17 20:45:31 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Rename GUIUtils to ResourceIcons. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParserTest.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/MapPreview.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypeset/DefaultArchetypeSetTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/artifact/TestParser.java trunk/src/model/src/test/java/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/io/ArchetypeParserTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/io/AttributeListUtilsTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java trunk/src/model/src/test/java/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java Added Paths: ----------- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java Removed Paths: ------------- trunk/src/utils/src/main/java/net/sf/gridarta/utils/GUIUtils.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -93,9 +93,9 @@ import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.validation.checks.InvalidCheckException; import net.sf.gridarta.utils.EditorAction; -import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.actions.AtrinikServerActions; @@ -563,8 +563,8 @@ * {@inheritDoc} */ @Override - public ImageIcon getCompassIcon(@NotNull final GUIUtils guiUtils) { - return guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH); + public ImageIcon getCompassIcon(@NotNull final ResourceIcons resourceIcons) { + return resourceIcons.getResourceIcon(IGUIConstants.TILE_NORTH); } /** Modified: trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParserTest.java =================================================================== --- trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParserTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParserTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -36,7 +36,7 @@ import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.AbstractArchetypeParser; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.archetype.DefaultArchetypeFactory; @@ -142,8 +142,8 @@ @Override protected AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ? extends AbstractArchetypeBuilder<GameObject, MapArchObject, Archetype>> newArchetypeParser() { final FaceObjects faceObjects = new DefaultFaceObjects(true); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new DefaultAnimationObjects(); final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -89,8 +89,8 @@ import net.sf.gridarta.model.validation.checks.InvalidCheckException; import net.sf.gridarta.utils.ConfigFileUtils; import net.sf.gridarta.utils.EditorAction; -import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.gui.map.renderer.DefaultRendererFactory; @@ -454,7 +454,7 @@ * {@inheritDoc} */ @Override - public ImageIcon getCompassIcon(@NotNull final GUIUtils guiUtils) { + public ImageIcon getCompassIcon(@NotNull final ResourceIcons resourceIcons) { return null; } Modified: trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java =================================================================== --- trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -24,7 +24,7 @@ import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.archetype.DefaultArchetype; @@ -59,8 +59,8 @@ */ public GameObjectCreator() { final FaceObjects faceObjects = new DefaultFaceObjects(false); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); animationObjects = new DefaultAnimationObjects(); archetype = new DefaultArchetype("arch", faceObjectProviders, animationObjects); Modified: trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java =================================================================== --- trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -35,7 +35,7 @@ import net.sf.gridarta.model.io.AbstractArchetypeParserTest; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.smoothface.SmoothFaces; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.archetype.DefaultArchetypeFactory; @@ -101,8 +101,8 @@ @Override protected AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ? extends AbstractArchetypeBuilder<GameObject, MapArchObject, Archetype>> newArchetypeParser() { final FaceObjects faceObjects = new DefaultFaceObjects(false); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new DefaultAnimationObjects(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects); Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -93,9 +93,9 @@ import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.validation.checks.InvalidCheckException; import net.sf.gridarta.utils.EditorAction; -import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory; @@ -562,8 +562,8 @@ * {@inheritDoc} */ @Override - public ImageIcon getCompassIcon(@NotNull final GUIUtils guiUtils) { - return guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH); + public ImageIcon getCompassIcon(@NotNull final ResourceIcons resourceIcons) { + return resourceIcons.getResourceIcon(IGUIConstants.TILE_NORTH); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/MapPreview.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/MapPreview.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/MapPreview.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -111,7 +111,7 @@ frame = new JFrame("Map Previewer"); // WARNING: Do not set the icon. There's a bug that will prevent the frame from getting properly disposed. // This code will be put back in as soon as sun fixes the setIconImage() bug in their java.awt.peer.FramePeer impl. - //ImageIcon icon = GUIUtils.getIcon(GUIConstants.APP_ICON); + //ImageIcon icon = ResourceIcons.getIcon(GUIConstants.APP_ICON); //if (icon != null) { // frame.setIconImage(icon.getImage()); //} Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -60,7 +60,7 @@ import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.project.ProjectFactory; import net.sf.gridarta.utils.EditorAction; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.prefs.PreferencesGroup; import org.jetbrains.annotations.NotNull; @@ -252,11 +252,11 @@ /** * Returns the icon to display in the selected square view. - * @param guiUtils the gui utils for creating icons + * @param resourceIcons the gui utils for creating icons * @return the icon or {@code null} to display no icon */ @Nullable - ImageIcon getCompassIcon(@NotNull GUIUtils guiUtils); + ImageIcon getCompassIcon(@NotNull ResourceIcons resourceIcons); /** * Returns the filename of the editor's .jar file. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -205,8 +205,8 @@ import net.sf.gridarta.utils.ActionUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.Exiter; -import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -301,12 +301,12 @@ * @param projectModel the project model to edit * @param editorSettings the editor settings instance * @param errorView the error view for reporting errors - * @param guiUtils the gui utils for creating icons + * @param resourceIcons the gui utils for creating icons * @param editorFactory the editor factory instance * @param systemIcons the system icons for creating icons * @param configSourceFactory the config source factory instance */ - public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory) { + public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final ResourceIcons resourceIcons, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory) { this.projectModel = projectModel; final NamedFilter defaultNamedFilterList = new NamedFilter(projectModel.getGameObjectMatchers().getFilters()); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); @@ -541,7 +541,7 @@ mainViewFrame.add(new MainToolbar(editorSettings).getComponent(), BorderLayout.NORTH); mainViewFrame.add(statusBar, BorderLayout.SOUTH); mainView.addTab(gameObjectTab); - mainView.addTab(new Tab("selectedSquare", new SelectedSquareView<G, A, R>(selectedSquareModel, gameObjectAttributesDialogFactory, objectChooser, mapViewManager, mapViewSettings, editorFactory.getCompassIcon(guiUtils), projectModel.getFaceObjectProviders(), unknownSquareIcon, moveSquareUpAction, moveSquareDownAction, moveSquareTopAction, moveSquareBottomAction, moveSquareEnvAction, moveSquareInvAction), Location.RIGHT, false, 1, true)); + mainView.addTab(new Tab("selectedSquare", new SelectedSquareView<G, A, R>(selectedSquareModel, gameObjectAttributesDialogFactory, objectChooser, mapViewManager, mapViewSettings, editorFactory.getCompassIcon(resourceIcons), projectModel.getFaceObjectProviders(), unknownSquareIcon, moveSquareUpAction, moveSquareDownAction, moveSquareTopAction, moveSquareBottomAction, moveSquareEnvAction, moveSquareInvAction), Location.RIGHT, false, 1, true)); mainView.addTab(new Tab("tools", toolPalette, Location.LEFT, false, 2, false)); mainView.addTab(new Tab("objects", objectChooser, Location.LEFT, false, 3, true)); final JMenu windowMenu = MenuUtils.getMenu(menuBar, "window"); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -53,7 +53,7 @@ import net.sf.gridarta.preferences.FilePreferencesFactory; import net.sf.gridarta.project.ProjectModel; import net.sf.gridarta.utils.ConfigFileUtils; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SyntaxErrorException; import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.action.ActionBuilder; @@ -187,8 +187,8 @@ // Create the application and give it the parameters final ErrorView errorView = GraphicsEnvironment.isHeadless() || mode.isConsoleMode() || plugin != null ? new ConsoleErrorView() : new DefaultErrorView(null); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final ConfigSourceFactory configSourceFactory = new DefaultConfigSourceFactory(); final EditorSettings editorSettings = new DefaultEditorSettings(); final ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); @@ -201,7 +201,7 @@ try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, projectModel, editorSettings, systemIcons); + returnCode = runNormal(args2, editorFactory, errorView, resourceIcons, configSourceFactory, projectModel, editorSettings, systemIcons); break; case BATCH_PNG: @@ -282,20 +282,20 @@ * @param args the files to open * @param editorFactory the editor factory to use * @param errorView the error view to add errors to - * @param guiUtils the gui utils to use + * @param resourceIcons the gui utils to use * @param configSourceFactory the config source factory to use * @param projectModel the project model to use * @param editorSettings the editor settings * @param systemIcons the system icons for creating icons * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final ResourceIcons resourceIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { @Override public void run() { - guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, editorSettings, errorView, guiUtils, editorFactory, systemIcons, configSourceFactory); + guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, editorSettings, errorView, resourceIcons, editorFactory, systemIcons, configSourceFactory); } }; Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/archetypeset/DefaultArchetypeSetTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/archetypeset/DefaultArchetypeSetTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/archetypeset/DefaultArchetypeSetTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -33,7 +33,7 @@ import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import org.junit.Assert; import org.junit.Test; @@ -51,8 +51,8 @@ @Test public void testRetainLoadOrder() throws DuplicateArchetypeException { final FaceObjects faceObjects = new TestFaceObjects(); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new TestAnimationObjects(); final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory = new TestArchetypeFactory(faceObjectProviders, animationObjects); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -28,7 +28,7 @@ import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.TestFaceObjects; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import org.junit.Assert; import org.junit.Test; @@ -44,8 +44,8 @@ */ @Test public void testAttributes1() { - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjects faceObjects = new TestFaceObjects(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new TestAnimationObjects(); @@ -61,8 +61,8 @@ */ @Test public void testAttributes2() { - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjects faceObjects = new TestFaceObjects(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new TestAnimationObjects(); @@ -91,8 +91,8 @@ */ @Test public void testAttributes3() { - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjects faceObjects = new TestFaceObjects(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new TestAnimationObjects(); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/artifact/TestParser.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/artifact/TestParser.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/artifact/TestParser.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -47,7 +47,7 @@ import net.sf.gridarta.model.io.AbstractArchetypeParser; import net.sf.gridarta.model.io.TestArchetypeParser; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; @@ -99,8 +99,8 @@ * @param errorView the error view to use for parsing */ public TestParser(@NotNull final TestErrorView errorView) { - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final File file = new File("*string*"); errorViewCollector = new ErrorViewCollector(errorView, file); final FaceObjects faceObjects = new TestFaceObjects(); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -34,7 +34,7 @@ import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.TestMapModelCreator; import net.sf.gridarta.model.mapmodel.TopmostInsertionMode; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -542,8 +542,8 @@ */ @Before public void setUp() { - final GUIUtils guiUtils = new GUIUtils(); - systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + systemIcons = new SystemIcons(resourceIcons); } } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/io/ArchetypeParserTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/io/ArchetypeParserTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/io/ArchetypeParserTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -35,7 +35,7 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -194,8 +194,8 @@ @Override protected AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype, ? extends AbstractArchetypeBuilder<TestGameObject, TestMapArchObject, TestArchetype>> newArchetypeParser() { final FaceObjects faceObjects = new TestFaceObjects(); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new TestAnimationObjects(); final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/io/AttributeListUtilsTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/io/AttributeListUtilsTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/io/AttributeListUtilsTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -27,7 +27,7 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.junit.Assert; @@ -96,8 +96,8 @@ @NotNull private static BaseObject<?, ?, ?, ?> newArchetype(@NotNull final String objectText) { final FaceObjects faceObjects = new TestFaceObjects(); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new TestAnimationObjects(); final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -51,7 +51,7 @@ import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; @@ -141,14 +141,14 @@ */ public TestMapModelCreator(final boolean createIcons) { autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); - final GUIUtils guiUtils = new GUIUtils(); + final ResourceIcons resourceIcons = new ResourceIcons(); if (createIcons) { final ImageIcon imageIcon = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB)); for (final String iconName : ICON_NAMES) { - guiUtils.addToCache(iconName, imageIcon); + resourceIcons.addToCache(iconName, imageIcon); } } - systemIcons = new SystemIcons(guiUtils); + systemIcons = new SystemIcons(resourceIcons); final FaceObjects faceObjects = new TestFaceObjects(); faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final FaceProvider faceProvider = new EmptyFaceProvider(); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -30,7 +30,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -173,8 +173,8 @@ */ @Before public void setUp() { - final GUIUtils guiUtils = new GUIUtils(); - systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + systemIcons = new SystemIcons(resourceIcons); } } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -55,7 +55,7 @@ import net.sf.gridarta.model.io.AbstractArchetypeParser; import net.sf.gridarta.model.io.TestArchetypeParser; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.ResourceIcons; import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -163,8 +163,8 @@ private static AnimationObjects readAnimations(@NotNull final File archDirectory, @NotNull final File collectedDirectory) { final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final FaceObjects faceObjects = new TestFaceObjects(); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); + final ResourceIcons resourceIcons = new ResourceIcons(); + final SystemIcons systemIcons = new SystemIcons(resourceIcons); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); final AnimationObjects animationObjects = new TestAnimationObjects(); final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory = new TestArchetypeFactory(faceObjectProviders, animationObjects); Deleted: trunk/src/utils/src/main/java/net/sf/gridarta/utils/GUIUtils.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/GUIUtils.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/GUIUtils.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -1,105 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.utils; - -import java.io.File; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.MissingResourceException; -import javax.swing.ImageIcon; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -/** - * <code>CGUtils</code> is a collection of GUI utility methods. Mainly focusing - * on resource management. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class GUIUtils { - - /** - * The Logger for printing log messages. - */ - private static final Category log = Logger.getLogger(GUIUtils.class); - - /** - * Caches image icons. Maps icon name to image icon. - */ - @NotNull - private final Map<String, ImageIcon> imageCache = new HashMap<String, ImageIcon>(); - - /** - * Returns the image icon for the given icon name. Loads every icon only - * once and uses hash table to return the same instance if same icon name is - * given. Note: There must not be conflicting icon names from different - * directories. - * @param iconName the icon name - * @return the image icon for the given icon name - * @throws MissingResourceException if the icon cannot be loaded - */ - @NotNull - public ImageIcon getResourceIcon(@NotNull final String iconName) throws MissingResourceException { - // check cache - if (imageCache.containsKey(iconName)) { - if (log.isDebugEnabled()) { - log.debug("getResourceIcon(" + iconName + "): return cached"); - } - return imageCache.get(iconName); - } - - @NotNull final ImageIcon icon; - - final URL iconURL = GUIUtils.class.getClassLoader().getResource(iconName); - if (iconURL != null) { - if (log.isDebugEnabled()) { - log.debug("getResourceIcon(" + iconName + "): loading from resource: " + iconURL); - } - icon = new ImageIcon(iconURL); - } else { - final File iconFile = new File(iconName); - if (iconFile.exists()) { - if (log.isDebugEnabled()) { - log.debug("getResourceIcon(" + iconName + "): loading from file: " + iconFile); - } - icon = new ImageIcon(iconFile.getAbsolutePath()); - } else { - log.warn("Cannot find icon '" + iconName + "'"); - throw new MissingResourceException("missing resource: icon " + iconName, GUIUtils.class.getName(), iconName); - } - } - - imageCache.put(iconName, icon); - return icon; - } - - /** - * Add an image to the cache. - * @param name the name - * @param imageIcon the image icon - */ - public void addToCache(@NotNull final String name, @NotNull final ImageIcon imageIcon) { - imageCache.put(name, imageIcon); - } - -} Copied: trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java (from rev 9453, trunk/src/utils/src/main/java/net/sf/gridarta/utils/GUIUtils.java) =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java (rev 0) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -0,0 +1,106 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.utils; + +import java.io.File; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.MissingResourceException; +import javax.swing.ImageIcon; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +/** + * Creates {@link ImageIcon} instances from resources. The returned image icons + * are cached. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ +public class ResourceIcons { + + /** + * The Logger for printing log messages. + */ + private static final Category log = Logger.getLogger(ResourceIcons.class); + + /** + * Caches image icons. Maps icon name to image icon. + */ + @NotNull + private final Map<String, ImageIcon> imageCache = new HashMap<String, ImageIcon>(); + + /** + * Returns the image icon for the given icon name. Loads every icon only + * once and uses hash table to return the same instance if same icon name is + * given. Note: There must not be conflicting icon names from different + * directories. + * @param iconName the icon name + * @return the image icon for the given icon name + * @throws MissingResourceException if the icon cannot be loaded + */ + @NotNull + public ImageIcon getResourceIcon(@NotNull final String iconName) throws MissingResourceException { + // check cache + if (imageCache.containsKey(iconName)) { + if (log.isDebugEnabled()) { + log.debug("getResourceIcon(" + iconName + "): return cached"); + } + return imageCache.get(iconName); + } + + @NotNull final ImageIcon icon; + + final URL iconURL = ResourceIcons.class.getClassLoader().getResource(iconName); + if (iconURL != null) { + if (log.isDebugEnabled()) { + log.debug("getResourceIcon(" + iconName + "): loading from resource: " + iconURL); + } + icon = new ImageIcon(iconURL); + } else { + final File iconFile = new File(iconName); + if (iconFile.exists()) { + if (log.isDebugEnabled()) { + log.debug("getResourceIcon(" + iconName + "): loading from file: " + iconFile); + } + icon = new ImageIcon(iconFile.getAbsolutePath()); + } else { + log.warn("Cannot find icon '" + iconName + "'"); + throw new MissingResourceException("missing resource: icon " + iconName, ResourceIcons.class.getName(), iconName); + } + } + + imageCache.put(iconName, icon); + return icon; + } + + /** + * Add an image to the cache. + * @param name the name + * @param imageIcon the image icon + */ + public void addToCache(@NotNull final String name, @NotNull final ImageIcon imageIcon) { + imageCache.put(name, imageIcon); + } + +} Property changes on: trunk/src/utils/src/main/java/net/sf/gridarta/utils/ResourceIcons.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:mergeinfo ## -0,0 +1 ## +/streams/cher-japi-update/src/app/net/sf/gridarta/gui/utils/GUIUtils.java:5966-5991 \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java 2013-10-17 20:35:48 UTC (rev 9475) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java 2013-10-17 20:45:31 UTC (rev 9476) @@ -107,10 +107,10 @@ private static final String APP_ICON = ICON_DIR + "app_icon.gif"; /** - * The {@link GUIUtils} for creating icons. + * The {@link ResourceIcons} for creating icons. */ @NotNull - private final GUIUtils guiUtils; + private final ResourceIcons resourceIcons; @Nullable private ImageIcon mapSelIcon; @@ -195,17 +195,17 @@ /** * Creates a new instance. - * @param guiUtils the gui utils for creating icons + * @param resourceIcons the gui utils for creating icons */ - public SystemIcons(@NotNull final GUIUtils guiUtils) { - this.guiUtils = guiUtils; + public SystemIcons(@NotNull final ResourceIcons resourceIcons) { + this.resourceIcons = resourceIcons; } @NotNull @SuppressWarnings("NullableProblems") public ImageIcon getMapCursorIcon() { if (mapCursorIcon == null) { - mapCursorIcon = guiUtils.getResourceIcon(SQUARE_CURSOR); + mapCursorIcon = resourceIcons.getResourceIcon(SQUARE_CURSOR); } return mapCursorIcon; } @@ -214,7 +214,7 @@ @SuppressWarnings("NullableProblems") public Icon getEmptySquareIcon() { if (emptySquareIcon == null) { - emptySquareIcon = guiUtils.getResourceIcon(SQUARE_EMPTY); + emptySquareIcon = resourceIcons.getResourceIcon(SQUARE_EMPTY); } return emptySquareIcon; } @@ -223,7 +223,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getUnknownSquareIcon() { if (unknownSquareIcon == null) { - unknownSquareIcon = guiUtils.getResourceIcon(SQUARE_UNKNOWN); + unknownSquareIcon = resourceIcons.getResourceIcon(SQUARE_UNKNOWN); } return unknownSquareIcon; } @@ -233,7 +233,7 @@ public ImageIcon getWarningSquareIcon() { if (warningSquareIcon == null) { final ImageFilter alphaFilter = AlphaImageFilterInstance.ALPHA_FILTER; - final ImageIcon sysIcon = guiUtils.getResourceIcon(SQUARE_WARNING); + final ImageIcon sysIcon = resourceIcons.getResourceIcon(SQUARE_WARNING); final Image image = sysIcon.getImage(); final ImageProducer source = image.getSource(); final ImageProducer producer = new FilteredImageSource(source, alphaFilter); @@ -253,7 +253,7 @@ public ImageIcon getLightSquareIcon() { if (lightSquareIcon == null) { final ImageFilter alphaFilter = AlphaImageFilterInstance.ALPHA_FILTER; - final ImageIcon sysIcon = guiUtils.getResourceIcon(SQUARE_LIGHT); + final ImageIcon sysIcon = resourceIcons.getResourceIcon(SQUARE_LIGHT); final Image image = sysIcon.getImage(); final ImageProducer source = image.getSource(); final ImageProducer producer = new FilteredImageSource(source, alphaFilter); @@ -267,7 +267,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getNoFaceSquareIcon() { if (noFaceSquareIcon == null) { - noFaceSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_FACE); + noFaceSquareIcon = resourceIcons.getResourceIcon(SQUARE_NO_FACE); } return noFaceSquareIcon; } @@ -276,7 +276,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getNoArchSquareIcon() { if (noArchSquareIcon == null) { - noArchSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_ARCH); + noArchSquareIcon = resourceIcons.getResourceIcon(SQUARE_NO_ARCH); } return noArchSquareIcon; } @@ -285,7 +285,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIcon() { if (mapSelIcon == null) { - mapSelIcon = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE); + mapSelIcon = resourceIcons.getResourceIcon(SQUARE_SELECTED_SQUARE); } return mapSelIcon; } @@ -294,7 +294,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIconNorth() { if (mapSelIconNorth == null) { - mapSelIconNorth = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_NORTH); + mapSelIconNorth = resourceIcons.getResourceIcon(SQUARE_SELECTED_SQUARE_NORTH); } return mapSelIconNorth; } @@ -303,7 +303,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIconEast() { if (mapSelIconEast == null) { - mapSelIconEast = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_EAST); + mapSelIconEast = resourceIcons.getResourceIcon(SQUARE_SELECTED_SQUARE_EAST); } return mapSelIconEast; } @@ -312,7 +312,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIconSouth() { if (mapSelIconSouth == null) { - mapSelIconSouth = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_SOUTH); + mapSelIconSouth = resourceIcons.getResourceIcon(SQUARE_SELECTED_SQUARE_SOUTH); } return mapSelIconSouth; } @@ -321,7 +321,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIconWest() { if (mapSelIconWest == null) { - mapSelIconWest = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_WEST); + mapSelIconWest = resourceIcons.getResourceIcon(SQUARE_SELECTED_SQUARE_WEST); } return mapSelIconWest; } @@ -330,7 +330,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getMapPreSelectedIcon() { if (mapPreSelIcon == null) { - mapPreSelIcon = guiUtils.getResourceIcon(SQUARE_PRE_SELECTED_SQUARE); + mapPreSelIcon = resourceIcons.getResourceIcon(SQUARE_PRE_SELECTED_SQUARE); } return mapPreSelIcon; } @@ -343,7 +343,7 @@ @SuppressWarnings("NullableProblems") public Image getDefaultIcon() { if (defaultIcon == null) { - final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_ICON); + final ImageIcon icon = resourceIcons.getResourceIcon(DEFAULT_ICON); defaultIcon = icon.getImage(); } assert defaultIcon != null; @@ -358,7 +358,7 @@ @SuppressWarnings("NullableProblems") public Image getDefaultPreview() { if (defaultPreview == null) { - final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_PREVIEW); + final ImageIcon icon = resourceIcons.getResourceIcon(DEFAULT_PREVIEW); defaultPreview = icon.getImage(); } assert defaultPreview != null; @@ -369,7 +369,7 @@ @SuppressWarnings("NullableProblems") public Icon getTreasureListIcon() { if (treasureListIcon == null) { - treasureListIcon = guiUtils.getResourceIcon(TREASURE_LIST); + treasureListIcon = resourceIcons.getResourceIcon(TREASURE_LIST); } return treasureListIcon; } @@ -378,7 +378,7 @@ @SuppressWarnings("NullableProblems") public Icon getTreasureOneListIcon() { if (treasureOneListIcon == null) { - treasureOneListIcon = guiUtils.getResourceIcon(TREASUREONE_LIST); + treasureOneListIcon = resourceIcons.getResourceIcon(TREASUREONE_LIST); } return treasureOneListIcon; } @@ -387,7 +387,7 @@ @SuppressWarnings("NullableProblems") public Icon getTreasureYesIcon() { if (treasureYesIcon == null) { - treasureYesIcon = guiUtils.getResourceIcon(TREASURE_YES); + treasureYesIcon = resourceIcons.getResourceIcon(TREASURE_YES); } return treasureYesIcon; } @@ -396,7 +396,7 @@ @SuppressWarnings("NullableProblems") public Icon getTreasureNoIcon() { if (treasureNoIcon == null) { - treasureNoIcon = guiUtils.getResourceIcon(TREASURE_NO); + treasureNoIcon = resourceIcons.getResourceIcon(TREASURE_NO); } return treasureNoIcon; } @@ -405,7 +405,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getCloseTabSmallIcon() { if (closeTabSmallIcon == null) { - closeTabSmallIcon = guiUtils.getResourceIcon(CLOSE_TAB_SMALL_ICON); + closeTabSmallIcon = resourceIcons.getResourceIcon(CLOSE_TAB_SMALL_ICON); } return closeTabSmallIcon; } @@ -414,7 +414,7 @@ @SuppressWarnings("NullableProblems") public Icon getAutoRunSmallIcon() { if (autoRunSmallIcon == null) { - autoRunSmallIcon = guiUtils.getResourceIcon(AUTO_RUN_SMALL_ICON); + autoRunSmallIcon = resourceIcons.getResourceIcon(AUTO_RUN_SMALL_ICON); } return autoRunSmallIcon; } @@ -423,7 +423,7 @@ @SuppressWarnings("NullableProblems") public Icon getFilterSmallIcon() { if (filterSmallIcon == null) { - filterSmallIcon = guiUtils.getResourceIcon(FILTER_SMALL_ICON); + filterSmallIcon = resourceIcons.getResourceIcon(FILTER_SMALL_ICON); } return filterSmallIcon; } @@ -432,7 +432,7 @@ @SuppressWarnings("NullableProblems") public Icon getRunPluginSmallIcon() { if (runPluginSmallIcon == null) { - runPluginSmallIcon = guiUtils.getResourceIcon(RUN_PLUGIN_SMALL_ICON); + runPluginSmallIcon = resourceIcons.getResourceIcon(RUN_PLUGIN_SMALL_ICON); } return runPluginSmallIcon; } @@ -445,7 +445,7 @@ @SuppressWarnings("NullableProblems") public ImageIcon getAppIcon() { if (appIcon == null) { - appIcon = guiUtils.getResourceIcon(APP_ICON); + appIcon = resourceIcons.getResourceIcon(APP_ICON); } return appIcon; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 20:35:52
|
Revision: 9475 http://sourceforge.net/p/gridarta/code/9475 Author: akirschbaum Date: 2013-10-17 20:35:48 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-10-17 20:27:45 UTC (rev 9474) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-10-17 20:35:48 UTC (rev 9475) @@ -26,36 +26,12 @@ import net.sf.gridarta.gui.map.renderer.ImageCreator; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.model.autojoin.AutojoinLists; -import net.sf.gridarta.model.face.DefaultFaceObjects; -import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.gameobject.GameObjectFactory; -import net.sf.gridarta.model.io.DefaultMapReaderFactory; -import net.sf.gridarta.model.io.DefaultMapWriter; -import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.io.GameObjectParserFactory; -import net.sf.gridarta.model.io.MapArchObjectParserFactory; -import net.sf.gridarta.model.io.MapReaderFactory; -import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; -import net.sf.gridarta.model.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.mapmanager.DefaultMapManager; -import net.sf.gridarta.model.mapmanager.MapManager; -import net.sf.gridarta.model.mapmodel.InsertionMode; -import net.sf.gridarta.model.mapmodel.MapModelFactory; -import net.sf.gridarta.model.mapmodel.TopmostInsertionMode; import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.NamedGameObjectMatcher; -import net.sf.gridarta.model.settings.DefaultEditorSettings; -import net.sf.gridarta.model.settings.EditorSettings; -import net.sf.gridarta.model.settings.ProjectSettings; -import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.project.ProjectModel; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; @@ -81,30 +57,12 @@ */ @NotNull public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> ImageCreator<G, A, R> newImageCreator(@NotNull final SystemIcons systemIcons, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ProjectModel<G, A, R> projectModel) { - final EditorSettings editorSettings = new DefaultEditorSettings(); - final ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); - final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(projectSettings); - final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); - final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectModel.getArchetypeTypeSet()); - final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); - final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, projectModel.getArchetypeSet(), projectModel.getArchetypeTypeSet()); - final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); - final MapReaderFactory<G, A> mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory); - final MapWriter<G, A, R> mapWriter = new DefaultMapWriter<G, A, R>(mapArchObjectParserFactory, gameObjectParser); - final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); - final ArchetypeChooserModel<G, A, R> archetypeChooserModel = new ArchetypeChooserModel<G, A, R>(); - final InsertionMode<G, A, R> topmostInsertionMode = new TopmostInsertionMode<G, A, R>(); - final MapModelFactory<G, A, R> mapModelFactory = new MapModelFactory<G, A, R>(archetypeChooserModel, autojoinLists, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); - final MapControlFactory<G, A, R> mapControlFactory = editorFactory.newMapControlFactory(mapWriter, projectSettings, mapModelFactory); - final MapManager<G, A, R> mapManager = new DefaultMapManager<G, A, R>(mapReaderFactory, mapControlFactory, projectSettings, projectModel.getFaceObjectProviders()); final Set<NamedGameObjectMatcher> matchers = new HashSet<NamedGameObjectMatcher>(); final NamedFilter defaultNamedFilterList = new NamedFilter(matchers); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); - final FaceObjects faceObjects = new DefaultFaceObjects(editorFactory.getIncludeFaceNumbers()); - final SmoothFaces smoothFaces = new SmoothFaces(faceObjects); - final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, projectModel.getFaceObjectProviders(), systemIcons, smoothFaces); - return new ImageCreator<G, A, R>(mapManager, rendererFactory); + final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, projectModel.getGameObjectParser(), projectModel.getFaceObjectProviders(), systemIcons, projectModel.getSmoothFaces()); + return new ImageCreator<G, A, R>(projectModel.getMapManager(), rendererFactory); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 20:27:48
|
Revision: 9474 http://sourceforge.net/p/gridarta/code/9474 Author: akirschbaum Date: 2013-10-17 20:27:45 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Convert ImageCreatorFactory to utility class. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 20:22:15 UTC (rev 9473) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 20:27:45 UTC (rev 9474) @@ -205,7 +205,7 @@ break; case BATCH_PNG: - returnCode = new BatchPngCommand(args2, new ImageCreatorFactory<G, A, R>(systemIcons).newImageCreator(editorFactory, projectModel)).execute(); + returnCode = new BatchPngCommand(args2, ImageCreatorFactory.newImageCreator(systemIcons, editorFactory, projectModel)).execute(); break; case SINGLE_PNG: @@ -213,7 +213,7 @@ throw new SyntaxErrorException("input output"); } - returnCode = new SinglePngCommand(new File(args2.get(0)), new File(args2.get(1)), new ImageCreatorFactory<G, A, R>(systemIcons).newImageCreator(editorFactory, projectModel)).execute(); + returnCode = new SinglePngCommand(new File(args2.get(0)), new File(args2.get(1)), ImageCreatorFactory.newImageCreator(systemIcons, editorFactory, projectModel)).execute(); break; case COLLECT_ARCHES: Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-10-17 20:22:15 UTC (rev 9473) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-10-17 20:27:45 UTC (rev 9474) @@ -64,30 +64,23 @@ * Utility class for creating {@link ImageCreator} instances. * @author Andreas Kirschbaum */ -public class ImageCreatorFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class ImageCreatorFactory { /** - * The {@link SystemIcons} for creating icons. + * Private constructor to prevent instantiation. */ - @NotNull - private final SystemIcons systemIcons; - - /** - * Creates a new instance. - * @param systemIcons the system icons for creating icons - */ - public ImageCreatorFactory(@NotNull final SystemIcons systemIcons) { - this.systemIcons = systemIcons; + private ImageCreatorFactory() { } /** * Creates a new {@link ImageCreator} instance. + * @param systemIcons the system icons for creating icons * @param editorFactory the editor factory to use * @param projectModel the project model to use * @return the new instance */ @NotNull - public ImageCreator<G, A, R> newImageCreator(@NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ProjectModel<G, A, R> projectModel) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> ImageCreator<G, A, R> newImageCreator(@NotNull final SystemIcons systemIcons, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ProjectModel<G, A, R> projectModel) { final EditorSettings editorSettings = new DefaultEditorSettings(); final ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(projectSettings); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 20:22:18
|
Revision: 9473 http://sourceforge.net/p/gridarta/code/9473 Author: akirschbaum Date: 2013-10-17 20:22:15 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Move code from GridartaEditor to GUIMainControl. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 20:18:48 UTC (rev 9472) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 20:22:15 UTC (rev 9473) @@ -98,6 +98,7 @@ import net.sf.gridarta.gui.dialog.replace.ReplaceDialogManager; import net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager; import net.sf.gridarta.gui.exitconnector.ExitConnectorController; +import net.sf.gridarta.gui.filter.DefaultFilterControl; import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.mainwindow.GameObjectTab; import net.sf.gridarta.gui.mainwindow.GameObjectTextEditorTab; @@ -180,10 +181,12 @@ import net.sf.gridarta.model.exitconnector.DefaultExitConnectorModel; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.exitconnector.ExitMatcher; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.InsertionModeSet; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; @@ -296,18 +299,19 @@ /** * Creates a new instance. * @param projectModel the project model to edit - * @param mapViewSettings the map view settings * @param editorSettings the editor settings instance * @param errorView the error view for reporting errors * @param guiUtils the gui utils for creating icons * @param editorFactory the editor factory instance * @param systemIcons the system icons for creating icons * @param configSourceFactory the config source factory instance - * @param rendererFactory the renderer factory instance - * @param filterControl the filter control instance */ - public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { + public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory) { this.projectModel = projectModel; + final NamedFilter defaultNamedFilterList = new NamedFilter(projectModel.getGameObjectMatchers().getFilters()); + final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); + final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); + final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, projectModel.getGameObjectParser(), projectModel.getFaceObjectProviders(), systemIcons, projectModel.getSmoothFaces()); final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, projectModel.getPathManager()); scriptExtension = editorFactory.getScriptExtension(); final DisplayMode<G, A, R> displayModeGameObjectNames = new DisplayNameCellRenderer<G, A, R>(projectModel.getFaceObjectProviders()); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 20:18:48 UTC (rev 9472) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 20:22:15 UTC (rev 9473) @@ -38,20 +38,14 @@ import net.sf.gridarta.gui.dialog.errorview.ConsoleErrorView; import net.sf.gridarta.gui.dialog.errorview.DefaultErrorView; import net.sf.gridarta.gui.dialog.prefs.GUIPreferences; -import net.sf.gridarta.gui.filter.DefaultFilterControl; -import net.sf.gridarta.gui.filter.FilterControl; -import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.configsource.ConfigSource; import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.configsource.DefaultConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; -import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.settings.DefaultEditorSettings; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; @@ -201,18 +195,13 @@ final ConfigSource configSource = configSourceFactory.getConfigSource(mode == GridartaRunMode.COLLECT_ARCHES ? "ARCH_DIRECTORY" : projectSettings.getConfigSourceName()); final ProjectModel<G, A, R> projectModel = new ProjectModel<G, A, R>(errorView, projectSettings, editorFactory, systemIcons, configSource); - final NamedFilter defaultNamedFilterList = new NamedFilter(projectModel.getGameObjectMatchers().getFilters()); - final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); - final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); - final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, projectModel.getGameObjectParser(), projectModel.getFaceObjectProviders(), systemIcons, projectModel.getSmoothFaces()); - if (plugin != null) { returnCode = runPlugin(plugin, errorView, args2, projectModel); } else { try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, projectModel, mapViewSettings, editorSettings, systemIcons); + returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, projectModel, editorSettings, systemIcons); break; case BATCH_PNG: @@ -295,21 +284,18 @@ * @param errorView the error view to add errors to * @param guiUtils the gui utils to use * @param configSourceFactory the config source factory to use - * @param rendererFactory the renderer factory to use - * @param filterControl the filter control to use * @param projectModel the project model to use - * @param mapViewSettings the map view settings * @param editorSettings the editor settings * @param systemIcons the system icons for creating icons * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { @Override public void run() { - guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, mapViewSettings, editorSettings, errorView, guiUtils, editorFactory, systemIcons, configSourceFactory, rendererFactory, filterControl); + guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, editorSettings, errorView, guiUtils, editorFactory, systemIcons, configSourceFactory); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 20:18:51
|
Revision: 9472 http://sourceforge.net/p/gridarta/code/9472 Author: akirschbaum Date: 2013-10-17 20:18:48 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Clean up code related to plugin execution. Modified Paths: -------------- trunk/gridarta.ipr trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2013-10-17 19:38:37 UTC (rev 9471) +++ trunk/gridarta.ipr 2013-10-17 20:18:48 UTC (rev 9472) @@ -74,6 +74,9 @@ <option name="KEEP_LINE_BREAKS" value="false" /> <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" /> <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" /> + <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" /> + <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> + <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" /> <option name="BLANK_LINES_BEFORE_PACKAGE" value="1" /> <option name="BLANK_LINES_AROUND_FIELD" value="1" /> <option name="BLANK_LINES_AROUND_FIELD_IN_INTERFACE" value="1" /> Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java 2013-10-17 19:38:37 UTC (rev 9471) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java 2013-10-17 20:18:48 UTC (rev 9472) @@ -32,8 +32,10 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.Plugin; +import net.sf.gridarta.plugin.PluginExecutor; import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.PluginModelListener; +import net.sf.gridarta.plugin.PluginParameters; import net.sf.gridarta.utils.ActionUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.FileChooserUtils; @@ -62,6 +64,9 @@ private final PluginModel<G, A, R> pluginModel; @NotNull + private final PluginParameters pluginParameters; + + @NotNull private final PluginView<G, A, R> view; /** @@ -99,14 +104,14 @@ final String filterName = "(s)" + plugin.getName(); if (plugin.isFilter()) { - final Filter<?, ?> filter = pluginModel.getPluginAsFilter(plugin); + final Filter<?, ?> filter = plugin.getPluginAsFilter(pluginParameters); if (filter != null) { filterControl.addFilter(filterName, filter); } } if (plugin.isAutoBoot()) { - pluginModel.runPlugin(plugin); + plugin.runPlugin(pluginParameters); } } @@ -121,10 +126,11 @@ /** * Creates a new instance. */ - public PluginController(@NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final Component parent, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final File pluginsDir, @NotNull final SystemIcons systemIcons) { + public PluginController(@NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameters pluginParameters, @NotNull final Component parent, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final File pluginsDir, @NotNull final SystemIcons systemIcons) { this.parent = parent; this.filterControl = filterControl; this.pluginModel = pluginModel; + this.pluginParameters = pluginParameters; this.pluginsDir = pluginsDir; view = new PluginView<G, A, R>(this, pluginModel, pluginParameterViewFactory, systemIcons); pluginModel.addPluginModelListener(pluginModelListener); @@ -242,7 +248,7 @@ return; } - pluginModel.doRunPlugin(clonedPlugin, view.createConsole(clonedPlugin.getName())); // XXX: drops thread + new PluginExecutor<G, A, R>(pluginModel, pluginParameters).doRunPlugin(clonedPlugin, view.createConsole(clonedPlugin.getName())); // XXX: drops thread } @ActionMethod Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:38:37 UTC (rev 9471) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 20:18:48 UTC (rev 9472) @@ -194,7 +194,7 @@ import net.sf.gridarta.model.settings.DefaultVolatileSettings; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.VolatileSettings; -import net.sf.gridarta.plugin.PluginModel; +import net.sf.gridarta.plugin.PluginParameters; import net.sf.gridarta.project.ProjectModel; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.gridarta.textedit.textarea.TextAreaDefaults; @@ -300,14 +300,13 @@ * @param editorSettings the editor settings instance * @param errorView the error view for reporting errors * @param guiUtils the gui utils for creating icons - * @param pluginModel the plugin model instance * @param editorFactory the editor factory instance * @param systemIcons the system icons for creating icons * @param configSourceFactory the config source factory instance * @param rendererFactory the renderer factory instance * @param filterControl the filter control instance */ - public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { + public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { this.projectModel = projectModel; final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, projectModel.getPathManager()); scriptExtension = editorFactory.getScriptExtension(); @@ -396,7 +395,9 @@ final GameObjectTab<G, A, R> gameObjectTab = new GameObjectTab<G, A, R>("gameObject", gameObjectAttributesControl, Location.BOTTOM, false, 0, true); final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(parent, copyBuffer, objectChooser, mapViewManager, projectModel.getFaceObjectProviders(), insertionModeSet); final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory = new PluginParameterViewFactory<G, A, R>(projectModel.getArchetypeSet(), gameObjectAttributesModel, objectChooser, projectModel.getMapManager(), projectModel.getFaceObjectProviders()); - final PluginController<G, A, R> pluginControl = new PluginController<G, A, R>(filterControl, pluginModel, parent, pluginParameterViewFactory, scriptsFile, systemIcons); + final PluginParameters pluginParameters = projectModel.newPluginParameters(); + pluginParameters.addPluginParameter("rendererFactory", rendererFactory); + final PluginController<G, A, R> pluginControl = new PluginController<G, A, R>(filterControl, projectModel.getPluginModel(), pluginParameters, parent, pluginParameterViewFactory, scriptsFile, systemIcons); final EditorAction mainActions = new MainActions<G, A, R>(findDialogManager, replaceDialogManager, mainViewFrame, mapViewSettings, projectModel.getArchetypeSet(), copyBuffer, objectChooser, projectModel.getMapManager(), mapViewManager, insertionModeSet); final EditorAction mapCursorActions = new MapCursorActions<G, A, R>(mapViewManager); final Action moveSquareDownAction = createAction("moveSquareDown", "Selected Square View", new MoveSquareDownAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); @@ -437,7 +438,7 @@ createToggleAction("smoothing", "Map Navigation", mapActions); createToggleAction("doubleFaces", "Map Navigation", mapActions); createToggleAction("tileShow", "Map Navigation", mapActions); - createAction("editPlugins", "Plugin", new PluginManagerFactory<G, A, R>(pluginControl, pluginModel, pluginParameterViewFactory, systemIcons)); + createAction("editPlugins", "Plugin", new PluginManagerFactory<G, A, R>(pluginControl, projectModel.getPluginModel(), pluginParameterViewFactory, systemIcons)); createAction("savePlugins", "Plugin", pluginControl); createAction("importPlugin", "Plugin", pluginControl); createAction("update", "Tool", updaterManager); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 19:38:37 UTC (rev 9471) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 20:18:48 UTC (rev 9472) @@ -25,7 +25,6 @@ import java.io.File; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.MissingResourceException; @@ -53,14 +52,10 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.match.NamedGameObjectMatcher; import net.sf.gridarta.model.settings.DefaultEditorSettings; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; -import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.PluginModelLoader; -import net.sf.gridarta.plugin.PluginModelParser; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; +import net.sf.gridarta.plugin.PluginExecutor; import net.sf.gridarta.preferences.FilePreferencesFactory; import net.sf.gridarta.project.ProjectModel; import net.sf.gridarta.utils.ConfigFileUtils; @@ -211,25 +206,13 @@ final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, projectModel.getGameObjectParser(), projectModel.getFaceObjectProviders(), systemIcons, projectModel.getSmoothFaces()); - final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); - final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(projectModel.getArchetypeSet(), projectModel.getMapManager(), defaultFilterList, projectModel.getProjectSettings()); - final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); - final PluginModel<G, A, R> pluginModel = PluginModelLoader.loadPlugins(pluginParameterFactory, pluginModelParser, errorView, projectModel.getScriptsFile()); - pluginModel.addPluginParameter("archetypeSet", projectModel.getArchetypeSet()); - pluginModel.addPluginParameter("projectSettings", projectModel.getProjectSettings()); - pluginModel.addPluginParameter("globalSettings", projectModel.getProjectSettings()); // XXX: for compatibility with existing scripts; should be replaced with "projectSettings" - pluginModel.addPluginParameter("mapManager", projectModel.getMapManager()); - pluginModel.addPluginParameter("validators", projectModel.getValidators()); - pluginModel.addPluginParameter("rendererFactory", rendererFactory); - pluginModel.addPluginParameter("gameObjectMatchers", projectModel.getGameObjectMatchers()); - if (plugin != null) { - returnCode = runPlugin(plugin, errorView, args2, pluginModel); + returnCode = runPlugin(plugin, errorView, args2, projectModel); } else { try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginModel, projectModel, mapViewSettings, editorSettings, systemIcons); + returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, projectModel, mapViewSettings, editorSettings, systemIcons); break; case BATCH_PNG: @@ -269,13 +252,13 @@ * @param plugin the name of the plugin to run * @param errorView the error view to add errors to * @param args the arguments for the plugin - * @param pluginModel the plugin model to use + * @param projectModel the project model to use * @return return code suitable for passing to {@link System#exit(int)} */ - private int runPlugin(@NotNull final String plugin, final ErrorView errorView, final Iterable<String> args, @NotNull final PluginModel<G, A, R> pluginModel) { + private int runPlugin(@NotNull final String plugin, final ErrorView errorView, final Iterable<String> args, @NotNull final ProjectModel<G, A, R> projectModel) { checkForErrors(errorView); waitDialog(errorView); - return pluginModel.executePlugin(plugin, args); + return new PluginExecutor<G, A, R>(projectModel.getPluginModel(), projectModel.newPluginParameters()).executePlugin(plugin, args); } /** @@ -314,20 +297,19 @@ * @param configSourceFactory the config source factory to use * @param rendererFactory the renderer factory to use * @param filterControl the filter control to use - * @param pluginModel the plugin model to use * @param projectModel the project model to use * @param mapViewSettings the map view settings * @param editorSettings the editor settings * @param systemIcons the system icons for creating icons * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { @Override public void run() { - guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, mapViewSettings, editorSettings, errorView, guiUtils, pluginModel, editorFactory, systemIcons, configSourceFactory, rendererFactory, filterControl); + guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, mapViewSettings, editorSettings, errorView, guiUtils, editorFactory, systemIcons, configSourceFactory, rendererFactory, filterControl); } }; Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java 2013-10-17 19:38:37 UTC (rev 9471) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java 2013-10-17 20:18:48 UTC (rev 9472) @@ -19,7 +19,6 @@ package net.sf.gridarta.plugin; -import bsh.ConsoleInterface; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -28,7 +27,6 @@ import java.util.Map; import java.util.TreeMap; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.parameter.PluginParameterFactory; @@ -64,9 +62,6 @@ @NotNull private final Map<String, Plugin<G, A, R>> plugins = new TreeMap<String, Plugin<G, A, R>>(); - @NotNull - private final PluginParameters pluginParameters = new PluginParameters(); - /** * The {@link PluginModelListener PluginModelListeners} to inform of * changes. @@ -226,29 +221,6 @@ firePluginRegisteredEvent(plugin); } - public void addPluginParameter(@NotNull final String name, @NotNull final Object value) { - pluginParameters.addPluginParameter(name, value); - } - - @Nullable - public Filter<?, ?> getPluginAsFilter(@NotNull final Plugin<G, A, R> plugin) { - return plugin.getPluginAsFilter(pluginParameters); - } - - - public void runPlugin(@NotNull final Plugin<G, A, R> plugin) { - plugin.runPlugin(pluginParameters); - } - - public int executePlugin(@NotNull final String plugin, @NotNull final Iterable<String> args) { - return new PluginExecutor<G, A, R>(this, pluginParameters).executePlugin(plugin, args); - } - - @Nullable - public BshThread<G, A, R> doRunPlugin(@NotNull final Plugin<G, A, R> plugin, @NotNull final ConsoleInterface console) { - return new PluginExecutor<G, A, R>(this, pluginParameters).doRunPlugin(plugin, console); - } - @NotNull public String[] getTypes() { return pluginParameterFactory.getTypes(); Modified: trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java =================================================================== --- trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 2013-10-17 19:38:37 UTC (rev 9471) +++ trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 2013-10-17 20:18:48 UTC (rev 9472) @@ -53,6 +53,7 @@ import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjectProvidersListener; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractArchetypeParser; @@ -77,6 +78,7 @@ import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.GameObjectMatchersParser; +import net.sf.gridarta.model.match.NamedGameObjectMatcher; import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.model.smoothface.SmoothFaces; @@ -99,6 +101,11 @@ import net.sf.gridarta.model.validation.checks.PaidItemShopSquareChecker; import net.sf.gridarta.model.validation.checks.ShopSquareChecker; import net.sf.gridarta.model.validation.checks.ValidatorFactory; +import net.sf.gridarta.plugin.PluginModel; +import net.sf.gridarta.plugin.PluginModelLoader; +import net.sf.gridarta.plugin.PluginModelParser; +import net.sf.gridarta.plugin.PluginParameters; +import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.CommonConstants; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.StringUtils; @@ -197,6 +204,9 @@ @NotNull private final PathManager pathManager; + @NotNull + private final PluginModel<G, A, R> pluginModel; + public ProjectModel(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ProjectFactory<G, A, R> projectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSource configSource) { this.projectSettings = projectSettings; final XmlHelper xmlHelper; @@ -249,6 +259,10 @@ final Map<String, TreasureTreeNode> specialTreasureLists = loadSpecialTreasureLists(errorView, xmlHelper.getDocumentBuilder(), projectSettings); treasureTree = TreasureLoader.parseTreasures(errorView, specialTreasureLists, configSource, projectSettings); pathManager = new PathManager(projectSettings); + final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); + final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); + final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); + pluginModel = PluginModelLoader.loadPlugins(pluginParameterFactory, pluginModelParser, errorView, scriptsFile); } @NotNull @@ -574,4 +588,25 @@ return pathManager; } + @NotNull + public PluginModel<G, A, R> getPluginModel() { + return pluginModel; + } + + /** + * Creates a new {@link PluginParameters} instance for this project model. + * @return the plugin parameters; may be modified + */ + @NotNull + public PluginParameters newPluginParameters() { + final PluginParameters pluginParameters = new PluginParameters(); + pluginParameters.addPluginParameter("archetypeSet", archetypeSet); + pluginParameters.addPluginParameter("projectSettings", projectSettings); + pluginParameters.addPluginParameter("globalSettings", projectSettings); // XXX: for compatibility with existing scripts; should be replaced with "projectSettings" + pluginParameters.addPluginParameter("mapManager", mapManager); + pluginParameters.addPluginParameter("validators", validators); + pluginParameters.addPluginParameter("gameObjectMatchers", gameObjectMatchers); + return pluginParameters; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:38:41
|
Revision: 9471 http://sourceforge.net/p/gridarta/code/9471 Author: akirschbaum Date: 2013-10-17 19:38:37 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Make CollectArchesCommand operate on an ProjectModel instance. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/CollectArchesCommand.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/CollectArchesCommand.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/CollectArchesCommand.java 2013-10-17 19:34:38 UTC (rev 9470) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/CollectArchesCommand.java 2013-10-17 19:38:37 UTC (rev 9471) @@ -19,8 +19,7 @@ package net.sf.gridarta.commands; -import net.sf.gridarta.model.resource.AbstractResources; -import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.project.ProjectModel; import net.sf.japi.swing.misc.ConsoleProgress; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -42,25 +41,17 @@ private static final Category log = Logger.getLogger(CollectArchesCommand.class); /** - * The resources to collect. + * The project to collect. */ @NotNull - private final AbstractResources<?, ?, ?> resources; + private final ProjectModel<?, ?, ?> projectModel; /** - * The {@link ProjectSettings} instance. - */ - @NotNull - private final ProjectSettings projectSettings; - - /** * Creates a new instance. - * @param resources the resources to collect - * @param projectSettings the project settings instance + * @param projectModel the project to collect */ - public CollectArchesCommand(@NotNull final AbstractResources<?, ?, ?> resources, @NotNull final ProjectSettings projectSettings) { - this.resources = resources; - this.projectSettings = projectSettings; + public CollectArchesCommand(@NotNull final ProjectModel<?, ?, ?> projectModel) { + this.projectModel = projectModel; } /** @@ -68,11 +59,11 @@ */ @Override public int execute() { - if (!resources.canWriteCollected()) { + if (!projectModel.getResources().canWriteCollected()) { log.fatal("Cannot collect resources"); return 1; } - final Collector collector = new Collector(new ConsoleProgress(), resources, projectSettings.getCollectedDirectory()); + final Collector collector = new Collector(new ConsoleProgress(), projectModel.getResources(), projectModel.getProjectSettings().getCollectedDirectory()); collector.start(); try { collector.waitUntilFinished(); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 19:34:38 UTC (rev 9470) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 19:38:37 UTC (rev 9471) @@ -245,7 +245,7 @@ break; case COLLECT_ARCHES: - returnCode = new CollectArchesCommand(projectModel.getResources(), projectModel.getProjectSettings()).execute(); + returnCode = new CollectArchesCommand(projectModel).execute(); break; default: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:34:43
|
Revision: 9470 http://sourceforge.net/p/gridarta/code/9470 Author: akirschbaum Date: 2013-10-17 19:34:38 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Add ProjectSettings to ProjectModel. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:21:38 UTC (rev 9469) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:34:38 UTC (rev 9470) @@ -193,7 +193,6 @@ import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.DefaultVolatileSettings; import net.sf.gridarta.model.settings.EditorSettings; -import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.model.settings.VolatileSettings; import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.project.ProjectModel; @@ -297,7 +296,6 @@ /** * Creates a new instance. * @param projectModel the project model to edit - * @param projectSettings the project settings instance * @param mapViewSettings the map view settings * @param editorSettings the editor settings instance * @param errorView the error view for reporting errors @@ -309,7 +307,7 @@ * @param rendererFactory the renderer factory instance * @param filterControl the filter control instance */ - public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { + public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { this.projectModel = projectModel; final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, projectModel.getPathManager()); scriptExtension = editorFactory.getScriptExtension(); @@ -319,7 +317,7 @@ final ExitConnectorModel exitConnectorModel = new DefaultExitConnectorModel(); final ShortcutsManager shortcutsManager = new ShortcutsManager(ACTION_BUILDER); final ImageCreator<G, A, R> imageCreator = new ImageCreator<G, A, R>(projectModel.getMapManager(), rendererFactory); - final VolatileSettings volatileSettings = new DefaultVolatileSettings(projectSettings.getMapsDirectory()); + final VolatileSettings volatileSettings = new DefaultVolatileSettings(projectModel.getProjectSettings().getMapsDirectory()); final ImageCreator2<G, A, R> imageCreator2 = new ImageCreator2<G, A, R>(volatileSettings, imageCreator); final String spellFile = editorFactory.getSpellFile(); final SpellsUtils spellUtils = spellFile != null ? new SpellsUtils(spellFile) : null; @@ -327,7 +325,7 @@ final MapViewManager<G, A, R> mapViewManager = new MapViewManager<G, A, R>(); final StatusBar<G, A, R> statusBar = new StatusBar<G, A, R>(projectModel.getMapManager(), mapViewManager, projectModel.getArchetypeSet(), projectModel.getFaceObjects()); final MapImageCache<G, A, R> mapImageCache = new MapImageCache<G, A, R>(projectModel.getMapManager(), systemIcons.getDefaultIcon(), systemIcons.getDefaultPreview(), rendererFactory, editorFactory.getCacheFiles()); - final MapFolderTree<G, A, R> mapFolderTree = new MapFolderTree<G, A, R>(projectSettings.getPickmapDir()); + final MapFolderTree<G, A, R> mapFolderTree = new MapFolderTree<G, A, R>(projectModel.getProjectSettings().getPickmapDir()); final ImageIcon icon = systemIcons.getAppIcon(); mainViewFrame = new JFrame(ACTION_BUILDER.format("mainWindow.title", getBuildNumberAsString())); final Frame parent = mainViewFrame; @@ -340,33 +338,33 @@ final SelectedSquareModel<G, A, R> selectedSquareModel = new SelectedSquareModel<G, A, R>(); final GameObjectMatcher floorMatcher = projectModel.getGameObjectMatchers().getMatcher("system_floor", "floor"); final GameObjectMatcher wallMatcher = projectModel.getGameObjectMatchers().getMatcher("system_wall", "wall"); - final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, new File(projectSettings.getConfigurationDirectory(), "GameObjectMatchers.xml")); + final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, new File(projectModel.getProjectSettings().getConfigurationDirectory(), "GameObjectMatchers.xml")); final GameObjectMatcher belowFloorMatcher = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_below_floor", "below_floor"); final GameObjectMatcher systemObjectMatcher = projectModel.getGameObjectMatchers().getMatcher("system_system_object"); final InsertionModeSet<G, A, R> insertionModeSet = new InsertionModeSet<G, A, R>(projectModel.getTopmostInsertionMode(), floorMatcher, wallMatcher, belowFloorMatcher, systemObjectMatcher); final CopyBuffer<G, A, R> copyBuffer = new CopyBuffer<G, A, R>(mapViewSettings, projectModel.getGameObjectFactory(), projectModel.getMapArchObjectFactory(), projectModel.getMapModelFactory(), insertionModeSet); final FindDialogManager<G, A, R> findDialogManager = new FindDialogManager<G, A, R>(parent, mapViewManager); final Exiter exiter = new DefaultExiter(parent); - scriptEditControl = new ScriptEditControl(editorFactory.getScriptFileFilter(), scriptExtension, parent, projectSettings.getMapsDirectory(), preferences, exiter); + scriptEditControl = new ScriptEditControl(editorFactory.getScriptFileFilter(), scriptExtension, parent, projectModel.getProjectSettings().getMapsDirectory(), preferences, exiter); final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); scriptEditControl.setTextAreaDefaults(textAreaDefaults); - final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectSettings, editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, textAreaDefaults, projectModel.getMapManager()); - final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings, scriptEditControl); + final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectModel.getProjectSettings(), editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, textAreaDefaults, projectModel.getMapManager()); + final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectModel.getProjectSettings(), scriptEditControl); final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectModel.getArchetypeTypeSet()); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, projectModel.getGameObjectFactory(), scriptedEventEditor, projectModel.getArchetypeSet()); - final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, projectModel.getMapManager(), projectModel.getPathManager(), scriptEditControl); + final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectModel.getProjectSettings(), projectModel.getMapManager(), projectModel.getPathManager(), scriptEditControl); final ScriptArchDataUtils<G, A, R> scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); final GameObjectMatcher monsterMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_monster", "monster"); final GameObjectMatcher monsterMatcher = monsterMatcherTmp == null ? new TypeNrsGameObjectMatcher() : monsterMatcherTmp; final GameObjectMatcher exitGameObjectMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_exit", "exit"); final GameObjectMatcher exitGameObjectMatcher = exitGameObjectMatcherTmp == null ? new TypeNrsGameObjectMatcher() : exitGameObjectMatcherTmp; final ExitMatcher<G, A, R> exitMatcher = new ExitMatcher<G, A, R>(exitGameObjectMatcher); - final MapPathNormalizer mapPathNormalizer = new MapPathNormalizer(projectSettings); - final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(projectSettings, projectModel.getMapManager(), mapPathNormalizer); + final MapPathNormalizer mapPathNormalizer = new MapPathNormalizer(projectModel.getProjectSettings()); + final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(projectModel.getProjectSettings(), projectModel.getMapManager(), mapPathNormalizer); final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager = new DelayedMapModelListenerManager<G, A, R>(projectModel.getMapManager(), exiter); final Control<?, G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, editorFactory.getLockedItemsTypeNumbers()); final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel = new GameObjectAttributesModel<G, A, R>(); - final File scriptsFile = new File(projectSettings.getMapsDirectory(), editorFactory.getScriptsDir()); + final File scriptsFile = new File(projectModel.getProjectSettings().getMapsDirectory(), editorFactory.getScriptsDir()); updaterManager = new UpdaterManager(exiter, projectModel.getMapManager(), parent, editorFactory.getGridartaJarFilename()); final TextEditorTab<G, A, R> textEditorTab = new TextEditorTab<G, A, R>(gameObjectAttributesModel, projectModel.getArchetypeTypeSet()); final EditorAction undoControl = new UndoControl<G, A, R>(projectModel.getMapManager(), projectModel.getGameObjectFactory(), projectModel.getGameObjectMatchers()); @@ -377,7 +375,7 @@ final ArchetypeChooserControl<G, A, R> archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(projectModel.getArchetypeChooserModel(), archetypeChooserView); mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory, projectModel.getMapManager(), projectModel.getPickmapManager()); newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, projectModel.getMapArchObjectFactory(), pickmapChooserView, parent); - fileControl = new DefaultFileControl<G, A, R>(projectSettings, volatileSettings, mapImageCache, projectModel.getMapManager(), mapViewsManager, parent, GuiFileFilters.mapFileFilter, editorFactory.getScriptFileFilter(), newMapDialogFactory, scriptExtension, scriptEditControl); + fileControl = new DefaultFileControl<G, A, R>(projectModel.getProjectSettings(), volatileSettings, mapImageCache, projectModel.getMapManager(), mapViewsManager, parent, GuiFileFilters.mapFileFilter, editorFactory.getScriptFileFilter(), newMapDialogFactory, scriptExtension, scriptEditControl); mapViewsManager.setFileControl(fileControl); final PickmapChooserControl<G, A, R> pickmapChooserControl = new PickmapChooserControl<G, A, R>(pickmapChooserModel, pickmapSettings, newMapDialogFactory, mapFolderTree, projectModel.getMapManager(), parent, mapViewsManager, fileControl, pickmapChooserView); final DefaultObjectChooser<G, A, R> objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl, projectModel.getArchetypeChooserModel(), pickmapChooserModel, projectModel.getArchetypeTypeSet()); @@ -485,20 +483,20 @@ createAction("expandEmptySelection", "Map/Selection", mainActions); createAction("growSelection", "Map/Selection", new GrowSelectionAction<G, A, R>(mapViewManager)); createAction("shrinkSelection", "Map/Selection", new ShrinkSelectionAction<G, A, R>(mapViewManager)); - createAction("collectArches", "Tool", new CollectArchesAction<G, A, R>(projectSettings, projectModel.getResources(), exiter, mainViewFrame)); + createAction("collectArches", "Tool", new CollectArchesAction<G, A, R>(projectModel.getProjectSettings(), projectModel.getResources(), exiter, mainViewFrame)); createAction("reloadFaces", "Image,Tool", new ReloadFacesAction<G, A, R>(projectModel.getArchetypeSet(), projectModel.getFaceObjectProviders())); createAction("validateMap", "Map,Tool", new ValidateMapAction<G, A, R>(projectModel.getValidators(), projectModel.getMapManager())); createAction("showHelp", "Help", new ShowHelpAction(parent)); createAction("tipOfTheDay", "Help", new TipOfTheDayAction(parent)); createAction("newMap", "Map", new NewMapAction<G, A, R>(newMapDialogFactory)); - createAction("goMap", "Map", new GoMapDialogManager<G, A, R>(parent, projectModel.getMapManager(), mapViewsManager, projectSettings, exiter)); + createAction("goMap", "Map", new GoMapDialogManager<G, A, R>(parent, projectModel.getMapManager(), mapViewsManager, projectModel.getProjectSettings(), exiter)); createAction("goExit", "Map Navigation", new GoExitDialogManager<G, A, R>(parent, projectModel.getMapManager(), mapViewManager, exitGameObjectMatcher, projectModel.getPathManager(), enterMap, projectModel.getFaceObjectProviders())); createAction("cleanCompletelyBlockedSquares", "Tool", new CleanCompletelyBlockedSquaresAction<G, A, R>(projectModel.getMapManager())); - createAction("collectSpells", "Tool", new CollectSpellsAction(spellUtils, projectSettings, parent)); + createAction("collectSpells", "Tool", new CollectSpellsAction(spellUtils, projectModel.getProjectSettings(), parent)); createAction("controlClient", "Tool", new ControlClientAction(appPreferencesModel, mainViewFrame)); createAction("controlServer", "Tool", new ControlServerAction(appPreferencesModel, mainViewFrame)); createAction("gc", "Tool", new GcAction(statusBar)); - createAction("options", "Tool", new OptionsAction<G, A, R>(editorFactory, projectSettings, editorSettings, projectModel.getValidators(), appPreferencesModel, exitConnectorModel, configSourceFactory, parent)); + createAction("options", "Tool", new OptionsAction<G, A, R>(editorFactory, projectModel.getProjectSettings(), editorSettings, projectModel.getValidators(), appPreferencesModel, exitConnectorModel, configSourceFactory, parent)); createAction("shortcuts", "Tool", new ShortcutsAction(shortcutsManager, parent)); createAction("zoom", "Tool", new ZoomAction<G, A, R>(projectModel.getMapManager(), rendererFactory, parent)); createAction("moveCursorNorth", "Map Cursor,Map/Selection", mapCursorActions); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 19:21:38 UTC (rev 9469) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 19:34:38 UTC (rev 9470) @@ -212,12 +212,12 @@ final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, projectModel.getGameObjectParser(), projectModel.getFaceObjectProviders(), systemIcons, projectModel.getSmoothFaces()); final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); - final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(projectModel.getArchetypeSet(), projectModel.getMapManager(), defaultFilterList, projectSettings); + final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(projectModel.getArchetypeSet(), projectModel.getMapManager(), defaultFilterList, projectModel.getProjectSettings()); final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); final PluginModel<G, A, R> pluginModel = PluginModelLoader.loadPlugins(pluginParameterFactory, pluginModelParser, errorView, projectModel.getScriptsFile()); pluginModel.addPluginParameter("archetypeSet", projectModel.getArchetypeSet()); - pluginModel.addPluginParameter("projectSettings", projectSettings); - pluginModel.addPluginParameter("globalSettings", projectSettings); // XXX: for compatibility with existing scripts; should be replaced with "projectSettings" + pluginModel.addPluginParameter("projectSettings", projectModel.getProjectSettings()); + pluginModel.addPluginParameter("globalSettings", projectModel.getProjectSettings()); // XXX: for compatibility with existing scripts; should be replaced with "projectSettings" pluginModel.addPluginParameter("mapManager", projectModel.getMapManager()); pluginModel.addPluginParameter("validators", projectModel.getValidators()); pluginModel.addPluginParameter("rendererFactory", rendererFactory); @@ -229,7 +229,7 @@ try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginModel, projectModel, projectSettings, mapViewSettings, editorSettings, systemIcons); + returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginModel, projectModel, mapViewSettings, editorSettings, systemIcons); break; case BATCH_PNG: @@ -245,7 +245,7 @@ break; case COLLECT_ARCHES: - returnCode = new CollectArchesCommand(projectModel.getResources(), projectSettings).execute(); + returnCode = new CollectArchesCommand(projectModel.getResources(), projectModel.getProjectSettings()).execute(); break; default: @@ -316,19 +316,18 @@ * @param filterControl the filter control to use * @param pluginModel the plugin model to use * @param projectModel the project model to use - * @param projectSettings the project settings * @param mapViewSettings the map view settings * @param editorSettings the editor settings * @param systemIcons the system icons for creating icons * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { @Override public void run() { - guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, projectSettings, mapViewSettings, editorSettings, errorView, guiUtils, pluginModel, editorFactory, systemIcons, configSourceFactory, rendererFactory, filterControl); + guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, mapViewSettings, editorSettings, errorView, guiUtils, pluginModel, editorFactory, systemIcons, configSourceFactory, rendererFactory, filterControl); } }; Modified: trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java =================================================================== --- trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 2013-10-17 19:21:38 UTC (rev 9469) +++ trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 2013-10-17 19:34:38 UTC (rev 9470) @@ -126,6 +126,9 @@ private static final Category log = Logger.getLogger(ProjectModel.class); @NotNull + private final ProjectSettings projectSettings; + + @NotNull private final ArchetypeTypeSet archetypeTypeSet; @NotNull @@ -195,6 +198,7 @@ private final PathManager pathManager; public ProjectModel(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ProjectFactory<G, A, R> projectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSource configSource) { + this.projectSettings = projectSettings; final XmlHelper xmlHelper; try { xmlHelper = new XmlHelper(); @@ -451,6 +455,11 @@ } @NotNull + public ProjectSettings getProjectSettings() { + return projectSettings; + } + + @NotNull public ArchetypeTypeSet getArchetypeTypeSet() { return archetypeTypeSet; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:21:42
|
Revision: 9469 http://sourceforge.net/p/gridarta/code/9469 Author: akirschbaum Date: 2013-10-17 19:21:38 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Reorder initialization code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:18:48 UTC (rev 9468) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:21:38 UTC (rev 9469) @@ -379,10 +379,10 @@ newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, projectModel.getMapArchObjectFactory(), pickmapChooserView, parent); fileControl = new DefaultFileControl<G, A, R>(projectSettings, volatileSettings, mapImageCache, projectModel.getMapManager(), mapViewsManager, parent, GuiFileFilters.mapFileFilter, editorFactory.getScriptFileFilter(), newMapDialogFactory, scriptExtension, scriptEditControl); mapViewsManager.setFileControl(fileControl); - final MapDesktop<G, A, R> mapDesktop = new MapDesktop<G, A, R>(mapViewManager, projectModel.getMapManager(), mapImageCache, mapViewsManager); final PickmapChooserControl<G, A, R> pickmapChooserControl = new PickmapChooserControl<G, A, R>(pickmapChooserModel, pickmapSettings, newMapDialogFactory, mapFolderTree, projectModel.getMapManager(), parent, mapViewsManager, fileControl, pickmapChooserView); final DefaultObjectChooser<G, A, R> objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl, projectModel.getArchetypeChooserModel(), pickmapChooserModel, projectModel.getArchetypeTypeSet()); newMapDialogFactory.setObjectChooser(objectChooser); + final MapDesktop<G, A, R> mapDesktop = new MapDesktop<G, A, R>(mapViewManager, projectModel.getMapManager(), mapImageCache, mapViewsManager); final EnterMap<G, A, R> enterMap = new EnterMap<G, A, R>(parent, editorFactory.getDirectionMap(), mapPathNormalizer, fileControl, mapViewsManager); final EditorAction mapActions = new MapActions<G, A, R>(parent, projectModel.getMapManager(), mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, editorFactory.isAllowRandomMapParameters(), mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); final MapFolderTreeActions<G, A, R> mapFolderTreeActions = new MapFolderTreeActions<G, A, R>(mapFolderTree, pickmapSettings, newMapDialogFactory, "createPickmapFolder", "deletePickmapFolder", "confirmDeletePickmapFolder", "deletePickmapFolderNotEmpty"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:18:51
|
Revision: 9468 http://sourceforge.net/p/gridarta/code/9468 Author: akirschbaum Date: 2013-10-17 19:18:48 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Reorder order of initialization code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:17:23 UTC (rev 9467) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:18:48 UTC (rev 9468) @@ -349,8 +349,8 @@ final Exiter exiter = new DefaultExiter(parent); scriptEditControl = new ScriptEditControl(editorFactory.getScriptFileFilter(), scriptExtension, parent, projectSettings.getMapsDirectory(), preferences, exiter); final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); + scriptEditControl.setTextAreaDefaults(textAreaDefaults); final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectSettings, editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, textAreaDefaults, projectModel.getMapManager()); - scriptEditControl.setTextAreaDefaults(textAreaDefaults); final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings, scriptEditControl); final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectModel.getArchetypeTypeSet()); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, projectModel.getGameObjectFactory(), scriptedEventEditor, projectModel.getArchetypeSet()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:17:26
|
Revision: 9467 http://sourceforge.net/p/gridarta/code/9467 Author: akirschbaum Date: 2013-10-17 19:17:23 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Remove GameObjectAttributesDialogFactory.setTextAreaDefaults(). Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java 2013-10-17 19:14:15 UTC (rev 9466) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java 2013-10-17 19:17:23 UTC (rev 9467) @@ -157,7 +157,7 @@ * The {@link TextAreaDefaults} for text fields. */ @NotNull - private TextAreaDefaults textAreaDefaults; + private final TextAreaDefaults textAreaDefaults; /** * The {@link MapManager} instance. @@ -184,9 +184,10 @@ * @param treasureTree the treasure tree to use * @param noFaceSquareIcon the image icon for no animations * @param unknownSquareIcon the image icon for undefined animations + * @param textAreaDefaults the test area defaults for text fields * @param mapManager the map manager instance */ - public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Frame parent, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ProjectSettings projectSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final MapManager<G, A, R> mapManager) { + public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Frame parent, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ProjectSettings projectSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final TextAreaDefaults textAreaDefaults, @NotNull final MapManager<G, A, R> mapManager) { this.archetypeTypeSet = archetypeTypeSet; this.parent = parent; this.treasureListTree = treasureListTree; @@ -202,16 +203,10 @@ this.treasureTree = treasureTree; this.unknownSquareIcon = unknownSquareIcon; this.noFaceSquareIcon = noFaceSquareIcon; + this.textAreaDefaults = textAreaDefaults; this.mapManager = mapManager; } - @Deprecated - public void setTextAreaDefaults(@NotNull final TextAreaDefaults textAreaDefaults) { - synchronized (dialogs) { - this.textAreaDefaults = textAreaDefaults; - } - } - /** * Shows the game object attributes dialog for a given {@link GameObject} * instance. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:14:15 UTC (rev 9466) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:17:23 UTC (rev 9467) @@ -349,8 +349,7 @@ final Exiter exiter = new DefaultExiter(parent); scriptEditControl = new ScriptEditControl(editorFactory.getScriptFileFilter(), scriptExtension, parent, projectSettings.getMapsDirectory(), preferences, exiter); final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); - final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectSettings, editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, projectModel.getMapManager()); - gameObjectAttributesDialogFactory.setTextAreaDefaults(textAreaDefaults); + final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectSettings, editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, textAreaDefaults, projectModel.getMapManager()); scriptEditControl.setTextAreaDefaults(textAreaDefaults); final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings, scriptEditControl); final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectModel.getArchetypeTypeSet()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:14:18
|
Revision: 9466 http://sourceforge.net/p/gridarta/code/9466 Author: akirschbaum Date: 2013-10-17 19:14:15 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Reorder initialization code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:12:01 UTC (rev 9465) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:14:15 UTC (rev 9466) @@ -337,7 +337,6 @@ final CFTreasureListTree treasureListTree = new CFTreasureListTree(projectModel.getTreasureTree(), parent, projectModel.getArchetypeSet(), projectModel.getFaceObjectProviders(), systemIcons); final ImageIcon noFaceSquareIcon = systemIcons.getNoFaceSquareIcon(); final ImageIcon unknownSquareIcon = systemIcons.getUnknownSquareIcon(); - final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectSettings, editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, projectModel.getMapManager()); final SelectedSquareModel<G, A, R> selectedSquareModel = new SelectedSquareModel<G, A, R>(); final GameObjectMatcher floorMatcher = projectModel.getGameObjectMatchers().getMatcher("system_floor", "floor"); final GameObjectMatcher wallMatcher = projectModel.getGameObjectMatchers().getMatcher("system_wall", "wall"); @@ -350,6 +349,7 @@ final Exiter exiter = new DefaultExiter(parent); scriptEditControl = new ScriptEditControl(editorFactory.getScriptFileFilter(), scriptExtension, parent, projectSettings.getMapsDirectory(), preferences, exiter); final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); + final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectSettings, editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, projectModel.getMapManager()); gameObjectAttributesDialogFactory.setTextAreaDefaults(textAreaDefaults); scriptEditControl.setTextAreaDefaults(textAreaDefaults); final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings, scriptEditControl); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:12:04
|
Revision: 9465 http://sourceforge.net/p/gridarta/code/9465 Author: akirschbaum Date: 2013-10-17 19:12:01 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Remove ScriptArchEditor.setScriptEditControl(). Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java 2013-10-17 19:09:57 UTC (rev 9464) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java 2013-10-17 19:12:01 UTC (rev 9465) @@ -94,7 +94,7 @@ * The {@link ScriptEditControl} to use. */ @Nullable - private ScriptEditControl scriptEditControl; + private final ScriptEditControl scriptEditControl; @NotNull private final JComboBox eventTypeBox; @@ -139,12 +139,14 @@ * @param projectSettings the project settings to use * @param mapManager the map manager instance to use * @param pathManager the path manager for converting path names + * @param scriptEditControl the script edit control to use */ - public ScriptArchEditor(@NotNull final ScriptedEventFactory<G, A, R> scriptedEventFactory, final String scriptEnding, final String name, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final FileFilter scriptFileFilter, @NotNull final ProjectSettings projectSettings, @NotNull final MapManager<?, ?, ?> mapManager, @NotNull final PathManager pathManager) { + public ScriptArchEditor(@NotNull final ScriptedEventFactory<G, A, R> scriptedEventFactory, final String scriptEnding, final String name, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final FileFilter scriptFileFilter, @NotNull final ProjectSettings projectSettings, @NotNull final MapManager<?, ?, ?> mapManager, @NotNull final PathManager pathManager, @NotNull final ScriptEditControl scriptEditControl) { this.scriptedEventFactory = scriptedEventFactory; this.scriptEnding = scriptEnding; this.scriptArchUtils = scriptArchUtils; this.pathManager = pathManager; + this.scriptEditControl = scriptEditControl; pluginNameBox = new JComboBox(new String[] { name }); pluginNameBox.setSelectedIndex(0); @@ -163,11 +165,6 @@ return tmpEventTypeBox; } - @Deprecated - public void setScriptEditControl(@Nullable final ScriptEditControl scriptEditControl) { - this.scriptEditControl = scriptEditControl; - } - /** * A popup is opened and the user can create a new scripting event which * gets attached to this gameObject. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:09:57 UTC (rev 9464) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:12:01 UTC (rev 9465) @@ -355,9 +355,8 @@ final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings, scriptEditControl); final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectModel.getArchetypeTypeSet()); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, projectModel.getGameObjectFactory(), scriptedEventEditor, projectModel.getArchetypeSet()); - final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, projectModel.getMapManager(), projectModel.getPathManager()); + final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, projectModel.getMapManager(), projectModel.getPathManager(), scriptEditControl); final ScriptArchDataUtils<G, A, R> scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); - scriptArchEditor.setScriptEditControl(scriptEditControl); final GameObjectMatcher monsterMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_monster", "monster"); final GameObjectMatcher monsterMatcher = monsterMatcherTmp == null ? new TypeNrsGameObjectMatcher() : monsterMatcherTmp; final GameObjectMatcher exitGameObjectMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_exit", "exit"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:10:02
|
Revision: 9464 http://sourceforge.net/p/gridarta/code/9464 Author: akirschbaum Date: 2013-10-17 19:09:57 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Remove ScriptedEventEditor.setScriptEditControl(). Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java 2013-10-17 19:06:02 UTC (rev 9463) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java 2013-10-17 19:09:57 UTC (rev 9464) @@ -47,7 +47,6 @@ import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class ScriptedEventEditor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { @@ -66,8 +65,8 @@ /** * The {@link ScriptEditControl} to use. */ - @Nullable - private ScriptEditControl scriptEditControl; + @NotNull + private final ScriptEditControl scriptEditControl; @NotNull private JTextComponent inputScriptPath; @@ -81,13 +80,10 @@ /** * Creates a new instance. * @param projectSettings the project settings instance + * @param scriptEditControl the script edit control instance */ - public ScriptedEventEditor(@NotNull final ProjectSettings projectSettings) { + public ScriptedEventEditor(@NotNull final ProjectSettings projectSettings, @NotNull final ScriptEditControl scriptEditControl) { this.projectSettings = projectSettings; - } - - @Deprecated - public void setScriptEditControl(@Nullable final ScriptEditControl scriptEditControl) { this.scriptEditControl = scriptEditControl; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:06:02 UTC (rev 9463) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 19:09:57 UTC (rev 9464) @@ -352,12 +352,11 @@ final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); gameObjectAttributesDialogFactory.setTextAreaDefaults(textAreaDefaults); scriptEditControl.setTextAreaDefaults(textAreaDefaults); - final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); + final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings, scriptEditControl); final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectModel.getArchetypeTypeSet()); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, projectModel.getGameObjectFactory(), scriptedEventEditor, projectModel.getArchetypeSet()); final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, projectModel.getMapManager(), projectModel.getPathManager()); final ScriptArchDataUtils<G, A, R> scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); - scriptedEventEditor.setScriptEditControl(scriptEditControl); scriptArchEditor.setScriptEditControl(scriptEditControl); final GameObjectMatcher monsterMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_monster", "monster"); final GameObjectMatcher monsterMatcher = monsterMatcherTmp == null ? new TypeNrsGameObjectMatcher() : monsterMatcherTmp; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 19:06:09
|
Revision: 9463 http://sourceforge.net/p/gridarta/code/9463 Author: akirschbaum Date: 2013-10-17 19:06:02 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Remove unused import statements. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 18:58:32 UTC (rev 9462) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 19:06:02 UTC (rev 9463) @@ -42,9 +42,6 @@ import net.sf.gridarta.gui.filter.DefaultFilterControl; import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.map.renderer.RendererFactory; -import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; -import net.sf.gridarta.gui.scripts.ScriptArchEditor; -import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.configsource.ConfigSource; @@ -57,8 +54,6 @@ import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.NamedGameObjectMatcher; -import net.sf.gridarta.model.scripts.ScriptArchUtils; -import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.DefaultEditorSettings; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 18:58:39
|
Revision: 9462 http://sourceforge.net/p/gridarta/code/9462 Author: akirschbaum Date: 2013-10-17 18:58:32 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Move code from GridartaEditor to GUIMainControl. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 18:53:10 UTC (rev 9461) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 18:58:32 UTC (rev 9462) @@ -190,6 +190,7 @@ import net.sf.gridarta.model.pickmapsettings.DefaultPickmapSettings; import net.sf.gridarta.model.pickmapsettings.PickmapSettings; import net.sf.gridarta.model.scripts.ScriptArchUtils; +import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.DefaultVolatileSettings; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; @@ -302,17 +303,13 @@ * @param errorView the error view for reporting errors * @param guiUtils the gui utils for creating icons * @param pluginModel the plugin model instance - * @param scriptArchEditor the script arch editor instance - * @param scriptedEventEditor the scripted event editor instance - * @param scriptArchDataUtils the script arch data utils instance - * @param scriptArchUtils the script arch utils instance * @param editorFactory the editor factory instance * @param systemIcons the system icons for creating icons * @param configSourceFactory the config source factory instance * @param rendererFactory the renderer factory instance * @param filterControl the filter control instance */ - public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { + public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { this.projectModel = projectModel; final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, projectModel.getPathManager()); scriptExtension = editorFactory.getScriptExtension(); @@ -355,6 +352,11 @@ final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); gameObjectAttributesDialogFactory.setTextAreaDefaults(textAreaDefaults); scriptEditControl.setTextAreaDefaults(textAreaDefaults); + final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); + final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectModel.getArchetypeTypeSet()); + final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, projectModel.getGameObjectFactory(), scriptedEventEditor, projectModel.getArchetypeSet()); + final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, projectModel.getMapManager(), projectModel.getPathManager()); + final ScriptArchDataUtils<G, A, R> scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); scriptedEventEditor.setScriptEditControl(scriptEditControl); scriptArchEditor.setScriptEditControl(scriptEditControl); final GameObjectMatcher monsterMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_monster", "monster"); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 18:53:10 UTC (rev 9461) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 18:58:32 UTC (rev 9462) @@ -210,13 +210,7 @@ final ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); final ConfigSource configSource = configSourceFactory.getConfigSource(mode == GridartaRunMode.COLLECT_ARCHES ? "ARCH_DIRECTORY" : projectSettings.getConfigSourceName()); final ProjectModel<G, A, R> projectModel = new ProjectModel<G, A, R>(errorView, projectSettings, editorFactory, systemIcons, configSource); - final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); - final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectModel.getArchetypeTypeSet()); - final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, projectModel.getGameObjectFactory(), scriptedEventEditor, projectModel.getArchetypeSet()); - final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, projectModel.getMapManager(), projectModel.getPathManager()); - final ScriptArchDataUtils<G, A, R> scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); - final NamedFilter defaultNamedFilterList = new NamedFilter(projectModel.getGameObjectMatchers().getFilters()); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); @@ -240,7 +234,7 @@ try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginModel, projectModel, projectSettings, mapViewSettings, editorSettings, systemIcons, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor); + returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginModel, projectModel, projectSettings, mapViewSettings, editorSettings, systemIcons); break; case BATCH_PNG: @@ -331,19 +325,15 @@ * @param mapViewSettings the map view settings * @param editorSettings the editor settings * @param systemIcons the system icons for creating icons - * @param scriptedEventEditor the scripted event editor - * @param scriptArchDataUtils the script arch data utils - * @param scriptArchUtils the script arch utils - * @param scriptArchEditor the script arch editor * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { @Override public void run() { - guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, projectSettings, mapViewSettings, editorSettings, errorView, guiUtils, pluginModel, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, editorFactory, systemIcons, configSourceFactory, rendererFactory, filterControl); + guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, projectSettings, mapViewSettings, editorSettings, errorView, guiUtils, pluginModel, editorFactory, systemIcons, configSourceFactory, rendererFactory, filterControl); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-17 18:53:17
|
Revision: 9461 http://sourceforge.net/p/gridarta/code/9461 Author: akirschbaum Date: 2013-10-17 18:53:10 +0000 (Thu, 17 Oct 2013) Log Message: ----------- Move PathManager to ProjectModel. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-16 20:18:59 UTC (rev 9460) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-17 18:53:10 UTC (rev 9461) @@ -181,7 +181,6 @@ import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.exitconnector.ExitMatcher; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.InsertionModeSet; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; @@ -308,15 +307,14 @@ * @param scriptArchDataUtils the script arch data utils instance * @param scriptArchUtils the script arch utils instance * @param editorFactory the editor factory instance - * @param pathManager the path manager for converting path names * @param systemIcons the system icons for creating icons * @param configSourceFactory the config source factory instance * @param rendererFactory the renderer factory instance * @param filterControl the filter control instance */ - public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final PathManager pathManager, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { + public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { this.projectModel = projectModel; - final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager); + final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, projectModel.getPathManager()); scriptExtension = editorFactory.getScriptExtension(); final DisplayMode<G, A, R> displayModeGameObjectNames = new DisplayNameCellRenderer<G, A, R>(projectModel.getFaceObjectProviders()); final DisplayMode<G, A, R> displayModeArchetypeNames = new ArchetypeNameCellRenderer<G, A, R>(projectModel.getFaceObjectProviders()); @@ -394,7 +392,7 @@ final BookmarksMapMenuPreferences bookmarksMapMenuPreferences = new BookmarksMapMenuPreferences(); final MapMenu mapMenu = bookmarksMapMenuPreferences.getMapMenu(); @Nullable final MapMenuManager<G, A, R> bookmarksMapMenuManager = new MapMenuManager<G, A, R>(mapMenu, mapViewsManager, fileControl, mapImageCache); - final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, projectModel.getArchetypeSet(), projectModel.getMapManager(), fileControl, pathManager, insertionModeSet); // XXX: should be part of DefaultMainControl + final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, projectModel.getArchetypeSet(), projectModel.getMapManager(), fileControl, projectModel.getPathManager(), insertionModeSet); // XXX: should be part of DefaultMainControl final EditorAction exitConnectorController = new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareModel, objectChooser, pickmapSettings, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, projectModel.getMapManager(), selectedSquareModel, projectModel.getGameObjectFactory(), mapViewSettings); @@ -495,7 +493,7 @@ createAction("tipOfTheDay", "Help", new TipOfTheDayAction(parent)); createAction("newMap", "Map", new NewMapAction<G, A, R>(newMapDialogFactory)); createAction("goMap", "Map", new GoMapDialogManager<G, A, R>(parent, projectModel.getMapManager(), mapViewsManager, projectSettings, exiter)); - createAction("goExit", "Map Navigation", new GoExitDialogManager<G, A, R>(parent, projectModel.getMapManager(), mapViewManager, exitGameObjectMatcher, pathManager, enterMap, projectModel.getFaceObjectProviders())); + createAction("goExit", "Map Navigation", new GoExitDialogManager<G, A, R>(parent, projectModel.getMapManager(), mapViewManager, exitGameObjectMatcher, projectModel.getPathManager(), enterMap, projectModel.getFaceObjectProviders())); createAction("cleanCompletelyBlockedSquares", "Tool", new CleanCompletelyBlockedSquaresAction<G, A, R>(projectModel.getMapManager())); createAction("collectSpells", "Tool", new CollectSpellsAction(spellUtils, projectSettings, parent)); createAction("controlClient", "Tool", new ControlClientAction(appPreferencesModel, mainViewFrame)); @@ -531,7 +529,7 @@ createAction("gameObjectTextEditor", "Tool", new MainViewActions<G, A, R>(mainView, gameObjectAttributesControl, gameObjectTab, textEditorTab)); createAction("manageBookmarks", "Bookmarks", new ManageBookmarksAction<G, A, R>(mapMenu, mapImageCache, parent)); createAction("addBookmark", "Bookmarks", new AddBookmarkAction<G, A, R>(bookmarksMapMenuPreferences, mapViewManager)); - createActionOptional("openInClient", "Map", editorFactory.newServerActions(mapViewManager, fileControl, pathManager)); + createActionOptional("openInClient", "Map", editorFactory.newServerActions(mapViewManager, fileControl, projectModel.getPathManager())); createAction("exitCopy", "Exit Connector", exitConnectorController); createAction("exitPaste", "Exit Connector", exitConnectorController); createAction("exitConnect", "Exit Connector", exitConnectorController); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-16 20:18:59 UTC (rev 9460) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-17 18:53:10 UTC (rev 9461) @@ -53,7 +53,6 @@ import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; @@ -209,14 +208,13 @@ final ConfigSourceFactory configSourceFactory = new DefaultConfigSourceFactory(); final EditorSettings editorSettings = new DefaultEditorSettings(); final ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); - final PathManager pathManager = new PathManager(projectSettings); final ConfigSource configSource = configSourceFactory.getConfigSource(mode == GridartaRunMode.COLLECT_ARCHES ? "ARCH_DIRECTORY" : projectSettings.getConfigSourceName()); final ProjectModel<G, A, R> projectModel = new ProjectModel<G, A, R>(errorView, projectSettings, editorFactory, systemIcons, configSource); final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectModel.getArchetypeTypeSet()); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, projectModel.getGameObjectFactory(), scriptedEventEditor, projectModel.getArchetypeSet()); - final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, projectModel.getMapManager(), pathManager); + final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, projectModel.getMapManager(), projectModel.getPathManager()); final ScriptArchDataUtils<G, A, R> scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); final NamedFilter defaultNamedFilterList = new NamedFilter(projectModel.getGameObjectMatchers().getFilters()); @@ -242,7 +240,7 @@ try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginModel, projectModel, projectSettings, mapViewSettings, editorSettings, pathManager, systemIcons, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor); + returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginModel, projectModel, projectSettings, mapViewSettings, editorSettings, systemIcons, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor); break; case BATCH_PNG: @@ -332,7 +330,6 @@ * @param projectSettings the project settings * @param mapViewSettings the map view settings * @param editorSettings the editor settings - * @param pathManager the path manager * @param systemIcons the system icons for creating icons * @param scriptedEventEditor the scripted event editor * @param scriptArchDataUtils the script arch data utils @@ -340,13 +337,13 @@ * @param scriptArchEditor the script arch editor * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final PathManager pathManager, @NotNull final SystemIcons systemIcons, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final EditorSettings editorSettings, @NotNull final SystemIcons systemIcons, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { @Override public void run() { - guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, projectSettings, mapViewSettings, editorSettings, errorView, guiUtils, pluginModel, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, editorFactory, pathManager, systemIcons, configSourceFactory, rendererFactory, filterControl); + guiMainControl[0] = new GUIMainControl<G, A, R>(projectModel, projectSettings, mapViewSettings, editorSettings, errorView, guiUtils, pluginModel, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, editorFactory, systemIcons, configSourceFactory, rendererFactory, filterControl); } }; Modified: trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java =================================================================== --- trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 2013-10-16 20:18:59 UTC (rev 9460) +++ trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 2013-10-17 18:53:10 UTC (rev 9461) @@ -63,6 +63,7 @@ import net.sf.gridarta.model.io.MapArchObjectParserFactory; import net.sf.gridarta.model.io.MapReaderFactory; import net.sf.gridarta.model.io.MapWriter; +import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.mapcontrol.MapControlFactory; @@ -190,6 +191,9 @@ @NotNull private final TreasureTree treasureTree; + @NotNull + private final PathManager pathManager; + public ProjectModel(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ProjectFactory<G, A, R> projectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSource configSource) { final XmlHelper xmlHelper; try { @@ -240,6 +244,7 @@ scriptsFile = new File(projectSettings.getMapsDirectory(), projectFactory.getScriptsDir()); final Map<String, TreasureTreeNode> specialTreasureLists = loadSpecialTreasureLists(errorView, xmlHelper.getDocumentBuilder(), projectSettings); treasureTree = TreasureLoader.parseTreasures(errorView, specialTreasureLists, configSource, projectSettings); + pathManager = new PathManager(projectSettings); } @NotNull @@ -555,4 +560,9 @@ return treasureTree; } + @NotNull + public PathManager getPathManager() { + return pathManager; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |