1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
public class TreeFormBean extends ActionForm {
private final static long serialVersionUID = 20051104;
private TreeNodeBean root;
private String refId;
/*
* (non-Javadoc)
* @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
ServletContext context = request.getSession().getServletContext();
DiffInfoForm infoForm = (DiffInfoForm)request.getSession().getAttribute("diffInfoForm");
if(infoForm != null)
{
// refId = (String)request.getSession().getAttribute("refId");
JobInfoLookup lookup = infoForm.getInfoLookup();
TreeNodeBeanBuilder builder = new TreeNodeBeanBuilder(lookup);
if (this.root == null) {
this.root = builder.buildRoot();
} else {
builder.refresh(root);
}
}
if(root == null)
System.out.println("root null");
}
/* (non-Javadoc)
* @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
*/
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
// TODO Raccord de méthode auto-généré
ActionErrors errors = new ActionErrors();
if(root == null)
errors.add("root", new ActionError("Pas d'informations"));
return errors;
}
/* returns the reference to the monkey tree */
public TreeNodeBean getRoot() {
return this.root;
}
public void setRoot(TreeNodeBean root) {
this.root = root;
}
public void setRefId(String refId) {
this.refId = refId;
}
public String getRefId() {
return this.refId;
}
} |
Partager