All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xworker.javafx.design.Designer Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package xworker.javafx.design;

import javafx.scene.Node;
import javafx.scene.input.MouseEvent;
import org.xmeta.ActionContext;
import org.xmeta.Thing;


public class Designer {
    public static final String THING = "__designer_info__";

    private static final DesignerListener designerListener = new DesignerListener();

    public static void attach(Thing thing, Node node, ActionContext actionContext){
        if(node == null || MouseEvent.MOUSE_CLICKED == null){
            System.out.println("node is null or mouse clicked not exist, node=" + node + ", thing=" + thing);
            return;
        }

        node.addEventHandler(MouseEvent.MOUSE_CLICKED, designerListener);

        AttachInfo attachInfo = new AttachInfo(thing, node, actionContext);
        node.getProperties().put(THING, attachInfo);
    }

    public static AttachInfo getAttachInfo(Node node){
        return (AttachInfo) node.getProperties().get(THING);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy