Remove warnings from MaterialEditorTopComponent

experimental
Nehon 10 years ago
parent 2fb6eac744
commit 440009c3ac
  1. 10
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.form
  2. 44
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java

@ -78,8 +78,8 @@
<Component id="materialPreviewWidget1" min="-2" pref="120" max="-2" attributes="0"/> <Component id="materialPreviewWidget1" min="-2" pref="120" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/> <EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jToolBar3" alignment="0" pref="596" max="32767" attributes="1"/> <Component id="jToolBar3" alignment="0" max="32767" attributes="1"/>
<Component id="jToolBar2" alignment="0" pref="596" max="32767" attributes="1"/> <Component id="jToolBar2" alignment="0" max="32767" attributes="1"/>
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/> <Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -89,7 +89,7 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="jTabbedPane3" min="-2" pref="223" max="-2" attributes="0"/> <Component id="jTabbedPane3" min="-2" pref="223" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jTabbedPane2" pref="525" max="32767" attributes="0"/> <Component id="jTabbedPane2" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -109,8 +109,8 @@
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="1" attributes="0">
<Component id="jTabbedPane2" pref="320" max="32767" attributes="0"/> <Component id="jTabbedPane2" max="32767" attributes="0"/>
<Component id="jTabbedPane3" pref="326" max="32767" attributes="0"/> <Component id="jTabbedPane3" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</Group> </Group>

@ -12,7 +12,6 @@ import com.jme3.gde.materials.EditableMaterialFile;
import com.jme3.gde.materials.MaterialProperty; import com.jme3.gde.materials.MaterialProperty;
import com.jme3.gde.core.sceneexplorer.MaterialChangeListener; import com.jme3.gde.core.sceneexplorer.MaterialChangeListener;
import com.jme3.gde.core.sceneexplorer.MaterialChangeProvider; import com.jme3.gde.core.sceneexplorer.MaterialChangeProvider;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.materials.multiview.widgets.MaterialPropertyWidget; import com.jme3.gde.materials.multiview.widgets.MaterialPropertyWidget;
import com.jme3.gde.materials.multiview.widgets.MaterialWidgetListener; import com.jme3.gde.materials.multiview.widgets.MaterialWidgetListener;
import com.jme3.gde.materials.multiview.widgets.WidgetFactory; import com.jme3.gde.materials.multiview.widgets.WidgetFactory;
@ -23,13 +22,10 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.JComponent;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import org.openide.loaders.DataObjectNotFoundException; import org.openide.loaders.DataObjectNotFoundException;
@ -47,7 +43,6 @@ import org.openide.util.HelpCtx;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.lookup.InstanceContent; import org.openide.util.lookup.InstanceContent;
import org.openide.windows.CloneableTopComponent; import org.openide.windows.CloneableTopComponent;
import org.openide.windows.Mode;
/** /**
* Top component which displays something. * Top component which displays something.
@ -69,10 +64,10 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
private String materialFileName; private String materialFileName;
private String relativeMaterialFileName; private String relativeMaterialFileName;
private ProjectAssetManager manager; private ProjectAssetManager manager;
private SaveCookie saveCookie = new SaveCookieImpl(); private final SaveCookie saveCookie = new SaveCookieImpl();
private boolean saveImmediate = true; private boolean saveImmediate = true;
private boolean updateProperties = false; private boolean updateProperties = false;
private List<MaterialChangeListener> materialListeners = new ArrayList<MaterialChangeListener>(); private final List<MaterialChangeListener> materialListeners = new ArrayList<MaterialChangeListener>();
public MaterialEditorTopComponent() { public MaterialEditorTopComponent() {
} }
@ -520,8 +515,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
List<String> matDefList = Arrays.asList(matDefs); List<String> matDefList = Arrays.asList(matDefs);
Collections.sort(matDefList); Collections.sort(matDefList);
String[] sortedMatDefs = matDefList.toArray(new String[0]); String[] sortedMatDefs = matDefList.toArray(new String[0]);
for (int i = 0; i < sortedMatDefs.length; i++) { for (String string : sortedMatDefs) {
String string = sortedMatDefs[i];
jComboBox1.addItem(string); jComboBox1.addItem(string);
} }
@ -538,14 +532,12 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
} }
private void updateProperties() { private void updateProperties() {
for (int i = 0; i < optionsPanel.getComponents().length; i++) { for (Component component : optionsPanel.getComponents()) {
Component component = optionsPanel.getComponents()[i];
if (component instanceof MaterialPropertyWidget) { if (component instanceof MaterialPropertyWidget) {
((MaterialPropertyWidget) component).registerChangeListener(null); ((MaterialPropertyWidget) component).registerChangeListener(null);
} }
} }
for (int i = 0; i < texturePanel.getComponents().length; i++) { for (Component component : texturePanel.getComponents()) {
Component component = texturePanel.getComponents()[i];
if (component instanceof MaterialPropertyWidget) { if (component instanceof MaterialPropertyWidget) {
((MaterialPropertyWidget) component).registerChangeListener(null); ((MaterialPropertyWidget) component).registerChangeListener(null);
} }
@ -557,13 +549,12 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
List<Component> valueList = new LinkedList<Component>(); List<Component> valueList = new LinkedList<Component>();
List<Component> textureList = new LinkedList<Component>(); List<Component> textureList = new LinkedList<Component>();
List<Component> otherList = new LinkedList<Component>(); List<Component> otherList = new LinkedList<Component>();
for (Iterator<Entry<String, MaterialProperty>> it = materialFile.getParameterMap().entrySet().iterator(); it.hasNext();) { for (Entry<String, MaterialProperty> entry : materialFile.getParameterMap().entrySet()) {
Entry<String, MaterialProperty> entry = it.next();
MaterialPropertyWidget widget = WidgetFactory.getWidget(entry.getValue(), manager); MaterialPropertyWidget widget = WidgetFactory.getWidget(entry.getValue(), manager);
widget.registerChangeListener(this); widget.registerChangeListener(this);
if ("Boolean".equals(entry.getValue().getType())) { if ("Boolean".equals(entry.getValue().getType())) {
optionList.add(widget); optionList.add(widget);
} else if (entry.getValue().getType().indexOf("Texture") >= 0) { } else if (entry.getValue().getType().contains("Texture")) {
textureList.add(widget); textureList.add(widget);
} else if ("Color".equals(entry.getValue().getType())) { } else if ("Color".equals(entry.getValue().getType())) {
colorList.add(widget); colorList.add(widget);
@ -575,24 +566,19 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
otherList.add(widget); otherList.add(widget);
} }
} }
for (Iterator<Component> it = textureList.iterator(); it.hasNext();) { for (Component component : textureList) {
Component component = it.next();
texturePanel.add(component); texturePanel.add(component);
} }
for (Iterator<Component> it = optionList.iterator(); it.hasNext();) { for (Component component : optionList) {
Component component = it.next();
optionsPanel.add(component); optionsPanel.add(component);
} }
for (Iterator<Component> it = colorList.iterator(); it.hasNext();) { for (Component component : colorList) {
Component component = it.next();
texturePanel.add(component); texturePanel.add(component);
} }
for (Iterator<Component> it = valueList.iterator(); it.hasNext();) { for (Component component : valueList) {
Component component = it.next();
optionsPanel.add(component); optionsPanel.add(component);
} }
for (Iterator<Component> it = otherList.iterator(); it.hasNext();) { for (Component component : otherList) {
Component component = it.next();
optionsPanel.add(component); optionsPanel.add(component);
} }
jScrollPane2.repaint(); jScrollPane2.repaint();
@ -606,15 +592,13 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
} }
private void updateStates() { private void updateStates() {
for (int i = 0; i < statesPanel.getComponents().length; i++) { for (Component component : statesPanel.getComponents()) {
Component component = statesPanel.getComponents()[i];
if (component instanceof MaterialPropertyWidget) { if (component instanceof MaterialPropertyWidget) {
((MaterialPropertyWidget) component).registerChangeListener(null); ((MaterialPropertyWidget) component).registerChangeListener(null);
} }
} }
statesPanel.removeAll(); statesPanel.removeAll();
for (Iterator<Entry<String, MaterialProperty>> it = materialFile.getStateMap().entrySet().iterator(); it.hasNext();) { for (Entry<String, MaterialProperty> entry : materialFile.getStateMap().entrySet()) {
Entry<String, MaterialProperty> entry = it.next();
MaterialPropertyWidget widget = WidgetFactory.getWidget(entry.getValue(), manager); MaterialPropertyWidget widget = WidgetFactory.getWidget(entry.getValue(), manager);
widget.registerChangeListener(this); widget.registerChangeListener(this);
statesPanel.add(widget); statesPanel.add(widget);

Loading…
Cancel
Save