- Fixed Delete menu - Filters can now be reordered by rightclick on the node> move up, move down git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7811 75d07b2b-3a1a-0410-a2c5-0572b91ccdca3.0
parent
65de002a7a
commit
14aa1dfec3
@ -0,0 +1,74 @@ |
||||
package com.jme3.gde.core.filters; |
||||
|
||||
import com.jme3.gde.core.filters.FilterPostProcessorNode.FilterChildren; |
||||
import com.jme3.gde.core.scene.SceneApplication; |
||||
import com.jme3.post.Filter; |
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
import java.util.concurrent.Callable; |
||||
import org.openide.nodes.Index; |
||||
import org.openide.nodes.Node; |
||||
|
||||
/** |
||||
* |
||||
* @author Nehon |
||||
*/ |
||||
public class FilterIndexSupport extends Index.Support { |
||||
|
||||
FilterPostProcessorNode fppNode; |
||||
FilterChildren children; |
||||
|
||||
public FilterIndexSupport() { |
||||
|
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Node[] getNodes() { |
||||
return fppNode.getChildren().getNodes(); |
||||
} |
||||
|
||||
@Override |
||||
public int getNodesCount() { |
||||
return fppNode.getChildren().getNodesCount(); |
||||
} |
||||
|
||||
public FilterPostProcessorNode getFilterPostProcessorNode() { |
||||
return fppNode; |
||||
} |
||||
|
||||
public void setFilterPostProcessorNode(FilterPostProcessorNode fppNode) { |
||||
this.fppNode = fppNode; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void reorder(final int[] perm) { |
||||
|
||||
SceneApplication.getApplication().enqueue(new Callable<Object>() { |
||||
|
||||
public Object call() throws Exception { |
||||
List<Filter> filters=new ArrayList<Filter>(); |
||||
for (Iterator<Filter> it = fppNode.getFilterPostProcessor().getFilterIterator(); it.hasNext();) { |
||||
Filter f = it.next(); |
||||
filters.add(f); |
||||
} |
||||
System.err.println("reordering"); |
||||
fppNode.getFilterPostProcessor().removeAllFilters(); |
||||
for (int i = 0; i < perm.length; i++) { |
||||
fppNode.getFilterPostProcessor().addFilter(filters.get(perm[i])); |
||||
} |
||||
return null; |
||||
} |
||||
}); |
||||
java.awt.EventQueue.invokeLater(new Runnable() { |
||||
|
||||
public void run() { |
||||
((FilterChildren) fppNode.getChildren()).reorderNotify(); |
||||
((FilterChildren) fppNode.getChildren()).doRefresh(); |
||||
} |
||||
}); |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue