Manage style and control
Added a import action fro style and controls , also nifty-editor library is updated with the last style&control handling feuture
This commit is contained in:
parent
4506397b9c
commit
cc010862a9
@ -1,5 +1,5 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
OpenIDE-Module: com.jme3.gde.gui/1
|
OpenIDE-Module: com.jme3.gde.gui/3
|
||||||
OpenIDE-Module-Implementation-Version: 0
|
OpenIDE-Module-Implementation-Version: 0
|
||||||
OpenIDE-Module-Layer: com/jme3/gde/gui/layer.xml
|
OpenIDE-Module-Layer: com/jme3/gde/gui/layer.xml
|
||||||
OpenIDE-Module-Localizing-Bundle: com/jme3/gde/gui/Bundle.properties
|
OpenIDE-Module-Localizing-Bundle: com/jme3/gde/gui/Bundle.properties
|
||||||
|
@ -6,4 +6,4 @@ license.file=../license-jme.txt
|
|||||||
nbm.homepage=http://www.jmonkeyengine.com
|
nbm.homepage=http://www.jmonkeyengine.com
|
||||||
nbm.module.author=Normen Hansen,Cristiano Aguzzi
|
nbm.module.author=Normen Hansen,Cristiano Aguzzi
|
||||||
nbm.needs.restart=true
|
nbm.needs.restart=true
|
||||||
spec.version.base=3.2
|
spec.version.base=3.3
|
||||||
|
Binary file not shown.
@ -1,7 +1,8 @@
|
|||||||
LBL_NiftyGui_loader_name=NiftyGui Files
|
LBL_NiftyGui_loader_name=NiftyGui Files
|
||||||
OpenIDE-Module-Display-Category=jMonkeyEngine
|
OpenIDE-Module-Display-Category=jMonkeyEngine
|
||||||
OpenIDE-Module-Long-Description=\
|
OpenIDE-Module-Long-Description=\
|
||||||
This plugin adds NiftyGUI XML file support , with and easy visual desing interface .
|
This plugin adds NiftyGUI XML file support , with and easy visual desing interface . \
|
||||||
|
Icon pack provided by http://p.yusukekamiyamane.com/ Licensed under a Creative Commons Attribution 3.0 License.
|
||||||
OpenIDE-Module-Name=NiftyGUI Support
|
OpenIDE-Module-Name=NiftyGUI Support
|
||||||
OpenIDE-Module-Short-Description=Provides NiftyGUI Support
|
OpenIDE-Module-Short-Description=Provides NiftyGUI Support
|
||||||
Services/MIMEResolver/NiftyGuiResolver.xml=NiftyGui Files
|
Services/MIMEResolver/NiftyGuiResolver.xml=NiftyGui Files
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
|
|
||||||
<useStyles filename="nifty-default-styles.xml" />
|
|
||||||
<useControls filename="nifty-default-controls.xml" />
|
|
||||||
|
|
||||||
<screen id="start">
|
|
||||||
<layer childLayout="center">
|
|
||||||
<panel width="25%" height="25%" align="center" valign="center" childLayout="vertical" backgroundColor="#55a5" padding="10">
|
|
||||||
<panel height="*" backgroundColor="#55aa" padding="10">
|
|
||||||
<!-- add your content here -->
|
|
||||||
</panel>
|
|
||||||
<panel height="10px" />
|
|
||||||
<panel height="21px" childLayout="horizontal">
|
|
||||||
<control id="buttonOk" name="button" label="OK" />
|
|
||||||
<panel width="*" />
|
|
||||||
<control id="buttonCancel" name="button" label="Cancel" />
|
|
||||||
</panel>
|
|
||||||
</panel>
|
|
||||||
</layer>
|
|
||||||
</screen>
|
|
||||||
</nifty>
|
|
30
sdk/jme3-gui/src/com/jme3/gde/gui/examples/buttonstyle.xml
Normal file
30
sdk/jme3-gui/src/com/jme3/gde/gui/examples/buttonstyle.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<nifty-styles xmlns="http://nifty-gui.lessvoid.com/nifty-gui">
|
||||||
|
|
||||||
|
<!-- +++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
<!-- style for the button background panel -->
|
||||||
|
<!-- +++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
<style id="nifty-button#panel">
|
||||||
|
<attributes backgroundImage="button/button.png" imageMode="sprite-resize:100,23,0,2,96,2,2,2,96,2,19,2,96,2,2"
|
||||||
|
paddingLeft="7px" paddingRight="7px" width="100px" height="23px" childLayout="center"
|
||||||
|
visibleToMouse="true"/>
|
||||||
|
<effect>
|
||||||
|
<onHover name="border" color="#822f" post="true"/>
|
||||||
|
<onFocus name="imageOverlay" filename="button/button.png"
|
||||||
|
imageMode="sprite-resize:100,23,1,2,96,2,2,2,96,2,19,2,96,2,2" post="true"/>
|
||||||
|
<onEnabled name="renderQuad" startColor="#2228" endColor="#2220" post="true" length="150"/>
|
||||||
|
<onDisabled name="renderQuad" startColor="#2220" endColor="#2228" post="true" length="150"/>
|
||||||
|
</effect>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- +++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
<!-- style for the button text -->
|
||||||
|
<!-- +++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
<style id="nifty-button#text" base="button-font">
|
||||||
|
<attributes align="center" valign="center" textHAlign="center" textVAlign="center" visibleToMouse="false"/>
|
||||||
|
<effect>
|
||||||
|
<onEnabled name="textColorAnimated" startColor="#8886" endColor="#eeef" post="false" length="150"/>
|
||||||
|
<onDisabled name="textColorAnimated" startColor="#eeef" endColor="#8886" post="false" length="150"/>
|
||||||
|
</effect>
|
||||||
|
</style>
|
||||||
|
</nifty-styles>
|
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 361 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/control.png
Normal file
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/control.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 736 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/style.png
Normal file
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/style.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 865 B |
@ -8,10 +8,14 @@ import com.jme3.gde.gui.propertyeditors.ResourceEditor;
|
|||||||
import com.jme3.gde.gui.propertyeditors.SizeEditor;
|
import com.jme3.gde.gui.propertyeditors.SizeEditor;
|
||||||
import jada.ngeditor.controller.CommandProcessor;
|
import jada.ngeditor.controller.CommandProcessor;
|
||||||
import jada.ngeditor.controller.commands.EditAttributeCommand;
|
import jada.ngeditor.controller.commands.EditAttributeCommand;
|
||||||
|
import jada.ngeditor.controller.commands.VisibilityCommand;
|
||||||
import jada.ngeditor.model.elements.GElement;
|
import jada.ngeditor.model.elements.GElement;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
import java.beans.PropertyEditor;
|
import java.beans.PropertyEditor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import org.openide.nodes.AbstractNode;
|
import org.openide.nodes.AbstractNode;
|
||||||
import org.openide.nodes.Children;
|
import org.openide.nodes.Children;
|
||||||
@ -43,6 +47,14 @@ public class GElementNode extends AbstractNode{
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Action[] getActions(boolean context) {
|
||||||
|
if(!context){
|
||||||
|
return new Action[]{new Visibility("Show", true),new Visibility("Hide", false)};
|
||||||
|
}else
|
||||||
|
return super.getActions(context);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateChildren(){
|
public void updateChildren(){
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -68,7 +80,7 @@ public class GElementNode extends AbstractNode{
|
|||||||
private void pickEditor(Entry<String, String> pair, final ElementAttributeProperty elementAttributeProperty) {
|
private void pickEditor(Entry<String, String> pair, final ElementAttributeProperty elementAttributeProperty) {
|
||||||
if(pair.getKey().equals("width")||pair.getKey().equals("height") || pair.getKey().equals("x") || pair.getKey().equals("y") ){
|
if(pair.getKey().equals("width")||pair.getKey().equals("height") || pair.getKey().equals("x") || pair.getKey().equals("y") ){
|
||||||
elementAttributeProperty.setPropertyEditor(new SizeEditor());
|
elementAttributeProperty.setPropertyEditor(new SizeEditor());
|
||||||
}else if(pair.getKey().equals("filename")){
|
}else if(pair.getKey().equals("filename") || pair.getKey().equals("backgroundImage")){
|
||||||
elementAttributeProperty.setPropertyEditor(new ResourceEditor());
|
elementAttributeProperty.setPropertyEditor(new ResourceEditor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,4 +140,19 @@ public class GElementNode extends AbstractNode{
|
|||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private class Visibility extends AbstractAction {
|
||||||
|
private final boolean param;
|
||||||
|
|
||||||
|
public Visibility(String name ,boolean param) {
|
||||||
|
super(name);
|
||||||
|
this.param = param;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
VisibilityCommand command = CommandProcessor.getInstance().getCommand(VisibilityCommand.class);
|
||||||
|
command.setVisibility(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,15 @@
|
|||||||
package com.jme3.gde.gui.nodes;
|
package com.jme3.gde.gui.nodes;
|
||||||
|
|
||||||
import jada.ngeditor.model.GUI;
|
import jada.ngeditor.model.GUI;
|
||||||
|
import jada.ngeditor.model.elements.specials.GUseControls;
|
||||||
|
import jada.ngeditor.model.elements.specials.GUseStyle;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
|
import javax.swing.JFileChooser;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import org.openide.nodes.AbstractNode;
|
import org.openide.nodes.AbstractNode;
|
||||||
import org.openide.nodes.Children;
|
import org.openide.nodes.Children;
|
||||||
|
|
||||||
@ -19,6 +28,7 @@ public class GUINode extends AbstractNode{
|
|||||||
super(Children.create(new ScreenChildFactory(gui),false));
|
super(Children.create(new ScreenChildFactory(gui),false));
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
this.setIconBaseWithExtension(basePath+"/"+"game-monitor"+".png");
|
this.setIconBaseWithExtension(basePath+"/"+"game-monitor"+".png");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,10 +38,88 @@ public class GUINode extends AbstractNode{
|
|||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Action[] getActions(boolean context) {
|
||||||
|
if(true){
|
||||||
|
return new Action[]{new AddStyleAction(),new AddControlAction()}; //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}else
|
||||||
|
return super.getActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return super.getName()+" "+this.gui; //To change body of generated methods, choose Tools | Templates.
|
return super.getName()+" "+this.gui; //To change body of generated methods, choose Tools | Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class AddStyleAction extends AbstractAction {
|
||||||
|
|
||||||
|
public AddStyleAction() {
|
||||||
|
super("Add style");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JFileChooser chooser = new JFileChooser(gui.getAssetFolder());
|
||||||
|
int result = chooser.showSaveDialog(null);
|
||||||
|
if(result == JFileChooser.APPROVE_OPTION){
|
||||||
|
GUseStyle style = new GUseStyle();
|
||||||
|
|
||||||
|
|
||||||
|
style.setFilename(createReletive(chooser.getSelectedFile()));
|
||||||
|
gui.addLoadUseStyle(style);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private class AddControlAction extends AbstractAction {
|
||||||
|
|
||||||
|
public AddControlAction() {
|
||||||
|
super("Add Control");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JFileChooser chooser = new JFileChooser(gui.getAssetFolder());
|
||||||
|
int result = chooser.showSaveDialog(null);
|
||||||
|
if(result == JFileChooser.APPROVE_OPTION){
|
||||||
|
GUseControls controls = new GUseControls();
|
||||||
|
|
||||||
|
|
||||||
|
controls.setFilename(createReletive(chooser.getSelectedFile()));
|
||||||
|
gui.addLoadUseControls(controls);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String createReletive(File selected) {
|
||||||
|
File assets = gui.getAssetFolder();
|
||||||
|
String res = "";
|
||||||
|
String parentPath = selected.getParent();
|
||||||
|
String absAssets = assets.getAbsolutePath();
|
||||||
|
if (!parentPath.contains(absAssets)) {
|
||||||
|
try {
|
||||||
|
absAssets = assets.getCanonicalPath();
|
||||||
|
if (!parentPath.contains(absAssets)) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Sorry you can't relativize this file. Tip : the file must be inside the assets folder");
|
||||||
|
} else {
|
||||||
|
res = assets.toURI().relativize(selected.toURI()).getPath();
|
||||||
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Sorry you can't relativize this file");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
res = assets.toURI().relativize(selected.toURI()).getPath();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.jme3.gde.gui.nodes;
|
||||||
|
|
||||||
|
import jada.ngeditor.model.GUI;
|
||||||
|
import jada.ngeditor.model.elements.specials.GUseControls;
|
||||||
|
import org.openide.nodes.AbstractNode;
|
||||||
|
import org.openide.nodes.Children;
|
||||||
|
|
||||||
|
public class GUseControlsNode extends AbstractNode {
|
||||||
|
private static final String basePath="com/jme3/gde/gui/multiview/icons";
|
||||||
|
private final GUseControls controls;
|
||||||
|
|
||||||
|
public GUseControlsNode(GUI gui,GUseControls controls) {
|
||||||
|
super(Children.LEAF);
|
||||||
|
this.setIconBaseWithExtension(basePath+"/"+"control"+".png");
|
||||||
|
this.controls = controls;
|
||||||
|
this.setName(controls.getFilename());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
55
sdk/jme3-gui/src/com/jme3/gde/gui/nodes/GUseStyleNode.java
Normal file
55
sdk/jme3-gui/src/com/jme3/gde/gui/nodes/GUseStyleNode.java
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
package com.jme3.gde.gui.nodes;
|
||||||
|
|
||||||
|
import jada.ngeditor.model.GUI;
|
||||||
|
import jada.ngeditor.model.elements.specials.GUseStyle;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
|
import org.openide.nodes.AbstractNode;
|
||||||
|
import org.openide.nodes.Children;
|
||||||
|
|
||||||
|
public class GUseStyleNode extends AbstractNode {
|
||||||
|
private static final String basePath="com/jme3/gde/gui/multiview/icons";
|
||||||
|
private final GUI gui;
|
||||||
|
private final GUseStyle style;
|
||||||
|
|
||||||
|
public GUseStyleNode(GUI gui,GUseStyle style) {
|
||||||
|
super(Children.LEAF);
|
||||||
|
this.setIconBaseWithExtension(basePath+"/"+"style"+".png");
|
||||||
|
this.gui = gui;
|
||||||
|
this.style = style;
|
||||||
|
this.setName(style.getFilename());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Action[] getActions(boolean context) {
|
||||||
|
return new Action[]{new Refresh(),new Delete()};
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Refresh extends AbstractAction {
|
||||||
|
|
||||||
|
public Refresh() {
|
||||||
|
super("Refresh");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
gui.reoloadStyles(style.getFilename());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Delete extends AbstractAction {
|
||||||
|
|
||||||
|
public Delete() {
|
||||||
|
super("Delete");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
gui.removeStyle(style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,31 +1,55 @@
|
|||||||
package com.jme3.gde.gui.nodes;
|
package com.jme3.gde.gui.nodes;
|
||||||
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import jada.ngeditor.listeners.events.ElementEvent;
|
||||||
import jada.ngeditor.model.GUI;
|
import jada.ngeditor.model.GUI;
|
||||||
import jada.ngeditor.model.elements.GControl;
|
|
||||||
import jada.ngeditor.model.elements.GElement;
|
import jada.ngeditor.model.elements.GElement;
|
||||||
|
import jada.ngeditor.model.elements.GScreen;
|
||||||
|
import jada.ngeditor.model.elements.specials.GUseControls;
|
||||||
|
import jada.ngeditor.model.elements.specials.GUseStyle;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.openide.nodes.AbstractNode;
|
import java.util.Observable;
|
||||||
|
import java.util.Observer;
|
||||||
import org.openide.nodes.ChildFactory;
|
import org.openide.nodes.ChildFactory;
|
||||||
import org.openide.nodes.Children;
|
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
|
|
||||||
public class ScreenChildFactory extends ChildFactory<GElement> {
|
public class ScreenChildFactory extends ChildFactory<Object> implements Observer{
|
||||||
private final GUI gui;
|
private final GUI gui;
|
||||||
|
|
||||||
public ScreenChildFactory(GUI gui){
|
public ScreenChildFactory(GUI gui){
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
|
this.gui.addObserver(ScreenChildFactory.this);
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean createKeys(List<GElement> list) {
|
protected boolean createKeys(List<Object> list) {
|
||||||
|
list.addAll(gui.getUseStyles());
|
||||||
|
list.addAll(gui.getUseControls());
|
||||||
list.addAll(gui.getScreens());
|
list.addAll(gui.getScreens());
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Node createNodeForKey(GElement screen) {
|
protected Node createNodeForKey(Object node) {
|
||||||
return new GElementNode(screen);
|
if(node instanceof GElement){
|
||||||
|
return new GElementNode((GElement)node);
|
||||||
|
}else if (node instanceof GUseStyle){
|
||||||
|
return new GUseStyleNode(gui, (GUseStyle)node);
|
||||||
|
}else
|
||||||
|
return new GUseControlsNode(gui,(GUseControls)node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Observable o, Object arg) {
|
||||||
|
if(arg == null){
|
||||||
|
this.refresh(true);
|
||||||
|
}else{
|
||||||
|
ElementEvent e = (ElementEvent) arg;
|
||||||
|
if(e.getElement() instanceof GScreen){
|
||||||
|
this.refresh(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,8 +2,11 @@
|
|||||||
* To change this template, choose Tools | Templates
|
* To change this template, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
@TemplateRegistrations(value = {@TemplateRegistration(folder = "GUI", displayName = "Empty Gui",content = "templates/EmptyNiftyGui.xml"),
|
@TemplateRegistrations(value = {@TemplateRegistration(folder = "GUI", displayName = "Empty Gui",content = "templates/EmptyNiftyGui.xml",iconBase = "com/jme3/gde/gui/multiview/icons/gui-icon.png"),
|
||||||
@TemplateRegistration(folder = "GUI", displayName = "HelloJme",content = "templates/NiftyGui.xml")})
|
@TemplateRegistration(folder = "GUI", displayName = "HelloJme",content = "templates/NiftyGui.xml",iconBase = "com/jme3/gde/gui/multiview/icons/game-monitor.png"),
|
||||||
|
@TemplateRegistration(folder = "GUI", displayName = "Empty Style",content = "templates/EmptyStyle.xml",iconBase = "com/jme3/gde/gui/multiview/icons/style.png"),
|
||||||
|
@TemplateRegistration(folder = "GUI", displayName = "Empty Control",content = "templates/EmptyControl.xml",iconBase = "com/jme3/gde/gui/multiview/icons/control.png"),
|
||||||
|
@TemplateRegistration(folder = "GUI/Control Styles", displayName = "Button Style",content = "examples/buttonstyle.xml",iconBase = "com/jme3/gde/gui/multiview/icons/style.png")})
|
||||||
package com.jme3.gde.gui;
|
package com.jme3.gde.gui;
|
||||||
|
|
||||||
import org.netbeans.api.templates.TemplateRegistration;
|
import org.netbeans.api.templates.TemplateRegistration;
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<nifty-controls xmlns="http://nifty-gui.lessvoid.com/nifty-gui">
|
||||||
|
<controlDefinition style="your-style" name="empty-control">
|
||||||
|
<panel style="#panel" >
|
||||||
|
|
||||||
|
</panel>
|
||||||
|
</controlDefinition>
|
||||||
|
</nifty-controls>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<nifty-styles xmlns="http://nifty-gui.lessvoid.com/nifty-gui">
|
||||||
|
<style id="empty">
|
||||||
|
<attributes backgroundColor="#AA05"/>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</nifty-styles>
|
@ -145,10 +145,15 @@ public class Navigator extends javax.swing.JPanel implements NavigatorPanel,Expl
|
|||||||
}
|
}
|
||||||
Node result = mgr.getRootContext();
|
Node result = mgr.getRootContext();
|
||||||
for(int i=path.size()-1;i>=0;i--){
|
for(int i=path.size()-1;i>=0;i--){
|
||||||
|
if(result!=null){
|
||||||
result = result.getChildren().findChild(path.get(i));
|
result = result.getChildren().findChild(path.get(i));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
|
if(result!=null){
|
||||||
mgr.setSelectedNodes(new Node[]{result});
|
mgr.setSelectedNodes(new Node[]{result});
|
||||||
|
}
|
||||||
|
|
||||||
} catch (PropertyVetoException ex) {
|
} catch (PropertyVetoException ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
}
|
}
|
||||||
|
@ -314,8 +314,9 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadGui() {
|
private void loadGui() {
|
||||||
try {
|
|
||||||
ProgressHandle handle = ProgressHandleFactory.createHandle("Loading the gui file");
|
ProgressHandle handle = ProgressHandleFactory.createHandle("Loading the gui file");
|
||||||
|
try {
|
||||||
|
|
||||||
InputStream is = this.obj.getPrimaryFile().getInputStream();
|
InputStream is = this.obj.getPrimaryFile().getInputStream();
|
||||||
handle.start();
|
handle.start();
|
||||||
ProjectAssetManager mgr = this.obj.getLookup().lookup(ProjectAssetManager.class);
|
ProjectAssetManager mgr = this.obj.getLookup().lookup(ProjectAssetManager.class);
|
||||||
@ -346,6 +347,8 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
|||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
|
}finally{
|
||||||
|
handle.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user