Merge branch 'experimental'
With new nifty-editor. Added templates for styles and control .
6
sdk/jme3-gui/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# Nifty Editor
|
||||
|
||||
This project is the result of 2014 summer of code. It's the integration of Nifty-Editor on JMonkeyEngine sdk.
|
||||
|
||||
## Icons
|
||||
Icons provided by [Yusuke Kamiyamane](http://p.yusukekamiyamane.com/). Licensed under a Creative Commons Attribution 3.0 License.
|
@ -1,5 +1,6 @@
|
||||
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-Layer: com/jme3/gde/gui/layer.xml
|
||||
OpenIDE-Module-Localizing-Bundle: com/jme3/gde/gui/Bundle.properties
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
build.xml.data.CRC32=971927a9
|
||||
build.xml.script.CRC32=a0136781
|
||||
build.xml.stylesheet.CRC32=a56c6a5b@2.66.1
|
||||
@ -6,3 +7,13 @@ build.xml.stylesheet.CRC32=a56c6a5b@2.66.1
|
||||
nbproject/build-impl.xml.data.CRC32=971927a9
|
||||
nbproject/build-impl.xml.script.CRC32=55a34aaf
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.66.1
|
||||
=======
|
||||
build.xml.data.CRC32=d998e9a1
|
||||
build.xml.script.CRC32=a0136781
|
||||
build.xml.stylesheet.CRC32=a56c6a5b@2.56.1
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=d998e9a1
|
||||
nbproject/build-impl.xml.script.CRC32=55a34aaf
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.56.1
|
||||
>>>>>>> experimental
|
||||
|
BIN
sdk/jme3-gui/release/modules/ext/Nifty-Editor0.5.9.jar
Normal file
@ -1,7 +1,8 @@
|
||||
LBL_NiftyGui_loader_name=NiftyGui Files
|
||||
OpenIDE-Module-Display-Category=jMonkeyEngine
|
||||
OpenIDE-Module-Long-Description=\
|
||||
This plugin adds NiftyGUI XML file support
|
||||
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-Short-Description=Provides NiftyGUI Support
|
||||
Services/MIMEResolver/NiftyGuiResolver.xml=NiftyGui Files
|
||||
|
@ -1,10 +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">
|
||||
<!-- +++++++++++++++++++++++++++++++++++++++ -->
|
||||
<!-- start screen -->
|
||||
<!-- +++++++++++++++++++++++++++++++++++++++ -->
|
||||
<screen id="GScreen0" controller="mygame.Main">
|
||||
<layer id="GLayer0" childLayout="absolute">
|
||||
</layer>
|
||||
</screen>
|
||||
</nifty>
|
@ -1,145 +1,149 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui;
|
||||
|
||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||
import java.io.IOException;
|
||||
import org.netbeans.api.project.Project;
|
||||
import org.netbeans.api.project.ProjectManager;
|
||||
import org.netbeans.core.spi.multiview.MultiViewElement;
|
||||
import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionReferences;
|
||||
import org.openide.filesystems.FileObject;
|
||||
import org.openide.filesystems.MIMEResolver;
|
||||
import org.openide.loaders.DataNode;
|
||||
import org.openide.loaders.DataObject;
|
||||
import org.openide.loaders.DataObjectExistsException;
|
||||
import org.openide.loaders.MultiDataObject;
|
||||
import org.openide.loaders.MultiFileLoader;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.windows.TopComponent;
|
||||
|
||||
@Messages({
|
||||
"LBL_NiftyGui_LOADER=Files of NiftyGui"
|
||||
})
|
||||
@MIMEResolver.Registration(
|
||||
displayName = "#LBL_NiftyGui_LOADER",
|
||||
resource = "NiftyGuiResolver.xml")
|
||||
@DataObject.Registration(
|
||||
mimeType = "text/x-niftygui+xml",
|
||||
iconBase = "com/jme3/gde/gui/Computer_File_043.gif",
|
||||
displayName = "#LBL_NiftyGui_LOADER",
|
||||
position = 300)
|
||||
@ActionReferences({
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.OpenAction"),
|
||||
position = 100,
|
||||
separatorAfter = 200),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
|
||||
position = 300),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
|
||||
position = 400,
|
||||
separatorAfter = 500),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
|
||||
position = 600),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.RenameAction"),
|
||||
position = 700,
|
||||
separatorAfter = 800),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
|
||||
position = 900,
|
||||
separatorAfter = 1000),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
|
||||
position = 1100,
|
||||
separatorAfter = 1200),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
|
||||
position = 1300),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
|
||||
position = 1400)
|
||||
})
|
||||
public class NiftyGuiDataObject extends MultiDataObject {
|
||||
|
||||
public NiftyGuiDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
|
||||
super(pf, loader);
|
||||
registerEditor("text/x-niftygui+xml", true);
|
||||
findAssetManager();
|
||||
}
|
||||
|
||||
protected final void findAssetManager() {
|
||||
FileObject file = getPrimaryFile();
|
||||
ProjectManager pm = ProjectManager.getDefault();
|
||||
while (file != null) {
|
||||
if (file.isFolder() && pm.isProject(file)) {
|
||||
try {
|
||||
Project project = ProjectManager.getDefault().findProject(file);
|
||||
if (project != null) {
|
||||
ProjectAssetManager mgr = project.getLookup().lookup(ProjectAssetManager.class);
|
||||
if (mgr != null) {
|
||||
this.getCookieSet().assign(mgr.getClass(),mgr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
}
|
||||
}
|
||||
file = file.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeDelegate() {
|
||||
DataNode node = new DataNode(this, Children.LEAF, getLookup());
|
||||
node.setIconBaseWithExtension("com/jme3/gde/gui/Computer_File_043.gif");
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int associateLookup() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@MultiViewElement.Registration(
|
||||
displayName = "#LBL_NiftyGui_EDITOR",
|
||||
iconBase = "com/jme3/gde/gui/Computer_File_043.gif",
|
||||
mimeType = "text/x-niftygui+xml",
|
||||
persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
|
||||
preferredID = "NiftyGui",
|
||||
position = 1000)
|
||||
@Messages("LBL_NiftyGui_EDITOR=XML")
|
||||
public static MultiViewEditorElement createEditor(Lookup lkp) {
|
||||
return new MultiViewEditorElement(lkp);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui;
|
||||
|
||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||
import jada.ngeditor.controller.CommandProcessor;
|
||||
import jada.ngeditor.controller.GUIEditor;
|
||||
import java.io.IOException;
|
||||
import org.netbeans.api.project.Project;
|
||||
import org.netbeans.api.project.ProjectManager;
|
||||
import org.netbeans.core.spi.multiview.MultiViewElement;
|
||||
import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionReferences;
|
||||
import org.openide.filesystems.FileObject;
|
||||
import org.openide.filesystems.MIMEResolver;
|
||||
import org.openide.loaders.DataNode;
|
||||
import org.openide.loaders.DataObject;
|
||||
import org.openide.loaders.DataObjectExistsException;
|
||||
import org.openide.loaders.MultiDataObject;
|
||||
import org.openide.loaders.MultiFileLoader;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.windows.TopComponent;
|
||||
|
||||
@Messages({
|
||||
"LBL_NiftyGui_LOADER=Files of NiftyGui"
|
||||
})
|
||||
@MIMEResolver.Registration(
|
||||
displayName = "#LBL_NiftyGui_LOADER",
|
||||
resource = "NiftyGuiResolver.xml")
|
||||
@DataObject.Registration(
|
||||
mimeType = "text/x-niftygui+xml",
|
||||
iconBase = "com/jme3/gde/gui/multiview/icons/gui-icon.png",
|
||||
displayName = "#LBL_NiftyGui_LOADER",
|
||||
position = 300)
|
||||
@ActionReferences({
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.OpenAction"),
|
||||
position = 100,
|
||||
separatorAfter = 200),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
|
||||
position = 300),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
|
||||
position = 400,
|
||||
separatorAfter = 500),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
|
||||
position = 600),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.RenameAction"),
|
||||
position = 700,
|
||||
separatorAfter = 800),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
|
||||
position = 900,
|
||||
separatorAfter = 1000),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
|
||||
position = 1100,
|
||||
separatorAfter = 1200),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
|
||||
position = 1300),
|
||||
@ActionReference(
|
||||
path = "Loaders/text/x-niftygui+xml/Actions",
|
||||
id =
|
||||
@ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
|
||||
position = 1400)
|
||||
})
|
||||
public class NiftyGuiDataObject extends MultiDataObject {
|
||||
|
||||
public NiftyGuiDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
|
||||
super(pf, loader);
|
||||
registerEditor("text/x-niftygui+xml", true);
|
||||
findAssetManager();
|
||||
this.getCookieSet().assign(GUIEditor.class, CommandProcessor.getInstance().getGuiEditor());
|
||||
}
|
||||
|
||||
protected final void findAssetManager() {
|
||||
FileObject file = getPrimaryFile();
|
||||
ProjectManager pm = ProjectManager.getDefault();
|
||||
while (file != null) {
|
||||
if (file.isFolder() && pm.isProject(file)) {
|
||||
try {
|
||||
Project project = ProjectManager.getDefault().findProject(file);
|
||||
if (project != null) {
|
||||
ProjectAssetManager mgr = project.getLookup().lookup(ProjectAssetManager.class);
|
||||
if (mgr != null) {
|
||||
this.getCookieSet().assign(mgr.getClass(),mgr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
}
|
||||
}
|
||||
file = file.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeDelegate() {
|
||||
DataNode node = new DataNode(this, Children.LEAF, getLookup());
|
||||
node.setIconBaseWithExtension("com/jme3/gde/gui/multiview/icons/gui-icon.png");
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int associateLookup() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@MultiViewElement.Registration(
|
||||
displayName = "#LBL_NiftyGui_EDITOR",
|
||||
iconBase = "com/jme3/gde/gui/multiview/icons/gui-icon.png",
|
||||
mimeType = "text/x-niftygui+xml",
|
||||
persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
|
||||
preferredID = "NiftyGui",
|
||||
position = 1000)
|
||||
@Messages("LBL_NiftyGui_EDITOR=XML")
|
||||
public static MultiViewEditorElement createEditor(Lookup lkp) {
|
||||
final MultiViewEditorElement multiViewEditorElement = new MultiViewEditorElement(lkp);
|
||||
return multiViewEditorElement;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
To change this template, choose Tools | Templates
|
||||
and open the template in the editor.
|
||||
-->
|
||||
<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
|
||||
<MIME-resolver>
|
||||
<file>
|
||||
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="scrollArea">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui;
|
||||
|
||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||
import com.jme3.gde.gui.multiview.PreviewView;
|
||||
import java.io.IOException;
|
||||
import org.netbeans.api.project.Project;
|
||||
import org.netbeans.api.project.ProjectManager;
|
||||
import org.netbeans.modules.xml.multiview.DesignMultiViewDesc;
|
||||
import org.netbeans.modules.xml.multiview.XmlMultiViewDataObject;
|
||||
import org.openide.filesystems.FileObject;
|
||||
import org.openide.loaders.DataNode;
|
||||
import org.openide.loaders.DataObjectExistsException;
|
||||
import org.openide.loaders.MultiFileLoader;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.lookup.AbstractLookup;
|
||||
import org.openide.util.lookup.InstanceContent;
|
||||
import org.openide.util.lookup.ProxyLookup;
|
||||
|
||||
public class OldNiftyGuiDataObject extends XmlMultiViewDataObject {
|
||||
|
||||
private static final int TYPE_TOOLBAR = 0;
|
||||
protected final Lookup lookup;
|
||||
protected final InstanceContent lookupContents = new InstanceContent();
|
||||
|
||||
public OldNiftyGuiDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
|
||||
super(pf, loader);
|
||||
lookup = new ProxyLookup(getCookieSet().getLookup(), new AbstractLookup(getLookupContents()));
|
||||
findAssetManager();
|
||||
}
|
||||
|
||||
protected void findAssetManager() {
|
||||
FileObject file = getPrimaryFile();
|
||||
ProjectManager pm = ProjectManager.getDefault();
|
||||
while (file != null) {
|
||||
if (file.isFolder() && pm.isProject(file)) {
|
||||
try {
|
||||
Project project = ProjectManager.getDefault().findProject(file);
|
||||
if (project != null) {
|
||||
ProjectAssetManager mgr = project.getLookup().lookup(ProjectAssetManager.class);
|
||||
if (mgr != null) {
|
||||
getLookupContents().add(mgr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
}
|
||||
}
|
||||
file = file.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Lookup getLookup() {
|
||||
return lookup;
|
||||
}
|
||||
|
||||
public InstanceContent getLookupContents() {
|
||||
return lookupContents;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeDelegate() {
|
||||
DataNode node = new DataNode(this, Children.LEAF, getLookup());
|
||||
node.setIconBaseWithExtension("com/jme3/gde/gui/Computer_File_043.gif");
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DesignMultiViewDesc[] getMultiViewDesc() {
|
||||
if (getLookup().lookup(ProjectAssetManager.class) == null) {
|
||||
return new DesignMultiViewDesc[]{};
|
||||
} else {
|
||||
|
||||
return new DesignMultiViewDesc[]{new PreviewView(this, TYPE_TOOLBAR)};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPrefixMark() {
|
||||
return "Nifty";
|
||||
}
|
||||
}
|
@ -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
@ -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>
|
19
sdk/jme3-gui/src/com/jme3/gde/gui/layer.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
|
||||
<filesystem>
|
||||
<folder name="NiftyPalette">
|
||||
<folder name="Items">
|
||||
<file name="Screen" url="com/jme3/gde/gui/palette/Screen.xml">
|
||||
</file>
|
||||
</folder>
|
||||
</folder>
|
||||
<folder name="Navigator">
|
||||
<folder name="Panels">
|
||||
<folder name="text">
|
||||
<folder name="x-niftygui+xml">
|
||||
<file name="org-netbeans-modules-xml-text-navigator-XMLNavigatorPanel.instance"/>
|
||||
</folder>
|
||||
</folder>
|
||||
</folder>
|
||||
</folder>
|
||||
</filesystem>
|
@ -1,4 +0,0 @@
|
||||
|
||||
PreviewPanel.jLabel1.text=jLabel1
|
||||
ErrorPanel.jLabel1.text=jLabel1
|
||||
ErrorPanel.jLabel2.text=\ Errors
|
@ -1,62 +0,0 @@
|
||||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.PanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/jme3/gde/gui/multiview/Bundle.properties" key="ErrorPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</NonVisualComponents>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,93,0,0,3,24"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="jList1">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="errors" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="c8" green="c8" red="c8" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/jme3/gde/gui/multiview/Bundle.properties" key="ErrorPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="North"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ErrorPanel.java
|
||||
*
|
||||
* Created on 23 janv. 2012, 22:19:24
|
||||
*/
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Nehon
|
||||
*/
|
||||
public class ErrorPanel extends java.awt.Panel {
|
||||
|
||||
private DefaultListModel errors = new DefaultListModel();
|
||||
private static ImageIcon fatalImage = null, nonFatalImage = null;
|
||||
|
||||
/** Creates new form ErrorPanel */
|
||||
public ErrorPanel() {
|
||||
initComponents();
|
||||
jList1.setCellRenderer(new DefaultListCellRenderer() {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value instanceof JLabel) {
|
||||
setIcon(((JLabel) value).getIcon());
|
||||
setText(((JLabel) value).getText());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static ImageIcon getFatalErrorIcon() {
|
||||
if (fatalImage == null) {
|
||||
fatalImage = new ImageIcon(ErrorPanel.class.getResource("/com/jme3/gde/gui/multiview/icons/error.png")); //NOI18N
|
||||
}
|
||||
return fatalImage;
|
||||
}
|
||||
|
||||
private static ImageIcon getNonfatalErrorIcon() {
|
||||
if (nonFatalImage == null) {
|
||||
nonFatalImage = new ImageIcon(ErrorPanel.class.getResource("/com/jme3/gde/gui/multiview/icons/warning.png")); //NOI18N
|
||||
}
|
||||
return nonFatalImage;
|
||||
}
|
||||
|
||||
public void addError(String error) {
|
||||
errors.addElement(new JLabel(
|
||||
error,
|
||||
getFatalErrorIcon(),
|
||||
SwingConstants.LEFT));
|
||||
|
||||
}
|
||||
|
||||
public void addWarning(String error) {
|
||||
errors.addElement(new JLabel(
|
||||
error,
|
||||
getNonfatalErrorIcon(),
|
||||
SwingConstants.LEFT));
|
||||
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
errors.clear();
|
||||
}
|
||||
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jList1 = new javax.swing.JList();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
|
||||
jLabel1.setText(org.openide.util.NbBundle.getMessage(ErrorPanel.class, "ErrorPanel.jLabel1.text")); // NOI18N
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jList1.setModel(errors);
|
||||
jScrollPane1.setViewportView(jList1);
|
||||
|
||||
add(jScrollPane1, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jLabel2.setBackground(new java.awt.Color(200, 200, 200));
|
||||
jLabel2.setText(org.openide.util.NbBundle.getMessage(ErrorPanel.class, "ErrorPanel.jLabel2.text")); // NOI18N
|
||||
add(jLabel2, java.awt.BorderLayout.NORTH);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JList jList1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class MouseInputEvent {
|
||||
int x;
|
||||
int y;
|
||||
int button;
|
||||
int huh;
|
||||
boolean pressed;
|
||||
|
||||
public MouseInputEvent(int x, int y, int button, int huh, boolean pressed) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.button = button;
|
||||
this.huh = huh;
|
||||
this.pressed = pressed;
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class NiftyFileChildren extends Children.Keys<Element> {
|
||||
|
||||
Element xmlNode;
|
||||
|
||||
public NiftyFileChildren(Element xmlNode) {
|
||||
this.xmlNode = xmlNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addNotify() {
|
||||
super.addNotify();
|
||||
setKeys(createKeys());
|
||||
}
|
||||
|
||||
protected List<Element> createKeys() {
|
||||
LinkedList<Element> ret = new LinkedList<Element>();
|
||||
Element curElement = XmlHelper.findFirstChildElement(xmlNode);
|
||||
while (curElement != null) {
|
||||
if (checkElement(curElement)) {
|
||||
ret.add(curElement);
|
||||
}
|
||||
curElement = XmlHelper.findNextSiblingElement(curElement);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private boolean checkElement(Element curElement) {
|
||||
if (!"screen".equals(curElement.getTagName())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node[] createNodes(Element key) {
|
||||
return new Node[]{new NiftyScreenNode(key.getAttribute("id"))};
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class NiftyFileNode extends AbstractNode{
|
||||
|
||||
public NiftyFileNode(Element xmlNode) {
|
||||
super(new NiftyFileChildren(xmlNode));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,167 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 jMonkeyEngine
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import com.jme3.asset.AssetInfo;
|
||||
import com.jme3.asset.AssetKey;
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.asset.AssetNotFoundException;
|
||||
import com.jme3.asset.DesktopAssetManager;
|
||||
import com.jme3.audio.AudioRenderer;
|
||||
import com.jme3.niftygui.RenderDeviceJme;
|
||||
import com.jme3.niftygui.SoundDeviceJme;
|
||||
import com.jme3.post.SceneProcessor;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.Renderer;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.renderer.queue.RenderQueue;
|
||||
import com.jme3.texture.FrameBuffer;
|
||||
import de.lessvoid.nifty.Nifty;
|
||||
import de.lessvoid.nifty.spi.input.InputSystem;
|
||||
import de.lessvoid.nifty.tools.TimeProvider;
|
||||
import de.lessvoid.nifty.tools.resourceloader.ResourceLocation;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
public class NiftyJmeDisplay extends com.jme3.niftygui.NiftyJmeDisplay implements SceneProcessor {
|
||||
|
||||
protected class ResourceLocationJmp implements ResourceLocation {
|
||||
|
||||
public InputStream getResourceAsStream(String path) {
|
||||
AssetKey<Object> key = new AssetKey<Object>(path);
|
||||
AssetInfo info = assetManager.locateAsset(key);
|
||||
if (info != null){
|
||||
return info.openStream();
|
||||
}else{
|
||||
throw new AssetNotFoundException(path);
|
||||
}
|
||||
}
|
||||
|
||||
public URL getResource(String path) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
private ResourceLocation resourceLocation = new ResourceLocationJmp();
|
||||
|
||||
public NiftyJmeDisplay(AssetManager assetManager,
|
||||
InputSystem inputManager,
|
||||
AudioRenderer audioRenderer,
|
||||
ViewPort vp){
|
||||
this.assetManager = assetManager;
|
||||
//TODO: move
|
||||
((DesktopAssetManager)assetManager).clearCache();
|
||||
w = vp.getCamera().getWidth();
|
||||
h = vp.getCamera().getHeight();
|
||||
|
||||
soundDev = new SoundDeviceJme(assetManager, audioRenderer);
|
||||
renderDev = new RenderDeviceJme(this);
|
||||
nifty = new Nifty(renderDev, soundDev, inputManager, new TimeProvider());
|
||||
nifty.getResourceLoader().addResourceLocation(resourceLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(RenderManager rm, ViewPort vp) {
|
||||
this.renderManager = rm;
|
||||
renderDev.setRenderManager(rm);
|
||||
inited = true;
|
||||
this.vp = vp;
|
||||
this.renderer = rm.getRenderer();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Nifty getNifty() {
|
||||
return nifty;
|
||||
}
|
||||
|
||||
RenderDeviceJme getRenderDevice() {
|
||||
return renderDev;
|
||||
}
|
||||
|
||||
AssetManager getAssetManager() {
|
||||
return assetManager;
|
||||
}
|
||||
|
||||
RenderManager getRenderManager() {
|
||||
return renderManager;
|
||||
}
|
||||
|
||||
int getHeight() {
|
||||
return h;
|
||||
}
|
||||
|
||||
int getWidth() {
|
||||
return w;
|
||||
}
|
||||
|
||||
Renderer getRenderer(){
|
||||
return renderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reshape(ViewPort vp, int w, int h) {
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
nifty.resolutionChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return inited;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preFrame(float tpf) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postQueue(RenderQueue rq) {
|
||||
// render nifty before anything else
|
||||
renderManager.setCamera(vp.getCamera(), true);
|
||||
nifty.render(false);
|
||||
renderManager.setCamera(vp.getCamera(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postFrame(FrameBuffer out) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup() {
|
||||
nifty.getResourceLoader().removeResourceLocation(resourceLocation);
|
||||
inited = false;
|
||||
// nifty.exit();
|
||||
}
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import de.lessvoid.nifty.NiftyInputConsumer;
|
||||
import de.lessvoid.nifty.input.keyboard.KeyboardInputEvent;
|
||||
import de.lessvoid.nifty.tools.resourceloader.NiftyResourceLoader;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class NiftyPreviewInputHandler implements de.lessvoid.nifty.spi.input.InputSystem {
|
||||
|
||||
private List<MouseInputEvent> mouseEvents = new LinkedList<MouseInputEvent>();
|
||||
private List<KeyboardInputEvent> keyEvents = new LinkedList<KeyboardInputEvent>();
|
||||
|
||||
public synchronized void forwardEvents(NiftyInputConsumer nic) {
|
||||
for (Iterator<MouseInputEvent> it = mouseEvents.iterator(); it.hasNext();) {
|
||||
MouseInputEvent mouseInputEvent = it.next();
|
||||
nic.processMouseEvent(mouseInputEvent.x, mouseInputEvent.y, mouseInputEvent.button, mouseInputEvent.huh, mouseInputEvent.pressed);
|
||||
it.remove();
|
||||
}
|
||||
for (Iterator<KeyboardInputEvent> it = keyEvents.iterator(); it.hasNext();) {
|
||||
KeyboardInputEvent keyInputEvent = it.next();
|
||||
nic.processKeyboardEvent(keyInputEvent);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void addMouseEvent(int newMouseX, int newMouseY, boolean mouseDown) {
|
||||
MouseInputEvent event = new MouseInputEvent(newMouseX, newMouseY, 0, 0, mouseDown);
|
||||
mouseEvents.add(event);
|
||||
}
|
||||
|
||||
public synchronized void addKeyEvent(int newKey, char newCharacter, boolean newKeyDown, boolean newShiftDown, boolean newControlDown) {
|
||||
KeyboardInputEvent event = new KeyboardInputEvent(newKey, newCharacter, newKeyDown, newShiftDown, newControlDown);
|
||||
keyEvents.add(event);
|
||||
}
|
||||
|
||||
public void setMousePosition(int i, int i1) {
|
||||
// throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void setResourceLoader(NiftyResourceLoader nrl) {
|
||||
}
|
||||
|
||||
}
|
@ -1,335 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import com.jme3.audio.AudioRenderer;
|
||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||
import com.jme3.gde.core.scene.OffScenePanel;
|
||||
import com.jme3.gde.core.scene.SceneApplication;
|
||||
import com.jme3.gde.gui.OldNiftyGuiDataObject;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import de.lessvoid.nifty.Nifty;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JToolBar;
|
||||
import org.netbeans.modules.xml.multiview.Error;
|
||||
import org.netbeans.modules.xml.multiview.ui.PanelView;
|
||||
import org.netbeans.modules.xml.multiview.ui.ToolBarDesignEditor;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.NotifyDescriptor.Message;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.xml.XMLUtil;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class NiftyPreviewPanel extends PanelView implements ErrorHandler {
|
||||
|
||||
private OldNiftyGuiDataObject niftyObject;
|
||||
private OffScenePanel offPanel;
|
||||
private Nifty nifty;
|
||||
private Document doc;
|
||||
private ToolBarDesignEditor comp;
|
||||
private String screen = "";
|
||||
private NiftyPreviewInputHandler inputHandler;
|
||||
private NiftyJmeDisplay niftyDisplay;
|
||||
private JScrollPane scrollPanel;
|
||||
private int width = 640, height = 480;
|
||||
private ErrorPanel errors;
|
||||
|
||||
public NiftyPreviewPanel(OldNiftyGuiDataObject niftyObject, ToolBarDesignEditor comp) {
|
||||
super();
|
||||
setRoot(Node.EMPTY);
|
||||
this.niftyObject = niftyObject;
|
||||
this.comp = comp;
|
||||
comp.setContentView(this);
|
||||
preparePreview();
|
||||
updatePreView();
|
||||
}
|
||||
|
||||
private void createToolbar() {
|
||||
JToolBar toolBar = new JToolBar();
|
||||
toolBar.setPreferredSize(new Dimension(10000, 24));
|
||||
toolBar.setMaximumSize(new Dimension(10000, 24));
|
||||
toolBar.setFloatable(false);
|
||||
JComboBox comboBox = new JComboBox(new String[]{"640x480", "480x800", "800x480", "800x600", "1024x768", "1280x720"});
|
||||
comboBox.addItemListener(new ItemListener() {
|
||||
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
String string = (String) e.getItem();
|
||||
if ("640x480".equals(string)) {
|
||||
width = 640;
|
||||
height = 480;
|
||||
} else if ("1024x768".equals(string)) {
|
||||
width = 1024;
|
||||
height = 768;
|
||||
} else if ("1280x720".equals(string)) {
|
||||
width = 1280;
|
||||
height = 720;
|
||||
} else if ("800x600".equals(string)) {
|
||||
width = 800;
|
||||
height = 600;
|
||||
} else if ("800x480".equals(string)) {
|
||||
width = 800;
|
||||
height = 480;
|
||||
} else if ("480x800".equals(string)) {
|
||||
width = 480;
|
||||
height = 800;
|
||||
} else {
|
||||
width = 640;
|
||||
height = 480;
|
||||
}
|
||||
offPanel.resizeGLView(width, height);
|
||||
|
||||
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
||||
|
||||
public Object call() throws Exception {
|
||||
niftyDisplay.reshape(offPanel.getViewPort(), width, height);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// updatePreView();
|
||||
}
|
||||
});
|
||||
toolBar.add(comboBox);
|
||||
toolBar.add(new JPanel());
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
add(toolBar, java.awt.BorderLayout.NORTH);
|
||||
errors = new ErrorPanel();
|
||||
errors.setPreferredSize(new Dimension(0, 80));
|
||||
|
||||
|
||||
add(errors, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
}
|
||||
|
||||
public void updatePreView() {
|
||||
updatePreView(screen);
|
||||
}
|
||||
|
||||
public void updatePreView(final String screen) {
|
||||
errors.clear();
|
||||
final ProjectAssetManager pm = niftyObject.getLookup().lookup(ProjectAssetManager.class);
|
||||
if (pm == null) {
|
||||
Logger.getLogger(NiftyPreviewPanel.class.getName()).log(Level.WARNING, "No Project AssetManager found!");
|
||||
}
|
||||
InputStream stream = null;
|
||||
try {
|
||||
stream = niftyObject.getPrimaryFile().getInputStream();
|
||||
doc = XMLUtil.parse(new InputSource(stream), false, false, this, null);
|
||||
NiftyFileNode rootContext = new NiftyFileNode(doc.getDocumentElement());
|
||||
setRoot(rootContext);
|
||||
comp.setRootContext(rootContext);
|
||||
} catch (Exception ex) {
|
||||
// Message msg = new NotifyDescriptor.Message(
|
||||
// "Error parsing File:" + ex,
|
||||
// NotifyDescriptor.ERROR_MESSAGE);
|
||||
// DialogDisplayer.getDefault().notifyLater(msg);
|
||||
Exceptions.printStackTrace(ex);
|
||||
// return;
|
||||
} finally {
|
||||
try {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
if (nifty != null) {
|
||||
nifty.validateXml(niftyObject.getPrimaryFile().getPath());
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof SAXParseException) {
|
||||
SAXParseException spe = (SAXParseException) e;
|
||||
errors.addError("Line " + spe.getLineNumber() + " col :" + spe.getColumnNumber() + " : " + spe.getMessage());
|
||||
} else {
|
||||
errors.addError(e.getMessage());
|
||||
}
|
||||
Exceptions.printStackTrace(e);
|
||||
}
|
||||
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
||||
|
||||
public Object call() throws Exception {
|
||||
|
||||
try {
|
||||
nifty.fromXml(pm.getRelativeAssetPath(niftyObject.getPrimaryFile().getPath()), screen);
|
||||
if (screen == null || screen.length() == 0) {
|
||||
Collection<String> screens = nifty.getAllScreensName();
|
||||
for (Iterator<String> it = screens.iterator(); it.hasNext();) {
|
||||
String string = it.next();
|
||||
nifty.gotoScreen(string);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Message msg = new NotifyDescriptor.Message(
|
||||
"Error opening File:" + ex,
|
||||
NotifyDescriptor.ERROR_MESSAGE);
|
||||
// DialogDisplayer.getDefault().notifyLater(msg);
|
||||
Exceptions.printStackTrace(ex);
|
||||
errors.addError(ex.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
// java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
//
|
||||
// public void run() {
|
||||
// validateTree();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponents() {
|
||||
super.initComponents();
|
||||
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.PAGE_AXIS));
|
||||
createToolbar();
|
||||
scrollPanel = new JScrollPane();
|
||||
offPanel = new OffScenePanel(640, 480);
|
||||
scrollPanel.getViewport().add(offPanel);
|
||||
add(scrollPanel);
|
||||
offPanel.startPreview();
|
||||
prepareInputHandler();
|
||||
}
|
||||
|
||||
private void prepareInputHandler() {
|
||||
inputHandler = new NiftyPreviewInputHandler();
|
||||
offPanel.addMouseMotionListener(new MouseMotionListener() {
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
inputHandler.addMouseEvent(e.getX(), e.getY(), e.getButton() == MouseEvent.NOBUTTON ? false : true);
|
||||
}
|
||||
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
inputHandler.addMouseEvent(e.getX(), e.getY(), e.getButton() == MouseEvent.NOBUTTON ? false : true);
|
||||
}
|
||||
});
|
||||
offPanel.addMouseListener(new MouseListener() {
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
inputHandler.addMouseEvent(e.getX(), e.getY(), e.getButton() == MouseEvent.NOBUTTON ? false : true);
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
});
|
||||
offPanel.addKeyListener(new KeyListener() {
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
inputHandler.addKeyEvent(e.getKeyCode(), e.getKeyChar(), true, e.isShiftDown(), e.isControlDown());
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void preparePreview() {
|
||||
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
||||
|
||||
public Object call() throws Exception {
|
||||
ViewPort guiViewPort = offPanel.getViewPort();
|
||||
ProjectAssetManager pm = niftyObject.getLookup().lookup(ProjectAssetManager.class);
|
||||
if (pm == null) {
|
||||
Logger.getLogger(NiftyPreviewPanel.class.getName()).log(Level.WARNING, "No Project AssetManager found!");
|
||||
return null;
|
||||
}
|
||||
AudioRenderer audioRenderer = SceneApplication.getApplication().getAudioRenderer();
|
||||
niftyDisplay = new NiftyJmeDisplay(pm,
|
||||
inputHandler,
|
||||
audioRenderer,
|
||||
guiViewPort);
|
||||
nifty = niftyDisplay.getNifty();
|
||||
|
||||
// attach the nifty display to the gui view port as a processor
|
||||
guiViewPort.addProcessor(niftyDisplay);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Error validateView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSelection(Node[] nodes) {
|
||||
this.screen = nodes[0].getName();
|
||||
final String screen = this.screen;
|
||||
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
||||
|
||||
public Object call() throws Exception {
|
||||
nifty.gotoScreen(screen);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
offPanel.stopPreview();
|
||||
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
||||
|
||||
public Object call() throws Exception {
|
||||
ViewPort guiViewPort = offPanel.getViewPort();
|
||||
guiViewPort.removeProcessor(niftyDisplay);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void warning(SAXParseException exception) throws SAXException {
|
||||
//errors.addWarning("Line " + exception.getLineNumber() + " : " + exception.getMessage());
|
||||
}
|
||||
|
||||
public void error(SAXParseException exception) throws SAXException {
|
||||
//errors.addError("Line " + exception.getLineNumber() + " : " + exception.getMessage());
|
||||
}
|
||||
|
||||
public void fatalError(SAXParseException exception) throws SAXException {
|
||||
//errors.addError("Line " + exception.getLineNumber() + " : " + exception.getMessage());
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class NiftyScreenNode extends AbstractNode{
|
||||
|
||||
public NiftyScreenNode(String name) {
|
||||
super(Children.LEAF);
|
||||
setName(name);
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import com.jme3.gde.gui.OldNiftyGuiDataObject;
|
||||
import org.netbeans.modules.xml.multiview.ToolBarMultiViewElement;
|
||||
import org.netbeans.modules.xml.multiview.ui.SectionView;
|
||||
import org.netbeans.modules.xml.multiview.ui.ToolBarDesignEditor;
|
||||
import org.openide.nodes.Node;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class PreviewToolbarElement extends ToolBarMultiViewElement {
|
||||
// private NiftyGuiDataObject dObj;
|
||||
private ToolBarDesignEditor comp;
|
||||
private NiftyPreviewPanel viewPanel;
|
||||
|
||||
public PreviewToolbarElement(OldNiftyGuiDataObject dObj) {
|
||||
super(dObj);
|
||||
// this.dObj = dObj;
|
||||
comp = new ToolBarDesignEditor();
|
||||
setVisualEditor(comp);
|
||||
viewPanel=new NiftyPreviewPanel(dObj, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SectionView getSectionView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShowing() {
|
||||
super.componentShowing();
|
||||
viewPanel.updatePreView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentClosed() {
|
||||
super.componentClosed();
|
||||
viewPanel.cleanup();
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import com.jme3.gde.gui.OldNiftyGuiDataObject;
|
||||
import org.netbeans.modules.xml.multiview.DesignMultiViewDesc;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class PreviewView extends DesignMultiViewDesc {
|
||||
|
||||
private int type;
|
||||
|
||||
public PreviewView(OldNiftyGuiDataObject dObj, int type) {
|
||||
super(dObj, "Design");
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public org.netbeans.core.spi.multiview.MultiViewElement createElement() {
|
||||
OldNiftyGuiDataObject dObj = (OldNiftyGuiDataObject) getDataObject();
|
||||
return new PreviewToolbarElement(dObj);
|
||||
}
|
||||
|
||||
public java.awt.Image getIcon() {
|
||||
return org.openide.util.Utilities.loadImage("com/jme3/gde/gui/Computer_File_043.gif"); //NOI18N
|
||||
}
|
||||
|
||||
public String preferredID() {
|
||||
return "Toc_multiview_design" + String.valueOf(type);
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.jme3.gde.gui.multiview;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen
|
||||
*/
|
||||
public class XmlHelper {
|
||||
public static Element findFirstChildElement(Element parent) {
|
||||
org.w3c.dom.Node ret = parent.getFirstChild();
|
||||
while (ret != null && (!(ret instanceof Element))) {
|
||||
ret = ret.getNextSibling();
|
||||
}
|
||||
return (Element) ret;
|
||||
}
|
||||
|
||||
public static Element findChildElement(Element parent, String name) {
|
||||
if (parent == null) {
|
||||
return null;
|
||||
}
|
||||
org.w3c.dom.Node ret = parent.getFirstChild();
|
||||
while (ret != null && (!(ret instanceof Element) || !ret.getNodeName().equals(name))) {
|
||||
ret = ret.getNextSibling();
|
||||
}
|
||||
return (Element) ret;
|
||||
}
|
||||
|
||||
public static Element findNextElement(Node ret, String name) {
|
||||
ret = ret.getNextSibling();
|
||||
while (ret != null && (!(ret instanceof Element) || !ret.getNodeName().equals(name))) {
|
||||
ret = ret.getNextSibling();
|
||||
}
|
||||
return (Element) ret;
|
||||
}
|
||||
|
||||
public static Element findChildElementWithAttribute(Element parent, String name, String attribute, String value) {
|
||||
if (parent == null) {
|
||||
return null;
|
||||
}
|
||||
org.w3c.dom.Node ret = parent.getFirstChild();
|
||||
while (ret != null && (!(ret instanceof Element) || !ret.getNodeName().equals(name) || ((Element)ret).getAttribute(attribute)==null || !((Element)ret).getAttribute(attribute).equals(value))) {
|
||||
ret = ret.getNextSibling();
|
||||
}
|
||||
return (Element) ret;
|
||||
}
|
||||
|
||||
public static Element findNextElementWithAttribute(Node ret, String name, String attribute, String value) {
|
||||
ret = ret.getNextSibling();
|
||||
while (ret != null && (!(ret instanceof Element) || !ret.getNodeName().equals(name) || ((Element)ret).getAttribute(attribute)==null || !((Element)ret).getAttribute(attribute).equals(value))) {
|
||||
ret = ret.getNextSibling();
|
||||
}
|
||||
return (Element) ret;
|
||||
}
|
||||
|
||||
public static Element findNextSiblingElement(Element current) {
|
||||
org.w3c.dom.Node ret = current.getNextSibling();
|
||||
while (ret != null) {
|
||||
if (ret instanceof Element) {
|
||||
return (Element) ret;
|
||||
}
|
||||
ret = ret.getNextSibling();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GButton.png
Normal file
After Width: | Height: | Size: 348 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GChat.png
Normal file
After Width: | Height: | Size: 674 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GCheckbox.png
Normal file
After Width: | Height: | Size: 435 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GConsole.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GDraggable.png
Normal file
After Width: | Height: | Size: 768 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GDropDown.png
Normal file
After Width: | Height: | Size: 454 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GDroppable.png
Normal file
After Width: | Height: | Size: 556 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GHSlider.png
Normal file
After Width: | Height: | Size: 478 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GImage.png
Normal file
After Width: | Height: | Size: 540 B |
After Width: | Height: | Size: 602 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GLable.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GLayer.png
Normal file
After Width: | Height: | Size: 392 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GListBox.png
Normal file
After Width: | Height: | Size: 415 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GPanel.png
Normal file
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 478 B |
After Width: | Height: | Size: 557 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GScreen.png
Normal file
After Width: | Height: | Size: 536 B |
After Width: | Height: | Size: 361 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GTextfield.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GTree.png
Normal file
After Width: | Height: | Size: 520 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GVSlider.png
Normal file
After Width: | Height: | Size: 458 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/GWindow.png
Normal file
After Width: | Height: | Size: 341 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/control.png
Normal file
After Width: | Height: | Size: 736 B |
After Width: | Height: | Size: 608 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/gui-icon.png
Normal file
After Width: | Height: | Size: 538 B |
BIN
sdk/jme3-gui/src/com/jme3/gde/gui/multiview/icons/style.png
Normal file
After Width: | Height: | Size: 865 B |
After Width: | Height: | Size: 349 B |
After Width: | Height: | Size: 390 B |
@ -0,0 +1,34 @@
|
||||
package com.jme3.gde.gui.nodes;
|
||||
|
||||
|
||||
import jada.ngeditor.model.elements.GElement;
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
import org.openide.nodes.Node;
|
||||
|
||||
public class GElementChildFactory extends ChildFactory<GElement> implements Observer{
|
||||
private final GElement parent;
|
||||
|
||||
public GElementChildFactory(GElement parent) {
|
||||
this.parent = parent;
|
||||
this.parent.addObserver(this);
|
||||
|
||||
}
|
||||
@Override
|
||||
protected boolean createKeys(List<GElement> list) {
|
||||
list.addAll(parent.getElements());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeForKey(GElement element) {
|
||||
return new GElementNode(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
this.refresh(true);
|
||||
}
|
||||
}
|
158
sdk/jme3-gui/src/com/jme3/gde/gui/nodes/GElementNode.java
Normal file
@ -0,0 +1,158 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.nodes;
|
||||
|
||||
import com.jme3.gde.gui.propertyeditors.ResourceEditor;
|
||||
import com.jme3.gde.gui.propertyeditors.SizeEditor;
|
||||
import jada.ngeditor.controller.CommandProcessor;
|
||||
import jada.ngeditor.controller.commands.EditAttributeCommand;
|
||||
import jada.ngeditor.controller.commands.VisibilityCommand;
|
||||
import jada.ngeditor.model.elements.GElement;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.PropertyEditor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Map.Entry;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.Exceptions;
|
||||
import sun.beans.editors.BoolEditor;
|
||||
import sun.beans.editors.BooleanEditor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cris
|
||||
*/
|
||||
public class GElementNode extends AbstractNode{
|
||||
private final GElement element;
|
||||
private static final String basePath="com/jme3/gde/gui/multiview/icons";
|
||||
public GElementNode(GElement element) {
|
||||
super(Children.create(new GElementChildFactory(element), false));
|
||||
|
||||
this.element = element;
|
||||
this.setName(element.getID());
|
||||
String name = this.element.getClass().getSimpleName();
|
||||
this.setName(name);
|
||||
this.setIconBaseWithExtension(basePath+"/"+name+".png");
|
||||
|
||||
}
|
||||
|
||||
public GElement getGelement(){
|
||||
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(){
|
||||
|
||||
}
|
||||
@Override
|
||||
protected Sheet createSheet() {
|
||||
Sheet s = super.createSheet();
|
||||
Sheet.Set set = s.get(Sheet.PROPERTIES);
|
||||
if (set == null) {
|
||||
set = Sheet.createPropertiesSet();
|
||||
s.put(set);
|
||||
}
|
||||
set.setName("Element Properties");
|
||||
set.setShortDescription("You can set element properties");
|
||||
for(Entry<String,String> pair : this.element.listAttributes().entrySet()){
|
||||
final ElementAttributeProperty elementAttributeProperty = new ElementAttributeProperty(element,pair.getKey());
|
||||
pickEditor(pair, elementAttributeProperty);
|
||||
set.put(elementAttributeProperty);
|
||||
}
|
||||
s.put(set);
|
||||
return s;
|
||||
}
|
||||
|
||||
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") ){
|
||||
elementAttributeProperty.setPropertyEditor(new SizeEditor());
|
||||
}else if(pair.getKey().equals("filename") || pair.getKey().equals("backgroundImage")){
|
||||
elementAttributeProperty.setPropertyEditor(new ResourceEditor());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ElementAttributeProperty extends Node.Property {
|
||||
|
||||
private String attributeName;
|
||||
private GElement element;
|
||||
private PropertyEditor editor;
|
||||
|
||||
public ElementAttributeProperty(GElement element, String attributeName) {
|
||||
super(String.class);
|
||||
this.element = element;
|
||||
this.attributeName = attributeName;
|
||||
this.setName(attributeName);
|
||||
this.setDisplayName(attributeName);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRead() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() throws IllegalAccessException, InvocationTargetException{
|
||||
return element.getAttribute(attributeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPropertyEditor(PropertyEditor editor){
|
||||
this.editor = editor;
|
||||
}
|
||||
@Override
|
||||
public PropertyEditor getPropertyEditor() {
|
||||
|
||||
return this.editor; //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setValue(Object val) throws IllegalAccessException, IllegalArgumentException {
|
||||
try {
|
||||
EditAttributeCommand command = CommandProcessor.getInstance().getCommand(EditAttributeCommand.class);
|
||||
command.setAttribute(attributeName);
|
||||
command.setValue(val.toString());
|
||||
CommandProcessor.getInstance().excuteCommand(command);
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
125
sdk/jme3-gui/src/com/jme3/gde/gui/nodes/GUINode.java
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.nodes;
|
||||
|
||||
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.Children;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cris
|
||||
*/
|
||||
public class GUINode extends AbstractNode{
|
||||
private final GUI gui;
|
||||
private static final String basePath="com/jme3/gde/gui/multiview/icons";
|
||||
public GUINode(GUI gui) {
|
||||
super(Children.create(new ScreenChildFactory(gui),false));
|
||||
this.gui = gui;
|
||||
this.setIconBaseWithExtension(basePath+"/"+"game-monitor"+".png");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the gui
|
||||
*/
|
||||
public GUI getGui() {
|
||||
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
|
||||
public String getName() {
|
||||
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
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.jme3.gde.gui.nodes;
|
||||
|
||||
|
||||
import jada.ngeditor.listeners.events.ElementEvent;
|
||||
import jada.ngeditor.model.GUI;
|
||||
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.Observable;
|
||||
import java.util.Observer;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
import org.openide.nodes.Node;
|
||||
|
||||
public class ScreenChildFactory extends ChildFactory<Object> implements Observer{
|
||||
private final GUI gui;
|
||||
|
||||
public ScreenChildFactory(GUI gui){
|
||||
this.gui = gui;
|
||||
this.gui.addObserver(ScreenChildFactory.this);
|
||||
|
||||
}
|
||||
@Override
|
||||
protected boolean createKeys(List<Object> list) {
|
||||
list.addAll(gui.getUseStyles());
|
||||
list.addAll(gui.getUseControls());
|
||||
list.addAll(gui.getScreens());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeForKey(Object node) {
|
||||
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
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
@TemplateRegistrations(value = {@TemplateRegistration(folder = "GUI", displayName = "Empty Gui",content = "EmptyNiftyGui.xml"),
|
||||
@TemplateRegistration(folder = "GUI", displayName = "HelloJme",content = "NiftyGui.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",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;
|
||||
|
||||
import org.netbeans.api.templates.TemplateRegistration;
|
||||
|
@ -0,0 +1,48 @@
|
||||
package com.jme3.gde.gui.palette;
|
||||
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import jada.ngeditor.model.elements.GControl;
|
||||
import jada.ngeditor.model.elements.GElement;
|
||||
import java.util.List;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
|
||||
public class CategoryChildFactory extends ChildFactory<ElementFilter> {
|
||||
|
||||
@Override
|
||||
protected boolean createKeys(List<ElementFilter> list) {
|
||||
ElementFilter elements = new ElementFilter("Elements") {
|
||||
@Override
|
||||
public boolean apply(Class t) {
|
||||
return t.getGenericSuperclass().equals(GElement.class);
|
||||
}
|
||||
};
|
||||
list.add(elements);
|
||||
ElementFilter controls = new ElementFilter("Controls") {
|
||||
@Override
|
||||
public boolean apply(Class t) {
|
||||
return t.getGenericSuperclass().equals(GControl.class);
|
||||
//To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
};
|
||||
list.add(controls);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeForKey(ElementFilter category) {
|
||||
return new CategoryNode(category);
|
||||
}
|
||||
|
||||
public class CategoryNode extends AbstractNode {
|
||||
public CategoryNode(ElementFilter category) {
|
||||
super(Children.create(new WidgetChildFactory(category), true));
|
||||
setDisplayName(category.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
28
sdk/jme3-gui/src/com/jme3/gde/gui/palette/ElementFilter.java
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.palette;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cris
|
||||
*/
|
||||
abstract class ElementFilter implements Predicate<Class>{
|
||||
private final String name;
|
||||
|
||||
public ElementFilter(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 jMonkeyEngine
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.jme3.gde.gui.palette;
|
||||
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Caret;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import javax.swing.text.StyledDocument;
|
||||
import org.openide.text.NbDocument;
|
||||
|
||||
public class JmePaletteUtilities {
|
||||
|
||||
public static void insert(final String s,final JTextComponent target) throws BadLocationException {
|
||||
|
||||
final StyledDocument doc = (StyledDocument)target.getDocument();
|
||||
|
||||
class AtomicChange implements Runnable {
|
||||
|
||||
public void run() {
|
||||
Document value = target.getDocument();
|
||||
if (value == null)
|
||||
return;
|
||||
try {
|
||||
insert(s, target, doc);
|
||||
} catch (BadLocationException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
NbDocument.runAtomicAsUser(doc, new AtomicChange());
|
||||
} catch (BadLocationException ex) {}
|
||||
|
||||
}
|
||||
|
||||
private static int insert(String s, JTextComponent target, Document doc) throws BadLocationException {
|
||||
|
||||
int start = -1;
|
||||
|
||||
try {
|
||||
|
||||
//firstly, find selected text range:
|
||||
Caret caret = target.getCaret();
|
||||
int p0 = Math.min(caret.getDot(), caret.getMark());
|
||||
int p1 = Math.max(caret.getDot(), caret.getMark());
|
||||
doc.remove(p0, p1 - p0);
|
||||
|
||||
//then, replace selected text range with the inserted one:
|
||||
start = caret.getDot();
|
||||
doc.insertString(start, s, null);
|
||||
|
||||
} catch (BadLocationException ble) {}
|
||||
|
||||
return start;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -9,13 +9,19 @@
|
||||
|
||||
package com.jme3.gde.gui.palette;
|
||||
|
||||
import jada.ngeditor.guiviews.DND.WidgetData;
|
||||
import java.io.IOException;
|
||||
import javax.swing.Action;
|
||||
import org.netbeans.api.editor.mimelookup.MimeRegistration;
|
||||
import org.netbeans.spi.palette.DragAndDropHandler;
|
||||
import org.netbeans.spi.palette.PaletteActions;
|
||||
import org.netbeans.spi.palette.PaletteController;
|
||||
import org.netbeans.spi.palette.PaletteFactory;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.datatransfer.ExTransferable;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -26,21 +32,21 @@ public class NiftyGUIPaletteFactory {
|
||||
//http://blogs.sun.com/geertjan/entry/convert_your_topcomponent_to_a
|
||||
//http://www.javanb.com/netbeans/1/19785.html
|
||||
|
||||
public static final String PALETTE_FOLDER = "NiftyGUIPalette";
|
||||
public static final String PALETTE_FOLDER = "NiftyPalette";
|
||||
private static PaletteController palette = null;
|
||||
|
||||
public NiftyGUIPaletteFactory() {
|
||||
}
|
||||
|
||||
@MimeRegistration(mimeType = "text/x-niftygui+xml", service = PaletteController.class)
|
||||
public static PaletteController createPalette() {
|
||||
try {
|
||||
if (null == palette)
|
||||
palette = PaletteFactory.createPalette(PALETTE_FOLDER, new MyActions());
|
||||
|
||||
if (null == palette){
|
||||
AbstractNode paletteRoot = new AbstractNode(Children.create(new CategoryChildFactory(), true));
|
||||
paletteRoot.setName("Palette Root");
|
||||
palette = PaletteFactory.createPalette( paletteRoot,new MyActions(),null,new MyHandler());
|
||||
}
|
||||
|
||||
return palette;
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class MyActions extends PaletteActions {
|
||||
@ -71,5 +77,16 @@ public class NiftyGUIPaletteFactory {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class MyHandler extends DragAndDropHandler {
|
||||
|
||||
public MyHandler() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize(ExTransferable t, Lookup item) {
|
||||
t.remove(WidgetData.POINTFLAVOR);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 jMonkeyEngine
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.jme3.gde.gui.palette;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import org.openide.text.ActiveEditorDrop;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author normenhansen, zathras
|
||||
*/
|
||||
public class Screen implements ActiveEditorDrop {
|
||||
|
||||
public Screen() {
|
||||
}
|
||||
|
||||
private String createBody() {
|
||||
|
||||
String body = "<screen></screen>";
|
||||
return body;
|
||||
}
|
||||
|
||||
public boolean handleTransfer(JTextComponent targetComponent) {
|
||||
String body = createBody();
|
||||
try {
|
||||
JmePaletteUtilities.insert(body, targetComponent);
|
||||
} catch (BadLocationException ble) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.1//EN"
|
||||
"http://www.netbeans.org/dtds/editor-palette-item-1_1.dtd">
|
||||
|
||||
<editor_palette_item version="1.0">
|
||||
|
||||
<class name="com.jme3.gde.gui.palette.Screen" />
|
||||
|
||||
<icon16 urlvalue="com/jme3/gde/core/sceneviewer/jme-logo.png" />
|
||||
<icon32 urlvalue="com/jme3/gde/core/sceneviewer/jme-logo.png" />
|
||||
|
||||
<inline-description>
|
||||
<display-name>Screen</display-name>
|
||||
<tooltip>light source (ambient)</tooltip>
|
||||
</inline-description>
|
||||
|
||||
</editor_palette_item>
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.palette;
|
||||
|
||||
import jada.ngeditor.guiviews.palettecomponents.NWidget;
|
||||
import jada.ngeditor.model.elements.GControl;
|
||||
import jada.ngeditor.model.elements.GElement;
|
||||
import jada.ngeditor.model.utils.ClassUtils;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
import org.openide.nodes.Node;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cris
|
||||
*/
|
||||
public class WidgetChildFactory extends ChildFactory<Class>{
|
||||
private final ElementFilter category;
|
||||
|
||||
WidgetChildFactory(ElementFilter category) {
|
||||
this.category = category;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean createKeys(List<Class> toPopulate) {
|
||||
Set<Class<? extends GElement>> classes = ClassUtils.findAllGElements();
|
||||
for(Class c : classes){
|
||||
if(this.isConcreteClass(c) && category.apply(c)){
|
||||
toPopulate.add(c);
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isConcreteClass(Class object){
|
||||
boolean abs = Modifier.isAbstract( object.getModifiers() );
|
||||
return !abs && !object.isAnonymousClass() && GElement.class.isAssignableFrom(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeForKey(Class key) {
|
||||
return new WidgetNode(key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
61
sdk/jme3-gui/src/com/jme3/gde/gui/palette/WidgetNode.java
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.palette;
|
||||
|
||||
import jada.ngeditor.guiviews.DND.DragHandler;
|
||||
import jada.ngeditor.guiviews.DND.TrasferHandling;
|
||||
import jada.ngeditor.guiviews.DND.WidgetData;
|
||||
import jada.ngeditor.guiviews.palettecomponents.NWidget;
|
||||
import jada.ngeditor.model.GUIFactory;
|
||||
import jada.ngeditor.model.elements.GElement;
|
||||
import jada.ngeditor.model.exception.NoProductException;
|
||||
import java.awt.Image;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.util.Exceptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cris
|
||||
*/
|
||||
public class WidgetNode extends AbstractNode{
|
||||
private final Class<?extends GElement> clazz;
|
||||
private static final String basePath="com/jme3/gde/gui/multiview/icons";
|
||||
|
||||
public WidgetNode(Class<?extends GElement> wrappedClass) {
|
||||
super(Children.LEAF);
|
||||
this.clazz = wrappedClass;
|
||||
String name = wrappedClass.getSimpleName();
|
||||
this.setName(name);
|
||||
this.setIconBaseWithExtension(basePath+"/"+name+".png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getIcon(int type) {
|
||||
return super.getIcon(type); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transferable drag() throws IOException {
|
||||
try {
|
||||
final GElement gElement = GUIFactory.getInstance().newGElement(clazz);
|
||||
return new WidgetData(gElement);
|
||||
} catch (NoProductException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.propertyeditors;
|
||||
|
||||
import jada.ngeditor.controller.CommandProcessor;
|
||||
import jada.ngeditor.guiviews.editors.FileChooserEditor;
|
||||
import jada.ngeditor.model.GuiEditorModel;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.io.File;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
import javax.swing.JFileChooser;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cris
|
||||
*/
|
||||
public class ResourceEditor extends PropertyEditorSupport implements Observer, ActionListener{
|
||||
private final FileChooserEditor fileChooserEditor;
|
||||
private File assetFolder;
|
||||
|
||||
|
||||
public ResourceEditor() {
|
||||
CommandProcessor.getInstance().getObservable().addObserver(this);
|
||||
|
||||
GuiEditorModel model = (GuiEditorModel) CommandProcessor.getInstance().getObservable();
|
||||
this.assetFolder = model.getCurrent().getAssetFolder();
|
||||
fileChooserEditor = new FileChooserEditor(this.assetFolder);
|
||||
fileChooserEditor.getFileChooser().addActionListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
|
||||
return fileChooserEditor.getFileChooser(); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCustomEditor() {
|
||||
return true; //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
if(o instanceof GuiEditorModel){
|
||||
GuiEditorModel model = (GuiEditorModel) o;
|
||||
this.assetFolder = model.getCurrent().getAssetFolder();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (JFileChooser.APPROVE_SELECTION.equals(e.getActionCommand())) {
|
||||
this.setValue(fileChooserEditor.traslateFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.propertyeditors;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.beans.VetoableChangeListener;
|
||||
import javax.swing.JLabel;
|
||||
import org.openide.explorer.propertysheet.ExPropertyEditor;
|
||||
import org.openide.explorer.propertysheet.PropertyEnv;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cris
|
||||
*/
|
||||
public class SizeEditor extends PropertyEditorSupport implements ExPropertyEditor, PropertyChangeListener{
|
||||
private PropertyEnv env;
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
super.setAsText(text); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsText() {
|
||||
return super.getAsText(); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
jada.ngeditor.guiviews.editors.SizeEditor editor = new jada.ngeditor.guiviews.editors.SizeEditor();
|
||||
editor.setValue(this.getValue());
|
||||
editor.addPropertyChangeListener(this);
|
||||
return editor.getComponent(); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCustomEditor() {
|
||||
return true; //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachEnv(PropertyEnv env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
this.setValue(evt.getNewValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -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,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<nifty xmlns="http://nifty-gui.lessvoid.com/nifty-gui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd">
|
||||
<!-- +++++++++++++++++++++++++++++++++++++++ -->
|
||||
<!-- start screen -->
|
||||
<!-- +++++++++++++++++++++++++++++++++++++++ -->
|
||||
<screen id="GScreen0" controller="mygame.Main">
|
||||
<layer id="GLayer0" childLayout="absolute">
|
||||
</layer>
|
||||
</screen>
|
||||
</nifty>
|
@ -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>
|
205
sdk/jme3-gui/src/com/jme3/gde/gui/view/Navigator.java
Normal file
@ -0,0 +1,205 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui.view;
|
||||
|
||||
import com.jme3.gde.gui.nodes.GElementNode;
|
||||
import com.jme3.gde.gui.nodes.GUINode;
|
||||
import jada.ngeditor.controller.CommandProcessor;
|
||||
import jada.ngeditor.controller.GUIEditor;
|
||||
import jada.ngeditor.controller.commands.SelectCommand;
|
||||
import jada.ngeditor.listeners.events.SelectionChanged;
|
||||
import jada.ngeditor.model.GUI;
|
||||
import jada.ngeditor.model.GuiEditorModel;
|
||||
import jada.ngeditor.model.elements.GElement;
|
||||
import java.awt.BorderLayout;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
import javax.swing.JComponent;
|
||||
import org.netbeans.spi.navigator.NavigatorPanel;
|
||||
import org.openide.explorer.ExplorerManager;
|
||||
import org.openide.explorer.ExplorerUtils;
|
||||
import org.openide.explorer.view.BeanTreeView;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.lookup.ProxyLookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cris
|
||||
*/
|
||||
@NavigatorPanel.Registration(mimeType = "text/x-niftygui+xml", displayName="Gui View")
|
||||
public class Navigator extends javax.swing.JPanel implements NavigatorPanel,ExplorerManager.Provider , Observer, PropertyChangeListener{
|
||||
private Lookup lookup;
|
||||
private ExplorerManager mgr = new ExplorerManager();
|
||||
private final BeanTreeView beanTreeView;
|
||||
/**
|
||||
* Creates new form Navigator
|
||||
*/
|
||||
public Navigator() {
|
||||
initComponents();
|
||||
setLayout(new BorderLayout());
|
||||
beanTreeView = new BeanTreeView();
|
||||
add(beanTreeView, BorderLayout.CENTER);
|
||||
final GuiEditorModel model = (GuiEditorModel) CommandProcessor.getInstance().getObservable();
|
||||
model.addObserver(this);
|
||||
if(model.getCurrent() != null){
|
||||
try {
|
||||
this.intNavigator(model.getCurrent());
|
||||
} catch (PropertyVetoException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 244, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 274, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "GuiView";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayHint() {
|
||||
return "Easy view for your gui";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void panelActivated(Lookup context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void panelDeactivated() {
|
||||
ExplorerUtils.activateActions(mgr, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Lookup getLookup() {
|
||||
return lookup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExplorerManager getExplorerManager() {
|
||||
return mgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
if(o instanceof GuiEditorModel){
|
||||
try {
|
||||
GuiEditorModel model = (GuiEditorModel) o;
|
||||
model.getCurrent().addObserver(this);
|
||||
model.getCurrent().getSelection().addObserver(this);
|
||||
this.intNavigator(model.getCurrent());
|
||||
} catch (PropertyVetoException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
}
|
||||
|
||||
if(arg instanceof SelectionChanged){
|
||||
SelectionChanged event = (SelectionChanged) arg;
|
||||
if(event.getNewSelection().isEmpty()){
|
||||
return;
|
||||
}
|
||||
ArrayList<String> path = new ArrayList<String>();
|
||||
GElement parent = ((SelectionChanged)arg).getElement();
|
||||
while(parent!=null){
|
||||
path.add(parent.getID());
|
||||
parent = parent.getParent();
|
||||
}
|
||||
Node result = mgr.getRootContext();
|
||||
for(int i=path.size()-1;i>=0;i--){
|
||||
if(result!=null){
|
||||
result = result.getChildren().findChild(path.get(i));
|
||||
}
|
||||
}
|
||||
try {
|
||||
if(result!=null){
|
||||
mgr.setSelectedNodes(new Node[]{result});
|
||||
}
|
||||
|
||||
} catch (PropertyVetoException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
}
|
||||
beanTreeView.updateUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
|
||||
Node[] newValue = (Node[]) evt.getNewValue();
|
||||
if (newValue.length > 0) {
|
||||
AbstractNode firstSelected = (AbstractNode) newValue[0];
|
||||
if (firstSelected instanceof GElementNode) {
|
||||
GElement element = ((GElementNode) firstSelected).getGelement();
|
||||
GUI gui = ((GUINode)mgr.getRootContext()).getGui();
|
||||
gui.getSelection().deleteObserver(this); // I don't wont to get notified about this selection change
|
||||
SelectCommand command = CommandProcessor.getInstance().getCommand(SelectCommand.class);
|
||||
command.setElement(element);
|
||||
try {
|
||||
CommandProcessor.getInstance().excuteCommand(command);
|
||||
} catch (Exception ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
gui.getSelection().addObserver(this);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void intNavigator(GUI gui) throws PropertyVetoException {
|
||||
|
||||
|
||||
ExplorerUtils.activateActions(mgr, true);
|
||||
|
||||
|
||||
AbstractNode guiRoot = new GUINode(gui);
|
||||
guiRoot.setName("Gui");
|
||||
this.mgr.setRootContext(guiRoot);
|
||||
this.beanTreeView.updateUI();
|
||||
mgr.addPropertyChangeListener(this);
|
||||
this.mgr.setSelectedNodes(new Node[]{guiRoot});
|
||||
Lookup lookup1 = ExplorerUtils.createLookup(mgr, getActionMap());
|
||||
lookup = new ProxyLookup(lookup1);
|
||||
|
||||
}
|
||||
}
|
@ -2,53 +2,85 @@
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.jme3.gde.gui;
|
||||
package com.jme3.gde.gui.view;
|
||||
|
||||
import com.jme3.app.Application;
|
||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||
import com.jme3.gde.core.scene.SceneApplication;
|
||||
import com.jme3.gde.gui.NiftyGuiDataObject;
|
||||
import com.jme3.gde.gui.nodes.GElementNode;
|
||||
import com.jme3.gde.gui.nodes.GUINode;
|
||||
import de.lessvoid.nifty.Nifty;
|
||||
import jada.ngeditor.controller.CommandProcessor;
|
||||
import jada.ngeditor.controller.GUIEditor;
|
||||
import jada.ngeditor.guiviews.DND.PaletteDropTarget;
|
||||
import jada.ngeditor.guiviews.DND.TrasferHandling;
|
||||
import jada.ngeditor.guiviews.J2DNiftyView;
|
||||
import jada.ngeditor.listeners.events.SelectionChanged;
|
||||
import jada.ngeditor.model.GUI;
|
||||
import jada.ngeditor.model.GuiEditorModel;
|
||||
import jada.ngeditor.model.elements.GElement;
|
||||
import jada.ngeditor.model.elements.GLayer;
|
||||
import jada.ngeditor.model.exception.NoProductException;
|
||||
import jada.ngeditor.persistence.GUIWriter;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ActionMap;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.netbeans.api.progress.ProgressHandle;
|
||||
import org.netbeans.api.progress.ProgressHandleFactory;
|
||||
import org.netbeans.core.spi.multiview.CloseOperationState;
|
||||
import org.netbeans.core.spi.multiview.MultiViewElement;
|
||||
import org.netbeans.core.spi.multiview.MultiViewElementCallback;
|
||||
import org.netbeans.spi.actions.AbstractSavable;
|
||||
import org.openide.awt.UndoRedo;
|
||||
import org.openide.explorer.ExplorerManager;
|
||||
import org.openide.explorer.ExplorerUtils;
|
||||
import org.openide.loaders.DataObject;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.util.lookup.AbstractLookup;
|
||||
import org.openide.util.lookup.InstanceContent;
|
||||
import org.openide.util.lookup.ProxyLookup;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.xml.sax.SAXException;
|
||||
import sun.rmi.runtime.Log;
|
||||
|
||||
@MultiViewElement.Registration(
|
||||
displayName = "#LBL_NiftyGui_VISUAL",
|
||||
iconBase = "com/jme3/gde/gui/Computer_File_043.gif",
|
||||
iconBase = "com/jme3/gde/gui/multiview/icons/game-monitor.png",
|
||||
mimeType = "text/x-niftygui+xml",
|
||||
persistenceType = TopComponent.PERSISTENCE_NEVER,
|
||||
preferredID = "NiftyGuiVisual",
|
||||
position = 2000)
|
||||
@Messages("LBL_NiftyGui_VISUAL=Visual")
|
||||
public final class NiftyGuiVisualElement extends JPanel implements MultiViewElement {
|
||||
|
||||
public final class NiftyGuiVisualElement extends JPanel implements MultiViewElement , ExplorerManager.Provider,Observer, PropertyChangeListener {
|
||||
private static final Logger logger = Logger.getLogger(NiftyGuiVisualElement.class.getName());
|
||||
private NiftyGuiDataObject obj;
|
||||
private JToolBar toolbar = new JToolBar();
|
||||
private transient MultiViewElementCallback callback;
|
||||
@ -56,6 +88,11 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
||||
private final Nifty nifty;
|
||||
private final J2DNiftyView view;
|
||||
private final JComboBox layers = new JComboBox();
|
||||
private final ExplorerManager nodesManager;
|
||||
private final UndoRedo.Manager undoSupport;
|
||||
private int guiID;
|
||||
private final InstanceContent content = new InstanceContent();
|
||||
private Lookup lookup;
|
||||
|
||||
public NiftyGuiVisualElement(Lookup lkp) {
|
||||
obj = lkp.lookup(NiftyGuiDataObject.class);
|
||||
@ -67,14 +104,19 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
||||
this.scrollArea.setViewportView(view);
|
||||
TrasferHandling tranf = new TrasferHandling();
|
||||
PaletteDropTarget tmp = new PaletteDropTarget();
|
||||
editor = new GUIEditor();
|
||||
editor = obj.getLookup().lookup(GUIEditor.class);
|
||||
nodesManager = new ExplorerManager();
|
||||
nifty = view.getNifty();
|
||||
view.setTransferHandler(tranf);
|
||||
view.setDropTarget(tmp);
|
||||
editor.addObserver(view);
|
||||
editor.addObserver(tranf);
|
||||
editor.addObserver(tmp);
|
||||
// editor.addObserver(view);
|
||||
// editor.addObserver(tranf);
|
||||
this.obj.addPropertyChangeListener(this);
|
||||
this.createToolbar();
|
||||
this.undoSupport = new UndoRedo.Manager();
|
||||
CommandProcessor.getInstance().setUndoManager(undoSupport);
|
||||
this.content.set(Collections.singleton(obj.getNodeDelegate()), null);
|
||||
lookup = new AbstractLookup(content);
|
||||
}
|
||||
/**
|
||||
* Old code
|
||||
@ -84,6 +126,7 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
||||
toolbar.setPreferredSize(new Dimension(10000, 24));
|
||||
toolbar.setMaximumSize(new Dimension(10000, 24));
|
||||
toolbar.setFloatable(false);
|
||||
toolbar.add(new JLabel("Change Resolution"));
|
||||
JComboBox comboBox = new JComboBox(new String[]{"640x480", "480x800", "800x480", "800x600", "1024x768", "1280x720"});
|
||||
comboBox.addItemListener(new ItemListener() {
|
||||
|
||||
@ -108,6 +151,7 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
||||
});
|
||||
toolbar.add(comboBox);
|
||||
comboBox.setSelectedItem("800x600");
|
||||
toolbar.add(new JLabel("Current Layer"));
|
||||
layers.addItemListener(new ItemListener() {
|
||||
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
@ -156,71 +200,29 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
||||
|
||||
@Override
|
||||
public Lookup getLookup() {
|
||||
return obj.getLookup();
|
||||
return this.lookup ;
|
||||
}
|
||||
/**
|
||||
* Raw implementation , just to prototype the editor
|
||||
*/
|
||||
@Override
|
||||
public void componentOpened() {
|
||||
try {
|
||||
String path = this.obj.getPrimaryFile().getPath();
|
||||
ProjectAssetManager mgr = this.getLookup().lookup(ProjectAssetManager.class);
|
||||
String assetPath = mgr.getAssetFolder().getPath();
|
||||
this.editor.createNewGui(nifty,new File(path),new File(assetPath));
|
||||
Collection<GLayer> layers1 = this.editor.getGui().getLayers();
|
||||
DefaultComboBoxModel<GLayer> model = new DefaultComboBoxModel<GLayer>(layers1.toArray(new GLayer[0]));
|
||||
layers.setModel(model);
|
||||
layers.setSelectedItem(this.editor.getCurrentLayer());
|
||||
} catch (ParserConfigurationException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (JAXBException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (NoProductException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (SAXException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (Exception ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
loadGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentClosed() {
|
||||
|
||||
}
|
||||
/**
|
||||
* Raw implementation , just to prototype the editor
|
||||
*/
|
||||
@Override
|
||||
public void componentShowing() {
|
||||
try {
|
||||
String path = this.obj.getPrimaryFile().getPath();
|
||||
ProjectAssetManager mgr = this.getLookup().lookup(ProjectAssetManager.class);
|
||||
String assetPath = mgr.getAssetFolder().getPath();
|
||||
this.editor.createNewGui(nifty,new File(path),new File(assetPath));
|
||||
Collection<GLayer> layers1 = this.editor.getGui().getLayers();
|
||||
DefaultComboBoxModel<GLayer> model = new DefaultComboBoxModel<GLayer>(layers1.toArray(new GLayer[0]));
|
||||
layers.setModel(model);
|
||||
layers.setSelectedItem(this.editor.getCurrentLayer());
|
||||
} catch (ParserConfigurationException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (JAXBException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (NoProductException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (SAXException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (Exception ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
if(!this.obj.isModified()){
|
||||
return;
|
||||
}
|
||||
loadGui();
|
||||
|
||||
}
|
||||
/**
|
||||
@ -235,11 +237,21 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (JAXBException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (NullPointerException ex){
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentActivated() {
|
||||
try{
|
||||
GuiEditorModel model = (GuiEditorModel) CommandProcessor.getInstance().getObservable();
|
||||
model.setCurrentGUI(guiID);
|
||||
model.getCurrent().addObserver(this);
|
||||
CommandProcessor.getInstance().setUndoManager(undoSupport);
|
||||
}catch(java.lang.IllegalArgumentException ex){
|
||||
logger.log(Level.SEVERE,"Can't load your gui", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -248,7 +260,7 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
||||
|
||||
@Override
|
||||
public UndoRedo getUndoRedo() {
|
||||
return UndoRedo.NONE;
|
||||
return this.undoSupport;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -260,4 +272,136 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
|
||||
public CloseOperationState canCloseElement() {
|
||||
return CloseOperationState.STATE_OK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExplorerManager getExplorerManager() {
|
||||
return nodesManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
if(arg instanceof SelectionChanged ){
|
||||
SelectionChanged event = (SelectionChanged) arg;
|
||||
if(event.getNewSelection().isEmpty()){
|
||||
return;
|
||||
}
|
||||
GElement parent = event.getElement();
|
||||
GElementNode node = new GElementNode(parent);
|
||||
this.content.set(Collections.singleton(node), null);
|
||||
|
||||
}else if(o instanceof GUI){
|
||||
//Add a save. We don't add multible savable because they cointains the same
|
||||
//information about editing.
|
||||
GuiSavable savable = this.lookup.lookup(GuiSavable.class);
|
||||
if(savable == null){
|
||||
String path = this.obj.getPrimaryFile().getPath();
|
||||
final GuiSavable guiSavable = new NiftyGuiVisualElement.GuiSavable(((GUI)o),path);
|
||||
this.content.add(guiSavable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if(evt.getPropertyName().equals(DataObject.PROP_MODIFIED)){
|
||||
boolean old = (Boolean)evt.getOldValue();
|
||||
boolean nev = (Boolean)evt.getNewValue();
|
||||
if(old && !nev){
|
||||
this.loadGui();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void loadGui() {
|
||||
ProgressHandle handle = ProgressHandleFactory.createHandle("Loading the gui file");
|
||||
try {
|
||||
|
||||
InputStream is = this.obj.getPrimaryFile().getInputStream();
|
||||
handle.start();
|
||||
ProjectAssetManager mgr = this.obj.getLookup().lookup(ProjectAssetManager.class);
|
||||
String assetPath = mgr.getAssetFolder().getPath();
|
||||
this.editor.createNewGui(nifty,is,new File(assetPath));
|
||||
this.view.newGui(this.editor.getGui());
|
||||
nodesManager.setRootContext(new GUINode(this.editor.getGui()));
|
||||
this.editor.getGui().getSelection().addObserver(this);
|
||||
Collection<GLayer> layers1 = this.editor.getGui().getLayers();
|
||||
guiID = this.editor.getGui().getGUIid();
|
||||
this.editor.getGui().addObserver(this);
|
||||
DefaultComboBoxModel<GLayer> model = new DefaultComboBoxModel<GLayer>(layers1.toArray(new GLayer[0]));
|
||||
layers.setModel(model);
|
||||
layers.setSelectedItem(this.editor.getCurrentLayer());
|
||||
|
||||
handle.finish();
|
||||
} catch (ParserConfigurationException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (JAXBException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (NoProductException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (SAXException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (Exception ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}finally{
|
||||
handle.finish();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class GuiSavable extends AbstractSavable {
|
||||
private final GUI gui;
|
||||
|
||||
private final String filename;
|
||||
|
||||
public GuiSavable(GUI gui,String filename){
|
||||
|
||||
this.gui = gui;
|
||||
this.filename = filename;
|
||||
this.register();
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
protected String findDisplayName() {
|
||||
return "Save "+ this.gui + " changes";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleSave() throws IOException {
|
||||
try {
|
||||
GUIWriter writer = new GUIWriter(this.gui);
|
||||
writer.writeGUI(filename);
|
||||
NiftyGuiVisualElement.this.content.remove(this);
|
||||
|
||||
|
||||
} catch (FileNotFoundException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (JAXBException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj instanceof com.jme3.gde.gui.view.NiftyGuiVisualElement.GuiSavable){
|
||||
return this.gui.equals(((com.jme3.gde.gui.view.NiftyGuiVisualElement.GuiSavable)obj).gui);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.gui.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
}
|