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

xworker.javafx.control.cell.MapValueFactoryActions Maven / Gradle / Ivy

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

import org.xmeta.ActionContext;
import org.xmeta.Thing;

import javafx.scene.control.TableColumn;
import javafx.scene.control.cell.MapValueFactory;

public class MapValueFactoryActions {
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static MapValueFactory create(ActionContext actionContext) {
		Thing self = actionContext.getObject("self");
		Object parent = actionContext.getObject("parent");
		
		Object key = self.doAction("getKey", actionContext);
		MapValueFactory mf = new MapValueFactory(key);
		actionContext.g().put(self.getMetadata().getName(), mf);
		
		if(parent instanceof TableColumn) {
			((TableColumn) parent).setCellValueFactory(mf);
		}
		return mf;
	}
}