Added a import action fro style and controls , also nifty-editor library is updated with the last style&control handling feutureexperimental
parent
4506397b9c
commit
cc010862a9
Binary file not shown.
@ -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> |
|
@ -0,0 +1,30 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<nifty-styles xmlns="http://nifty-gui.lessvoid.com/nifty-gui"> |
||||||
|
|
||||||
|
<!-- +++++++++++++++++++++++++++++++++++++ --> |
||||||
|
<!-- style for the button background panel --> |
||||||
|
<!-- +++++++++++++++++++++++++++++++++++++ --> |
||||||
|
<style id="nifty-button#panel"> |
||||||
|
<attributes backgroundImage="button/button.png" imageMode="sprite-resize:100,23,0,2,96,2,2,2,96,2,19,2,96,2,2" |
||||||
|
paddingLeft="7px" paddingRight="7px" width="100px" height="23px" childLayout="center" |
||||||
|
visibleToMouse="true"/> |
||||||
|
<effect> |
||||||
|
<onHover name="border" color="#822f" post="true"/> |
||||||
|
<onFocus name="imageOverlay" filename="button/button.png" |
||||||
|
imageMode="sprite-resize:100,23,1,2,96,2,2,2,96,2,19,2,96,2,2" post="true"/> |
||||||
|
<onEnabled name="renderQuad" startColor="#2228" endColor="#2220" post="true" length="150"/> |
||||||
|
<onDisabled name="renderQuad" startColor="#2220" endColor="#2228" post="true" length="150"/> |
||||||
|
</effect> |
||||||
|
</style> |
||||||
|
|
||||||
|
<!-- +++++++++++++++++++++++++++++++++++++ --> |
||||||
|
<!-- style for the button text --> |
||||||
|
<!-- +++++++++++++++++++++++++++++++++++++ --> |
||||||
|
<style id="nifty-button#text" base="button-font"> |
||||||
|
<attributes align="center" valign="center" textHAlign="center" textVAlign="center" visibleToMouse="false"/> |
||||||
|
<effect> |
||||||
|
<onEnabled name="textColorAnimated" startColor="#8886" endColor="#eeef" post="false" length="150"/> |
||||||
|
<onDisabled name="textColorAnimated" startColor="#eeef" endColor="#8886" post="false" length="150"/> |
||||||
|
</effect> |
||||||
|
</style> |
||||||
|
</nifty-styles> |
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 361 B |
After Width: | Height: | Size: 736 B |
After Width: | Height: | Size: 865 B |
@ -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()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,55 @@ |
|||||||
|
package com.jme3.gde.gui.nodes; |
||||||
|
|
||||||
|
import jada.ngeditor.model.GUI; |
||||||
|
import jada.ngeditor.model.elements.specials.GUseStyle; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import javax.swing.AbstractAction; |
||||||
|
import javax.swing.Action; |
||||||
|
import org.openide.nodes.AbstractNode; |
||||||
|
import org.openide.nodes.Children; |
||||||
|
|
||||||
|
public class GUseStyleNode extends AbstractNode { |
||||||
|
private static final String basePath="com/jme3/gde/gui/multiview/icons"; |
||||||
|
private final GUI gui; |
||||||
|
private final GUseStyle style; |
||||||
|
|
||||||
|
public GUseStyleNode(GUI gui,GUseStyle style) { |
||||||
|
super(Children.LEAF); |
||||||
|
this.setIconBaseWithExtension(basePath+"/"+"style"+".png"); |
||||||
|
this.gui = gui; |
||||||
|
this.style = style; |
||||||
|
this.setName(style.getFilename()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Action[] getActions(boolean context) { |
||||||
|
return new Action[]{new Refresh(),new Delete()}; |
||||||
|
} |
||||||
|
|
||||||
|
private class Refresh extends AbstractAction { |
||||||
|
|
||||||
|
public Refresh() { |
||||||
|
super("Refresh"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
gui.reoloadStyles(style.getFilename()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private class Delete extends AbstractAction { |
||||||
|
|
||||||
|
public Delete() { |
||||||
|
super("Delete"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
gui.removeStyle(style); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,31 +1,55 @@ |
|||||||
package com.jme3.gde.gui.nodes; |
package com.jme3.gde.gui.nodes; |
||||||
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate; |
import jada.ngeditor.listeners.events.ElementEvent; |
||||||
import jada.ngeditor.model.GUI; |
import jada.ngeditor.model.GUI; |
||||||
import jada.ngeditor.model.elements.GControl; |
|
||||||
import jada.ngeditor.model.elements.GElement; |
import jada.ngeditor.model.elements.GElement; |
||||||
|
import jada.ngeditor.model.elements.GScreen; |
||||||
|
import jada.ngeditor.model.elements.specials.GUseControls; |
||||||
|
import jada.ngeditor.model.elements.specials.GUseStyle; |
||||||
import java.util.List; |
import java.util.List; |
||||||
import org.openide.nodes.AbstractNode; |
import java.util.Observable; |
||||||
|
import java.util.Observer; |
||||||
import org.openide.nodes.ChildFactory; |
import org.openide.nodes.ChildFactory; |
||||||
import org.openide.nodes.Children; |
|
||||||
import org.openide.nodes.Node; |
import org.openide.nodes.Node; |
||||||
|
|
||||||
public class ScreenChildFactory extends ChildFactory<GElement> { |
public class ScreenChildFactory extends ChildFactory<Object> implements Observer{ |
||||||
private final GUI gui; |
private final GUI gui; |
||||||
|
|
||||||
public ScreenChildFactory(GUI gui){ |
public ScreenChildFactory(GUI gui){ |
||||||
this.gui = gui; |
this.gui = gui; |
||||||
|
this.gui.addObserver(ScreenChildFactory.this); |
||||||
|
|
||||||
} |
} |
||||||
@Override |
@Override |
||||||
protected boolean createKeys(List<GElement> list) { |
protected boolean createKeys(List<Object> list) { |
||||||
|
list.addAll(gui.getUseStyles()); |
||||||
|
list.addAll(gui.getUseControls()); |
||||||
list.addAll(gui.getScreens()); |
list.addAll(gui.getScreens()); |
||||||
|
|
||||||
|
|
||||||
return true; |
return true; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected Node createNodeForKey(GElement screen) { |
protected Node createNodeForKey(Object node) { |
||||||
return new GElementNode(screen); |
if(node instanceof GElement){ |
||||||
|
return new GElementNode((GElement)node); |
||||||
|
}else if (node instanceof GUseStyle){ |
||||||
|
return new GUseStyleNode(gui, (GUseStyle)node); |
||||||
|
}else |
||||||
|
return new GUseControlsNode(gui,(GUseControls)node); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(Observable o, Object arg) { |
||||||
|
if(arg == null){ |
||||||
|
this.refresh(true); |
||||||
|
}else{ |
||||||
|
ElementEvent e = (ElementEvent) arg; |
||||||
|
if(e.getElement() instanceof GScreen){ |
||||||
|
this.refresh(true); |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
@ -0,0 +1,8 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<nifty-controls xmlns="http://nifty-gui.lessvoid.com/nifty-gui"> |
||||||
|
<controlDefinition style="your-style" name="empty-control"> |
||||||
|
<panel style="#panel" > |
||||||
|
|
||||||
|
</panel> |
||||||
|
</controlDefinition> |
||||||
|
</nifty-controls> |
@ -0,0 +1,7 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<nifty-styles xmlns="http://nifty-gui.lessvoid.com/nifty-gui"> |
||||||
|
<style id="empty"> |
||||||
|
<attributes backgroundColor="#AA05"/> |
||||||
|
|
||||||
|
</style> |
||||||
|
</nifty-styles> |
Loading…
Reference in new issue