package com.joeyon.demo.component.action;
import com.joeyon.framework.common.lang.Caster;
import com.joeyon.framework.component.assembly.manager.AssemblyComponentManager;
import com.joeyon.framework.util.CollectionUtils;
import com.joeyon.framework.webutil.annotation.Action;
import com.joeyon.framework.webutil.annotation.Result;
import com.joeyon.demo.component.vo.ComponentVO;
import com.joeyon.demo.framework.webutil.BaseAction;
import java.util.List;
@org.springframework.stereotype.Component("jfs.ComponentAction")
@Action(className="jfs.ComponentAction")
public class ComponentAction extends BaseAction
{
private ComponentModel model = new ComponentModel();
public Object getModel()
{
return this.model;
}
@Action(name="ComponentAction_goMain")
@Result("/demo/pages/com/joeyon/demo/component/ComponentAction_goMain.jsp")
public String goMain() {
List allRegisterComponent = AssemblyComponentManager.getInstance().getAllRegisterComponent();
this.model.setListComponent(CollectionUtils.toList(allRegisterComponent, new Caster()
{
public ComponentVO cast(Object obj)
{
ComponentVO vo = new ComponentVO();
vo.setComponent((com.joeyon.framework.component.Component)obj);
return vo;
}
}));
return "success";
}
@Action
@Result("/demo/pages/com/joeyon/demo/component/ComponentAction_goDisplay.jsp")
public String goDisplay() {
ComponentVO vo = new ComponentVO();
vo.setComponent(AssemblyComponentManager.getInstance().getComponentByCode(this.model.getComponentCode()));
this.model.setComponentVO(vo);
return "success";
}
}