use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class QuestionPoolMainEditorController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (menuTree == source) {
if (event instanceof TreeDropEvent) {
TreeDropEvent e = (TreeDropEvent) event;
String targetId = e.getTargetNodeId();
String dropId = e.getDroppedNodeId();
// drop id w_o_fi1000002357-4
doDrop(ureq, targetId, dropId);
} else if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
TreeNode node = menuTree.getTreeModel().getNodeById(te.getNodeId());
doSelectControllerTreeNode(ureq, node, null, null);
}
}
}
}
use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class EPTOCController method doSelectTreeElement.
private void doSelectTreeElement(UserRequest ureq, TreeEvent te) {
TreeNode selectedNode = treeCtr.getTreeModel().getNodeById(te.getNodeId());
Object userObj = selectedNode.getUserObject();
if (userObj instanceof PortfolioStructure) {
// structure clicked
structureClicked = (PortfolioStructure) userObj;
refreshAddElements(ureq, structureClicked);
delButton.setVisible(true);
// send event to load this page
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.SELECTED, structureClicked));
} else if (userObj instanceof AbstractArtefact) {
// artefact clicked
Object parentObj = ((TreeNode) selectedNode.getParent()).getUserObject();
if (parentObj instanceof PortfolioStructure) {
artefactClicked = (AbstractArtefact) userObj;
PortfolioStructure structure = (PortfolioStructure) parentObj;
refreshAddElements(ureq, null);
delButton.setVisible(true);
fireEvent(ureq, new EPArtefactClicked(ARTEFACT_NODE_CLICKED, structure));
}
} else {
// root tree node clicked, no add/delete link
delButton.setVisible(false);
refreshAddElements(ureq, null);
fireEvent(ureq, new Event(ARTEFACT_NODE_CLICKED));
}
}
use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class QTI12StatisticsToolController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (courseTree == source) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
String ident = te.getNodeId();
TreeNode selectedNode = courseTree.getTreeModel().getNodeById(ident);
doSelectNode(ureq, selectedNode);
}
}
}
}
use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class CPDisplayController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
Long id = entries.get(0).getOLATResourceable().getResourceableId();
TreeNode newNode = null;
if (id != null && id.longValue() > 0l) {
newNode = ctm.getNodeById(id.toString());
}
if (newNode == null) {
String path = BusinessControlFactory.getInstance().getPath(entries.get(0));
newNode = ctm.lookupTreeNodeByHref(path);
}
if (newNode != null) {
selectTreeNode(ureq, newNode);
switchToPage(ureq, new TreeEvent(TreeEvent.COMMAND_TREENODES_SELECTED, newNode.getIdent()));
}
}
use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class CPDisplayController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (source == cpTree) {
// TreeEvent.dito...
if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
TreeEvent te = (TreeEvent) event;
switchToPage(ureq, te);
}
} else if (source == cpComponent) {
if (event instanceof NewInlineUriEvent) {
NewInlineUriEvent nue = (NewInlineUriEvent) event;
// adjust the tree selection to the current choice if found
selectTreeNode(ureq, nue.getNewUri());
}
} else if (source == nextLink) {
TreeNode nextUri = (TreeNode) nextLink.getUserObject();
switchToPage(ureq, nextUri);
if (cpTree != null) {
cpTree.setSelectedNode(nextUri);
}
fireEvent(ureq, new TreeNodeEvent(nextUri));
} else if (source == previousLink) {
TreeNode previousUri = (TreeNode) previousLink.getUserObject();
if (cpTree != null) {
cpTree.setSelectedNode(previousUri);
}
switchToPage(ureq, previousUri);
fireEvent(ureq, new TreeNodeEvent(previousUri));
} else if (source == printLink) {
selectPagesToPrint(ureq);
}
}
Aggregations