Skip to content

Commit e649511

Browse files
authored
Merge pull request #464 from tonihele/feature/issue-371
Feature/issue 371
2 parents 21a6711 + 6608606 commit e649511

30 files changed

+1593
-285
lines changed

jme3-templates/nbproject/project.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
<code-name-base>com.jme3.gde.templates</code-name-base>
77
<suite-component/>
88
<module-dependencies>
9+
<dependency>
10+
<code-name-base>com.google.gson</code-name-base>
11+
<build-prerequisite/>
12+
<compile-dependency/>
13+
<run-dependency>
14+
<specification-version>2.8.9</specification-version>
15+
</run-dependency>
16+
</dependency>
917
<dependency>
1018
<code-name-base>com.jme3.gde.project.baselibs</code-name-base>
1119
<run-dependency>

jme3-templates/src/com/jme3/gde/templates/files/freemarker/build.gradle.ftl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ dependencies {
3838
// Core JME
3939
implementation "org.jmonkeyengine:jme3-core:$jmeVer"
4040
implementation "org.jmonkeyengine:jme3-desktop:$jmeVer"
41-
implementation "${lwjglArtifact}:$jmeVer"
41+
<#if lwjglLibrary.isCoreJmeLibrary == true>
42+
implementation "${lwjglLibrary.groupId}:${lwjglLibrary.artifactId}:$jmeVer"
43+
<#else>
44+
implementation "${lwjglLibrary.groupId}:${lwjglLibrary.artifactId}:${lwjglLibrary.versionInfo.versionString}"
45+
</#if>
4246

4347
// Suppress errors / warnings building in SDK
4448
implementation "org.jmonkeyengine:jme3-jogg:$jmeVer"
@@ -47,36 +51,36 @@ dependencies {
4751

4852
// GUI Library
4953
<#if guiLibrary.isCoreJmeLibrary == true>
50-
implementation "${guiLibrary.artifact}:$jmeVer"
54+
implementation "${guiLibrary.groupId}:${guiLibrary.artifactId}:$jmeVer"
5155
<#else>
52-
implementation "${guiLibrary.artifact}"
56+
implementation "${guiLibrary.groupId}:${guiLibrary.artifactId}:${guiLibrary.versionInfo.versionString}"
5357
</#if>
5458
</#if>
5559
<#if physicsLibrary.label != "">
5660

5761
// Physics Library
5862
<#if physicsLibrary.isCoreJmeLibrary == true>
59-
implementation "${physicsLibrary.artifact}:$jmeVer"
63+
implementation "${physicsLibrary.groupId}:${physicsLibrary.artifactId}:$jmeVer"
6064
<#else>
61-
implementation "${physicsLibrary.artifact}"
65+
implementation "${physicsLibrary.groupId}:${physicsLibrary.artifactId}:${physicsLibrary.versionInfo.versionString}"
6266
</#if>
6367
</#if>
6468
<#if networkingLibrary.label != "">
6569

6670
// Networking Library
6771
<#if networkingLibrary.isCoreJmeLibrary == true>
68-
implementation "${networkingLibrary.artifact}:$jmeVer"
72+
implementation "${networkingLibrary.groupId}:${networkingLibrary.artifactId}:$jmeVer"
6973
<#else>
70-
implementation "${networkingLibrary.artifact}"
74+
implementation "${networkingLibrary.groupId}:${networkingLibrary.artifactId}:${networkingLibrary.versionInfo.versionString}"
7175
</#if>
7276
</#if>
7377

7478
// Additional Libraries
7579
<#list additionalLibraries as additionalLibrary>
7680
<#if additionalLibrary.isCoreJmeLibrary == true>
77-
implementation "${additionalLibrary.artifact}:$jmeVer"
81+
implementation "${additionalLibrary.groupId}:${additionalLibrary.artifactId}:$jmeVer"
7882
<#else>
79-
implementation "${additionalLibrary.artifact}"
83+
implementation "${additionalLibrary.groupId}:${additionalLibrary.artifactId}:${additionalLibrary.versionInfo.versionString}"
8084
</#if>
8185
</#list>
8286

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<html>
2+
Check jMonkeyEngine <a href="https://github.com/jMonkeyEngine/jmonkeyengine/releases">release history</a>
3+
</html>

jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameAdditionalLibrariesPanelVisual.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232

3333
package com.jme3.gde.templates.gradledesktop;
3434

35-
import com.jme3.gde.templates.gradledesktop.options.AdditionalLibrary;
35+
import com.jme3.gde.templates.gradledesktop.options.CachedOptionsContainer;
36+
import com.jme3.gde.templates.gradledesktop.options.TemplateLibrary;
3637
import java.awt.Dimension;
3738
import java.util.ArrayList;
3839
import java.util.List;
@@ -80,11 +81,13 @@ public GradleDesktopGameAdditionalLibrariesPanelVisual(
8081
}
8182

8283
private void populateLibraryTable() {
83-
int noRows = AdditionalLibrary.values().length;
84+
List<TemplateLibrary> libraries = CachedOptionsContainer.getInstance().getAdditionalLibraries();
85+
86+
int noRows = libraries.size();
8487
Object[][] tableData = new Object[noRows][2];
8588

8689
int row = 0;
87-
for (AdditionalLibrary library : AdditionalLibrary.values()) {
90+
for (TemplateLibrary library : libraries) {
8891
tableData[row][0] = Boolean.FALSE;
8992
tableData[row][1] = library;
9093
row++;
@@ -107,8 +110,7 @@ private void updateLibraryDescription() {
107110
if (selectedRow == -1) {
108111
libraryDescriptionTextArea.setText("");
109112
} else {
110-
AdditionalLibrary selectedLibrary = (AdditionalLibrary)
111-
additionalLibraryTable.getValueAt(selectedRow, 1);
113+
TemplateLibrary selectedLibrary = (TemplateLibrary) additionalLibraryTable.getValueAt(selectedRow, 1);
112114
libraryDescriptionTextArea.setText(selectedLibrary
113115
.getDescription());
114116
}
@@ -117,8 +119,8 @@ private void updateLibraryDescription() {
117119
protected void store(WizardDescriptor d) {
118120
AdditionalLibraryTableModel model = (AdditionalLibraryTableModel)
119121
additionalLibraryTable.getModel();
120-
List<AdditionalLibrary> selectedLibraries =
121-
model.getSelectedLibraries();
122+
List<TemplateLibrary> selectedLibraries
123+
= model.getSelectedLibraries();
122124

123125
d.putProperty("additionalLibraries", selectedLibraries);
124126
}
@@ -202,7 +204,7 @@ public Class<?> getColumnClass(int columnIndex) {
202204
case 0:
203205
return Boolean.class;
204206
case 1:
205-
return String.class;
207+
return TemplateLibrary.class;
206208
default:
207209
return super.getColumnClass(columnIndex);
208210
}
@@ -213,11 +215,11 @@ public boolean isCellEditable(int row, int column) {
213215
return column == 0;
214216
}
215217

216-
public List<AdditionalLibrary> getSelectedLibraries() {
217-
List<AdditionalLibrary> selectedLibraries = new ArrayList<>();
218+
public List<TemplateLibrary> getSelectedLibraries() {
219+
List<TemplateLibrary> selectedLibraries = new ArrayList<>();
218220
for (int i = 0; i < getRowCount(); i++) {
219221
if ((Boolean) getValueAt(i, 0)) {
220-
selectedLibraries.add((AdditionalLibrary) getValueAt(i, 1));
222+
selectedLibraries.add((TemplateLibrary) getValueAt(i, 1));
221223
}
222224
}
223225

jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameGuiPanelVisual.form

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@
9595
<Component class="javax.swing.JComboBox" name="guiComboBox">
9696
<Properties>
9797
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
98-
<Connection code="new DefaultComboBoxModel(GUILibrary.values())" type="code"/>
98+
<Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(CachedOptionsContainer.getInstance().getGuiLibraries().toArray(TemplateLibrary[]::new))" type="code"/>
9999
</Property>
100100
</Properties>
101101
<Events>
102102
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="guiComboBoxActionPerformed"/>
103103
</Events>
104104
<AuxValues>
105-
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
105+
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;TemplateLibrary&gt;"/>
106106
</AuxValues>
107107
</Component>
108108
<Container class="javax.swing.JScrollPane" name="guiDescriptionScrollPane">
@@ -138,14 +138,14 @@
138138
<Component class="javax.swing.JComboBox" name="physicsEngineComboBox">
139139
<Properties>
140140
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
141-
<Connection code="new DefaultComboBoxModel(PhysicsLibrary.values())" type="code"/>
141+
<Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(CachedOptionsContainer.getInstance().getPhysicsLibraries().toArray(TemplateLibrary[]::new))" type="code"/>
142142
</Property>
143143
</Properties>
144144
<Events>
145145
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="physicsEngineComboBoxActionPerformed"/>
146146
</Events>
147147
<AuxValues>
148-
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
148+
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;TemplateLibrary&gt;"/>
149149
</AuxValues>
150150
</Component>
151151
<Container class="javax.swing.JScrollPane" name="physicsEngineDescriptionScrollPane">
@@ -181,14 +181,14 @@
181181
<Component class="javax.swing.JComboBox" name="networkingComboBox">
182182
<Properties>
183183
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
184-
<Connection code="new DefaultComboBoxModel(NetworkingLibrary.values())" type="code"/>
184+
<Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(CachedOptionsContainer.getInstance().getNetworkingLibraries().toArray(TemplateLibrary[]::new))" type="code"/>
185185
</Property>
186186
</Properties>
187187
<Events>
188188
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="networkingComboBoxActionPerformed"/>
189189
</Events>
190190
<AuxValues>
191-
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
191+
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;TemplateLibrary&gt;"/>
192192
</AuxValues>
193193
</Component>
194194
<Container class="javax.swing.JScrollPane" name="networkingDescriptionScrollPane">

jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameGuiPanelVisual.java

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131
*/
3232
package com.jme3.gde.templates.gradledesktop;
3333

34-
import com.jme3.gde.templates.gradledesktop.options.GUILibrary;
35-
import com.jme3.gde.templates.gradledesktop.options.NetworkingLibrary;
36-
import com.jme3.gde.templates.gradledesktop.options.PhysicsLibrary;
34+
import com.jme3.gde.templates.gradledesktop.options.CachedOptionsContainer;
35+
import com.jme3.gde.templates.gradledesktop.options.TemplateLibrary;
3736
import java.awt.event.ActionEvent;
3837
import java.awt.event.ActionListener;
3938
import javax.swing.DefaultComboBoxModel;
@@ -50,45 +49,42 @@
5049
import org.openide.util.NbBundle;
5150

5251
/**
53-
* UI Compoment for the New Gradle Game Wizard GUI panel.
52+
* UI Component for the New Gradle Game Wizard GUI panel.
5453
*
5554
* @author peedeeboy
5655
*/
5756
public class GradleDesktopGameGuiPanelVisual extends JPanel {
5857

59-
private final GradleDesktopGameGuiPanel panel;
60-
6158
/**
6259
* Creates new form GradleDesktopGameGuiPanelVisual
6360
*/
6461
public GradleDesktopGameGuiPanelVisual(GradleDesktopGameGuiPanel panel) {
6562
initComponents();
63+
6664
updateGuiLibraryDescription();
6765
updatePhysicsLibraryDescription();
6866
updateNetworkingLibraryDescription();
69-
70-
this.panel = panel;
7167
}
7268

7369
private void updateGuiLibraryDescription() {
74-
GUILibrary selectedGuiLibrary = (GUILibrary) guiComboBox.getSelectedItem();
70+
TemplateLibrary selectedGuiLibrary = guiComboBox.getItemAt(guiComboBox.getSelectedIndex());
7571
guiDescriptionTextArea.setText(selectedGuiLibrary.getDescription());
7672
}
7773

7874
private void updatePhysicsLibraryDescription() {
79-
PhysicsLibrary selectedPhysicsLibrary = (PhysicsLibrary) physicsEngineComboBox.getSelectedItem();
75+
TemplateLibrary selectedPhysicsLibrary = physicsEngineComboBox.getItemAt(physicsEngineComboBox.getSelectedIndex());
8076
physicsEngineDescriptionTextArea.setText(selectedPhysicsLibrary.getDescription());
8177
}
8278

8379
private void updateNetworkingLibraryDescription() {
84-
NetworkingLibrary selectedNetworkingLibrary = (NetworkingLibrary) networkingComboBox.getSelectedItem();
80+
TemplateLibrary selectedNetworkingLibrary = networkingComboBox.getItemAt(networkingComboBox.getSelectedIndex());
8581
networkingDescriptionTextArea.setText(selectedNetworkingLibrary.getDescription());
8682
}
8783

8884
protected void store(WizardDescriptor d) {
89-
GUILibrary selectedGuiLibrary = (GUILibrary) guiComboBox.getSelectedItem();
90-
PhysicsLibrary selectedPhysicsLibrary = (PhysicsLibrary) physicsEngineComboBox.getSelectedItem();
91-
NetworkingLibrary selectedNetworkingLibrary = (NetworkingLibrary) networkingComboBox.getSelectedItem();
85+
TemplateLibrary selectedGuiLibrary = guiComboBox.getItemAt(guiComboBox.getSelectedIndex());
86+
TemplateLibrary selectedPhysicsLibrary = physicsEngineComboBox.getItemAt(physicsEngineComboBox.getSelectedIndex());
87+
TemplateLibrary selectedNetworkingLibrary = networkingComboBox.getItemAt(networkingComboBox.getSelectedIndex());
9288

9389
d.putProperty("guiLibrary", selectedGuiLibrary);
9490
d.putProperty("physicsLibrary", selectedPhysicsLibrary);
@@ -122,7 +118,7 @@ private void initComponents() {
122118
guiLabel.setLabelFor(guiComboBox);
123119
Mnemonics.setLocalizedText(guiLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.guiLabel.text")); // NOI18N
124120

125-
guiComboBox.setModel(new DefaultComboBoxModel(GUILibrary.values()));
121+
guiComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(CachedOptionsContainer.getInstance().getGuiLibraries().toArray(TemplateLibrary[]::new)));
126122
guiComboBox.addActionListener(new ActionListener() {
127123
public void actionPerformed(ActionEvent evt) {
128124
guiComboBoxActionPerformed(evt);
@@ -139,7 +135,7 @@ public void actionPerformed(ActionEvent evt) {
139135
physicsEngineLabel.setLabelFor(physicsEngineComboBox);
140136
Mnemonics.setLocalizedText(physicsEngineLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.physicsEngineLabel.text")); // NOI18N
141137

142-
physicsEngineComboBox.setModel(new DefaultComboBoxModel(PhysicsLibrary.values()));
138+
physicsEngineComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(CachedOptionsContainer.getInstance().getPhysicsLibraries().toArray(TemplateLibrary[]::new)));
143139
physicsEngineComboBox.addActionListener(new ActionListener() {
144140
public void actionPerformed(ActionEvent evt) {
145141
physicsEngineComboBoxActionPerformed(evt);
@@ -156,7 +152,7 @@ public void actionPerformed(ActionEvent evt) {
156152
networkingLabel.setLabelFor(networkingComboBox);
157153
Mnemonics.setLocalizedText(networkingLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.networkingLabel.text")); // NOI18N
158154

159-
networkingComboBox.setModel(new DefaultComboBoxModel(NetworkingLibrary.values()));
155+
networkingComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(CachedOptionsContainer.getInstance().getNetworkingLibraries().toArray(TemplateLibrary[]::new)));
160156
networkingComboBox.addActionListener(new ActionListener() {
161157
public void actionPerformed(ActionEvent evt) {
162158
networkingComboBoxActionPerformed(evt);
@@ -239,17 +235,17 @@ private void networkingComboBoxActionPerformed(ActionEvent evt) {//GEN-FIRST:eve
239235

240236

241237
// Variables declaration - do not modify//GEN-BEGIN:variables
242-
private JComboBox<String> guiComboBox;
238+
private JComboBox<TemplateLibrary> guiComboBox;
243239
private JScrollPane guiDescriptionScrollPane;
244240
private JTextArea guiDescriptionTextArea;
245241
private JLabel guiLabel;
246242
private JSeparator jSeparator1;
247243
private JSeparator jSeparator2;
248-
private JComboBox<String> networkingComboBox;
244+
private JComboBox<TemplateLibrary> networkingComboBox;
249245
private JScrollPane networkingDescriptionScrollPane;
250246
private JTextArea networkingDescriptionTextArea;
251247
private JLabel networkingLabel;
252-
private JComboBox<String> physicsEngineComboBox;
248+
private JComboBox<TemplateLibrary> physicsEngineComboBox;
253249
private JScrollPane physicsEngineDescriptionScrollPane;
254250
private JTextArea physicsEngineDescriptionTextArea;
255251
private JLabel physicsEngineLabel;

jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameJMEVersionPanelVisual.form

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<Component class="javax.swing.JComboBox" name="jmeVersionComboBox">
9292
<Properties>
9393
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
94-
<Connection code="new DefaultComboBoxModel(JMEVersion.values())" type="code"/>
94+
<Connection code="new DefaultComboBoxModel&lt;LibraryVersion&gt;(com.jme3.gde.templates.gradledesktop.options.JMEVersion.values())" type="code"/>
9595
</Property>
9696
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
9797
<Dimension value="[100, 25]"/>
@@ -101,7 +101,7 @@
101101
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jmeVersionComboBoxActionPerformed"/>
102102
</Events>
103103
<AuxValues>
104-
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
104+
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;LibraryVersion&gt;"/>
105105
</AuxValues>
106106
</Component>
107107
<Container class="javax.swing.JScrollPane" name="jmeVersionDescriptionScrollPane">
@@ -140,7 +140,7 @@
140140
<Component class="javax.swing.JComboBox" name="lwjglComboBox">
141141
<Properties>
142142
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
143-
<Connection code="new DefaultComboBoxModel(LWJGLVersion.values())" type="code"/>
143+
<Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(com.jme3.gde.templates.gradledesktop.options.LWJGLLibrary.values())" type="code"/>
144144
</Property>
145145
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
146146
<Dimension value="[100, 25]"/>
@@ -150,7 +150,7 @@
150150
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lwjglComboBoxActionPerformed"/>
151151
</Events>
152152
<AuxValues>
153-
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
153+
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;TemplateLibrary&gt;"/>
154154
</AuxValues>
155155
</Component>
156156
<Container class="javax.swing.JScrollPane" name="lwjglDescriptionScrollPane">

0 commit comments

Comments
 (0)