UndoSupport, now the editor will reload the gui only if file is changed and some property editors. Also xml auto completition and XmlNavigator

experimental
relu91 10 years ago
parent f1071fd05b
commit ba848391dd
  1. BIN
      sdk/jme3-gui/release/modules/ext/Nifty-Editor0.5.9.jar
  2. 2
      sdk/jme3-gui/src/com/jme3/gde/gui/EmptyNiftyGui.xml
  3. 75
      sdk/jme3-gui/src/com/jme3/gde/gui/Navigator.java
  4. 3
      sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiDataObject.java
  5. 163
      sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiVisualElement.java
  6. 9
      sdk/jme3-gui/src/com/jme3/gde/gui/layer.xml
  7. 24
      sdk/jme3-gui/src/com/jme3/gde/gui/nodes/GElementNode.java
  8. 71
      sdk/jme3-gui/src/com/jme3/gde/gui/propertyeditors/ResourceEditor.java
  9. 59
      sdk/jme3-gui/src/com/jme3/gde/gui/propertyeditors/SizeEditor.java

@ -1,5 +1,5 @@
<?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">
<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 -->
<!-- +++++++++++++++++++++++++++++++++++++++ -->

@ -5,8 +5,15 @@
package com.jme3.gde.gui;
import com.jme3.gde.gui.nodes.GElementNode;
import com.jme3.gde.gui.nodes.GUINode;
import com.jme3.gde.gui.nodes.ScreenChildFactory;
import jada.ngeditor.controller.CommandProcessor;
import jada.ngeditor.controller.GUIEditor;
import jada.ngeditor.controller.commands.SelectCommand;
import jada.ngeditor.listeners.events.ReloadGuiEvent;
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;
@ -36,7 +43,7 @@ import org.openide.windows.TopComponent;
* @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, LookupListener{
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;
@ -51,6 +58,7 @@ public class Navigator extends javax.swing.JPanel implements NavigatorPanel,Expl
setLayout(new BorderLayout());
beanTreeView = new BeanTreeView();
add(beanTreeView, BorderLayout.CENTER);
CommandProcessor.getInstance().getObservable().addObserver(this);
}
@ -94,13 +102,7 @@ public class Navigator extends javax.swing.JPanel implements NavigatorPanel,Expl
@Override
public void panelActivated(Lookup context) {
try {
this.context = context;
context.lookupResult(NiftyGuiDataObject.class).addLookupListener(this);
intNavigator(context);
} catch (PropertyVetoException ex) {
Exceptions.printStackTrace(ex);
}
}
@Override
@ -120,11 +122,24 @@ public class Navigator extends javax.swing.JPanel implements NavigatorPanel,Expl
@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);
}
}
jada.ngeditor.listeners.actions.Action act = ( jada.ngeditor.listeners.actions.Action) arg;
if(act.getType() == jada.ngeditor.listeners.actions.Action.SEL){
if(arg instanceof SelectionChanged){
SelectionChanged event = (SelectionChanged) arg;
if(event.getNewSelection().isEmpty()){
return;
}
ArrayList<String> path = new ArrayList<String>();
GElement parent = act.getGUIElement();
GElement parent = ((SelectionChanged)arg).getElement();
while(parent!=null){
path.add(parent.getID());
parent = parent.getParent();
@ -138,12 +153,6 @@ public class Navigator extends javax.swing.JPanel implements NavigatorPanel,Expl
} catch (PropertyVetoException ex) {
Exceptions.printStackTrace(ex);
}
}else if(act.getType() == jada.ngeditor.listeners.actions.Action.NEW){
try {
this.intNavigator(context);
} catch (PropertyVetoException ex) {
Exceptions.printStackTrace(ex);
}
}
beanTreeView.updateUI();
}
@ -156,29 +165,31 @@ public class Navigator extends javax.swing.JPanel implements NavigatorPanel,Expl
AbstractNode firstSelected = (AbstractNode) newValue[0];
if (firstSelected instanceof GElementNode) {
GElement element = ((GElementNode) firstSelected).getGelement();
editor.selectElement(element);
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 {
lock = true;
CommandProcessor.getInstance().excuteCommand(command);
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
gui.getSelection().addObserver(this);
}
}
}
}
@Override
public void resultChanged(LookupEvent ev) {
try {
intNavigator(context);
} catch (PropertyVetoException ex) {
Exceptions.printStackTrace(ex);
}
}
private void intNavigator(Lookup context) throws PropertyVetoException {
private void intNavigator(GUI gui) throws PropertyVetoException {
NiftyGuiDataObject man = context.lookup(NiftyGuiDataObject.class);
ExplorerUtils.activateActions(mgr, true);
editor = man.getLookup().lookup(GUIEditor.class);
AbstractNode guiRoot = new AbstractNode(Children.create(new ScreenChildFactory(editor.getGui()), true));
AbstractNode guiRoot = new GUINode(gui);
guiRoot.setName("Gui");
this.mgr.setRootContext(guiRoot);
this.beanTreeView.updateUI();
@ -186,6 +197,6 @@ public class Navigator extends javax.swing.JPanel implements NavigatorPanel,Expl
this.mgr.setSelectedNodes(new Node[]{guiRoot});
Lookup lookup1 = ExplorerUtils.createLookup(mgr, getActionMap());
lookup = new ProxyLookup(lookup1);
editor.addObserver(this);
}
}

@ -5,6 +5,7 @@
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;
@ -96,7 +97,7 @@ public class NiftyGuiDataObject extends MultiDataObject {
super(pf, loader);
registerEditor("text/x-niftygui+xml", true);
findAssetManager();
this.getCookieSet().assign(GUIEditor.class,new GUIEditor());
this.getCookieSet().assign(GUIEditor.class, CommandProcessor.getInstance().getGuiEditor());
}
protected final void findAssetManager() {

@ -5,42 +5,40 @@
package com.jme3.gde.gui;
import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.gui.nodes.GUINode;
import com.jme3.gde.gui.palette.NiftyGUIPaletteFactory;
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.GuiEditorModel;
import jada.ngeditor.model.elements.GElement;
import jada.ngeditor.model.elements.GLayer;
import jada.ngeditor.model.exception.NoProductException;
import java.awt.Dimension;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
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.Observable;
import java.util.Observer;
import java.util.concurrent.Callable;
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.swing.text.AbstractDocument;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import org.netbeans.api.progress.ProgressHandle;
@ -48,20 +46,17 @@ 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.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
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",
@ -71,7 +66,7 @@ import org.xml.sax.SAXException;
preferredID = "NiftyGuiVisual",
position = 2000)
@Messages("LBL_NiftyGui_VISUAL=Visual")
public final class NiftyGuiVisualElement extends JPanel implements MultiViewElement , ExplorerManager.Provider,Observer {
public final class NiftyGuiVisualElement extends JPanel implements MultiViewElement , ExplorerManager.Provider,Observer, PropertyChangeListener {
private NiftyGuiDataObject obj;
private JToolBar toolbar = new JToolBar();
@ -81,6 +76,8 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
private final J2DNiftyView view;
private final JComboBox layers = new JComboBox();
private final ExplorerManager nodesManager;
private final UndoRedo.Manager undoSupport;
private int guiID;
public NiftyGuiVisualElement(Lookup lkp) {
@ -94,15 +91,16 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
TrasferHandling tranf = new TrasferHandling();
PaletteDropTarget tmp = new PaletteDropTarget();
editor = obj.getLookup().lookup(GUIEditor.class);
editor.addObserver(this);
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);
}
/**
* Old code
@ -112,6 +110,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() {
@ -136,6 +135,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) {
@ -191,74 +191,22 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
*/
@Override
public void componentOpened() {
try {
ProgressHandle handle = ProgressHandleFactory.createHandle("Loading the gui file");
String path = this.obj.getPrimaryFile().getPath();
ProjectAssetManager mgr = obj.getLookup().lookup(ProjectAssetManager.class);
String assetPath = mgr.getAssetFolder().getPath();
handle.progress(50);
this.editor.createNewGui(nifty,new File(path),new File(assetPath));
nodesManager.setRootContext(new GUINode(this.editor.getGui()));
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());
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);
}
loadGui();
}
@Override
public void componentClosed() {
}
/**
* Raw implementation , just to prototype the editor
*/
@Override
public void componentShowing() {
try {
ProgressHandle handle = ProgressHandleFactory.createHandle("Loading the gui file");
String path = this.obj.getPrimaryFile().getPath();
ProjectAssetManager mgr = this.obj.getLookup().lookup(ProjectAssetManager.class);
String assetPath = mgr.getAssetFolder().getPath();
this.editor.createNewGui(nifty,new File(path),new File(assetPath));
nodesManager.setRootContext(new GUINode(this.editor.getGui()));
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());
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);
if(!this.obj.isModified()){
return;
}
loadGui();
}
/**
@ -273,11 +221,16 @@ 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() {
GuiEditorModel model = (GuiEditorModel) CommandProcessor.getInstance().getObservable();
model.setCurrentGUI(guiID);
CommandProcessor.getInstance().setUndoManager(undoSupport);
}
@Override
@ -286,7 +239,7 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
@Override
public UndoRedo getUndoRedo() {
return UndoRedo.NONE;
return this.undoSupport;
}
@Override
@ -306,10 +259,13 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
@Override
public void update(Observable o, Object arg) {
jada.ngeditor.listeners.actions.Action act = ( jada.ngeditor.listeners.actions.Action) arg;
if(act.getType() == jada.ngeditor.listeners.actions.Action.SEL){
if(arg instanceof SelectionChanged ){
SelectionChanged event = (SelectionChanged) arg;
if(event.getNewSelection().isEmpty()){
return;
}
ArrayList<String> path = new ArrayList<String>();
GElement parent = act.getGUIElement();
GElement parent = event.getElement();
while(parent!=null){
path.add(parent.getID());
parent = parent.getParent();
@ -329,4 +285,51 @@ public final class NiftyGuiVisualElement extends JPanel implements MultiViewElem
}
}
}
@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() {
try {
ProgressHandle handle = ProgressHandleFactory.createHandle("Loading the gui file");
InputStream is = this.obj.getPrimaryFile().getInputStream();
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();
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);
}
}
}

@ -7,4 +7,13 @@
</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>

@ -4,6 +4,8 @@
*/
package com.jme3.gde.gui.nodes;
import com.jme3.gde.gui.propertyeditors.ResourceEditor;
import com.jme3.gde.gui.propertyeditors.SizeEditor;
import jada.ngeditor.model.elements.GElement;
import java.beans.PropertyEditor;
import java.lang.reflect.InvocationTargetException;
@ -12,6 +14,8 @@ import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.nodes.Sheet;
import sun.beans.editors.BoolEditor;
import sun.beans.editors.BooleanEditor;
/**
*
@ -46,16 +50,28 @@ public class GElementNode extends AbstractNode{
set.setName("Element Properties");
set.setShortDescription("You can set element properties");
for(Entry<String,String> pair : this.element.listAttributes().entrySet()){
set.put(new ElementAttributeProperty(element,pair.getKey()));
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")){
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);
@ -81,9 +97,13 @@ public class GElementNode extends AbstractNode{
return true;
}
public void setPropertyEditor(PropertyEditor editor){
this.editor = editor;
}
@Override
public PropertyEditor getPropertyEditor() {
return super.getPropertyEditor(); //To change body of generated methods, choose Tools | Templates.
return this.editor; //To change body of generated methods, choose Tools | Templates.
}

@ -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());
}
}
Loading…
Cancel
Save