parent
ba848391dd
commit
81ba23a2e2
@ -1,9 +1,9 @@ |
|||||||
file.reference.swingtonifty.jar=release/modules/ext/swingtonifty.jar |
file.reference.swingtonifty.jar=release/modules/ext/swingtonifty.jar |
||||||
#Thu, 25 Aug 2011 20:26:49 +0200 |
#Thu, 25 Aug 2011 20:26:49 +0200 |
||||||
javac.source=1.6 |
javac.source=1.6 |
||||||
javac.compilerargs=-Xlint -Xlint:-serial |
javac.compilerargs=-Xlint -Xlint:-serial |
||||||
license.file=../license-jme.txt |
license.file=../license-jme.txt |
||||||
nbm.homepage=http://www.jmonkeyengine.com |
nbm.homepage=http://www.jmonkeyengine.com |
||||||
nbm.module.author=Normen Hansen,Cristiano Aguzzi |
nbm.module.author=Normen Hansen,Cristiano Aguzzi |
||||||
nbm.needs.restart=true |
nbm.needs.restart=true |
||||||
spec.version.base=3.1.5 |
spec.version.base=3.2 |
||||||
|
Binary file not shown.
@ -1,202 +1,200 @@ |
|||||||
/* |
/* |
||||||
* To change this template, choose Tools | Templates |
* To change this template, choose Tools | Templates |
||||||
* and open the template in the editor. |
* and open the template in the editor. |
||||||
*/ |
*/ |
||||||
package com.jme3.gde.gui; |
package com.jme3.gde.gui; |
||||||
|
|
||||||
import com.jme3.gde.gui.nodes.GElementNode; |
import com.jme3.gde.gui.nodes.GElementNode; |
||||||
import com.jme3.gde.gui.nodes.GUINode; |
import com.jme3.gde.gui.nodes.GUINode; |
||||||
import com.jme3.gde.gui.nodes.ScreenChildFactory; |
import jada.ngeditor.controller.CommandProcessor; |
||||||
import jada.ngeditor.controller.CommandProcessor; |
import jada.ngeditor.controller.GUIEditor; |
||||||
import jada.ngeditor.controller.GUIEditor; |
import jada.ngeditor.controller.commands.SelectCommand; |
||||||
import jada.ngeditor.controller.commands.SelectCommand; |
import jada.ngeditor.listeners.events.SelectionChanged; |
||||||
import jada.ngeditor.listeners.events.ReloadGuiEvent; |
import jada.ngeditor.model.GUI; |
||||||
import jada.ngeditor.listeners.events.SelectionChanged; |
import jada.ngeditor.model.GuiEditorModel; |
||||||
import jada.ngeditor.model.GUI; |
import jada.ngeditor.model.elements.GElement; |
||||||
import jada.ngeditor.model.GuiEditorModel; |
import java.awt.BorderLayout; |
||||||
import jada.ngeditor.model.elements.GElement; |
import java.beans.PropertyChangeEvent; |
||||||
import java.awt.BorderLayout; |
import java.beans.PropertyChangeListener; |
||||||
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyVetoException; |
||||||
import java.beans.PropertyChangeListener; |
import java.util.ArrayList; |
||||||
import java.beans.PropertyVetoException; |
import java.util.Observable; |
||||||
import java.util.ArrayList; |
import java.util.Observer; |
||||||
import java.util.Observable; |
import javax.swing.JComponent; |
||||||
import java.util.Observer; |
import org.netbeans.spi.navigator.NavigatorPanel; |
||||||
import javax.swing.JComponent; |
import org.openide.explorer.ExplorerManager; |
||||||
import org.netbeans.spi.navigator.NavigatorPanel; |
import org.openide.explorer.ExplorerUtils; |
||||||
import org.openide.explorer.ExplorerManager; |
import org.openide.explorer.view.BeanTreeView; |
||||||
import org.openide.explorer.ExplorerUtils; |
import org.openide.nodes.AbstractNode; |
||||||
import org.openide.explorer.view.BeanTreeView; |
import org.openide.nodes.Node; |
||||||
import org.openide.nodes.AbstractNode; |
import org.openide.util.Exceptions; |
||||||
import org.openide.nodes.Children; |
import org.openide.util.Lookup; |
||||||
import org.openide.nodes.Node; |
import org.openide.util.lookup.ProxyLookup; |
||||||
import org.openide.util.Exceptions; |
|
||||||
import org.openide.util.Lookup; |
/** |
||||||
import org.openide.util.LookupEvent; |
* |
||||||
import org.openide.util.LookupListener; |
* @author cris |
||||||
import org.openide.util.Utilities; |
*/ |
||||||
import org.openide.util.lookup.ProxyLookup; |
@NavigatorPanel.Registration(mimeType = "text/x-niftygui+xml", displayName="Gui View") |
||||||
import org.openide.windows.TopComponent; |
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; |
||||||
* @author cris |
/** |
||||||
*/ |
* Creates new form Navigator |
||||||
@NavigatorPanel.Registration(mimeType = "text/x-niftygui+xml", displayName="Gui View") |
*/ |
||||||
public class Navigator extends javax.swing.JPanel implements NavigatorPanel,ExplorerManager.Provider , Observer, PropertyChangeListener{ |
public Navigator() { |
||||||
private Lookup lookup; |
initComponents(); |
||||||
private ExplorerManager mgr = new ExplorerManager(); |
setLayout(new BorderLayout()); |
||||||
private final BeanTreeView beanTreeView; |
beanTreeView = new BeanTreeView(); |
||||||
private GUIEditor editor; |
add(beanTreeView, BorderLayout.CENTER); |
||||||
private Lookup context; |
final GuiEditorModel model = (GuiEditorModel) CommandProcessor.getInstance().getObservable(); |
||||||
private boolean lock; |
model.addObserver(this); |
||||||
/** |
if(model.getCurrent() != null){ |
||||||
* Creates new form Navigator |
try { |
||||||
*/ |
this.intNavigator(model.getCurrent()); |
||||||
public Navigator() { |
} catch (PropertyVetoException ex) { |
||||||
initComponents(); |
Exceptions.printStackTrace(ex); |
||||||
setLayout(new BorderLayout()); |
} |
||||||
beanTreeView = new BeanTreeView(); |
} |
||||||
add(beanTreeView, BorderLayout.CENTER); |
|
||||||
CommandProcessor.getInstance().getObservable().addObserver(this); |
|
||||||
|
} |
||||||
} |
|
||||||
|
/** |
||||||
/** |
* This method is called from within the constructor to initialize the form. |
||||||
* 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 |
||||||
* WARNING: Do NOT modify this code. The content of this method is always |
* regenerated by the Form Editor. |
||||||
* regenerated by the Form Editor. |
*/ |
||||||
*/ |
@SuppressWarnings("unchecked") |
||||||
@SuppressWarnings("unchecked") |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
private void initComponents() { |
||||||
private void initComponents() { |
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
this.setLayout(layout); |
||||||
this.setLayout(layout); |
layout.setHorizontalGroup( |
||||||
layout.setHorizontalGroup( |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
.addGap(0, 244, Short.MAX_VALUE) |
||||||
.addGap(0, 244, Short.MAX_VALUE) |
); |
||||||
); |
layout.setVerticalGroup( |
||||||
layout.setVerticalGroup( |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
.addGap(0, 274, Short.MAX_VALUE) |
||||||
.addGap(0, 274, Short.MAX_VALUE) |
); |
||||||
); |
}// </editor-fold>//GEN-END:initComponents
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
|
@Override |
||||||
@Override |
public String getDisplayName() { |
||||||
public String getDisplayName() { |
return "GuiView"; |
||||||
return "GuiView"; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public String getDisplayHint() { |
||||||
public String getDisplayHint() { |
return "Easy view for your gui"; |
||||||
return "Easy view for your gui"; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public JComponent getComponent() { |
||||||
public JComponent getComponent() { |
return this; |
||||||
return this; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public void panelActivated(Lookup context) { |
||||||
public void panelActivated(Lookup context) { |
|
||||||
|
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public void panelDeactivated() { |
||||||
public void panelDeactivated() { |
ExplorerUtils.activateActions(mgr, false); |
||||||
ExplorerUtils.activateActions(mgr, false); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public Lookup getLookup() { |
||||||
public Lookup getLookup() { |
return lookup; |
||||||
return lookup; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public ExplorerManager getExplorerManager() { |
||||||
public ExplorerManager getExplorerManager() { |
return mgr; |
||||||
return mgr; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public void update(Observable o, Object arg) { |
||||||
public void update(Observable o, Object arg) { |
if(o instanceof GuiEditorModel){ |
||||||
if(o instanceof GuiEditorModel){ |
try { |
||||||
try { |
GuiEditorModel model = (GuiEditorModel) o; |
||||||
GuiEditorModel model = (GuiEditorModel) o; |
model.getCurrent().addObserver(this); |
||||||
model.getCurrent().addObserver(this); |
model.getCurrent().getSelection().addObserver(this); |
||||||
model.getCurrent().getSelection().addObserver(this); |
this.intNavigator(model.getCurrent()); |
||||||
this.intNavigator(model.getCurrent()); |
} catch (PropertyVetoException ex) { |
||||||
} catch (PropertyVetoException ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} |
||||||
} |
} |
||||||
} |
|
||||||
|
if(arg instanceof SelectionChanged){ |
||||||
if(arg instanceof SelectionChanged){ |
SelectionChanged event = (SelectionChanged) arg; |
||||||
SelectionChanged event = (SelectionChanged) arg; |
if(event.getNewSelection().isEmpty()){ |
||||||
if(event.getNewSelection().isEmpty()){ |
return; |
||||||
return; |
} |
||||||
} |
ArrayList<String> path = new ArrayList<String>(); |
||||||
ArrayList<String> path = new ArrayList<String>(); |
GElement parent = ((SelectionChanged)arg).getElement(); |
||||||
GElement parent = ((SelectionChanged)arg).getElement(); |
while(parent!=null){ |
||||||
while(parent!=null){ |
path.add(parent.getID()); |
||||||
path.add(parent.getID()); |
parent = parent.getParent(); |
||||||
parent = parent.getParent(); |
} |
||||||
} |
Node result = mgr.getRootContext(); |
||||||
Node result = mgr.getRootContext(); |
for(int i=path.size()-1;i>=0;i--){ |
||||||
for(int i=path.size()-1;i>=0;i--){ |
result = result.getChildren().findChild(path.get(i)); |
||||||
result = result.getChildren().findChild(path.get(i)); |
} |
||||||
} |
try { |
||||||
try { |
mgr.setSelectedNodes(new Node[]{result}); |
||||||
mgr.setSelectedNodes(new Node[]{result}); |
} catch (PropertyVetoException ex) { |
||||||
} catch (PropertyVetoException ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} |
||||||
} |
} |
||||||
} |
beanTreeView.updateUI(); |
||||||
beanTreeView.updateUI(); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
||||||
public void propertyChange(PropertyChangeEvent evt) { |
if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { |
||||||
if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { |
Node[] newValue = (Node[]) evt.getNewValue(); |
||||||
Node[] newValue = (Node[]) evt.getNewValue(); |
if (newValue.length > 0) { |
||||||
if (newValue.length > 0) { |
AbstractNode firstSelected = (AbstractNode) newValue[0]; |
||||||
AbstractNode firstSelected = (AbstractNode) newValue[0]; |
if (firstSelected instanceof GElementNode) { |
||||||
if (firstSelected instanceof GElementNode) { |
GElement element = ((GElementNode) firstSelected).getGelement(); |
||||||
GElement element = ((GElementNode) firstSelected).getGelement(); |
GUI gui = ((GUINode)mgr.getRootContext()).getGui(); |
||||||
GUI gui = ((GUINode)mgr.getRootContext()).getGui(); |
gui.getSelection().deleteObserver(this); // I don't wont to get notified about this selection change
|
||||||
gui.getSelection().deleteObserver(this); // I don't wont to get notified about this selection change
|
SelectCommand command = CommandProcessor.getInstance().getCommand(SelectCommand.class); |
||||||
SelectCommand command = CommandProcessor.getInstance().getCommand(SelectCommand.class); |
command.setElement(element); |
||||||
command.setElement(element); |
try { |
||||||
try { |
CommandProcessor.getInstance().excuteCommand(command); |
||||||
lock = true; |
} catch (Exception ex) { |
||||||
CommandProcessor.getInstance().excuteCommand(command); |
Exceptions.printStackTrace(ex); |
||||||
} catch (Exception ex) { |
} |
||||||
Exceptions.printStackTrace(ex); |
gui.getSelection().addObserver(this); |
||||||
} |
|
||||||
gui.getSelection().addObserver(this); |
} |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
} |
|
||||||
} |
|
||||||
|
private void intNavigator(GUI gui) throws PropertyVetoException { |
||||||
|
|
||||||
private void intNavigator(GUI gui) throws PropertyVetoException { |
|
||||||
|
ExplorerUtils.activateActions(mgr, true); |
||||||
|
|
||||||
ExplorerUtils.activateActions(mgr, true); |
|
||||||
|
AbstractNode guiRoot = new GUINode(gui); |
||||||
|
guiRoot.setName("Gui"); |
||||||
AbstractNode guiRoot = new GUINode(gui); |
this.mgr.setRootContext(guiRoot); |
||||||
guiRoot.setName("Gui"); |
this.beanTreeView.updateUI(); |
||||||
this.mgr.setRootContext(guiRoot); |
mgr.addPropertyChangeListener(this); |
||||||
this.beanTreeView.updateUI(); |
this.mgr.setSelectedNodes(new Node[]{guiRoot}); |
||||||
mgr.addPropertyChangeListener(this); |
Lookup lookup1 = ExplorerUtils.createLookup(mgr, getActionMap()); |
||||||
this.mgr.setSelectedNodes(new Node[]{guiRoot}); |
lookup = new ProxyLookup(lookup1); |
||||||
Lookup lookup1 = ExplorerUtils.createLookup(mgr, getActionMap()); |
|
||||||
lookup = new ProxyLookup(lookup1); |
} |
||||||
|
} |
||||||
} |
|
||||||
} |
|
||||||
|
@ -1,335 +1,334 @@ |
|||||||
/* |
/* |
||||||
* To change this template, choose Tools | Templates |
* To change this template, choose Tools | Templates |
||||||
* and open the template in the editor. |
* and open the template in the editor. |
||||||
*/ |
*/ |
||||||
package com.jme3.gde.gui; |
package com.jme3.gde.gui; |
||||||
|
|
||||||
import com.jme3.gde.core.assets.ProjectAssetManager; |
import com.jme3.app.Application; |
||||||
import com.jme3.gde.gui.nodes.GUINode; |
import com.jme3.gde.core.assets.ProjectAssetManager; |
||||||
import de.lessvoid.nifty.Nifty; |
import com.jme3.gde.gui.nodes.GElementNode; |
||||||
import jada.ngeditor.controller.CommandProcessor; |
import com.jme3.gde.gui.nodes.GUINode; |
||||||
import jada.ngeditor.controller.GUIEditor; |
import de.lessvoid.nifty.Nifty; |
||||||
import jada.ngeditor.guiviews.DND.PaletteDropTarget; |
import jada.ngeditor.controller.CommandProcessor; |
||||||
import jada.ngeditor.guiviews.DND.TrasferHandling; |
import jada.ngeditor.controller.GUIEditor; |
||||||
import jada.ngeditor.guiviews.J2DNiftyView; |
import jada.ngeditor.guiviews.DND.PaletteDropTarget; |
||||||
import jada.ngeditor.listeners.events.SelectionChanged; |
import jada.ngeditor.guiviews.DND.TrasferHandling; |
||||||
import jada.ngeditor.model.GuiEditorModel; |
import jada.ngeditor.guiviews.J2DNiftyView; |
||||||
import jada.ngeditor.model.elements.GElement; |
import jada.ngeditor.listeners.events.SelectionChanged; |
||||||
import jada.ngeditor.model.elements.GLayer; |
import jada.ngeditor.model.GuiEditorModel; |
||||||
import jada.ngeditor.model.exception.NoProductException; |
import jada.ngeditor.model.elements.GElement; |
||||||
import java.awt.Dimension; |
import jada.ngeditor.model.elements.GLayer; |
||||||
import java.awt.event.ItemEvent; |
import jada.ngeditor.model.exception.NoProductException; |
||||||
import java.awt.event.ItemListener; |
import java.awt.Dimension; |
||||||
import java.beans.PropertyChangeEvent; |
import java.awt.event.ItemEvent; |
||||||
import java.beans.PropertyChangeListener; |
import java.awt.event.ItemListener; |
||||||
import java.beans.PropertyVetoException; |
import java.beans.PropertyChangeEvent; |
||||||
import java.io.File; |
import java.beans.PropertyChangeListener; |
||||||
import java.io.FileNotFoundException; |
import java.beans.PropertyVetoException; |
||||||
import java.io.IOException; |
import java.io.File; |
||||||
import java.io.InputStream; |
import java.io.FileNotFoundException; |
||||||
import java.util.ArrayList; |
import java.io.IOException; |
||||||
import java.util.Collection; |
import java.io.InputStream; |
||||||
import java.util.Observable; |
import java.util.ArrayList; |
||||||
import java.util.Observer; |
import java.util.Collection; |
||||||
import javax.swing.Action; |
import java.util.Collections; |
||||||
import javax.swing.ActionMap; |
import java.util.Observable; |
||||||
import javax.swing.DefaultComboBoxModel; |
import java.util.Observer; |
||||||
import javax.swing.JComboBox; |
import java.util.logging.Level; |
||||||
import javax.swing.JComponent; |
import java.util.logging.Logger; |
||||||
import javax.swing.JLabel; |
import javax.swing.Action; |
||||||
import javax.swing.JPanel; |
import javax.swing.ActionMap; |
||||||
import javax.swing.JToolBar; |
import javax.swing.DefaultComboBoxModel; |
||||||
import javax.xml.bind.JAXBException; |
import javax.swing.JComboBox; |
||||||
import javax.xml.parsers.ParserConfigurationException; |
import javax.swing.JComponent; |
||||||
import org.netbeans.api.progress.ProgressHandle; |
import javax.swing.JLabel; |
||||||
import org.netbeans.api.progress.ProgressHandleFactory; |
import javax.swing.JPanel; |
||||||
import org.netbeans.core.spi.multiview.CloseOperationState; |
import javax.swing.JToolBar; |
||||||
import org.netbeans.core.spi.multiview.MultiViewElement; |
import javax.xml.bind.JAXBException; |
||||||
import org.netbeans.core.spi.multiview.MultiViewElementCallback; |
import javax.xml.parsers.ParserConfigurationException; |
||||||
import org.openide.awt.UndoRedo; |
import org.netbeans.api.progress.ProgressHandle; |
||||||
import org.openide.explorer.ExplorerManager; |
import org.netbeans.api.progress.ProgressHandleFactory; |
||||||
import org.openide.explorer.ExplorerUtils; |
import org.netbeans.core.spi.multiview.CloseOperationState; |
||||||
import org.openide.loaders.DataObject; |
import org.netbeans.core.spi.multiview.MultiViewElement; |
||||||
import org.openide.nodes.Node; |
import org.netbeans.core.spi.multiview.MultiViewElementCallback; |
||||||
import org.openide.util.Exceptions; |
import org.openide.awt.UndoRedo; |
||||||
import org.openide.util.Lookup; |
import org.openide.explorer.ExplorerManager; |
||||||
import org.openide.util.NbBundle.Messages; |
import org.openide.explorer.ExplorerUtils; |
||||||
import org.openide.windows.TopComponent; |
import org.openide.loaders.DataObject; |
||||||
import org.xml.sax.SAXException; |
import org.openide.nodes.Node; |
||||||
import sun.rmi.runtime.Log; |
import org.openide.util.Exceptions; |
||||||
|
import org.openide.util.Lookup; |
||||||
@MultiViewElement.Registration( |
import org.openide.util.NbBundle.Messages; |
||||||
displayName = "#LBL_NiftyGui_VISUAL", |
import org.openide.util.lookup.AbstractLookup; |
||||||
iconBase = "com/jme3/gde/gui/Computer_File_043.gif", |
import org.openide.util.lookup.InstanceContent; |
||||||
mimeType = "text/x-niftygui+xml", |
import org.openide.util.lookup.ProxyLookup; |
||||||
persistenceType = TopComponent.PERSISTENCE_NEVER, |
import org.openide.windows.TopComponent; |
||||||
preferredID = "NiftyGuiVisual", |
import org.xml.sax.SAXException; |
||||||
position = 2000) |
import sun.rmi.runtime.Log; |
||||||
@Messages("LBL_NiftyGui_VISUAL=Visual") |
|
||||||
public final class NiftyGuiVisualElement extends JPanel implements MultiViewElement , ExplorerManager.Provider,Observer, PropertyChangeListener { |
@MultiViewElement.Registration( |
||||||
|
displayName = "#LBL_NiftyGui_VISUAL", |
||||||
private NiftyGuiDataObject obj; |
iconBase = "com/jme3/gde/gui/Computer_File_043.gif", |
||||||
private JToolBar toolbar = new JToolBar(); |
mimeType = "text/x-niftygui+xml", |
||||||
private transient MultiViewElementCallback callback; |
persistenceType = TopComponent.PERSISTENCE_NEVER, |
||||||
private GUIEditor editor; |
preferredID = "NiftyGuiVisual", |
||||||
private final Nifty nifty; |
position = 2000) |
||||||
private final J2DNiftyView view; |
@Messages("LBL_NiftyGui_VISUAL=Visual") |
||||||
private final JComboBox layers = new JComboBox(); |
public final class NiftyGuiVisualElement extends JPanel implements MultiViewElement , ExplorerManager.Provider,Observer, PropertyChangeListener { |
||||||
private final ExplorerManager nodesManager; |
private static final Logger logger = Logger.getLogger(NiftyGuiVisualElement.class.getName()); |
||||||
private final UndoRedo.Manager undoSupport; |
private NiftyGuiDataObject obj; |
||||||
private int guiID; |
private JToolBar toolbar = new JToolBar(); |
||||||
|
private transient MultiViewElementCallback callback; |
||||||
|
private GUIEditor editor; |
||||||
public NiftyGuiVisualElement(Lookup lkp) { |
private final Nifty nifty; |
||||||
obj = lkp.lookup(NiftyGuiDataObject.class); |
private final J2DNiftyView view; |
||||||
assert obj != null; |
private final JComboBox layers = new JComboBox(); |
||||||
initComponents(); |
private final ExplorerManager nodesManager; |
||||||
view = new J2DNiftyView(800, 600); |
private final UndoRedo.Manager undoSupport; |
||||||
view.init(); |
private int guiID; |
||||||
this.scrollArea.getViewport().addChangeListener(view); |
private final InstanceContent content = new InstanceContent(); |
||||||
this.scrollArea.setViewportView(view); |
private Lookup lookup; |
||||||
TrasferHandling tranf = new TrasferHandling(); |
|
||||||
PaletteDropTarget tmp = new PaletteDropTarget(); |
public NiftyGuiVisualElement(Lookup lkp) { |
||||||
editor = obj.getLookup().lookup(GUIEditor.class); |
obj = lkp.lookup(NiftyGuiDataObject.class); |
||||||
nodesManager = new ExplorerManager(); |
assert obj != null; |
||||||
nifty = view.getNifty(); |
initComponents(); |
||||||
view.setTransferHandler(tranf); |
view = new J2DNiftyView(800, 600); |
||||||
view.setDropTarget(tmp); |
view.init(); |
||||||
// editor.addObserver(view);
|
this.scrollArea.getViewport().addChangeListener(view); |
||||||
// editor.addObserver(tranf);
|
this.scrollArea.setViewportView(view); |
||||||
this.obj.addPropertyChangeListener(this); |
TrasferHandling tranf = new TrasferHandling(); |
||||||
this.createToolbar(); |
PaletteDropTarget tmp = new PaletteDropTarget(); |
||||||
this.undoSupport = new UndoRedo.Manager(); |
editor = obj.getLookup().lookup(GUIEditor.class); |
||||||
CommandProcessor.getInstance().setUndoManager(undoSupport); |
nodesManager = new ExplorerManager(); |
||||||
} |
nifty = view.getNifty(); |
||||||
/** |
view.setTransferHandler(tranf); |
||||||
* Old code |
view.setDropTarget(tmp); |
||||||
* @author normenhansen |
// editor.addObserver(view);
|
||||||
*/ |
// editor.addObserver(tranf);
|
||||||
private void createToolbar() { |
this.obj.addPropertyChangeListener(this); |
||||||
toolbar.setPreferredSize(new Dimension(10000, 24)); |
this.createToolbar(); |
||||||
toolbar.setMaximumSize(new Dimension(10000, 24)); |
this.undoSupport = new UndoRedo.Manager(); |
||||||
toolbar.setFloatable(false); |
CommandProcessor.getInstance().setUndoManager(undoSupport); |
||||||
toolbar.add(new JLabel("Change Resolution")); |
this.content.set(Collections.singleton(obj.getNodeDelegate()), null); |
||||||
JComboBox comboBox = new JComboBox(new String[]{"640x480", "480x800", "800x480", "800x600", "1024x768", "1280x720"}); |
lookup = new AbstractLookup(content); |
||||||
comboBox.addItemListener(new ItemListener() { |
} |
||||||
|
/** |
||||||
public void itemStateChanged(ItemEvent e) { |
* Old code |
||||||
String string = (String) e.getItem(); |
* @author normenhansen |
||||||
if ("640x480".equals(string)) { |
*/ |
||||||
view.setResoltion(640, 480); |
private void createToolbar() { |
||||||
} else if ("1024x768".equals(string)) { |
toolbar.setPreferredSize(new Dimension(10000, 24)); |
||||||
view.setResoltion(1024, 768); |
toolbar.setMaximumSize(new Dimension(10000, 24)); |
||||||
} else if ("1280x720".equals(string)) { |
toolbar.setFloatable(false); |
||||||
view.setResoltion(1280, 720); |
toolbar.add(new JLabel("Change Resolution")); |
||||||
} else if ("800x600".equals(string)) { |
JComboBox comboBox = new JComboBox(new String[]{"640x480", "480x800", "800x480", "800x600", "1024x768", "1280x720"}); |
||||||
view.setResoltion(800, 600); |
comboBox.addItemListener(new ItemListener() { |
||||||
} else if ("800x480".equals(string)) { |
|
||||||
view.setResoltion(800, 480); |
public void itemStateChanged(ItemEvent e) { |
||||||
} else if ("480x800".equals(string)) { |
String string = (String) e.getItem(); |
||||||
view.setResoltion(480, 800); |
if ("640x480".equals(string)) { |
||||||
} else { |
view.setResoltion(640, 480); |
||||||
view.setResoltion(800, 600); |
} else if ("1024x768".equals(string)) { |
||||||
} |
view.setResoltion(1024, 768); |
||||||
} |
} else if ("1280x720".equals(string)) { |
||||||
}); |
view.setResoltion(1280, 720); |
||||||
toolbar.add(comboBox); |
} else if ("800x600".equals(string)) { |
||||||
comboBox.setSelectedItem("800x600"); |
view.setResoltion(800, 600); |
||||||
toolbar.add(new JLabel("Current Layer")); |
} else if ("800x480".equals(string)) { |
||||||
layers.addItemListener(new ItemListener() { |
view.setResoltion(800, 480); |
||||||
|
} else if ("480x800".equals(string)) { |
||||||
public void itemStateChanged(ItemEvent e) { |
view.setResoltion(480, 800); |
||||||
GLayer item = (GLayer) e.getItem(); |
} else { |
||||||
editor.selectElement(item); |
view.setResoltion(800, 600); |
||||||
} |
} |
||||||
}); |
} |
||||||
toolbar.add(layers); |
}); |
||||||
} |
toolbar.add(comboBox); |
||||||
@Override |
comboBox.setSelectedItem("800x600"); |
||||||
public String getName() { |
toolbar.add(new JLabel("Current Layer")); |
||||||
return "NiftyGuiVisualElement"; |
layers.addItemListener(new ItemListener() { |
||||||
} |
|
||||||
|
public void itemStateChanged(ItemEvent e) { |
||||||
/** |
GLayer item = (GLayer) e.getItem(); |
||||||
* This method is called from within the constructor to initialize the form. |
editor.selectElement(item); |
||||||
* WARNING: Do NOT modify this code. The content of this method is always |
} |
||||||
* regenerated by the Form Editor. |
}); |
||||||
*/ |
toolbar.add(layers); |
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
} |
||||||
private void initComponents() { |
@Override |
||||||
|
public String getName() { |
||||||
scrollArea = new javax.swing.JScrollPane(); |
return "NiftyGuiVisualElement"; |
||||||
|
} |
||||||
setLayout(new java.awt.BorderLayout()); |
|
||||||
add(scrollArea, java.awt.BorderLayout.CENTER); |
/** |
||||||
}// </editor-fold>//GEN-END:initComponents
|
* 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 |
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
* regenerated by the Form Editor. |
||||||
private javax.swing.JScrollPane scrollArea; |
*/ |
||||||
// End of variables declaration//GEN-END:variables
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
@Override |
private void initComponents() { |
||||||
public JComponent getVisualRepresentation() { |
|
||||||
return this; |
scrollArea = new javax.swing.JScrollPane(); |
||||||
} |
|
||||||
|
setLayout(new java.awt.BorderLayout()); |
||||||
@Override |
add(scrollArea, java.awt.BorderLayout.CENTER); |
||||||
public JComponent getToolbarRepresentation() { |
}// </editor-fold>//GEN-END:initComponents
|
||||||
return toolbar; |
|
||||||
} |
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JScrollPane scrollArea; |
||||||
@Override |
// End of variables declaration//GEN-END:variables
|
||||||
public Action[] getActions() { |
@Override |
||||||
return new Action[0]; |
public JComponent getVisualRepresentation() { |
||||||
} |
return this; |
||||||
|
} |
||||||
@Override |
|
||||||
public Lookup getLookup() { |
@Override |
||||||
return ExplorerUtils.createLookup(nodesManager, new ActionMap()); |
public JComponent getToolbarRepresentation() { |
||||||
} |
return toolbar; |
||||||
/** |
} |
||||||
* Raw implementation , just to prototype the editor |
|
||||||
*/ |
@Override |
||||||
@Override |
public Action[] getActions() { |
||||||
public void componentOpened() { |
return new Action[0]; |
||||||
loadGui(); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public Lookup getLookup() { |
||||||
public void componentClosed() { |
return this.lookup ; |
||||||
|
} |
||||||
} |
/** |
||||||
/** |
* Raw implementation , just to prototype the editor |
||||||
* Raw implementation , just to prototype the editor |
*/ |
||||||
*/ |
@Override |
||||||
@Override |
public void componentOpened() { |
||||||
public void componentShowing() { |
loadGui(); |
||||||
if(!this.obj.isModified()){ |
} |
||||||
return; |
|
||||||
} |
@Override |
||||||
loadGui(); |
public void componentClosed() { |
||||||
|
|
||||||
} |
} |
||||||
/** |
/** |
||||||
* Raw implementation , just to prototype the editor |
* Raw implementation , just to prototype the editor |
||||||
*/ |
*/ |
||||||
@Override |
@Override |
||||||
public void componentHidden() { |
public void componentShowing() { |
||||||
String path = this.obj.getPrimaryFile().getPath(); |
if(!this.obj.isModified()){ |
||||||
try { |
return; |
||||||
this.editor.saveGui(path); |
} |
||||||
} catch (FileNotFoundException ex) { |
loadGui(); |
||||||
Exceptions.printStackTrace(ex); |
|
||||||
} catch (JAXBException ex) { |
} |
||||||
Exceptions.printStackTrace(ex); |
/** |
||||||
} catch (NullPointerException ex){ |
* Raw implementation , just to prototype the editor |
||||||
Exceptions.printStackTrace(ex); |
*/ |
||||||
} |
@Override |
||||||
} |
public void componentHidden() { |
||||||
|
String path = this.obj.getPrimaryFile().getPath(); |
||||||
@Override |
try { |
||||||
public void componentActivated() { |
this.editor.saveGui(path); |
||||||
GuiEditorModel model = (GuiEditorModel) CommandProcessor.getInstance().getObservable(); |
} catch (FileNotFoundException ex) { |
||||||
model.setCurrentGUI(guiID); |
Exceptions.printStackTrace(ex); |
||||||
CommandProcessor.getInstance().setUndoManager(undoSupport); |
} catch (JAXBException ex) { |
||||||
} |
Exceptions.printStackTrace(ex); |
||||||
|
} catch (NullPointerException ex){ |
||||||
@Override |
Exceptions.printStackTrace(ex); |
||||||
public void componentDeactivated() { |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public UndoRedo getUndoRedo() { |
public void componentActivated() { |
||||||
return this.undoSupport; |
try{ |
||||||
} |
GuiEditorModel model = (GuiEditorModel) CommandProcessor.getInstance().getObservable(); |
||||||
|
model.setCurrentGUI(guiID); |
||||||
@Override |
CommandProcessor.getInstance().setUndoManager(undoSupport); |
||||||
public void setMultiViewCallback(MultiViewElementCallback callback) { |
}catch(java.lang.IllegalArgumentException ex){ |
||||||
this.callback = callback; |
logger.log(Level.SEVERE,"Can't load your gui", ex); |
||||||
} |
} |
||||||
|
} |
||||||
@Override |
|
||||||
public CloseOperationState canCloseElement() { |
@Override |
||||||
return CloseOperationState.STATE_OK; |
public void componentDeactivated() { |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public ExplorerManager getExplorerManager() { |
public UndoRedo getUndoRedo() { |
||||||
return nodesManager; |
return this.undoSupport; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void update(Observable o, Object arg) { |
public void setMultiViewCallback(MultiViewElementCallback callback) { |
||||||
if(arg instanceof SelectionChanged ){ |
this.callback = callback; |
||||||
SelectionChanged event = (SelectionChanged) arg; |
} |
||||||
if(event.getNewSelection().isEmpty()){ |
|
||||||
return; |
@Override |
||||||
} |
public CloseOperationState canCloseElement() { |
||||||
ArrayList<String> path = new ArrayList<String>(); |
return CloseOperationState.STATE_OK; |
||||||
GElement parent = event.getElement(); |
} |
||||||
while(parent!=null){ |
|
||||||
path.add(parent.getID()); |
@Override |
||||||
parent = parent.getParent(); |
public ExplorerManager getExplorerManager() { |
||||||
} |
return nodesManager; |
||||||
|
} |
||||||
Node result = nodesManager.getRootContext(); |
|
||||||
|
@Override |
||||||
for(int i=path.size()-1;i>=0 && result!=null;i--){ |
public void update(Observable o, Object arg) { |
||||||
result = result.getChildren().findChild(path.get(i)); |
if(arg instanceof SelectionChanged ){ |
||||||
} |
SelectionChanged event = (SelectionChanged) arg; |
||||||
try { |
if(event.getNewSelection().isEmpty()){ |
||||||
if(result!=null){ |
return; |
||||||
nodesManager.setSelectedNodes(new Node[]{result}); |
} |
||||||
} |
GElement parent = event.getElement(); |
||||||
} catch (PropertyVetoException ex) { |
GElementNode node = new GElementNode(parent); |
||||||
Exceptions.printStackTrace(ex); |
this.content.set(Collections.singleton(node), null); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
||||||
public void propertyChange(PropertyChangeEvent evt) { |
if(evt.getPropertyName().equals(DataObject.PROP_MODIFIED)){ |
||||||
if(evt.getPropertyName().equals(DataObject.PROP_MODIFIED)){ |
boolean old = (Boolean)evt.getOldValue(); |
||||||
boolean old = (Boolean)evt.getOldValue(); |
boolean nev = (Boolean)evt.getNewValue(); |
||||||
boolean nev = (Boolean)evt.getNewValue(); |
if(old && !nev){ |
||||||
if(old && !nev){ |
this.loadGui(); |
||||||
this.loadGui(); |
} |
||||||
} |
} |
||||||
} |
|
||||||
|
} |
||||||
} |
|
||||||
|
private void loadGui() { |
||||||
private void loadGui() { |
try { |
||||||
try { |
ProgressHandle handle = ProgressHandleFactory.createHandle("Loading the gui file"); |
||||||
ProgressHandle handle = ProgressHandleFactory.createHandle("Loading the gui file"); |
InputStream is = this.obj.getPrimaryFile().getInputStream(); |
||||||
InputStream is = this.obj.getPrimaryFile().getInputStream(); |
|
||||||
|
ProjectAssetManager mgr = this.obj.getLookup().lookup(ProjectAssetManager.class); |
||||||
ProjectAssetManager mgr = this.obj.getLookup().lookup(ProjectAssetManager.class); |
String assetPath = mgr.getAssetFolder().getPath(); |
||||||
String assetPath = mgr.getAssetFolder().getPath(); |
this.editor.createNewGui(nifty,is,new File(assetPath)); |
||||||
this.editor.createNewGui(nifty,is,new File(assetPath)); |
this.view.newGui(this.editor.getGui()); |
||||||
this.view.newGui(this.editor.getGui()); |
nodesManager.setRootContext(new GUINode(this.editor.getGui())); |
||||||
nodesManager.setRootContext(new GUINode(this.editor.getGui())); |
this.editor.getGui().getSelection().addObserver(this); |
||||||
this.editor.getGui().getSelection().addObserver(this); |
Collection<GLayer> layers1 = this.editor.getGui().getLayers(); |
||||||
Collection<GLayer> layers1 = this.editor.getGui().getLayers(); |
guiID = this.editor.getGui().getGUIid(); |
||||||
guiID = this.editor.getGui().getGUIid(); |
DefaultComboBoxModel<GLayer> model = new DefaultComboBoxModel<GLayer>(layers1.toArray(new GLayer[0])); |
||||||
DefaultComboBoxModel<GLayer> model = new DefaultComboBoxModel<GLayer>(layers1.toArray(new GLayer[0])); |
layers.setModel(model); |
||||||
layers.setModel(model); |
layers.setSelectedItem(this.editor.getCurrentLayer()); |
||||||
layers.setSelectedItem(this.editor.getCurrentLayer()); |
|
||||||
|
handle.finish(); |
||||||
handle.finish(); |
} catch (ParserConfigurationException ex) { |
||||||
} catch (ParserConfigurationException ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} catch (JAXBException ex) { |
||||||
} catch (JAXBException ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} catch (ClassNotFoundException ex) { |
||||||
} catch (ClassNotFoundException ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} catch (IOException ex) { |
||||||
} catch (IOException ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} catch (NoProductException ex) { |
||||||
} catch (NoProductException ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} catch (SAXException ex) { |
||||||
} catch (SAXException ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} catch (Exception ex) { |
||||||
} catch (Exception ex) { |
Exceptions.printStackTrace(ex); |
||||||
Exceptions.printStackTrace(ex); |
} |
||||||
} |
} |
||||||
} |
} |
||||||
} |
|
||||||
|
@ -1,117 +1,128 @@ |
|||||||
/* |
/* |
||||||
* To change this template, choose Tools | Templates |
* To change this template, choose Tools | Templates |
||||||
* and open the template in the editor. |
* and open the template in the editor. |
||||||
*/ |
*/ |
||||||
package com.jme3.gde.gui.nodes; |
package com.jme3.gde.gui.nodes; |
||||||
|
|
||||||
import com.jme3.gde.gui.propertyeditors.ResourceEditor; |
import com.jme3.gde.gui.propertyeditors.ResourceEditor; |
||||||
import com.jme3.gde.gui.propertyeditors.SizeEditor; |
import com.jme3.gde.gui.propertyeditors.SizeEditor; |
||||||
import jada.ngeditor.model.elements.GElement; |
import jada.ngeditor.controller.CommandProcessor; |
||||||
import java.beans.PropertyEditor; |
import jada.ngeditor.controller.commands.EditAttributeCommand; |
||||||
import java.lang.reflect.InvocationTargetException; |
import jada.ngeditor.model.elements.GElement; |
||||||
import java.util.Map.Entry; |
import java.beans.PropertyEditor; |
||||||
import org.openide.nodes.AbstractNode; |
import java.lang.reflect.InvocationTargetException; |
||||||
import org.openide.nodes.Children; |
import java.util.Map.Entry; |
||||||
import org.openide.nodes.Node; |
import javax.swing.JOptionPane; |
||||||
import org.openide.nodes.Sheet; |
import org.openide.nodes.AbstractNode; |
||||||
import sun.beans.editors.BoolEditor; |
import org.openide.nodes.Children; |
||||||
import sun.beans.editors.BooleanEditor; |
import org.openide.nodes.Node; |
||||||
|
import org.openide.nodes.Sheet; |
||||||
/** |
import org.openide.util.Exceptions; |
||||||
* |
import sun.beans.editors.BoolEditor; |
||||||
* @author cris |
import sun.beans.editors.BooleanEditor; |
||||||
*/ |
|
||||||
public class GElementNode extends AbstractNode{ |
/** |
||||||
private final GElement element; |
* |
||||||
|
* @author cris |
||||||
public GElementNode(GElement element) { |
*/ |
||||||
super(Children.create(new GElementChildFactory(element), false)); |
public class GElementNode extends AbstractNode{ |
||||||
|
private final GElement element; |
||||||
this.element = element; |
|
||||||
this.setName(element.getID()); |
public GElementNode(GElement element) { |
||||||
|
super(Children.create(new GElementChildFactory(element), false)); |
||||||
} |
|
||||||
|
this.element = element; |
||||||
public GElement getGelement(){ |
this.setName(element.getID()); |
||||||
return element; |
|
||||||
} |
} |
||||||
|
|
||||||
public void updateChildren(){ |
public GElement getGelement(){ |
||||||
|
return element; |
||||||
} |
} |
||||||
@Override |
|
||||||
protected Sheet createSheet() { |
public void updateChildren(){ |
||||||
Sheet s = super.createSheet(); |
|
||||||
Sheet.Set set = s.get(Sheet.PROPERTIES); |
} |
||||||
if (set == null) { |
@Override |
||||||
set = Sheet.createPropertiesSet(); |
protected Sheet createSheet() { |
||||||
s.put(set); |
Sheet s = super.createSheet(); |
||||||
} |
Sheet.Set set = s.get(Sheet.PROPERTIES); |
||||||
set.setName("Element Properties"); |
if (set == null) { |
||||||
set.setShortDescription("You can set element properties"); |
set = Sheet.createPropertiesSet(); |
||||||
for(Entry<String,String> pair : this.element.listAttributes().entrySet()){ |
s.put(set); |
||||||
final ElementAttributeProperty elementAttributeProperty = new ElementAttributeProperty(element,pair.getKey()); |
} |
||||||
pickEditor(pair, elementAttributeProperty); |
set.setName("Element Properties"); |
||||||
set.put(elementAttributeProperty); |
set.setShortDescription("You can set element properties"); |
||||||
} |
for(Entry<String,String> pair : this.element.listAttributes().entrySet()){ |
||||||
s.put(set); |
final ElementAttributeProperty elementAttributeProperty = new ElementAttributeProperty(element,pair.getKey()); |
||||||
return s; |
pickEditor(pair, elementAttributeProperty); |
||||||
} |
set.put(elementAttributeProperty); |
||||||
|
} |
||||||
private void pickEditor(Entry<String, String> pair, final ElementAttributeProperty elementAttributeProperty) { |
s.put(set); |
||||||
if(pair.getKey().equals("width")||pair.getKey().equals("height") || pair.getKey().equals("x") || pair.getKey().equals("y") ){ |
return s; |
||||||
elementAttributeProperty.setPropertyEditor(new SizeEditor()); |
} |
||||||
}else if(pair.getKey().equals("filename")){ |
|
||||||
elementAttributeProperty.setPropertyEditor(new ResourceEditor()); |
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 class ElementAttributeProperty extends Node.Property { |
||||||
|
|
||||||
public ElementAttributeProperty(GElement element, String attributeName) { |
private String attributeName; |
||||||
super(String.class); |
private GElement element; |
||||||
this.element = element; |
private PropertyEditor editor; |
||||||
this.attributeName = attributeName; |
|
||||||
this.setName(attributeName); |
public ElementAttributeProperty(GElement element, String attributeName) { |
||||||
this.setDisplayName(attributeName); |
super(String.class); |
||||||
|
this.element = element; |
||||||
} |
this.attributeName = attributeName; |
||||||
|
this.setName(attributeName); |
||||||
@Override |
this.setDisplayName(attributeName); |
||||||
public boolean canRead() { |
|
||||||
return true; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public boolean canRead() { |
||||||
public String getValue() throws IllegalAccessException, InvocationTargetException{ |
return true; |
||||||
return element.getAttribute(attributeName); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public String getValue() throws IllegalAccessException, InvocationTargetException{ |
||||||
public boolean canWrite() { |
return element.getAttribute(attributeName); |
||||||
return true; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
public void setPropertyEditor(PropertyEditor editor){ |
public boolean canWrite() { |
||||||
this.editor = editor; |
return true; |
||||||
} |
} |
||||||
@Override |
|
||||||
public PropertyEditor getPropertyEditor() { |
public void setPropertyEditor(PropertyEditor editor){ |
||||||
|
this.editor = editor; |
||||||
return this.editor; //To change body of generated methods, choose Tools | Templates.
|
} |
||||||
} |
@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 { |
|
||||||
element.addAttribute(attributeName, val.toString()); |
|
||||||
element.refresh(); |
|
||||||
} |
@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); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
Loading…
Reference in new issue