/** * 创建。 * * @param actionContext * @return */ public static Thing create(ActionContext actionContext) { Thing self = (Thing) actionContext.get("self"); // 任务列表 List<Thing> tasks = new ArrayList<Thing>(); Thing tasksThing = self.getThing("Tasks@0"); if (tasksThing != null) { tasks.addAll(tasksThing.getChilds()); } // 进度条和标签 String progressBarVarName = self.getStringBlankAsNull("progressBarVarName"); ProgressBar progressBar = null; if (progressBarVarName != null) { progressBar = (ProgressBar) actionContext.get(progressBarVarName); } String labelVarName = self.getStringBlankAsNull("labelVarName"); Label label = null; if (labelVarName != null) { label = (Label) actionContext.get(labelVarName); } // 创建新的事物 Thing thing = new Thing(); thing.put("descriptors", self.getMetadata().getPath()); // 设置原来的事物为描述者,用于继承行为 // 创建实例 TaskMonitor monitor = new TaskMonitor(self, tasks, progressBar, label, actionContext); thing.setData(TaskMonitor.monitor_name, monitor); // 保存变量 actionContext.getScope(0).put(self.getMetadata().getName(), thing); return thing; }
public static SplitPane create(ActionContext actionContext) throws OgnlException { Thing self = (Thing) actionContext.get("self"); Actor firstWidget = null; Actor secondWidget = null; Skin skin = null; String styleName = self.getStringBlankAsNull("styleName"); String firstWidgetStr = self.getStringBlankAsNull("firstWidget"); if (firstWidgetStr != null) { firstWidget = (Actor) actionContext.get(firstWidgetStr); } String secondWidgetStr = self.getStringBlankAsNull("secondWidget"); if (secondWidgetStr != null) { secondWidget = (Actor) actionContext.get(secondWidgetStr); } if (firstWidget == null) { firstWidget = createActor(self, "FirstWidget", actionContext); } if (secondWidget == null) { secondWidget = createActor(self, "SecondWidget", actionContext); } skin = (Skin) actionContext.get(self.getString("skin")); SplitPane group = new SplitPane(firstWidget, secondWidget, self.getBoolean("vertical"), skin, styleName); actionContext.getScope(0).put(self.getMetadata().getName(), group); init(self, group, actionContext); return group; }
public static void init(Thing self, SplitPane item, ActionContext actionContext) throws OgnlException { WidgetGroupActions.init(self, item, actionContext); if (self.getStringBlankAsNull("maxSplitAmount") != null) { item.setMaxSplitAmount(self.getFloat("maxSplitAmount", 0, actionContext)); } if (self.getStringBlankAsNull("minSplitAmount") != null) { item.setMinSplitAmount(self.getFloat("minSplitAmount", 0, actionContext)); } if (self.getStringBlankAsNull("splitAmount") != null) { item.setSplitAmount(self.getFloat("splitAmount", 0, actionContext)); } }
public static RemoveListenerAction create(ActionContext actionContext) { Thing self = (Thing) actionContext.get("self"); RemoveListenerAction ac = Actions.action(RemoveListenerAction.class); if (self.getStringBlankAsNull("capture") != null) { ac.setCapture(self.getBoolean("capture")); } EventListener listener = (EventListener) actionContext.get("listener"); ac.setListener(listener); Actor actor = (Actor) actionContext.get("actor"); ac.setActor(actor); actionContext.getScope(0).put(self.getMetadata().getName(), ac); return ac; }