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

xworker.swt.xwidgets.DemoThing Maven / Gradle / Ivy

package xworker.swt.xwidgets;

import ognl.OgnlException;

import org.xmeta.ActionContext;
import org.xmeta.Thing;
import org.xmeta.World;
import org.xmeta.util.UtilData;
import org.xmeta.util.UtilMap;

import xworker.swt.ActionContainer;

public class DemoThing {
	public static Object create(ActionContext actionContext) throws OgnlException{
		Thing self = (Thing) actionContext.get("self");
		
		//要演示的事物
		Object com = UtilData.getData(self, "thing", actionContext);
		Thing comThing = null;
		if(com instanceof Thing){
			comThing = (Thing) com;
		}else if(com instanceof String){
			comThing = World.getInstance().getThing((String) com);
		}
		
		//创建演示的TabFolder
		Thing tabThing = World.getInstance().getThing("xworker.swt.xwidgets.DemoThing/@demoTabFolder");
		ActionContext ac = new ActionContext();
		ac.put("parent", actionContext.get("parent"));
		Object tabFolder = tabThing.doAction("create", ac);
		//创建子节点
		actionContext.peek().put("parent", tabFolder);
		for(Thing child : self.getChilds()){
			child.doAction("create", actionContext);
		}
				
		//演示的动作集
		ActionContainer actions = (ActionContainer) ac.get("actions");
		if(comThing != null){
			actions.doAction("setThing", ac, UtilMap.toMap("thing", comThing));
		}
		
		actionContext.getScope(0).put(self.getMetadata().getName(), actions);
		return tabFolder;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy