Kaynağa Gözat

Review fixes
Adding icon

rickard 3 yıl önce
ebeveyn
işleme
003b96453f

+ 3 - 3
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Bundle.properties

@@ -19,6 +19,6 @@ ShaderNodeToolBar.codeButton.toolTipText=Display code
 NodeToolBar.deleteButton.toolTipText=Delete node
 NodeToolBar.deleteButton.text=
 NodeToolBar.codeButton.toolTipText=Display code
-MatDefEditorToolBar.jToggleButton2.toolTipText=Toggle Live Material Updates
-MatDefEditorToolBar.jToggleButton2.text=toggleLiveUpdates
-MatDefEditorToolBar.jToggleButton2.actionCommand=toggleLiveUpdates
+MatDefEditorToolBar.toggleLiveUpdates.actionCommand=toggleLiveUpdates
+MatDefEditorToolBar.toggleLiveUpdates.toolTipText=Toggle Live Backpanel Updates
+MatDefEditorToolBar.toggleLiveUpdates.text=

+ 20 - 5
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorToolBar.form

@@ -32,7 +32,7 @@
               <EmptySpace max="-2" attributes="0"/>
               <Component id="jButton2" min="-2" max="-2" attributes="0"/>
               <EmptySpace max="32767" attributes="0"/>
-              <Component id="jToggleButton2" min="-2" pref="23" max="-2" attributes="0"/>
+              <Component id="jToggleButton2" min="-2" max="-2" attributes="0"/>
               <EmptySpace min="-2" pref="99" max="-2" attributes="0"/>
           </Group>
       </Group>
@@ -111,18 +111,33 @@
     </Component>
     <Component class="javax.swing.JToggleButton" name="jToggleButton2">
       <Properties>
+        <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
+          <Image iconType="3" name="/com/jme3/gde/core/editor/icons/repeat.png"/>
+        </Property>
         <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
-          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.jToggleButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.toggleLiveUpdates.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
         </Property>
         <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
-          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.jToggleButton2.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.toggleLiveUpdates.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
         </Property>
         <Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
-          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.jToggleButton2.actionCommand" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.toggleLiveUpdates.actionCommand" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
         </Property>
         <Property name="horizontalAlignment" type="int" value="11"/>
+        <Property name="horizontalTextPosition" type="int" value="0"/>
+        <Property name="iconTextGap" type="int" value="0"/>
+        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+          <Insets value="[2, 14, 2, 18]"/>
+        </Property>
+        <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+          <Dimension value="[25, 24]"/>
+        </Property>
+        <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+          <Dimension value="[25, 24]"/>
+        </Property>
+        <Property name="name" type="java.lang.String" value="toggleLiveUpdates" noResource="true"/>
         <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
-          <Dimension value="[99, 24]"/>
+          <Dimension value="[25, 24]"/>
         </Property>
       </Properties>
       <Events>

+ 12 - 5
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorToolBar.java

@@ -135,11 +135,18 @@ public class MatDefEditorToolBar extends JPanel {
             }
         });
 
-        org.openide.awt.Mnemonics.setLocalizedText(jToggleButton2, org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.jToggleButton2.text")); // NOI18N
-        jToggleButton2.setToolTipText(org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.jToggleButton2.toolTipText")); // NOI18N
-        jToggleButton2.setActionCommand(org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.jToggleButton2.actionCommand")); // NOI18N
+        jToggleButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/core/editor/icons/repeat.png"))); // NOI18N
+        org.openide.awt.Mnemonics.setLocalizedText(jToggleButton2, org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.toggleLiveUpdates.text")); // NOI18N
+        jToggleButton2.setToolTipText(org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.toggleLiveUpdates.toolTipText")); // NOI18N
+        jToggleButton2.setActionCommand(org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.toggleLiveUpdates.actionCommand")); // NOI18N
         jToggleButton2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
-        jToggleButton2.setPreferredSize(new java.awt.Dimension(99, 24));
+        jToggleButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+        jToggleButton2.setIconTextGap(0);
+        jToggleButton2.setMargin(new java.awt.Insets(2, 14, 2, 18));
+        jToggleButton2.setMaximumSize(new java.awt.Dimension(25, 24));
+        jToggleButton2.setMinimumSize(new java.awt.Dimension(25, 24));
+        jToggleButton2.setName("toggleLiveUpdates"); // NOI18N
+        jToggleButton2.setPreferredSize(new java.awt.Dimension(25, 24));
         jToggleButton2.addActionListener(new java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
                 jToggleButton2ActionPerformed(evt);
@@ -161,7 +168,7 @@ public class MatDefEditorToolBar extends JPanel {
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(jButton2)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-                .addComponent(jToggleButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addComponent(jToggleButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addGap(99, 99, 99))
         );
         layout.setVerticalGroup(

+ 0 - 1
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java

@@ -136,7 +136,6 @@ public final class MatDefEditorlElement extends JPanel implements
         if (!file.isLoaded()) {
             throw new IllegalArgumentException("Cannot build MatDefEditorlElement: Failed at loading the EditableMatDefFile");
         }
-        
         reload(file, lkp);        
         toolbar.setParent(this);
         toolbar.addTechnique(lkp.lookup(MatDefBlock.class).getTechniques());

+ 10 - 5
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderNodeDiagram.java

@@ -77,6 +77,7 @@ public class ShaderNodeDiagram extends Diagram implements ComponentListener {
     private String currentTechniqueName;
     private final BackdropPanel backDrop = new BackdropPanel();
     private final Point pp = new Point();
+    private Thread backgroundThread;
     private UpdateBackgroundRunnable backgroundUpdate = new UpdateBackgroundRunnable();
 
     @SuppressWarnings("LeakingThisInConstructor")
@@ -133,9 +134,6 @@ public class ShaderNodeDiagram extends Diagram implements ComponentListener {
                         bus.dispatchEvent(me);
                     }
                 }
-//                if (!e.isConsumed()){
-//                    setLocation(e.getX(), e.getY());
-//                }
             }
         } else {
             super.mouseDragged(e); // Handle all the UI Stuff
@@ -499,9 +497,16 @@ public class ShaderNodeDiagram extends Diagram implements ComponentListener {
     public void toggleUpdateThread(boolean on) {
         if(on && !backgroundUpdate.isRunning()){
             backgroundUpdate.setRunning(true);
-            new Thread(backgroundUpdate).start();
+            backgroundThread = new Thread(backgroundUpdate);
+            backgroundThread.setDaemon(true);
+            backgroundThread.start();
         } else if (!on && backgroundUpdate.isRunning()){
-            backgroundUpdate.setRunning(false);
+            try {
+                backgroundUpdate.setRunning(false);
+                backgroundThread.join();
+            } catch (InterruptedException ex) {
+                Thread.currentThread().interrupt();
+            }
         }
     }