浏览代码

Use the cached container

Toni Helenius 2 年之前
父节点
当前提交
8d92de74d7

+ 4 - 3
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameAdditionalLibrariesPanelVisual.java

@@ -32,7 +32,6 @@
 
 package com.jme3.gde.templates.gradledesktop;
 
-import com.jme3.gde.templates.gradledesktop.options.AdditionalLibrary;
 import com.jme3.gde.templates.gradledesktop.options.TemplateLibrary;
 import java.awt.Dimension;
 import java.util.ArrayList;
@@ -81,11 +80,13 @@ public class GradleDesktopGameAdditionalLibrariesPanelVisual extends JPanel
     }
 
     private void populateLibraryTable() {
-        int noRows = AdditionalLibrary.values().length;
+        List<TemplateLibrary> libraries = CachedOptionsContainer.getInstance().getAdditionalLibraries();
+
+        int noRows = libraries.size();
         Object[][] tableData = new Object[noRows][2];
 
         int row = 0;
-        for (TemplateLibrary library : AdditionalLibrary.values()) {
+        for (TemplateLibrary library : libraries) {
             tableData[row][0] = Boolean.FALSE;
             tableData[row][1] = library;
             row++;

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

@@ -95,7 +95,7 @@
     <Component class="javax.swing.JComboBox" name="guiComboBox">
       <Properties>
         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
-          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(GUILibrary.values())" type="code"/>
+          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(CachedOptionsContainer.getInstance().getGuiLibraries().toArray(new TemplateLibrary[0]))" type="code"/>
         </Property>
       </Properties>
       <Events>
@@ -138,7 +138,7 @@
     <Component class="javax.swing.JComboBox" name="physicsEngineComboBox">
       <Properties>
         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
-          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(PhysicsLibrary.values())" type="code"/>
+          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(CachedOptionsContainer.getInstance().getPhysicsLibraries().toArray(new TemplateLibrary[0]))" type="code"/>
         </Property>
       </Properties>
       <Events>
@@ -181,7 +181,7 @@
     <Component class="javax.swing.JComboBox" name="networkingComboBox">
       <Properties>
         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
-          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(NetworkingLibrary.values())" type="code"/>
+          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(CachedOptionsContainer.getInstance().getNetworkingLibraries().toArray(new TemplateLibrary[0]))" type="code"/>
         </Property>
       </Properties>
       <Events>

+ 3 - 6
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameGuiPanelVisual.java

@@ -31,9 +31,6 @@
  */
 package com.jme3.gde.templates.gradledesktop;
 
-import com.jme3.gde.templates.gradledesktop.options.GUILibrary;
-import com.jme3.gde.templates.gradledesktop.options.NetworkingLibrary;
-import com.jme3.gde.templates.gradledesktop.options.PhysicsLibrary;
 import com.jme3.gde.templates.gradledesktop.options.TemplateLibrary;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -120,7 +117,7 @@ public class GradleDesktopGameGuiPanelVisual extends JPanel {
         guiLabel.setLabelFor(guiComboBox);
         Mnemonics.setLocalizedText(guiLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.guiLabel.text")); // NOI18N
 
-        guiComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(GUILibrary.values()));
+        guiComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(CachedOptionsContainer.getInstance().getGuiLibraries().toArray(new TemplateLibrary[0])));
         guiComboBox.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 guiComboBoxActionPerformed(evt);
@@ -137,7 +134,7 @@ public class GradleDesktopGameGuiPanelVisual extends JPanel {
         physicsEngineLabel.setLabelFor(physicsEngineComboBox);
         Mnemonics.setLocalizedText(physicsEngineLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.physicsEngineLabel.text")); // NOI18N
 
-        physicsEngineComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(PhysicsLibrary.values()));
+        physicsEngineComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(CachedOptionsContainer.getInstance().getPhysicsLibraries().toArray(new TemplateLibrary[0])));
         physicsEngineComboBox.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 physicsEngineComboBoxActionPerformed(evt);
@@ -154,7 +151,7 @@ public class GradleDesktopGameGuiPanelVisual extends JPanel {
         networkingLabel.setLabelFor(networkingComboBox);
         Mnemonics.setLocalizedText(networkingLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.networkingLabel.text")); // NOI18N
 
-        networkingComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(NetworkingLibrary.values()));
+        networkingComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(CachedOptionsContainer.getInstance().getNetworkingLibraries().toArray(new TemplateLibrary[0])));
         networkingComboBox.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 networkingComboBoxActionPerformed(evt);