All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
xworker.javafx.control.MenuItemActions Maven / Gradle / Ivy
package xworker.javafx.control;
import javafx.scene.Node;
import javafx.scene.control.MenuItem;
import org.xmeta.ActionContext;
import org.xmeta.Thing;
import xworker.javafx.beans.property.PropertyFactory;
import xworker.javafx.util.JavaFXUtils;
public class MenuItemActions {
static{
PropertyFactory.regist(MenuItem.class, "styleProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.styleProperty();
});
PropertyFactory.regist(MenuItem.class, "acceleratorProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.acceleratorProperty();
});
PropertyFactory.regist(MenuItem.class, "mnemonicParsingProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.mnemonicParsingProperty();
});
PropertyFactory.regist(MenuItem.class, "onMenuValidationProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.onMenuValidationProperty();
});
PropertyFactory.regist(MenuItem.class, "idProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.idProperty();
});
PropertyFactory.regist(MenuItem.class, "graphicProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.graphicProperty();
});
PropertyFactory.regist(MenuItem.class, "disableProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.disableProperty();
});
PropertyFactory.regist(MenuItem.class, "textProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.textProperty();
});
PropertyFactory.regist(MenuItem.class, "visibleProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.visibleProperty();
});
PropertyFactory.regist(MenuItem.class, "onActionProperty", o -> {
MenuItem obj = (MenuItem) o;
return obj.onActionProperty();
});
}
public static void init(MenuItem item, Thing thing, ActionContext actionContext) {
if(thing.valueExists("accelerator")){
item.setAccelerator(JavaFXUtils.getKeyCombination(thing.getString("accelerator")));
}
if(thing.valueExists("disable")){
item.setDisable(thing.getBoolean("disable"));
}
if(thing.valueExists("graphic")){
Node graphic = JavaFXUtils.getGraphic(thing, "graphic", actionContext);
if(graphic != null) {
item.setGraphic(graphic);
}
}
if(thing.valueExists("id")){
String id = JavaFXUtils.getString(thing, "id", actionContext);
if(id != null) {
item.setId(thing.getString("id"));
}
}
if(thing.valueExists("mnemonicParsing")){
item.setMnemonicParsing(thing.getBoolean("mnemonicParsing"));
}
if(thing.valueExists("style")){
String style = JavaFXUtils.getString(thing, "style", actionContext);
if(style != null) {
item.setStyle(style);
}
}
if(thing.valueExists("text")){
String text = JavaFXUtils.getString(thing, "text", actionContext);
if(text != null) {
item.setText(text);
}
}
if(thing.valueExists("visible")){
item.setVisible(thing.getBoolean("visible"));
}
}
public static MenuItem create(ActionContext actionContext) {
Thing self = actionContext.getObject("self");
MenuItem item = new MenuItem();
init(item, self, actionContext);
actionContext.g().put(self.getMetadata().getName(), item);
actionContext.peek().put("parent", item);
for(Thing child : self.getChilds()) {
child.doAction("create", actionContext);
}
return item;
}
public static void createGraphic(ActionContext actionContext){
Thing self = actionContext.getObject("self");
Object parent = actionContext.get("parent");
for(Thing child : self.getChilds()){
Object obj = child.doAction("create", actionContext);
if(obj instanceof Node && parent instanceof MenuItem){
((MenuItem) parent).setGraphic((Node) obj);
}
}
}
}