private AjaxTreeModel buildTreeModel() {
AjaxTreeModel model = new AjaxTreeModel("demomodelsdf"){
@Override
public List<AjaxTreeNode> getChildrenFor(String nodeId) {
List<AjaxTreeNode> children = new ArrayList<AjaxTreeNode>();
AjaxTreeNode child;
try {
child = new AjaxTreeNode( nodeId + ".1", "A wonderful day " + Calendar.getInstance().getTime().toString());
// Setting some node attributes - see the Treenode or the extjs
// documentation on what else you could use
child.put(AjaxTreeNode.CONF_LEAF, true);// leafs can't be opened
child.put(AjaxTreeNode.CONF_IS_TYPE_LEAF, true);
child.put(AjaxTreeNode.CONF_ALLOWDRAG, true);
child.put(AjaxTreeNode.CONF_ALLOWDROP, false);
children.add(child);
child = new AjaxTreeNode( nodeId + ".2", " Hello World " + Calendar.getInstance().getTime().toString());
child.put(AjaxTreeNode.CONF_LEAF, false);
child.put(AjaxTreeNode.CONF_IS_TYPE_LEAF, false); // sort folders above leafs
child.put(AjaxTreeNode.CONF_ALLOWDRAG, true);
child.put(AjaxTreeNode.CONF_ALLOWDROP, true);
children.add(child);
child = new AjaxTreeNode( nodeId + ".3", "I'm number two " + Calendar.getInstance().getTime().toString());
child.put(AjaxTreeNode.CONF_LEAF, true); // leafs can't be opened
child.put(AjaxTreeNode.CONF_IS_TYPE_LEAF, true);
child.put(AjaxTreeNode.CONF_ICON_CSS_CLASS, "b_filetype_doc"); // a custom icon css class
child.put(AjaxTreeNode.CONF_ALLOWDRAG, true);
child.put(AjaxTreeNode.CONF_ALLOWDROP, false);
children.add(child);
child = new AjaxTreeNode( nodeId + ".4", "Folder " + Calendar.getInstance().getTime().toString());
child.put(AjaxTreeNode.CONF_LEAF, false);
child.put(AjaxTreeNode.CONF_IS_TYPE_LEAF, false); // sort folders above leafs
child.put(AjaxTreeNode.CONF_ALLOWDRAG, true);
child.put(AjaxTreeNode.CONF_ALLOWDROP, true);
children.add(child);
} catch (JSONException e) {
throw new OLATRuntimeException("Error while creating gui demo ajax tree model", e);
}
return children;