UndoSupport, now the editor will reload the gui only if file is changed and some property editors. Also xml auto completition and XmlNavigator
parent
f1071fd05b
commit
ba848391dd
Binary file not shown.
@ -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…
Reference in new issue