code: public void elementAdded(QueryControllerEntity element) {
  		if (element instanceof QueryControllerGroup) {
  			QueryControllerGroup group = (QueryControllerGroup) element;
  			QueryGroupTreeElement ele = new QueryGroupTreeElement(group.getID());
  			insertNodeInto(ele, (DefaultMutableTreeNode) root, root.getChildCount());
  			nodeStructureChanged(root);
  		} else if (element instanceof QueryControllerQuery) {
  			QueryControllerQuery query = (QueryControllerQuery) element;
  			QueryTreeElement ele = new QueryTreeElement(query.getID(), query.getQuery());
  			insertNodeInto(ele, (DefaultMutableTreeNode) root, root.getChildCount());
  			nodeStructureChanged(root);
  		}
  	}
docs: Inserts a new node group or query into the Tree