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...> - 2010-06-26 13:45:19
|
Revision: 8510 http://gridarta.svn.sourceforge.net/gridarta/?rev=8510&view=rev Author: akirschbaum Date: 2010-06-26 13:45:11 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java Modified: trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2010-06-26 13:44:33 UTC (rev 8509) +++ trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2010-06-26 13:45:11 UTC (rev 8510) @@ -65,8 +65,9 @@ public Element toXML() { final Element e = super.toXML(); final Element v = new Element("value"); - if (getValue() != null) { - v.addContent(getValue().getArchetypeName()); + final Archetype<G, A, R> archetype = getValue(); + if (archetype != null) { + v.addContent(archetype.getArchetypeName()); } else { v.addContent(valueString); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 13:44:40
|
Revision: 8509 http://gridarta.svn.sourceforge.net/gridarta/?rev=8509&view=rev Author: akirschbaum Date: 2010-06-26 13:44:33 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Add @Nullable annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java Modified: trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2010-06-26 13:38:32 UTC (rev 8508) +++ trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2010-06-26 13:44:33 UTC (rev 8509) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import org.jdom.Element; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ArchParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, Archetype<G, A, R>, Void> { @@ -73,6 +74,7 @@ return e; } + @Nullable @Override public Archetype<G, A, R> getValue() { if (super.getValue() == null) { Modified: trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java 2010-06-26 13:38:32 UTC (rev 8508) +++ trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java 2010-06-26 13:44:33 UTC (rev 8509) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.map.mapcontrol.MapControl; import org.jdom.Element; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class MapParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, Object, Void> { // XXX: find correct parameter type: String or MapControl<GameObject, MapArchObject, Archetype> @@ -72,6 +73,7 @@ return e; } + @Nullable @Override public Object getValue() { final String s = (String) super.getValue(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 13:38:38
|
Revision: 8508 http://gridarta.svn.sourceforge.net/gridarta/?rev=8508&view=rev Author: akirschbaum Date: 2010-06-26 13:38:32 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Reorder fields. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java 2010-06-26 13:37:40 UTC (rev 8507) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java 2010-06-26 13:38:32 UTC (rev 8508) @@ -29,10 +29,10 @@ public class ParameterDescriptionEditor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JTextField { + private static final long serialVersionUID = 1L; + private final PluginParameter<G, A, R> parameter; - private static final long serialVersionUID = 1L; - public ParameterDescriptionEditor(final PluginParameter<G, A, R> param) { parameter = param; setText(param.getDescription()); Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java 2010-06-26 13:37:40 UTC (rev 8507) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java 2010-06-26 13:38:32 UTC (rev 8508) @@ -35,13 +35,13 @@ public class ParameterTypeEditor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JComboBox { + private static final long serialVersionUID = 1L; + /** * The Logger for printing log messages. */ private static final Category log = Logger.getLogger(ParameterTypeEditor.class); - private static final long serialVersionUID = 1L; - private final PluginParameter<G, A, R> parameter; private final Script<G, A, R> script; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 13:37:46
|
Revision: 8507 http://gridarta.svn.sourceforge.net/gridarta/?rev=8507&view=rev Author: akirschbaum Date: 2010-06-26 13:37:40 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java 2010-06-26 13:37:17 UTC (rev 8506) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java 2010-06-26 13:37:40 UTC (rev 8507) @@ -278,7 +278,7 @@ final PluginParameter<G, A, R> parameter; try { parameter = script.getParameter(selectedRow); - } catch (final NoSuchParameterException ex) { + } catch (final NoSuchParameterException ignored) { return; } final String name = parameter.getName(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 13:37:23
|
Revision: 8506 http://gridarta.svn.sourceforge.net/gridarta/?rev=8506&view=rev Author: akirschbaum Date: 2010-06-26 13:37:17 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java 2010-06-26 13:35:20 UTC (rev 8505) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java 2010-06-26 13:37:17 UTC (rev 8506) @@ -74,15 +74,19 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(ScriptEditor.class); @NotNull private final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory; + @NotNull private final JPanel paramTable; + @NotNull private final AbstractButton removeParameter; + @NotNull private final JTextArea code; @NotNull @@ -91,16 +95,21 @@ @NotNull private final Script<G, A, R> script; + @NotNull private final Map<PluginParameter<G, A, R>, ParameterNameEditor<G, A, R>> paramNameEditors = new HashMap<PluginParameter<G, A, R>, ParameterNameEditor<G, A, R>>(); + @NotNull private final Map<PluginParameter<G, A, R>, ParameterDescriptionEditor<G, A, R>> paramDescriptionEditors = new HashMap<PluginParameter<G, A, R>, ParameterDescriptionEditor<G, A, R>>(); + @NotNull private final Map<PluginParameter<G, A, R>, ParameterTypeEditor<G, A, R>> paramTypeEditors = new HashMap<PluginParameter<G, A, R>, ParameterTypeEditor<G, A, R>>(); + @NotNull private final Map<PluginParameter<G, A, R>, PluginParameterView<G, A, R>> paramViews = new HashMap<PluginParameter<G, A, R>, PluginParameterView<G, A, R>>(); private int selectedRow = -1; + @NotNull private final MouseListener cellMouseListener = new MouseListener() { @Override public void mouseClicked(final MouseEvent e) { @@ -126,6 +135,7 @@ } }; + @NotNull private final FocusListener cellFocusListener = new FocusListener() { @Override public void focusGained(final FocusEvent e) { @@ -137,10 +147,13 @@ } }; + @NotNull private final AbstractButton typeAutoRun; + @NotNull private final AbstractButton typeFilter; + @NotNull private final AbstractButton typeBash; /** @@ -149,7 +162,7 @@ * @param scriptController the associated script control instance * @param systemIcons the system icons for creating icons */ - public ScriptEditor(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final Script<G, A, R> script, final ScriptController<G, A, R> scriptController, @NotNull final ScriptModel<G, A, R> scriptModel, final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { + public ScriptEditor(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final Script<G, A, R> script, @NotNull final ScriptController<G, A, R> scriptController, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { this.pluginParameterFactory = pluginParameterFactory; this.script = script; this.pluginParameterViewFactory = pluginParameterViewFactory; @@ -313,7 +326,7 @@ tabs.addTab("Code", codePanel); } - public void selectTableComponent(final Component c) { + public void selectTableComponent(@NotNull final Component c) { final GridBagLayout l = (GridBagLayout) paramTable.getLayout(); final GridBagConstraints gbc = l.getConstraints(c); if (gbc != null) { @@ -342,12 +355,12 @@ repaint(); } - private void newTableComponent(final Component c) { + private void newTableComponent(@NotNull final Component c) { c.addFocusListener(cellFocusListener); c.addMouseListener(cellMouseListener); } - private Component getParameterNameEditor(final PluginParameter<G, A, R> param) { + private Component getParameterNameEditor(@NotNull final PluginParameter<G, A, R> param) { if (log.isDebugEnabled()) { log.debug("Doing " + param); } @@ -363,7 +376,7 @@ return newParameterNameEditor; } - private Component getParameterDescriptionEditor(final PluginParameter<G, A, R> param) { + private Component getParameterDescriptionEditor(@NotNull final PluginParameter<G, A, R> param) { final Component existingParameterDescriptionEditor = paramDescriptionEditors.get(param); if (existingParameterDescriptionEditor != null) { return existingParameterDescriptionEditor; @@ -375,7 +388,7 @@ return newParameterDescriptionEditor; } - private Component getParameterTypeEditor(final PluginParameter<G, A, R> param) { + private Component getParameterTypeEditor(@NotNull final PluginParameter<G, A, R> param) { final Component existingParameterTypeEditor = paramTypeEditors.get(param); if (existingParameterTypeEditor != null) { return existingParameterTypeEditor; @@ -387,7 +400,7 @@ return newParameterTypeEditor; } - private PluginParameterView<G, A, R> getParameterView(final PluginParameter<G, A, R> param) { + private PluginParameterView<G, A, R> getParameterView(@NotNull final PluginParameter<G, A, R> param) { final PluginParameterView<G, A, R> existingPluginParameterView = paramViews.get(param); if (existingPluginParameterView != null) { return existingPluginParameterView; @@ -402,7 +415,7 @@ return newPluginParameterView; } - private void putRow(final GridBagConstraints gbc, final PluginParameter<G, A, R> param) { + private void putRow(@NotNull final GridBagConstraints gbc, @NotNull final PluginParameter<G, A, R> param) { gbc.gridx = 0; paramTable.add(getParameterNameEditor(param), gbc); gbc.gridx = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 13:35:27
|
Revision: 8505 http://gridarta.svn.sourceforge.net/gridarta/?rev=8505&view=rev Author: akirschbaum Date: 2010-06-26 13:35:20 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Remove redundant parameters. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -395,8 +395,8 @@ final PluginParameterView<G, A, R> newPluginParameterView = pluginParameterViewFactory.getView(param); - newTableComponent(newPluginParameterView.getConfigComponent(param)); - newTableComponent(newPluginParameterView.getValueComponent(param)); + newTableComponent(newPluginParameterView.getConfigComponent()); + newTableComponent(newPluginParameterView.getValueComponent()); paramViews.put(param, newPluginParameterView); return newPluginParameterView; @@ -412,9 +412,9 @@ gbc.weightx = 0.1; paramTable.add(getParameterTypeEditor(param), gbc); gbc.gridx = 3; - paramTable.add(getParameterView(param).getConfigComponent(param), gbc); + paramTable.add(getParameterView(param).getConfigComponent(), gbc); gbc.gridx = 4; - paramTable.add(getParameterView(param).getValueComponent(param), gbc); + paramTable.add(getParameterView(param).getValueComponent(), gbc); } } // class ScriptEditor Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -232,7 +232,7 @@ log.debug("adding parameter"); final Component name = new JLabel(parameter.getName()); final PluginParameterView<G, A, R> view = pluginParameterViewFactory.getView(parameter); - final JComponent val = view.getValueComponent(parameter); + final JComponent val = view.getValueComponent(); val.setToolTipText(parameter.getDescription()); final GridBagConstraints gn = new GridBagConstraints(0, i, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 5, 5); final GridBagConstraints gf = new GridBagConstraints(1, i, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 5, 5); Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -32,7 +32,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.AbstractPluginParameter; -import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; public class ArchParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { @@ -70,14 +69,14 @@ @NotNull @Override - public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { - return this.config; + public JComponent getConfigComponent() { + return config; } @NotNull @Override - public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { - return this.value; + public JComponent getValueComponent() { + return value; } } // class ArchParameterView Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -30,7 +30,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.BooleanParameter; -import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; public class BooleanParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R>, ActionListener { @@ -57,14 +56,14 @@ @NotNull @Override - public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { - return this.config; + public JComponent getConfigComponent() { + return config; } @NotNull @Override - public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { - return this.value; + public JComponent getValueComponent() { + return value; } @Override Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -35,7 +35,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.DoubleParameter; -import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -73,14 +72,14 @@ @NotNull @Override - public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { - return this.config; + public JComponent getConfigComponent() { + return config; } @NotNull @Override - public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { - return this.value; + public JComponent getValueComponent() { + return value; } private void updateTooltip() { Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -26,7 +26,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.FilterParameter; -import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; public class FilterParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { @@ -47,8 +46,8 @@ */ @NotNull @Override - public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { - return this.value; + public JComponent getValueComponent() { + return value; } /** @@ -56,8 +55,8 @@ */ @NotNull @Override - public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { - return this.config; + public JComponent getConfigComponent() { + return config; } } // class FilterParameterView Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -34,7 +34,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.IntegerParameter; -import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; public class IntegerParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R>, ActionListener { @@ -75,14 +74,14 @@ @NotNull @Override - public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { - return this.config; + public JComponent getConfigComponent() { + return config; } @NotNull @Override - public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { - return this.value; + public JComponent getValueComponent() { + return value; } private void updateTooltip() { Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -30,7 +30,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.MapParameter; -import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; public class MapParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { @@ -70,7 +69,7 @@ */ @NotNull @Override - public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { + public JComponent getValueComponent() { return this.value; } @@ -79,7 +78,7 @@ */ @NotNull @Override - public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent() { return this.config; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -23,7 +23,6 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; /** @@ -33,9 +32,9 @@ public interface PluginParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { @NotNull - JComponent getValueComponent(@NotNull PluginParameter<G, A, R> value); + JComponent getValueComponent(); @NotNull - JComponent getConfigComponent(@NotNull PluginParameter<G, A, R> config); + JComponent getConfigComponent(); } // interface PluginParameterView Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2010-06-26 13:35:20 UTC (rev 8505) @@ -30,7 +30,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.AbstractPluginParameter; -import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; public class StringParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { @@ -71,16 +70,15 @@ @NotNull @Override - public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent() { return this.config; } @NotNull @Override - public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { - final AbstractPluginParameter<G, A, R, String, Void> abstractPluginParameter = (AbstractPluginParameter<G, A, R, String, Void>) value; // XXX - this.value.setText(abstractPluginParameter.getValue()); - return this.value; + public JComponent getValueComponent() { + value.setText(linkedParameter.getValue()); + return value; } } // class StringParameterView This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 13:28:49
|
Revision: 8504 http://gridarta.svn.sourceforge.net/gridarta/?rev=8504&view=rev Author: akirschbaum Date: 2010-06-26 13:28:42 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Add nullable annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) @@ -37,10 +37,13 @@ public class ArchParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { + @NotNull private final JComponent config = new JPanel(); + @NotNull private final JComboBox value; + @NotNull private final AbstractPluginParameter<G, A, R, Archetype<G, A, R>, Void> parameter; /** @@ -48,7 +51,7 @@ * @param faceObjectProviders the face object providers for looking up * faces */ - public ArchParameterView(final AbstractPluginParameter<G, A, R, Archetype<G, A, R>, Void> param, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders) { + public ArchParameterView(@NotNull final AbstractPluginParameter<G, A, R, Archetype<G, A, R>, Void> param, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders) { value = new ArchComboBox<G, A, R>(gameObjectAttributesModel, archetypeSet, objectChooser, faceObjectProviders); parameter = param; value.setSelectedItem(param.getValue()); @@ -65,13 +68,15 @@ }); } + @NotNull @Override - public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { return this.config; } + @NotNull @Override - public JComponent getValueComponent(final PluginParameter<G, A, R> value) { + public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { return this.value; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) @@ -31,16 +31,20 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.BooleanParameter; import net.sf.gridarta.script.parameter.PluginParameter; +import org.jetbrains.annotations.NotNull; public class BooleanParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R>, ActionListener { + @NotNull private final AbstractButton value; + @NotNull private final AbstractButton config; + @NotNull private final BooleanParameter<G, A, R> parameter; - public BooleanParameterView(final BooleanParameter<G, A, R> param) { + public BooleanParameterView(@NotNull final BooleanParameter<G, A, R> param) { parameter = param; value = new JCheckBox(); value.setActionCommand("toggle"); @@ -51,18 +55,20 @@ config.addActionListener(this); } + @NotNull @Override - public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { return this.config; } + @NotNull @Override - public JComponent getValueComponent(final PluginParameter<G, A, R> value) { + public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { return this.value; } @Override - public void actionPerformed(final ActionEvent e) { + public void actionPerformed(@NotNull final ActionEvent e) { if (e.getActionCommand().equals("toggle")) { if (value.isSelected()) { parameter.setValue(Boolean.TRUE); Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) @@ -36,16 +36,21 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.DoubleParameter; import net.sf.gridarta.script.parameter.PluginParameter; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class DoubleParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R>, ActionListener { + @NotNull private final JSpinner value; + @NotNull private final AbstractButton config; + @NotNull private final DoubleParameter<G, A, R> parameter; - public DoubleParameterView(final DoubleParameter<G, A, R> param) { + public DoubleParameterView(@NotNull final DoubleParameter<G, A, R> param) { parameter = param; final SpinnerModel mdl = new SpinnerNumberModel(0.0, param.getMin(), param.getMax(), (param.getMax() - param.getMin()) / 100.0); value = new TooltipSpinner(mdl); @@ -66,13 +71,15 @@ updateTooltip(); } + @NotNull @Override - public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { return this.config; } + @NotNull @Override - public JComponent getValueComponent(final PluginParameter<G, A, R> value) { + public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { return this.value; } @@ -83,7 +90,7 @@ } @Override - public void actionPerformed(final ActionEvent e) { + public void actionPerformed(@NotNull final ActionEvent e) { if (e.getActionCommand().equals("Config")) { final String min = JOptionPane.showInputDialog("Minimum value:", parameter.getMin()); final String max = JOptionPane.showInputDialog("Maximum value:", parameter.getMax()); @@ -108,7 +115,7 @@ private static final long serialVersionUID = 1L; - private TooltipSpinner(final SpinnerModel model) { + private TooltipSpinner(@NotNull final SpinnerModel model) { super(model); } @@ -118,11 +125,11 @@ * @param text the tooltip to show */ @Override - public void setToolTipText(final String text) { + public void setToolTipText(@Nullable final String text) { forceTooltip(this, text); } - private void forceTooltip(final JComponent c, final String tip) { + private void forceTooltip(@NotNull final JComponent c, @Nullable final String tip) { if (c == this) { super.setToolTipText(tip); } else { Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) @@ -27,14 +27,17 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.FilterParameter; import net.sf.gridarta.script.parameter.PluginParameter; +import org.jetbrains.annotations.NotNull; public class FilterParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { + @NotNull private final JComponent value; + @NotNull private final JPanel config = new JPanel(); - public FilterParameterView(final FilterParameter<G, A, R> param) { + public FilterParameterView(@NotNull final FilterParameter<G, A, R> param) { value = new MenuItemCreator(param.getValue()).getMenuItem(); value.setName("Choose filters"); } @@ -42,16 +45,18 @@ /** * {@inheritDoc} */ + @NotNull @Override - public JComponent getValueComponent(final PluginParameter<G, A, R> value) { + public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { return this.value; } /** * {@inheritDoc} */ + @NotNull @Override - public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { return this.config; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) @@ -35,16 +35,20 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.IntegerParameter; import net.sf.gridarta.script.parameter.PluginParameter; +import org.jetbrains.annotations.NotNull; public class IntegerParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R>, ActionListener { + @NotNull private final JSpinner value; + @NotNull private final AbstractButton config; + @NotNull private final IntegerParameter<G, A, R> parameter; - public IntegerParameterView(final IntegerParameter<G, A, R> parameter) { + public IntegerParameterView(@NotNull final IntegerParameter<G, A, R> parameter) { this.parameter = parameter; final SpinnerModel mdl = new SpinnerNumberModel(0, parameter.getMin(), parameter.getMax(), 1); value = new TooltipSpinner(mdl); @@ -69,13 +73,15 @@ updateTooltip(); } + @NotNull @Override - public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { return this.config; } + @NotNull @Override - public JComponent getValueComponent(final PluginParameter<G, A, R> value) { + public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { return this.value; } @@ -86,7 +92,7 @@ } @Override - public void actionPerformed(final ActionEvent e) { + public void actionPerformed(@NotNull final ActionEvent e) { if (e.getActionCommand().equals("Config")) { final String min = JOptionPane.showInputDialog("Minimum value:", parameter.getMin()); final String max = JOptionPane.showInputDialog("Maximum value:", parameter.getMax()); Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) @@ -35,13 +35,16 @@ public class MapParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { + @NotNull private final MapParameter<G, A, R> parameter; + @NotNull private final JComponent config = new JPanel(); + @NotNull private final JComboBox value; - public MapParameterView(final MapParameter<G, A, R> param, @NotNull final MapManager<G, A, R> mapManager) { + public MapParameterView(@NotNull final MapParameter<G, A, R> param, @NotNull final MapManager<G, A, R> mapManager) { parameter = param; value = new JComboBox(); final ComboBoxModel myModel = new MapParameterComboBoxModel<G, A, R>(mapManager); @@ -65,16 +68,18 @@ /** * {@inheritDoc} */ + @NotNull @Override - public JComponent getValueComponent(final PluginParameter<G, A, R> value) { + public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { return this.value; } /** * {@inheritDoc} */ + @NotNull @Override - public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { return this.config; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) @@ -24,6 +24,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.PluginParameter; +import org.jetbrains.annotations.NotNull; /** * Interface for Views that display plugin parameters. @@ -31,8 +32,10 @@ */ public interface PluginParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - JComponent getValueComponent(PluginParameter<G, A, R> value); + @NotNull + JComponent getValueComponent(@NotNull PluginParameter<G, A, R> value); - JComponent getConfigComponent(PluginParameter<G, A, R> config); + @NotNull + JComponent getConfigComponent(@NotNull PluginParameter<G, A, R> config); } // interface PluginParameterView Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2010-06-26 13:28:42 UTC (rev 8504) @@ -31,16 +31,20 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.AbstractPluginParameter; import net.sf.gridarta.script.parameter.PluginParameter; +import org.jetbrains.annotations.NotNull; public class StringParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { + @NotNull private final JTextComponent value = new JTextField(); + @NotNull private final JComponent config = new JPanel(); + @NotNull private final AbstractPluginParameter<G, A, R, String, Void> linkedParameter; - public StringParameterView(final AbstractPluginParameter<G, A, R, String, Void> parameter) { + public StringParameterView(@NotNull final AbstractPluginParameter<G, A, R, String, Void> parameter) { linkedParameter = parameter; final Document d = value.getDocument(); d.addDocumentListener(new DocumentListener() { @@ -65,13 +69,15 @@ }); } + @NotNull @Override - public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { + public JComponent getConfigComponent(@NotNull final PluginParameter<G, A, R> config) { return this.config; } + @NotNull @Override - public JComponent getValueComponent(final PluginParameter<G, A, R> value) { + public JComponent getValueComponent(@NotNull final PluginParameter<G, A, R> value) { final AbstractPluginParameter<G, A, R, String, Void> abstractPluginParameter = (AbstractPluginParameter<G, A, R, String, Void>) value; // XXX this.value.setText(abstractPluginParameter.getValue()); return this.value; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 13:25:15
|
Revision: 8503 http://gridarta.svn.sourceforge.net/gridarta/?rev=8503&view=rev Author: akirschbaum Date: 2010-06-26 13:25:08 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Create only one component for filter parameters. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-06-26 13:25:08 UTC (rev 8503) @@ -32,6 +32,8 @@ private final JComponent value; + private final JPanel config = new JPanel(); + public FilterParameterView(final FilterParameter<G, A, R> param) { value = new MenuItemCreator(param.getValue()).getMenuItem(); value.setName("Choose filters"); @@ -50,7 +52,7 @@ */ @Override public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { - return new JPanel(); + return this.config; } } // class FilterParameterView This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 13:23:18
|
Revision: 8502 http://gridarta.svn.sourceforge.net/gridarta/?rev=8502&view=rev Author: akirschbaum Date: 2010-06-26 13:23:10 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Fix type parameters. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java trunk/src/app/net/sf/gridarta/script/Script.java trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -91,13 +91,13 @@ @NotNull private final Script<G, A, R> script; - private final Map<PluginParameter<G, A, R, ?, ?>, ParameterNameEditor<G, A, R>> paramNameEditors = new HashMap<PluginParameter<G, A, R, ?, ?>, ParameterNameEditor<G, A, R>>(); + private final Map<PluginParameter<G, A, R>, ParameterNameEditor<G, A, R>> paramNameEditors = new HashMap<PluginParameter<G, A, R>, ParameterNameEditor<G, A, R>>(); - private final Map<PluginParameter<G, A, R, ?, ?>, ParameterDescriptionEditor<G, A, R>> paramDescriptionEditors = new HashMap<PluginParameter<G, A, R, ?, ?>, ParameterDescriptionEditor<G, A, R>>(); + private final Map<PluginParameter<G, A, R>, ParameterDescriptionEditor<G, A, R>> paramDescriptionEditors = new HashMap<PluginParameter<G, A, R>, ParameterDescriptionEditor<G, A, R>>(); - private final Map<PluginParameter<G, A, R, ?, ?>, ParameterTypeEditor<G, A, R>> paramTypeEditors = new HashMap<PluginParameter<G, A, R, ?, ?>, ParameterTypeEditor<G, A, R>>(); + private final Map<PluginParameter<G, A, R>, ParameterTypeEditor<G, A, R>> paramTypeEditors = new HashMap<PluginParameter<G, A, R>, ParameterTypeEditor<G, A, R>>(); - private final Map<PluginParameter<G, A, R, ?, ?>, PluginParameterView<G, A, R, ?, ?>> paramViews = new HashMap<PluginParameter<G, A, R, ?, ?>, PluginParameterView<G, A, R, ?, ?>>(); + private final Map<PluginParameter<G, A, R>, PluginParameterView<G, A, R>> paramViews = new HashMap<PluginParameter<G, A, R>, PluginParameterView<G, A, R>>(); private int selectedRow = -1; @@ -262,7 +262,7 @@ return; } - final PluginParameter<G, A, R, ?, ?> parameter; + final PluginParameter<G, A, R> parameter; try { parameter = script.getParameter(selectedRow); } catch (final NoSuchParameterException ex) { @@ -334,7 +334,7 @@ gbc.gridx = 4; paramTable.add(new JLabel("Default"), gbc); int i = 0; - for (final PluginParameter<G, A, R, ?, ?> parameter : script) { + for (final PluginParameter<G, A, R> parameter : script) { gbc.gridy = i + 1; putRow(gbc, parameter); i++; @@ -347,7 +347,7 @@ c.addMouseListener(cellMouseListener); } - private Component getParameterNameEditor(final PluginParameter<G, A, R, ?, ?> param) { + private Component getParameterNameEditor(final PluginParameter<G, A, R> param) { if (log.isDebugEnabled()) { log.debug("Doing " + param); } @@ -363,7 +363,7 @@ return newParameterNameEditor; } - private Component getParameterDescriptionEditor(final PluginParameter<G, A, R, ?, ?> param) { + private Component getParameterDescriptionEditor(final PluginParameter<G, A, R> param) { final Component existingParameterDescriptionEditor = paramDescriptionEditors.get(param); if (existingParameterDescriptionEditor != null) { return existingParameterDescriptionEditor; @@ -375,7 +375,7 @@ return newParameterDescriptionEditor; } - private Component getParameterTypeEditor(final PluginParameter<G, A, R, ?, ?> param) { + private Component getParameterTypeEditor(final PluginParameter<G, A, R> param) { final Component existingParameterTypeEditor = paramTypeEditors.get(param); if (existingParameterTypeEditor != null) { return existingParameterTypeEditor; @@ -387,28 +387,22 @@ return newParameterTypeEditor; } - private PluginParameterView getParameterView(final PluginParameter<G, A, R, ?, ?> param) { - final PluginParameterView<G, A, R, ?, ?> existingPluginParameterView = paramViews.get(param); + private PluginParameterView<G, A, R> getParameterView(final PluginParameter<G, A, R> param) { + final PluginParameterView<G, A, R> existingPluginParameterView = paramViews.get(param); if (existingPluginParameterView != null) { return existingPluginParameterView; } - final PluginParameterView newPluginParameterView = pluginParameterViewFactory.getView(param); - if (log.isDebugEnabled()) { - log.debug("param.getValue() is " + param.getValue()); - } + final PluginParameterView<G, A, R> newPluginParameterView = pluginParameterViewFactory.getView(param); - newTableComponent(newPluginParameterView.getConfigComponent(param.getConfig())); - newTableComponent(newPluginParameterView.getValueComponent(param.getValue())); - if (log.isDebugEnabled()) { - log.debug("param.getValue() is " + param.getValue()); - } + newTableComponent(newPluginParameterView.getConfigComponent(param)); + newTableComponent(newPluginParameterView.getValueComponent(param)); paramViews.put(param, newPluginParameterView); return newPluginParameterView; } - private void putRow(final GridBagConstraints gbc, final PluginParameter<G, A, R, ?, ?> param) { + private void putRow(final GridBagConstraints gbc, final PluginParameter<G, A, R> param) { gbc.gridx = 0; paramTable.add(getParameterNameEditor(param), gbc); gbc.gridx = 1; @@ -418,9 +412,9 @@ gbc.weightx = 0.1; paramTable.add(getParameterTypeEditor(param), gbc); gbc.gridx = 3; - paramTable.add(getParameterView(param).getConfigComponent(param.getConfig()), gbc); + paramTable.add(getParameterView(param).getConfigComponent(param), gbc); gbc.gridx = 4; - paramTable.add(getParameterView(param).getValueComponent(param.getValue()), gbc); + paramTable.add(getParameterView(param).getValueComponent(param), gbc); } } // class ScriptEditor Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -228,11 +228,11 @@ dialog.setModal(true); dialog.getContentPane().removeAll(); int i = 0; - for (final PluginParameter<G, A, R, ?, ?> parameter : script) { + for (final PluginParameter<G, A, R> parameter : script) { log.debug("adding parameter"); final Component name = new JLabel(parameter.getName()); - final PluginParameterView view = pluginParameterViewFactory.getView(parameter); - final JComponent val = view.getValueComponent(parameter.getValue()); + final PluginParameterView<G, A, R> view = pluginParameterViewFactory.getView(parameter); + final JComponent val = view.getValueComponent(parameter); val.setToolTipText(parameter.getDescription()); final GridBagConstraints gn = new GridBagConstraints(0, i, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 5, 5); final GridBagConstraints gf = new GridBagConstraints(1, i, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 5, 5); Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -31,23 +31,24 @@ import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.script.parameter.AbstractPluginParameter; import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; -public class ArchParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, R, Void> { +public class ArchParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { private final JComponent config = new JPanel(); private final JComboBox value; - private final PluginParameter<G, A, R, Archetype<G, A, R>, Void> parameter; + private final AbstractPluginParameter<G, A, R, Archetype<G, A, R>, Void> parameter; /** * Creates a new instance. * @param faceObjectProviders the face object providers for looking up * faces */ - public ArchParameterView(final PluginParameter<G, A, R, Archetype<G, A, R>, Void> param, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders) { + public ArchParameterView(final AbstractPluginParameter<G, A, R, Archetype<G, A, R>, Void> param, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders) { value = new ArchComboBox<G, A, R>(gameObjectAttributesModel, archetypeSet, objectChooser, faceObjectProviders); parameter = param; value.setSelectedItem(param.getValue()); @@ -65,12 +66,12 @@ } @Override - public JComponent getConfigComponent(final Void config) { + public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { return this.config; } @Override - public JComponent getValueComponent(final R value) { + public JComponent getValueComponent(final PluginParameter<G, A, R> value) { return this.value; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -29,10 +29,10 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.script.parameter.BooleanConfig; import net.sf.gridarta.script.parameter.BooleanParameter; +import net.sf.gridarta.script.parameter.PluginParameter; -public class BooleanParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, Boolean, BooleanConfig>, ActionListener { +public class BooleanParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R>, ActionListener { private final AbstractButton value; @@ -52,12 +52,12 @@ } @Override - public JComponent getConfigComponent(final BooleanConfig config) { + public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { return this.config; } @Override - public JComponent getValueComponent(final Boolean value) { + public JComponent getValueComponent(final PluginParameter<G, A, R> value) { return this.value; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -34,10 +34,10 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.script.parameter.DoubleConfig; import net.sf.gridarta.script.parameter.DoubleParameter; +import net.sf.gridarta.script.parameter.PluginParameter; -public class DoubleParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, Double, DoubleConfig>, ActionListener { +public class DoubleParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R>, ActionListener { private final JSpinner value; @@ -67,12 +67,12 @@ } @Override - public JComponent getConfigComponent(final DoubleConfig config) { + public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { return this.config; } @Override - public JComponent getValueComponent(final Double value) { + public JComponent getValueComponent(final PluginParameter<G, A, R> value) { return this.value; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -23,12 +23,12 @@ import javax.swing.JPanel; import net.sf.gridarta.gui.filter.MenuItemCreator; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.FilterParameter; +import net.sf.gridarta.script.parameter.PluginParameter; -public class FilterParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, FilterConfig<?, ?>, Void> { +public class FilterParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { private final JComponent value; @@ -41,7 +41,7 @@ * {@inheritDoc} */ @Override - public JComponent getValueComponent(final FilterConfig<?, ?> value) { + public JComponent getValueComponent(final PluginParameter<G, A, R> value) { return this.value; } @@ -49,7 +49,7 @@ * {@inheritDoc} */ @Override - public JComponent getConfigComponent(final Void config) { + public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { return new JPanel(); } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -33,10 +33,10 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.script.parameter.IntegerConfig; import net.sf.gridarta.script.parameter.IntegerParameter; +import net.sf.gridarta.script.parameter.PluginParameter; -public class IntegerParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, Integer, IntegerConfig>, ActionListener { +public class IntegerParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R>, ActionListener { private final JSpinner value; @@ -70,12 +70,12 @@ } @Override - public JComponent getConfigComponent(final IntegerConfig config) { + public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { return this.config; } @Override - public JComponent getValueComponent(final Integer value) { + public JComponent getValueComponent(final PluginParameter<G, A, R> value) { return this.value; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -30,9 +30,10 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.MapParameter; +import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; -public class MapParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, Object, Void> { +public class MapParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { private final MapParameter<G, A, R> parameter; @@ -65,7 +66,7 @@ * {@inheritDoc} */ @Override - public JComponent getValueComponent(final Object value) { + public JComponent getValueComponent(final PluginParameter<G, A, R> value) { return this.value; } @@ -73,7 +74,7 @@ * {@inheritDoc} */ @Override - public JComponent getConfigComponent(final Void config) { + public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { return this.config; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -29,11 +29,11 @@ public class ParameterDescriptionEditor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JTextField { - private final PluginParameter<G, A, R, ?, ?> parameter; + private final PluginParameter<G, A, R> parameter; private static final long serialVersionUID = 1L; - public ParameterDescriptionEditor(final PluginParameter<G, A, R, ?, ?> param) { + public ParameterDescriptionEditor(final PluginParameter<G, A, R> param) { parameter = param; setText(param.getDescription()); getDocument().addDocumentListener(new DocumentListener() { Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -31,7 +31,7 @@ private static final long serialVersionUID = 1L; - private final PluginParameter<G, A, R, ?, ?> parameter; + private final PluginParameter<G, A, R> parameter; private final DocumentListener documentListener = new DocumentListener() { @@ -55,7 +55,7 @@ }; - public ParameterNameEditor(final PluginParameter<G, A, R, ?, ?> parameter) { + public ParameterNameEditor(final PluginParameter<G, A, R> parameter) { this.parameter = parameter; setText(parameter.getName()); getDocument().addDocumentListener(documentListener); Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -42,7 +42,7 @@ private static final long serialVersionUID = 1L; - private final PluginParameter<G, A, R, ?, ?> parameter; + private final PluginParameter<G, A, R> parameter; private final Script<G, A, R> script; @@ -64,7 +64,7 @@ }; - public ParameterTypeEditor(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final Script<G, A, R> script, final PluginParameter<G, A, R, ?, ?> parameter) { + public ParameterTypeEditor(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final Script<G, A, R> script, final PluginParameter<G, A, R> parameter) { super(pluginParameterFactory.getTypes()); this.parameter = parameter; this.script = script; Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -23,15 +23,16 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.script.parameter.PluginParameter; /** * Interface for Views that display plugin parameters. * @author tchize */ -public interface PluginParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V, C> { +public interface PluginParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - JComponent getValueComponent(V value); + JComponent getValueComponent(PluginParameter<G, A, R> value); - JComponent getConfigComponent(C config); + JComponent getConfigComponent(PluginParameter<G, A, R> config); } // interface PluginParameterView Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -64,7 +64,7 @@ private final FaceObjectProviders faceObjectProviders; @Nullable - private PluginParameterView<G, A, R, ?, ?> view = null; + private PluginParameterView<G, A, R> view = null; private final PluginParameterVisitor<G, A, R> visitor = new PluginParameterVisitor<G, A, R>() { @@ -126,7 +126,7 @@ } @NotNull - public PluginParameterView<G, A, R, ?, ?> getView(@NotNull final PluginParameter<G, A, R, ?, ?> parameter) { + public PluginParameterView<G, A, R> getView(@NotNull final PluginParameter<G, A, R> parameter) { view = null; parameter.visit(visitor); assert view != null; Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -29,17 +29,18 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.script.parameter.AbstractPluginParameter; import net.sf.gridarta.script.parameter.PluginParameter; -public class StringParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, String, Void> { +public class StringParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { private final JTextComponent value = new JTextField(); private final JComponent config = new JPanel(); - private final PluginParameter<G, A, R, String, Void> linkedParameter; + private final AbstractPluginParameter<G, A, R, String, Void> linkedParameter; - public StringParameterView(final PluginParameter<G, A, R, String, Void> parameter) { + public StringParameterView(final AbstractPluginParameter<G, A, R, String, Void> parameter) { linkedParameter = parameter; final Document d = value.getDocument(); d.addDocumentListener(new DocumentListener() { @@ -65,13 +66,14 @@ } @Override - public JComponent getConfigComponent(final Void config) { + public JComponent getConfigComponent(final PluginParameter<G, A, R> config) { return this.config; } @Override - public JComponent getValueComponent(final String value) { - this.value.setText(value); + public JComponent getValueComponent(final PluginParameter<G, A, R> value) { + final AbstractPluginParameter<G, A, R, String, Void> abstractPluginParameter = (AbstractPluginParameter<G, A, R, String, Void>) value; // XXX + this.value.setText(abstractPluginParameter.getValue()); return this.value; } Modified: trunk/src/app/net/sf/gridarta/script/Script.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/Script.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/Script.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -45,7 +45,7 @@ * @author tchize * @author Andreas Kirschbaum */ -public class Script<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Iterable<PluginParameter<G, A, R, ?, ?>> { +public class Script<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Iterable<PluginParameter<G, A, R>> { /** * The Logger for printing log messages. @@ -63,7 +63,7 @@ * The {@link PluginParameter PluginParameters} for this plugin script. */ @NotNull - private final List<PluginParameter<G, A, R, ?, ?>> parameters = new ArrayList<PluginParameter<G, A, R, ?, ?>>(); + private final List<PluginParameter<G, A, R>> parameters = new ArrayList<PluginParameter<G, A, R>>(); /** * The plugin script's name. @@ -169,7 +169,7 @@ */ public int getParameter(@NotNull final String paramName) { int index = 0; - for (final PluginParameter<G, A, R, ?, ?> param : parameters) { + for (final PluginParameter<G, A, R> param : parameters) { if (param.getName().equals(paramName)) { return index; } @@ -191,7 +191,7 @@ * Creates a new plugin parameter. */ public void newParameter() { - final PluginParameter<G, A, R, ?, ?> pluginParameter; + final PluginParameter<G, A, R> pluginParameter; try { pluginParameter = pluginParameterFactory.createParameter(StringParameter.PARAMETER_TYPE); } catch (final NoSuchParameterException ex) { @@ -254,7 +254,7 @@ model.filter = filter; model.script = script; model.modified = modified; - for (final PluginParameter<G, A, R, ?, ?> param : parameters) { + for (final PluginParameter<G, A, R> param : parameters) { model.addParameter(param.clonePluginParameter(pluginParameterFactory)); } return model; @@ -264,7 +264,7 @@ * Adds a plugin parameter to this plugin script. * @param pluginParameter the plugin parameter to add */ - public void addParameter(@NotNull final PluginParameter<G, A, R, ?, ?> pluginParameter) { + public void addParameter(@NotNull final PluginParameter<G, A, R> pluginParameter) { parameters.add(pluginParameter); modified = true; notifyListeners(); @@ -277,7 +277,7 @@ * @return the plugin parameter * @throws NoSuchParameterException if the index is invalid */ - public PluginParameter<G, A, R, ?, ?> getParameter(final int index) throws NoSuchParameterException { + public PluginParameter<G, A, R> getParameter(final int index) throws NoSuchParameterException { try { return parameters.get(index); } catch (final IndexOutOfBoundsException ignored) { @@ -368,7 +368,7 @@ * @param newType the new type * @throws NoSuchParameterException if the index is invalid */ - public void convertType(@NotNull final PluginParameter<G, A, R, ?, ?> pluginParameter, @NotNull final String newType) throws NoSuchParameterException { + public void convertType(@NotNull final PluginParameter<G, A, R> pluginParameter, @NotNull final String newType) throws NoSuchParameterException { final int index = parameters.indexOf(pluginParameter); convertType(index, newType); } @@ -418,7 +418,7 @@ */ @NotNull @Override - public Iterator<PluginParameter<G, A, R, ?, ?>> iterator() { + public Iterator<PluginParameter<G, A, R>> iterator() { return Collections.unmodifiableList(parameters).iterator(); } Modified: trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -87,7 +87,7 @@ if (index == -1) { final StringBuilder sb = new StringBuilder(); boolean firstParameter = true; - for (final PluginParameter<?, ?, ?, ?, ?> parameter : clonedScript) { + for (final PluginParameter<?, ?, ?> parameter : clonedScript) { sb.append(firstParameter ? " " : ", "); sb.append(parameter.getName()); firstParameter = false; @@ -95,7 +95,7 @@ throw new ScriptExecException("script " + script + " has no parameter " + tmp[0] + "; available parameters:" + sb); } - final PluginParameter<G, A, R, ?, ?> parameter; + final PluginParameter<G, A, R> parameter; try { parameter = clonedScript.getParameter(index); } catch (final NoSuchParameterException ex) { @@ -168,7 +168,7 @@ runner.setConsole(console); try { scriptParameters.setInterpreterValues(runner, ScriptRunMode.BATCH); - for (final PluginParameter<G, A, R, ?, ?> parameter : script) { + for (final PluginParameter<G, A, R> parameter : script) { runner.set(parameter.getName(), parameter.getValue()); } } catch (final TargetError ex) { Modified: trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -117,7 +117,7 @@ final Collection<Element> parameters = node.getChildren("parameter"); if (parameters != null && !parameters.isEmpty()) { for (final Element parameter : parameters) { - final PluginParameter<G, A, R, ?, ?> pluginParameter; + final PluginParameter<G, A, R> pluginParameter; try { pluginParameter = pluginParameterFactory.createParameter(parameter); } catch (final NoSuchParameterException ex) { @@ -163,7 +163,7 @@ modes.addContent(filter); root.addContent(modes); - for (final PluginParameter<G, A, R, ?, ?> pluginParameter : script) { + for (final PluginParameter<G, A, R> pluginParameter : script) { root.addContent(pluginParameter.toXML()); } return root; Copied: trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java (from rev 8482, trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java) =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java (rev 0) +++ trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -0,0 +1,154 @@ +/* + * 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.script.parameter; + +import java.util.Collection; +import java.util.HashSet; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import org.jdom.Element; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Parameter for a Plugin. + * @author tchize + */ +public abstract class AbstractPluginParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V, C> implements PluginParameter<G, A, R> { + + @Nullable + private V value; + + @Nullable + private C config; + + @NotNull + private String description = "[description]"; + + @NotNull + private String name = "[name]"; + + @NotNull + private final Collection<ChangeListener> listeners = new HashSet<ChangeListener>(); + + protected AbstractPluginParameter() { + } + + @Nullable + public C getConfig() { + return config; + } + + public void setConfig(@Nullable final C config) { + this.config = config; + } + + @NotNull + public String getDescription() { + return description; + } + + public void setDescription(@NotNull final String description) { + this.description = description; + } + + @NotNull + public String getName() { + return name; + } + + public void setName(@NotNull final String name) { + this.name = name; + } + + @Nullable + public V getValue() { + return value; + } + + public boolean setValue(@Nullable final V value) { + if (this.value == null ? value == null : this.value.equals(value)) { + return false; + } + + this.value = value; + return true; + } + + /** + * Sets the parameter value from string representation. + * @param value the value to set + * @return whether the value was updated + */ + public abstract boolean setStringValue(@NotNull final String value); + + @NotNull + public Element toXML() { + final Element e = new Element("parameter"); + final Element n = new Element("name"); + final Element d = new Element("description"); + final Element t = new Element("type"); + n.addContent(name); + d.addContent(description); + t.addContent(getParameterType()); + e.addContent(n); + e.addContent(d); + e.addContent(t); + return e; + } + + public void fromXML(@NotNull final Element e) { + name = e.getChildText("name"); + description = e.getChildText("description"); + } + + @NotNull + public abstract String getParameterType(); + + public void addChangeListener(@NotNull final ChangeListener listener) { + listeners.add(listener); + } + + public void removeListener(@NotNull final ChangeListener listener) { + listeners.remove(listener); + } + + protected void fireDataChanged() { + final ChangeEvent e = new ChangeEvent(this); + for (final ChangeListener listener : listeners) { + listener.stateChanged(e); + } + } + + @NotNull + public PluginParameter<G, A, R> clonePluginParameter(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { + try { + return pluginParameterFactory.createParameter(toXML()); + } catch (final NoSuchParameterException ex) { + throw new AssertionError(ex); + } + } + + public abstract void visit(@NotNull final PluginParameterVisitor<G, A, R> visitor); + +} // class PluginParameter Modified: trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -27,7 +27,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class ArchParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<G, A, R, Archetype<G, A, R>, Void> { +public class ArchParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, Archetype<G, A, R>, Void> { @NotNull public static final String PARAMETER_TYPE = Archetype.class.getName(); Modified: trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -25,7 +25,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class BooleanParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<G, A, R, Boolean, BooleanConfig> { +public class BooleanParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, Boolean, BooleanConfig> { @NotNull public static final String PARAMETER_TYPE = Boolean.class.getName(); Modified: trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -26,7 +26,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class DoubleParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<G, A, R, Double, DoubleConfig> { +public class DoubleParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, Double, DoubleConfig> { @NotNull public static final String PARAMETER_TYPE = Double.class.getName(); Modified: trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -28,7 +28,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class FilterParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<G, A, R, NamedFilterConfig, Void> { +public class FilterParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, NamedFilterConfig, Void> { @NotNull public static final String PARAMETER_TYPE = NamedFilterConfig.class.getName(); Modified: trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -25,7 +25,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class IntegerParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<G, A, R, Integer, IntegerConfig> { +public class IntegerParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, Integer, IntegerConfig> { @NotNull public static final String PARAMETER_TYPE = Integer.class.getName(); Modified: trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -27,7 +27,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class MapParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<G, A, R, Object, Void> { // XXX: find correct parameter type: String or MapControl<GameObject, MapArchObject, Archetype> +public class MapParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, Object, Void> { // XXX: find correct parameter type: String or MapControl<GameObject, MapArchObject, Archetype> @NotNull public static final String PARAMETER_TYPE = MapControl.class.getName(); Modified: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -19,9 +19,6 @@ package net.sf.gridarta.script.parameter; -import java.util.Collection; -import java.util.HashSet; -import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -33,122 +30,45 @@ /** * Parameter for a Plugin. * @author tchize + * @author Andreas Kirschbaum */ -public abstract class PluginParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V, C> { +public interface PluginParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - @Nullable - private V value; - - @Nullable - private C config; - @NotNull - private String description = "[description]"; + String getDescription(); - @NotNull - private String name = "[name]"; + void setDescription(@NotNull String description); @NotNull - private final Collection<ChangeListener> listeners = new HashSet<ChangeListener>(); + String getName(); - protected PluginParameter() { - } + void setName(@NotNull String name); @Nullable - public C getConfig() { - return config; - } + Object getValue(); - public void setConfig(@Nullable final C config) { - this.config = config; - } - - @NotNull - public String getDescription() { - return description; - } - - public void setDescription(@NotNull final String description) { - this.description = description; - } - - @NotNull - public String getName() { - return name; - } - - public void setName(@NotNull final String name) { - this.name = name; - } - - @Nullable - public V getValue() { - return value; - } - - public boolean setValue(@Nullable final V value) { - if (this.value == null ? value == null : this.value.equals(value)) { - return false; - } - - this.value = value; - return true; - } - /** * Sets the parameter value from string representation. * @param value the value to set * @return whether the value was updated */ - public abstract boolean setStringValue(@NotNull final String value); + boolean setStringValue(@NotNull String value); @NotNull - public Element toXML() { - final Element e = new Element("parameter"); - final Element n = new Element("name"); - final Element d = new Element("description"); - final Element t = new Element("type"); - n.addContent(name); - d.addContent(description); - t.addContent(getParameterType()); - e.addContent(n); - e.addContent(d); - e.addContent(t); - return e; - } + Element toXML(); - public void fromXML(@NotNull final Element e) { - name = e.getChildText("name"); - description = e.getChildText("description"); - } + void fromXML(@NotNull Element e); @NotNull - public abstract String getParameterType(); + String getParameterType(); - public void addChangeListener(@NotNull final ChangeListener listener) { - listeners.add(listener); - } + void addChangeListener(@NotNull ChangeListener listener); - public void removeListener(@NotNull final ChangeListener listener) { - listeners.remove(listener); - } + void removeListener(@NotNull ChangeListener listener); - protected void fireDataChanged() { - final ChangeEvent e = new ChangeEvent(this); - for (final ChangeListener listener : listeners) { - listener.stateChanged(e); - } - } - @NotNull - public PluginParameter<G, A, R, ?, ?> clonePluginParameter(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { - try { - return pluginParameterFactory.createParameter(toXML()); - } catch (final NoSuchParameterException ex) { - throw new AssertionError(ex); - } - } + PluginParameter<G, A, R> clonePluginParameter(@NotNull PluginParameterFactory<G, A, R> pluginParameterFactory); - public abstract void visit(@NotNull final PluginParameterVisitor<G, A, R> visitor); + void visit(@NotNull PluginParameterVisitor<G, A, R> visitor); } // class PluginParameter Modified: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -51,12 +51,12 @@ } @Nullable - public PluginParameter<G, A, R, ?, ?> createParameter(@NotNull final Element parameterNode) throws NoSuchParameterException { + public PluginParameter<G, A, R> createParameter(@NotNull final Element parameterNode) throws NoSuchParameterException { return createParameter(parameterNode.getChildText("type"), parameterNode); } @NotNull - public PluginParameter<G, A, R, ?, ?> createParameter(@NotNull final String type) throws NoSuchParameterException { + public PluginParameter<G, A, R> createParameter(@NotNull final String type) throws NoSuchParameterException { if (type.equals(StringParameter.PARAMETER_TYPE)) { return new StringParameter<G, A, R>(); } @@ -82,8 +82,8 @@ } @NotNull - public PluginParameter<G, A, R, ?, ?> createParameter(@NotNull final String type, @NotNull final Element parameterNode) throws NoSuchParameterException { - final PluginParameter<G, A, R, ?, ?> p = createParameter(type); + public PluginParameter<G, A, R> createParameter(@NotNull final String type, @NotNull final Element parameterNode) throws NoSuchParameterException { + final PluginParameter<G, A, R> p = createParameter(type); p.fromXML(parameterNode); return p; } Modified: trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java 2010-06-26 12:48:06 UTC (rev 8501) +++ trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java 2010-06-26 13:23:10 UTC (rev 8502) @@ -27,7 +27,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class StringParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<G, A, R, String, Void> { +public class StringParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractPluginParameter<G, A, R, String, Void> { /** * The Logger for printing log messages. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 12:48:15
|
Revision: 8501 http://gridarta.svn.sourceforge.net/gridarta/?rev=8501&view=rev Author: akirschbaum Date: 2010-06-26 12:48:06 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2010-06-26 10:34:07 UTC (rev 8500) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2010-06-26 12:48:06 UTC (rev 8501) @@ -71,11 +71,7 @@ @Override public JComponent getValueComponent(final String value) { - if (value == null) { - this.value.setText(null); - } else { - this.value.setText(value); - } + this.value.setText(value); return this.value; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 10:34:14
|
Revision: 8500 http://gridarta.svn.sourceforge.net/gridarta/?rev=8500&view=rev Author: akirschbaum Date: 2010-06-26 10:34:07 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java 2010-06-26 10:26:31 UTC (rev 8499) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java 2010-06-26 10:34:07 UTC (rev 8500) @@ -40,7 +40,6 @@ import javax.swing.JTextArea; import javax.swing.JViewport; import javax.swing.WindowConstants; -import net.sf.gridarta.model.baseobject.BaseObject; import org.jetbrains.annotations.NotNull; /** @@ -65,10 +64,10 @@ * off with a new thread. It freezes the parent frames (and threads) until * the popup window is closed, which mimics non-event-driven behaviour. * @param errors a textual list of the encountered errors - * @param gameObject the game object to update * @param parent the parent dialog + * @return whether to keep the errors */ - public static void askConfirmErrors(@NotNull final String errors, @NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final Component parent) { + public static boolean askConfirmErrors(@NotNull final String errors, @NotNull final Component parent) { final JDialog dialog = new JDialog((JFrame) null, "Syntax Errors", true); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); @@ -95,25 +94,14 @@ buttonPanel.add(dumpButton); buttonPanel.add(keepButton); + final boolean[] result = { true }; + // attach action listener to the buttons (and the dialog) final ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { - //noinspection ObjectEquality - if (e.getSource() == keepButton) { - // the user pressed "keep", so we append the contents - // of the textfield to the object text - final String text2 = textArea.getText(); - if (text2 != null) { - final String trimmedText2 = text2.trim(); - if (trimmedText2.length() > 0) { - gameObject.addObjectText(trimmedText2); - } - } - } - - // nuke the popup dialog + result[0] = e.getSource() == keepButton; dialog.dispose(); } @@ -128,7 +116,7 @@ @Override public void windowClosing(final WindowEvent e) { - gameObject.addObjectText(errors.trim()); + result[0] = true; dialog.dispose(); } @@ -169,6 +157,7 @@ dialog.pack(); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); + return result[0]; } } // class ConfirmErrorsDialog Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 10:26:31 UTC (rev 8499) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 10:34:07 UTC (rev 8500) @@ -1295,14 +1295,18 @@ // deal with syntax errors now if (errors != null) { + final boolean keepErrors; if (tmpArchetypeType == archetypeTypeSet.getArchetypeType(0)) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types - gameObject.addObjectText(errors.trim()); + keepErrors = true; } else { // open a popup dialog and ask user to decide what to do with his errors - ConfirmErrorsDialog.askConfirmErrors(errors, gameObject, this); + keepErrors = ConfirmErrorsDialog.askConfirmErrors(errors, this); } + if (keepErrors) { + gameObject.addObjectText(errors.trim()); + } } // recalculate the editType value; XXX: should use MVC This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 10:26:37
|
Revision: 8499 http://gridarta.svn.sourceforge.net/gridarta/?rev=8499&view=rev Author: akirschbaum Date: 2010-06-26 10:26:31 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Remove ConfirmErrorsAL. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java Deleted: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2010-06-26 10:20:44 UTC (rev 8498) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2010-06-26 10:26:31 UTC (rev 8499) @@ -1,119 +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.gui.gameobjectattributesdialog; - -import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import javax.swing.JButton; -import javax.swing.text.JTextComponent; -import net.sf.gridarta.model.baseobject.BaseObject; -import org.jetbrains.annotations.Nullable; - -/** - * ActionListener for the buttons in the ConfirmErrors popup dialog and also - * WindowListener for the close box of the dialog (which would equal a "keep all" - * button). - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class ConfirmErrorsAL extends WindowAdapter implements ActionListener { - - /** - * The popup dialog. - */ - @Nullable - private Window dialog; - - /** - * The button to keep what's in the textfield. - */ - private final JButton keepButton; - - /** - * The textfield containing the error text to keep. - */ - private final JTextComponent text; - - /** - * The affected GameObject. - */ - private final BaseObject<?, ?, ?, ?> gameObject; - - /** - * List of all errors. - */ - private final String errors; - - /** - * Constructor. - * @param dialog the popup dialog - * @param gameObject the gameObject which has the error to be added - * @param errors list of all errors (= initial content of the text area) - * @param keepButton button "keep what is in the textfield" - * @param text textfield containing the error-text to keep - */ - public ConfirmErrorsAL(final Window dialog, final BaseObject<?, ?, ?, ?> gameObject, final String errors, final JButton keepButton, final JTextComponent text) { - this.gameObject = gameObject; - this.keepButton = keepButton; - this.text = text; - this.dialog = dialog; - this.errors = errors; - } - - /** - * {@inheritDoc} - */ - @Override - public void actionPerformed(final ActionEvent e) { - //noinspection ObjectEquality - if (e.getSource() == keepButton) { - // the user pressed "keep", so we append the contents - // of the textfield to the object text - final String text2 = text.getText(); - if (text2 != null) { - final String trimmedText2 = text2.trim(); - if (trimmedText2.length() > 0) { - gameObject.addObjectText(trimmedText2); - } - } - } - - // nuke the popup dialog - if (dialog != null) { - dialog.dispose(); - dialog = null; - } - } - - /** - * {@inheritDoc} - */ - @Override - public void windowClosing(final WindowEvent e) { - gameObject.addObjectText(errors.trim()); - if (dialog != null) { - dialog.dispose(); - dialog = null; - } - } - -} // class ConfirmErrorsAL Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java 2010-06-26 10:20:44 UTC (rev 8498) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java 2010-06-26 10:26:31 UTC (rev 8499) @@ -23,6 +23,10 @@ import java.awt.Container; import java.awt.FlowLayout; import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.Box; @@ -87,16 +91,70 @@ // create buttons final AbstractButton dumpButton = new JButton("Dump All Errors"); - final JButton keepButton = new JButton("Keep Above Text"); + final AbstractButton keepButton = new JButton("Keep Above Text"); buttonPanel.add(dumpButton); buttonPanel.add(keepButton); // attach action listener to the buttons (and the dialog) - final ConfirmErrorsAL listener = new ConfirmErrorsAL(dialog, gameObject, errors, keepButton, textArea); - keepButton.addActionListener(listener); - dumpButton.addActionListener(listener); - dialog.addWindowListener(listener); + final ActionListener actionListener = new ActionListener() { + @Override + public void actionPerformed(final ActionEvent e) { + //noinspection ObjectEquality + if (e.getSource() == keepButton) { + // the user pressed "keep", so we append the contents + // of the textfield to the object text + final String text2 = textArea.getText(); + if (text2 != null) { + final String trimmedText2 = text2.trim(); + if (trimmedText2.length() > 0) { + gameObject.addObjectText(trimmedText2); + } + } + } + + // nuke the popup dialog + dialog.dispose(); + } + + }; + keepButton.addActionListener(actionListener); + dumpButton.addActionListener(actionListener); + final WindowListener windowListener = new WindowListener() { + + @Override + public void windowOpened(final WindowEvent e) { + } + + @Override + public void windowClosing(final WindowEvent e) { + gameObject.addObjectText(errors.trim()); + dialog.dispose(); + } + + @Override + public void windowClosed(final WindowEvent e) { + } + + @Override + public void windowIconified(final WindowEvent e) { + } + + @Override + public void windowDeiconified(final WindowEvent e) { + } + + @Override + public void windowActivated(final WindowEvent e) { + } + + @Override + public void windowDeactivated(final WindowEvent e) { + } + + }; + dialog.addWindowListener(windowListener); + // stick panels together mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); mainPanel.add(headerPanel); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 10:20:50
|
Revision: 8498 http://gridarta.svn.sourceforge.net/gridarta/?rev=8498&view=rev Author: akirschbaum Date: 2010-06-26 10:20:44 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2010-06-26 10:19:07 UTC (rev 8497) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2010-06-26 10:20:44 UTC (rev 8498) @@ -88,8 +88,12 @@ if (e.getSource() == keepButton) { // the user pressed "keep", so we append the contents // of the textfield to the object text - if (text.getText() != null && text.getText().trim().length() > 0) { - gameObject.addObjectText(text.getText().trim()); + final String text2 = text.getText(); + if (text2 != null) { + final String trimmedText2 = text2.trim(); + if (trimmedText2.length() > 0) { + gameObject.addObjectText(trimmedText2); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 10:19:14
|
Revision: 8497 http://gridarta.svn.sourceforge.net/gridarta/?rev=8497&view=rev Author: akirschbaum Date: 2010-06-26 10:19:07 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2010-06-26 10:17:10 UTC (rev 8496) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2010-06-26 10:19:07 UTC (rev 8497) @@ -61,22 +61,22 @@ /** * List of all errors. */ - private final String allErrors; + private final String errors; /** * Constructor. * @param dialog the popup dialog * @param gameObject the gameObject which has the error to be added * @param errors list of all errors (= initial content of the text area) - * @param keepB button "keep what is in the textfield" - * @param textNew textfield containing the error-text to keep + * @param keepButton button "keep what is in the textfield" + * @param text textfield containing the error-text to keep */ - public ConfirmErrorsAL(final Window dialog, final BaseObject<?, ?, ?, ?> gameObject, final String errors, final JButton keepB, final JTextComponent textNew) { + public ConfirmErrorsAL(final Window dialog, final BaseObject<?, ?, ?, ?> gameObject, final String errors, final JButton keepButton, final JTextComponent text) { this.gameObject = gameObject; - keepButton = keepB; - text = textNew; + this.keepButton = keepButton; + this.text = text; this.dialog = dialog; - allErrors = errors; + this.errors = errors; } /** @@ -105,7 +105,7 @@ */ @Override public void windowClosing(final WindowEvent e) { - gameObject.addObjectText(allErrors.trim()); + gameObject.addObjectText(errors.trim()); if (dialog != null) { dialog.dispose(); dialog = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 10:17:17
|
Revision: 8496 http://gridarta.svn.sourceforge.net/gridarta/?rev=8496&view=rev Author: akirschbaum Date: 2010-06-26 10:17:10 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Extract ConfirmErrorsDialog from GameObjectAttributesDialog. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java 2010-06-26 10:17:10 UTC (rev 8496) @@ -0,0 +1,116 @@ +/* + * 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.gui.gameobjectattributesdialog; + +import java.awt.Component; +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import javax.swing.AbstractButton; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JViewport; +import javax.swing.WindowConstants; +import net.sf.gridarta.model.baseobject.BaseObject; +import org.jetbrains.annotations.NotNull; + +/** + * Utility class for displaying a dialog to keep or dump invalid attributes of a + * game object. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ +public class ConfirmErrorsDialog { + + /** + * Private constructor to prevent instantiation. + */ + private ConfirmErrorsDialog() { + } + + /** + * Open a popup dialog and ask the user to confirm (or modify) the + * encountered syntax errors. If the user chooses to keep any errors, these + * get attached to the archetype text by the action listener + * (<code>ConfirmErrorsAL</code>). <p/> Note that this method does not fork + * off with a new thread. It freezes the parent frames (and threads) until + * the popup window is closed, which mimics non-event-driven behaviour. + * @param errors a textual list of the encountered errors + * @param gameObject the game object to update + * @param parent the parent dialog + */ + public static void askConfirmErrors(@NotNull final String errors, @NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final Component parent) { + final JDialog dialog = new JDialog((JFrame) null, "Syntax Errors", true); + dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + + final JPanel mainPanel = new JPanel(); + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); + final Container headerPanel = new JPanel(new GridLayout(2, 1)); + final Container buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + + // create header labels + final Component header1 = new JLabel("The following lines from the archetype text appear to be wrong."); + final Component header2 = new JLabel("They do not match the type definitions:"); + headerPanel.add(header1); + headerPanel.add(header2); + + // create text area for showing errors + final JTextArea textArea = new JTextArea(errors, 7, 25); + textArea.setBorder(BorderFactory.createEmptyBorder(1, 4, 0, 0)); + final JScrollPane scrollPane = new JScrollPane(textArea); + scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); + + // create buttons + final AbstractButton dumpButton = new JButton("Dump All Errors"); + final JButton keepButton = new JButton("Keep Above Text"); + buttonPanel.add(dumpButton); + buttonPanel.add(keepButton); + + // attach action listener to the buttons (and the dialog) + final ConfirmErrorsAL listener = new ConfirmErrorsAL(dialog, gameObject, errors, keepButton, textArea); + keepButton.addActionListener(listener); + dumpButton.addActionListener(listener); + dialog.addWindowListener(listener); + + // stick panels together + mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + mainPanel.add(headerPanel); + mainPanel.add(Box.createVerticalStrut(10)); + mainPanel.add(scrollPane); + mainPanel.add(Box.createVerticalStrut(10)); + mainPanel.add(buttonPanel); + + dialog.getContentPane().add(mainPanel); + + // pack, position and show the popup + dialog.pack(); + dialog.setLocationRelativeTo(parent); + dialog.setVisible(true); + } + +} // class ConfirmErrorsDialog Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsDialog.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:31:07 UTC (rev 8495) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 10:17:10 UTC (rev 8496) @@ -24,10 +24,8 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.GridLayout; import java.awt.Insets; import java.awt.Point; import java.awt.event.FocusListener; @@ -41,7 +39,6 @@ import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.Box; -import javax.swing.BoxLayout; import javax.swing.DefaultComboBoxModel; import javax.swing.ImageIcon; import javax.swing.JButton; @@ -63,7 +60,6 @@ import javax.swing.JViewport; import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; -import javax.swing.WindowConstants; import javax.swing.filechooser.FileFilter; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultFormatterFactory; @@ -1305,7 +1301,7 @@ gameObject.addObjectText(errors.trim()); } else { // open a popup dialog and ask user to decide what to do with his errors - askConfirmErrors(errors); + ConfirmErrorsDialog.askConfirmErrors(errors, gameObject, this); } } @@ -1316,64 +1312,6 @@ } /** - * Open a popup dialog and ask the user to confirm (or modify) the - * encountered syntax errors. If the user chooses to keep any errors, these - * get attached to the archetype text by the action listener - * (<code>ConfirmErrorsAL</code>). <p/> Note that this method does not fork - * off with a new thread. It freezes the parent frames (and threads) until - * the popup window is closed, which mimics non-event-driven behaviour. - * @param errors a textual list of the encountered errors - */ - private void askConfirmErrors(@NotNull final String errors) { - final JDialog dialog = new JDialog((JFrame) null, "Syntax Errors", true); - dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - - final JPanel mainPanel = new JPanel(); - mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); - final Container headerPanel = new JPanel(new GridLayout(2, 1)); - final Container buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); - - // create header labels - final Component header1 = new JLabel("The following lines from the archetype text appear to be wrong."); - final Component header2 = new JLabel("They do not match the type definitions:"); - headerPanel.add(header1); - headerPanel.add(header2); - - // create text area for showing errors - final JTextArea textArea = new JTextArea(errors, 7, 25); - textArea.setBorder(BorderFactory.createEmptyBorder(1, 4, 0, 0)); - final JScrollPane scrollPane = new JScrollPane(textArea); - scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - - // create buttons - final AbstractButton dumpButton = new JButton("Dump All Errors"); - final JButton keepButton = new JButton("Keep Above Text"); - buttonPanel.add(dumpButton); - buttonPanel.add(keepButton); - - // attach action listener to the buttons (and the dialog) - final ConfirmErrorsAL listener = new ConfirmErrorsAL(dialog, gameObject, errors, keepButton, textArea); - keepButton.addActionListener(listener); - dumpButton.addActionListener(listener); - dialog.addWindowListener(listener); - - // stick panels together - mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - mainPanel.add(headerPanel); - mainPanel.add(Box.createVerticalStrut(10)); - mainPanel.add(scrollPane); - mainPanel.add(Box.createVerticalStrut(10)); - mainPanel.add(buttonPanel); - - dialog.getContentPane().add(mainPanel); - - // pack, position and show the popup - dialog.pack(); - dialog.setLocationRelativeTo(this); - dialog.setVisible(true); - } - - /** * Constructs the combo box of the available spells. * @param gameObjectSpells the game object spells to use * @param isOptionalSpell whether the entry <none> should be shown This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 09:31:13
|
Revision: 8495 http://gridarta.svn.sourceforge.net/gridarta/?rev=8495&view=rev Author: akirschbaum Date: 2010-06-26 09:31:07 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Add final modifier. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:30:35 UTC (rev 8494) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:31:07 UTC (rev 8495) @@ -1030,7 +1030,7 @@ * Construct the central part of the attribute dialog, containing the * object's gameObject attributes. */ - public void buildAttribute() { + public final void buildAttribute() { tabbedPane.removeAll(); for (int sectionId = 0; sectionId < typesBoxItemListener.archetypeType.getSectionNum(); sectionId++) { final Component panel = makeAttributePanel(sectionId); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 09:30:41
|
Revision: 8494 http://gridarta.svn.sourceforge.net/gridarta/?rev=8494&view=rev Author: akirschbaum Date: 2010-06-26 09:30:35 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Fix possible NullPointerException. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:29:07 UTC (rev 8493) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:30:35 UTC (rev 8494) @@ -555,7 +555,7 @@ cComp = input; } else { // error: list data is missing or corrupt - input = null; + input = new JComboBox(); cComp = new JLabel("Error: Undefined List"); } guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeList>(new DialogAttributeList<G, A, R>(archetypeAttribute, input, archetypeTypeSet), cLabel, cComp, null, null, false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 09:29:13
|
Revision: 8493 http://gridarta.svn.sourceforge.net/gridarta/?rev=8493&view=rev Author: akirschbaum Date: 2010-06-26 09:29:07 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Move GameObjectAttributesDialog.TypesBoxItemListener to top-level class. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:16:26 UTC (rev 8492) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:29:07 UTC (rev 8493) @@ -31,8 +31,6 @@ import java.awt.Insets; import java.awt.Point; import java.awt.event.FocusListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.io.File; import java.text.DecimalFormat; import java.text.NumberFormat; @@ -302,12 +300,8 @@ @NotNull private final Collection<DialogAttribute<G, A, R, ?>> dialogAttributes = new ArrayList<DialogAttribute<G, A, R, ?>>(); - /** - * The selection box for type. - * @serial - */ @NotNull - private JComboBox typeComboBox; + private TypesBoxItemListener<G, A, R> typesBoxItemListener; /** * The panel for object's face (png). @@ -345,13 +339,6 @@ private final Archetype<G, A, R> archetype; /** - * Reference to the type data. - * @serial - */ - @NotNull - private ArchetypeType archetypeType; - - /** * The CardLayout for toggling between edit and summary. * @serial */ @@ -849,10 +836,9 @@ mapModel.addMapModelListener(mapModelListener); mapManager.addMapManagerListener(mapManagerListener); - archetypeType = archetypeTypeSet.getArchetypeType(gameObject); - // first split top-left and -right - final JComponent leftPane = buildHeader(archetypeTypeSet.getArchetypeTypeIndex(archetypeType)); + final ArchetypeType archetypeType = archetypeTypeSet.getArchetypeType(gameObject); + final JComponent leftPane = buildHeader(archetypeTypeSet.getArchetypeTypeIndex(archetypeType), archetypeType); final JScrollPane rightPane = buildInv(); //Create a split pane with the two scroll panes in it. @@ -922,10 +908,11 @@ /** * Construct the Combo box of the available archetypes. * @param type the initially selected type + * @param archetypeType the archetype type to display * @return a <code>JComponent</code> with the combo box in it */ @NotNull - private Component buildTypesBox(final int type) { + private Component buildTypesBox(final int type, @NotNull final ArchetypeType archetypeType) { final String[] nameList = new String[archetypeTypeSet.getLength()]; // read all type names @@ -937,7 +924,7 @@ // the active type appears selected in the box final int selection = type; - typeComboBox = new JComboBox(nameList); + final JComboBox typeComboBox = new JComboBox(nameList); typeComboBox.setSelectedIndex(selection); //typeComboBox.setKeySelectionManager(new StringKeyManager(typeComboBox)); @@ -945,7 +932,8 @@ typeComboBox.setName("Types"); // the listener: - typeComboBox.addItemListener(new TypesBoxItemListener<G, A, R>(this, gameObject, type, archetypeTypeSet, dialogAttributes, gameObjectMatchers)); + typesBoxItemListener = new TypesBoxItemListener<G, A, R>(this, gameObject, type, archetypeTypeSet, dialogAttributes, gameObjectMatchers, typeComboBox, archetypeType); + typeComboBox.addItemListener(typesBoxItemListener); return typeComboBox; } @@ -963,11 +951,12 @@ * Construct the upper left part of the attribute dialog, containing name, * type, archetype name and face. * @param type the initially selected type + * @param archetypeType the archetype type to display * @return a <code>JScrollPane</code> with the upper left part of the dialog * window */ @NotNull - private JComponent buildHeader(final int type) { + private JComponent buildHeader(final int type, @NotNull final ArchetypeType archetypeType) { final JComponent header = new JPanel(new GridBagLayout()); // the final thing, in a panel final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; @@ -1008,7 +997,7 @@ nameTextField.setEditable(false); header.add(nameTextField, gbc); gbc.gridy++; - header.add(buildTypesBox(type), gbc); // build type-selection box + header.add(buildTypesBox(type, archetypeType), gbc); // build type-selection box gbc.gridy++; final JTextComponent archetypeTextField = new JTextField(archetype.getArchetypeName(), 16); archetypeTextField.setEditable(false); @@ -1041,17 +1030,19 @@ * Construct the central part of the attribute dialog, containing the * object's gameObject attributes. */ - private void buildAttribute() { - for (int sectionId = 0; sectionId < archetypeType.getSectionNum(); sectionId++) { + public void buildAttribute() { + tabbedPane.removeAll(); + for (int sectionId = 0; sectionId < typesBoxItemListener.archetypeType.getSectionNum(); sectionId++) { final Component panel = makeAttributePanel(sectionId); if (panel != null) { - final String sectionName = archetypeType.getSectionName(sectionId); + final String sectionName = typesBoxItemListener.archetypeType.getSectionName(sectionId); tabbedPane.addTab(sectionName, null, panel); } } // set selected tab tabbedPane.setSelectedIndex(0); + tabbedPane.validate(); } /** @@ -1067,7 +1058,7 @@ boolean hasBitmask = false; // true if this section contains a bitmask attribute // first we check how many attributes this section has - for (final ArchetypeAttribute archetypeAttribute : archetypeType) { + for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.archetypeType) { if (archetypeAttribute.getSectionId() == sectionId) { // count number of attributes if (!(archetypeAttribute instanceof ArchetypeAttributeFixed)) { @@ -1103,7 +1094,7 @@ boolean isText = false; // now add the entries, line by line - for (final ArchetypeAttribute archetypeAttribute : archetypeType) { + for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.archetypeType) { if (archetypeAttribute.getSectionId() == sectionId && !(archetypeAttribute instanceof ArchetypeAttributeFixed)) { final AbstractButton helpButton = new JButton("?"); helpButton.setMargin(new Insets(0, 5, 0, 5)); @@ -1164,7 +1155,7 @@ */ @ActionMethod public void attribHelp() { - new Help(/* XXX */ parent, archetypeType.createHtmlDocumentation()).setVisible(true); + new Help(/* XXX */ parent, typesBoxItemListener.archetypeType.createHtmlDocumentation()).setVisible(true); } /** @@ -1269,7 +1260,7 @@ } // Also write all the 'fixed' attributes into the archetype text - for (final ArchetypeAttribute archetypeAttribute : archetypeType) { + for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.archetypeType) { // ### TODO: for changed types, copy fixed attributes over default arches ### if (archetypeAttribute instanceof ArchetypeAttributeFixed) { final String defaultValue = archetype.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); @@ -1510,129 +1501,4 @@ return comboBox; } - /** - * ItemListener for the type-selection box on the attribute-dialog. - */ - private static class TypesBoxItemListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements ItemListener { - - /** - * The attribute dialog main frame. - */ - @NotNull - private final GameObjectAttributesDialog<G, A, R> gameObjectAttributesDialog; - - /** - * The game object which has the error to be added. - */ - @NotNull - private final GameObject<G, A, R> gameObject; - - /** - * The {@link ArchetypeTypeSet} to display. - */ - @NotNull - private final ArchetypeTypeSet archetypeTypeSet; - - /** - * The {@link DialogAttribute DialogAttributes} to update. - */ - @NotNull - private final Collection<DialogAttribute<G, A, R, ?>> dialogAttributes; - - /** - * The {@link GameObjectMatchers} to use. - * @serial - */ - @NotNull - private final GameObjectMatchers gameObjectMatchers; - - /** - * The latest deselected item. - */ - @Nullable - private String deselected = null; - - /** - * While <code>true</code>, this listener ignores all events. - */ - private boolean ignoreEvent; - - /** - * The position of this type in the type list. This differs from the - * GameObject if the type is undefined. - * @serial - */ - private int type; - - /** - * Creates a new instance. - * @param frameNew the attribute dialog main frame - * @param gameObject the game object which has the error to be added - * @param type the initially selected type - * @param archetypeTypeSet the archetype type set to display - * @param dialogAttributes the dialog attributes to update - * @param gameObjectMatchers the game object matchers to use - */ - private TypesBoxItemListener(@NotNull final GameObjectAttributesDialog<G, A, R> frameNew, @NotNull final GameObject<G, A, R> gameObject, final int type, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Collection<DialogAttribute<G, A, R, ?>> dialogAttributes, @NotNull final GameObjectMatchers gameObjectMatchers) { - gameObjectAttributesDialog = frameNew; - this.gameObject = gameObject; - this.type = type; - this.archetypeTypeSet = archetypeTypeSet; - this.dialogAttributes = dialogAttributes; - this.gameObjectMatchers = gameObjectMatchers; - ignoreEvent = false; - } - - /** - * {@inheritDoc} - */ - @Override - public void itemStateChanged(final ItemEvent e) { - if (ignoreEvent) { - return; - } - - if (e.getStateChange() == ItemEvent.DESELECTED) { - // remember the deselected type - deselected = ((String) e.getItem()).trim(); - } else if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(deselected)) { - // new type was selected - // first, get new type structure - final ArchetypeType newType = archetypeTypeSet.getTypeByName((String) e.getItem()); - - gameObjectAttributesDialog.typeComboBox.hidePopup(); - gameObjectAttributesDialog.update(gameObjectAttributesDialog.getGraphics()); - - if (deselected == null) { - deselected = gameObjectAttributesDialog.archetypeType.getTypeName(); - } - if (showConfirmDialog(gameObjectAttributesDialog, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", YES_NO_OPTION, INFORMATION_MESSAGE) == YES_OPTION) { - // change is confirmed, now get it on... - gameObjectAttributesDialog.archetypeType = newType; - - // change the gameObject to be of the new type: - gameObject.setAttributeString(BaseObject.TYPE, Integer.toString(newType.getTypeNo())); - dialogAttributes.clear(); - - type = gameObjectAttributesDialog.typeComboBox.getSelectedIndex(); - - // rebuild the dialog frame to show the new tabs - gameObjectAttributesDialog.tabbedPane.removeAll(); - gameObjectAttributesDialog.buildAttribute(); - gameObjectAttributesDialog.tabbedPane.validate(); - gameObjectAttributesDialog.update(gameObjectAttributesDialog.getGraphics()); - - // recalculate the editType value; XXX: should use MVC - gameObjectMatchers.updateEditType(gameObject, gameObject.getMapSquare().getMapModel().getActiveEditType()); - } else { - // change not wanted -> reset the choose box - ignoreEvent = true; // ignore events thrown by the forced reset - gameObjectAttributesDialog.typeComboBox.setSelectedIndex(type); - ignoreEvent = false; - } - } - } - - } // class TypesBoxItemListener - } // class GameObjectAttributesDialog Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java 2010-06-26 09:29:07 UTC (rev 8493) @@ -0,0 +1,177 @@ +/* + * 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.gui.gameobjectattributesdialog; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Collection; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypetype.ArchetypeType; +import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; +import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.match.GameObjectMatchers; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * ItemListener for the type-selection box on the attribute-dialog. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ +public class TypesBoxItemListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements ItemListener { + + /** + * The attribute dialog main frame. + */ + @NotNull + private final GameObjectAttributesDialog<G, A, R> gameObjectAttributesDialog; + + /** + * The game object which has the error to be added. + */ + @NotNull + private final GameObject<G, A, R> gameObject; + + /** + * The {@link ArchetypeTypeSet} to display. + */ + @NotNull + private final ArchetypeTypeSet archetypeTypeSet; + + /** + * The {@link DialogAttribute DialogAttributes} to update. + */ + @NotNull + private final Collection<DialogAttribute<G, A, R, ?>> dialogAttributes; + + /** + * The {@link GameObjectMatchers} to use. + * @serial + */ + @NotNull + private final GameObjectMatchers gameObjectMatchers; + + /** + * The selection box for the type. + */ + @NotNull + private final JComboBox typeComboBox; + + /** + * Reference to the type data. + * @serial + */ + @NotNull + public ArchetypeType archetypeType; + + /** + * The latest deselected item. + */ + @Nullable + private String deselected = null; + + /** + * While <code>true</code>, this listener ignores all events. + */ + private boolean ignoreEvent; + + /** + * The position of this type in the type list. This differs from the + * GameObject if the type is undefined. + * @serial + */ + private int type; + + /** + * Creates a new instance. + * @param frameNew the attribute dialog main frame + * @param gameObject the game object which has the error to be added + * @param type the initially selected type + * @param archetypeTypeSet the archetype type set to display + * @param dialogAttributes the dialog attributes to update + * @param gameObjectMatchers the game object matchers to use + * @param typeComboBox the selection box for the type + * @param archetypeType the references to the data type + */ + public TypesBoxItemListener(@NotNull final GameObjectAttributesDialog<G, A, R> frameNew, @NotNull final GameObject<G, A, R> gameObject, final int type, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Collection<DialogAttribute<G, A, R, ?>> dialogAttributes, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final JComboBox typeComboBox, @NotNull final ArchetypeType archetypeType) { + gameObjectAttributesDialog = frameNew; + this.gameObject = gameObject; + this.type = type; + this.archetypeTypeSet = archetypeTypeSet; + this.dialogAttributes = dialogAttributes; + this.gameObjectMatchers = gameObjectMatchers; + this.typeComboBox = typeComboBox; + this.archetypeType = archetypeType; + ignoreEvent = false; + } + + /** + * {@inheritDoc} + */ + @Override + public void itemStateChanged(final ItemEvent e) { + if (ignoreEvent) { + return; + } + + if (e.getStateChange() == ItemEvent.DESELECTED) { + // remember the deselected type + deselected = ((String) e.getItem()).trim(); + } else if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(deselected)) { + // new type was selected + // first, get new type structure + final ArchetypeType newType = archetypeTypeSet.getTypeByName((String) e.getItem()); + + typeComboBox.hidePopup(); + gameObjectAttributesDialog.update(gameObjectAttributesDialog.getGraphics()); + + if (deselected == null) { + deselected = archetypeType.getTypeName(); + } + if (JOptionPane.showConfirmDialog(gameObjectAttributesDialog, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) { + // change is confirmed, now get it on... + archetypeType = newType; + + // change the gameObject to be of the new type: + gameObject.setAttributeString(BaseObject.TYPE, Integer.toString(newType.getTypeNo())); + dialogAttributes.clear(); + + type = typeComboBox.getSelectedIndex(); + + // rebuild the dialog frame to show the new tabs + gameObjectAttributesDialog.buildAttribute(); + gameObjectAttributesDialog.update(gameObjectAttributesDialog.getGraphics()); + + // recalculate the editType value; XXX: should use MVC + gameObjectMatchers.updateEditType(gameObject, gameObject.getMapSquare().getMapModel().getActiveEditType()); + } else { + // change not wanted -> reset the choose box + ignoreEvent = true; // ignore events thrown by the forced reset + typeComboBox.setSelectedIndex(type); + ignoreEvent = false; + } + } + } + +} // class TypesBoxItemListener Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 09:16:32
|
Revision: 8492 http://gridarta.svn.sourceforge.net/gridarta/?rev=8492&view=rev Author: akirschbaum Date: 2010-06-26 09:16:26 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Make GameObjectAttributesDialog.TypesBoxItemListener static. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:11:37 UTC (rev 8491) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:16:26 UTC (rev 8492) @@ -945,7 +945,7 @@ typeComboBox.setName("Types"); // the listener: - typeComboBox.addItemListener(new TypesBoxItemListener(this, gameObject, type)); + typeComboBox.addItemListener(new TypesBoxItemListener<G, A, R>(this, gameObject, type, archetypeTypeSet, dialogAttributes, gameObjectMatchers)); return typeComboBox; } @@ -1513,7 +1513,7 @@ /** * ItemListener for the type-selection box on the attribute-dialog. */ - private class TypesBoxItemListener implements ItemListener { + private static class TypesBoxItemListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements ItemListener { /** * The attribute dialog main frame. @@ -1528,6 +1528,25 @@ private final GameObject<G, A, R> gameObject; /** + * The {@link ArchetypeTypeSet} to display. + */ + @NotNull + private final ArchetypeTypeSet archetypeTypeSet; + + /** + * The {@link DialogAttribute DialogAttributes} to update. + */ + @NotNull + private final Collection<DialogAttribute<G, A, R, ?>> dialogAttributes; + + /** + * The {@link GameObjectMatchers} to use. + * @serial + */ + @NotNull + private final GameObjectMatchers gameObjectMatchers; + + /** * The latest deselected item. */ @Nullable @@ -1550,11 +1569,17 @@ * @param frameNew the attribute dialog main frame * @param gameObject the game object which has the error to be added * @param type the initially selected type + * @param archetypeTypeSet the archetype type set to display + * @param dialogAttributes the dialog attributes to update + * @param gameObjectMatchers the game object matchers to use */ - private TypesBoxItemListener(@NotNull final GameObjectAttributesDialog<G, A, R> frameNew, @NotNull final GameObject<G, A, R> gameObject, final int type) { + private TypesBoxItemListener(@NotNull final GameObjectAttributesDialog<G, A, R> frameNew, @NotNull final GameObject<G, A, R> gameObject, final int type, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Collection<DialogAttribute<G, A, R, ?>> dialogAttributes, @NotNull final GameObjectMatchers gameObjectMatchers) { gameObjectAttributesDialog = frameNew; this.gameObject = gameObject; this.type = type; + this.archetypeTypeSet = archetypeTypeSet; + this.dialogAttributes = dialogAttributes; + this.gameObjectMatchers = gameObjectMatchers; ignoreEvent = false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 09:11:43
|
Revision: 8491 http://gridarta.svn.sourceforge.net/gridarta/?rev=8491&view=rev Author: akirschbaum Date: 2010-06-26 09:11:37 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Move GameObjectAttributesDialog.type to GameObjectAttributesDialog.TypesBoxItemListener.type. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 07:38:40 UTC (rev 8490) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-26 09:11:37 UTC (rev 8491) @@ -352,13 +352,6 @@ private ArchetypeType archetypeType; /** - * The position of this type in the type list. This differs from the - * GameObject if the type is undefined. - * @serial - */ - private int type; - - /** * The CardLayout for toggling between edit and summary. * @serial */ @@ -857,10 +850,9 @@ mapManager.addMapManagerListener(mapManagerListener); archetypeType = archetypeTypeSet.getArchetypeType(gameObject); - type = archetypeTypeSet.getArchetypeTypeIndex(archetypeType); // first split top-left and -right - final JComponent leftPane = buildHeader(); + final JComponent leftPane = buildHeader(archetypeTypeSet.getArchetypeTypeIndex(archetypeType)); final JScrollPane rightPane = buildInv(); //Create a split pane with the two scroll panes in it. @@ -929,10 +921,11 @@ /** * Construct the Combo box of the available archetypes. + * @param type the initially selected type * @return a <code>JComponent</code> with the combo box in it */ @NotNull - private Component buildTypesBox() { + private Component buildTypesBox(final int type) { final String[] nameList = new String[archetypeTypeSet.getLength()]; // read all type names @@ -952,7 +945,7 @@ typeComboBox.setName("Types"); // the listener: - typeComboBox.addItemListener(new TypesBoxItemListener(this, gameObject)); + typeComboBox.addItemListener(new TypesBoxItemListener(this, gameObject, type)); return typeComboBox; } @@ -969,11 +962,12 @@ /** * Construct the upper left part of the attribute dialog, containing name, * type, archetype name and face. + * @param type the initially selected type * @return a <code>JScrollPane</code> with the upper left part of the dialog * window */ @NotNull - private JComponent buildHeader() { + private JComponent buildHeader(final int type) { final JComponent header = new JPanel(new GridBagLayout()); // the final thing, in a panel final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; @@ -1014,7 +1008,7 @@ nameTextField.setEditable(false); header.add(nameTextField, gbc); gbc.gridy++; - header.add(buildTypesBox(), gbc); // build type-selection box + header.add(buildTypesBox(type), gbc); // build type-selection box gbc.gridy++; final JTextComponent archetypeTextField = new JTextField(archetype.getArchetypeName(), 16); archetypeTextField.setEditable(false); @@ -1545,13 +1539,22 @@ private boolean ignoreEvent; /** + * The position of this type in the type list. This differs from the + * GameObject if the type is undefined. + * @serial + */ + private int type; + + /** * Creates a new instance. * @param frameNew the attribute dialog main frame * @param gameObject the game object which has the error to be added + * @param type the initially selected type */ - private TypesBoxItemListener(@NotNull final GameObjectAttributesDialog<G, A, R> frameNew, @NotNull final GameObject<G, A, R> gameObject) { + private TypesBoxItemListener(@NotNull final GameObjectAttributesDialog<G, A, R> frameNew, @NotNull final GameObject<G, A, R> gameObject, final int type) { gameObjectAttributesDialog = frameNew; this.gameObject = gameObject; + this.type = type; ignoreEvent = false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 07:38:46
|
Revision: 8490 http://gridarta.svn.sourceforge.net/gridarta/?rev=8490&view=rev Author: akirschbaum Date: 2010-06-26 07:38:40 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2010-06-26 07:37:52 UTC (rev 8489) +++ trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2010-06-26 07:38:40 UTC (rev 8490) @@ -74,7 +74,7 @@ * {@inheritDoc} */ @Override - public int compareTo(final NamedObject o) { + public int compareTo(@NotNull final NamedObject o) { return getName().compareTo(o.getName()); } Modified: trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java 2010-06-26 07:37:52 UTC (rev 8489) +++ trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java 2010-06-26 07:38:40 UTC (rev 8490) @@ -205,7 +205,7 @@ * faces. */ @Override - public int compareTo(final NamedObject o) { + public int compareTo(@NotNull final NamedObject o) { final boolean iAmBug = faceName.equals("bug.111") || faceName.equals("bug.101"); final boolean otherIsBug = o.getName().equals("bug.111") || o.getName().equals("bug.101"); if (iAmBug && otherIsBug) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 07:37:59
|
Revision: 8489 http://gridarta.svn.sourceforge.net/gridarta/?rev=8489&view=rev Author: akirschbaum Date: 2010-06-26 07:37:52 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Implement AbstractNamedObject.hashCode() and .equals(). Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2010-06-26 07:28:06 UTC (rev 8488) +++ trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2010-06-26 07:37:52 UTC (rev 8489) @@ -20,6 +20,7 @@ package net.sf.gridarta.model.data; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A <code>AbstractNamedObject</code> has a name and tree position source and @@ -81,6 +82,29 @@ * {@inheritDoc} */ @Override + public int hashCode() { + return getName().hashCode(); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(@Nullable final Object obj) { + if (obj == this) { + return true; + } + if (obj == null || obj.getClass() != getClass()) { + return false; + } + final NamedObject abstractNamedObject = (AbstractNamedObject) obj; + return getName().equals(abstractNamedObject.getName()); + } + + /** + * {@inheritDoc} + */ + @Override public String toString() { return getName() + "@" + path; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 07:28:12
|
Revision: 8488 http://gridarta.svn.sourceforge.net/gridarta/?rev=8488&view=rev Author: akirschbaum Date: 2010-06-26 07:28:06 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Suppress warning. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-06-26 07:26:12 UTC (rev 8487) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-06-26 07:28:06 UTC (rev 8488) @@ -363,6 +363,7 @@ /** * {@inheritDoc} + * @noinspection AbstractMethodOverridesConcreteMethod */ @Override public abstract void paintComponent(@NotNull final Graphics g); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 07:26:18
|
Revision: 8487 http://gridarta.svn.sourceforge.net/gridarta/?rev=8487&view=rev Author: akirschbaum Date: 2010-06-26 07:26:12 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java trunk/model/src/app/net/sf/gridarta/model/spells/Spells.java trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditUndoActions.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java 2010-06-26 07:21:20 UTC (rev 8486) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java 2010-06-26 07:26:12 UTC (rev 8487) @@ -103,7 +103,7 @@ if (line.length() > 0 && (test == null || c == '\n')) { result.append(line).append('\n'); } - } catch (final StringIndexOutOfBoundsException e) { + } catch (final StringIndexOutOfBoundsException ignored) { // ignore } } Modified: trunk/model/src/app/net/sf/gridarta/model/spells/Spells.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/spells/Spells.java 2010-06-26 07:21:20 UTC (rev 8486) +++ trunk/model/src/app/net/sf/gridarta/model/spells/Spells.java 2010-06-26 07:26:12 UTC (rev 8487) @@ -92,7 +92,7 @@ public S getSpell(final int index) { try { return spells.get(index); - } catch (final IndexOutOfBoundsException ex) { + } catch (final IndexOutOfBoundsException ignored) { return spells.get(0); } } Modified: trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2010-06-26 07:21:20 UTC (rev 8486) +++ trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2010-06-26 07:26:12 UTC (rev 8487) @@ -287,13 +287,13 @@ final File file; try { file = mapPathNormalizer.normalizeMapPath(mapModel, path); - } catch (final InvalidPathException ex) { + } catch (final InvalidPathException ignored) { return null; - } catch (final IOErrorException ex) { + } catch (final IOErrorException ignored) { return null; - } catch (final RelativePathOnUnsavedMapException ex) { + } catch (final RelativePathOnUnsavedMapException ignored) { return null; - } catch (final SameMapException ex) { + } catch (final SameMapException ignored) { return null; } return mapManager.openMapFile(file, false); Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditUndoActions.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditUndoActions.java 2010-06-26 07:21:20 UTC (rev 8486) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditUndoActions.java 2010-06-26 07:26:12 UTC (rev 8487) @@ -123,7 +123,7 @@ undoManager.undo(); refresh(); } - } catch (final CannotUndoException ex) { + } catch (final CannotUndoException ignored) { // ignore } } Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2010-06-26 07:21:20 UTC (rev 8486) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2010-06-26 07:26:12 UTC (rev 8487) @@ -260,10 +260,10 @@ try { ch = KeyEvent.class.getField("VK_" + key).getInt(null); - } catch (final IllegalAccessException e) { + } catch (final IllegalAccessException ignored) { log.error("Invalid key stroke: " + keyStroke); return null; - } catch (final NoSuchFieldException e) { + } catch (final NoSuchFieldException ignored) { log.error("Invalid key stroke: " + keyStroke); return null; } Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2010-06-26 07:21:20 UTC (rev 8486) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2010-06-26 07:26:12 UTC (rev 8487) @@ -259,13 +259,13 @@ // System.err.println("freeTabKeyFromFocusTraversal() succeeded!"); } } - } catch (final ClassNotFoundException e) { + } catch (final ClassNotFoundException ignored) { // ignore - } catch (final IllegalAccessException e) { + } catch (final IllegalAccessException ignored) { // ignore - } catch (final InvocationTargetException e) { + } catch (final InvocationTargetException ignored) { // ignore - } catch (final NoSuchFieldException e) { + } catch (final NoSuchFieldException ignored) { // ignore } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 07:21:26
|
Revision: 8486 http://gridarta.svn.sourceforge.net/gridarta/?rev=8486&view=rev Author: akirschbaum Date: 2010-06-26 07:21:20 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Suppress warning. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/gameobject/NotInsideContainerException.java Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/NotInsideContainerException.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/NotInsideContainerException.java 2010-06-26 07:20:47 UTC (rev 8485) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/NotInsideContainerException.java 2010-06-26 07:21:20 UTC (rev 8486) @@ -29,6 +29,7 @@ * container or the wrong container was invoked when a GameObject requires a * container. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @noinspection UncheckedExceptionClass */ public class NotInsideContainerException extends IllegalStateException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |