1 13 package com.tonbeller.wcf.tree; 14 15 import javax.servlet.jsp.JspException ; 16 17 import com.tonbeller.wcf.component.Component; 18 import com.tonbeller.wcf.component.ComponentTag; 19 import com.tonbeller.wcf.controller.RequestContext; 20 import com.tonbeller.wcf.selection.SelectionModel; 21 22 26 public class TreeComponentTag extends ComponentTag { 27 String model, selectionModel; 28 29 public Component createComponent(RequestContext context) throws JspException { 30 if (model != null) { 32 TreeModel tm = (TreeModel)context.getModelReference(model); 33 if (tm == null) 34 throw new JspException ("model \"" + model + "\" not found"); 35 TreeComponent tc = new TreeComponent(getId(), null, tm); 36 if (selectionModel != null) { 37 SelectionModel sm = (SelectionModel)context.getModelReference(selectionModel); 38 tc.setSelectionModel(sm); 39 } 40 return tc; 41 } 42 43 TestTreeModel ttm = new TestTreeModel(); 45 MutableTreeModelDecorator mtmd = new MutableTreeModelDecorator(ttm); 46 TreeComponent tc = new TreeComponent(id, null, mtmd); 47 tc.setDeleteNodeModel(ttm.getDeleteNodeModel()); 48 return tc; 49 } 50 51 55 public void setModel(String model) { 56 this.model = model; 57 } 58 59 63 public void setSelectionModel(String selectionModel) { 64 this.selectionModel = selectionModel; 65 } 66 } 67 | Popular Tags |