use of org.olat.repository.ui.RepositoryTableModel in project OpenOLAT by OpenOLAT.
the class BGConfigResourcesStepController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
addResource = uifactory.addFormLink("cmd.addresource", formLayout, Link.BUTTON);
Translator resourceTrans = Util.createPackageTranslator(RepositoryTableModel.class, getLocale(), getTranslator());
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("config.resources.noresources"));
resourcesCtr = new TableController(tableConfig, ureq, getWindowControl(), resourceTrans);
listenTo(resourcesCtr);
repoTableModel = new RepositoryTableModel(getLocale());
repoTableModel.addColumnDescriptors(resourcesCtr, false, false, true, true);
resourcesCtr.setTableDataModel(repoTableModel);
((FormLayoutContainer) formLayout).put("resources", resourcesCtr.getInitialComponent());
}
use of org.olat.repository.ui.RepositoryTableModel in project OpenOLAT by OpenOLAT.
the class BusinessGroupMainRunController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == bgEditCntrllr) {
// changes from the admin controller
if (event == Event.CHANGED_EVENT) {
businessGroup = bgEditCntrllr.getBusinessGroup();
chatAvailable = isChatAvailable();
TreeModel trMdl = buildTreeModel();
bgTree.setTreeModel(trMdl);
bgTree.setSelectedNode(nodeAdmin);
} else if (event == Event.CANCELLED_EVENT) {
// could not get lock on business group, back to inital screen
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == resourcesCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
int rowid = te.getRowId();
RepositoryTableModel repoTableModel = (RepositoryTableModel) resourcesCtr.getTableDataModel();
if (RepositoryTableModel.TABLE_ACTION_SELECT_LINK.equals(actionid)) {
RepositoryEntry currentRepoEntry = repoTableModel.getObject(rowid);
OLATResource ores = currentRepoEntry.getOlatResource();
if (ores == null)
throw new AssertException("repoEntry had no olatresource, repoKey = " + currentRepoEntry.getKey());
addLoggingResourceable(LoggingResourceable.wrap(ores, OlatResourceableType.genRepoEntry));
String businessPath = "[RepositoryEntry:" + currentRepoEntry.getKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
}
} else if (source == sendToChooserForm) {
if (event == Event.DONE_EVENT) {
removeAsListenerAndDispose(collabToolCtr);
collabToolCtr = createContactFormController(ureq);
listenTo(collabToolCtr);
mainPanel.setContent(collabToolCtr.getInitialComponent());
} else if (event == Event.CANCELLED_EVENT) {
// back to group overview
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == collabToolCtr) {
if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.BACK_EVENT || event == Event.FAILED_EVENT) {
// In all cases (success or failure) we
// go back to the group overview page.
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == accessController) {
if (event.equals(AccessEvent.ACCESS_OK_EVENT)) {
removeAsListenerAndDispose(accessController);
accessController = null;
// check if on waiting list
List<BusinessGroupMembership> memberships = businessGroupService.getBusinessGroupMembership(Collections.singletonList(businessGroup.getKey()), getIdentity());
if (isOnWaitinglist(memberships)) {
Component cmp = getOnWaitingListMessage(ureq, businessGroup);
mainPanel.setContent(cmp);
} else {
mainPanel.setContent(main);
bgTree.setTreeModel(buildTreeModel());
needActivation = false;
}
} else if (event.equals(AccessEvent.ACCESS_FAILED_EVENT)) {
String msg = ((AccessEvent) event).getMessage();
if (StringHelper.containsNonWhitespace(msg)) {
getWindowControl().setError(msg);
} else {
showError("error.accesscontrol");
}
}
}
}
use of org.olat.repository.ui.RepositoryTableModel in project openolat by klemens.
the class BusinessGroupMainRunController method doShowResources.
private void doShowResources(UserRequest ureq) {
// always refresh data model, maybe it has changed
RepositoryTableModel repoTableModel = new RepositoryTableModel(getLocale());
List<RepositoryEntry> repoTableModelEntries = businessGroupService.findRepositoryEntries(Collections.singletonList(businessGroup), 0, -1);
repoTableModel.setObjects(repoTableModelEntries);
// init table controller only once
if (resourcesCtr == null) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("resources.noresources"));
// removeAsListenerAndDispose(resourcesCtr);
resourcesCtr = new TableController(tableConfig, ureq, getWindowControl(), resourceTrans);
listenTo(resourcesCtr);
resourcesVC = createVelocityContainer("resources");
repoTableModel.addColumnDescriptors(resourcesCtr, true, false, false, false);
resourcesVC.put("resources", resourcesCtr.getInitialComponent());
}
// add table model to table
resourcesCtr.setTableDataModel(repoTableModel);
mainPanel.setContent(resourcesVC);
addToHistory(ureq, ORES_TOOLRESOURCES, null);
}
use of org.olat.repository.ui.RepositoryTableModel in project OpenOLAT by OpenOLAT.
the class BusinessGroupMainRunController method doShowResources.
private void doShowResources(UserRequest ureq) {
// always refresh data model, maybe it has changed
RepositoryTableModel repoTableModel = new RepositoryTableModel(getLocale());
List<RepositoryEntry> repoTableModelEntries = businessGroupService.findRepositoryEntries(Collections.singletonList(businessGroup), 0, -1);
repoTableModel.setObjects(repoTableModelEntries);
// init table controller only once
if (resourcesCtr == null) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("resources.noresources"));
// removeAsListenerAndDispose(resourcesCtr);
resourcesCtr = new TableController(tableConfig, ureq, getWindowControl(), resourceTrans);
listenTo(resourcesCtr);
resourcesVC = createVelocityContainer("resources");
repoTableModel.addColumnDescriptors(resourcesCtr, true, false, false, false);
resourcesVC.put("resources", resourcesCtr.getInitialComponent());
}
// add table model to table
resourcesCtr.setTableDataModel(repoTableModel);
mainPanel.setContent(resourcesVC);
addToHistory(ureq, ORES_TOOLRESOURCES, null);
}
use of org.olat.repository.ui.RepositoryTableModel in project openolat by klemens.
the class BusinessGroupMainRunController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == bgEditCntrllr) {
// changes from the admin controller
if (event == Event.CHANGED_EVENT) {
businessGroup = bgEditCntrllr.getBusinessGroup();
chatAvailable = isChatAvailable();
TreeModel trMdl = buildTreeModel();
bgTree.setTreeModel(trMdl);
bgTree.setSelectedNode(nodeAdmin);
} else if (event == Event.CANCELLED_EVENT) {
// could not get lock on business group, back to inital screen
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == resourcesCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
int rowid = te.getRowId();
RepositoryTableModel repoTableModel = (RepositoryTableModel) resourcesCtr.getTableDataModel();
if (RepositoryTableModel.TABLE_ACTION_SELECT_LINK.equals(actionid)) {
RepositoryEntry currentRepoEntry = repoTableModel.getObject(rowid);
OLATResource ores = currentRepoEntry.getOlatResource();
if (ores == null)
throw new AssertException("repoEntry had no olatresource, repoKey = " + currentRepoEntry.getKey());
addLoggingResourceable(LoggingResourceable.wrap(ores, OlatResourceableType.genRepoEntry));
String businessPath = "[RepositoryEntry:" + currentRepoEntry.getKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
}
} else if (source == sendToChooserForm) {
if (event == Event.DONE_EVENT) {
removeAsListenerAndDispose(collabToolCtr);
collabToolCtr = createContactFormController(ureq);
listenTo(collabToolCtr);
mainPanel.setContent(collabToolCtr.getInitialComponent());
} else if (event == Event.CANCELLED_EVENT) {
// back to group overview
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == collabToolCtr) {
if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.BACK_EVENT || event == Event.FAILED_EVENT) {
// In all cases (success or failure) we
// go back to the group overview page.
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == accessController) {
if (event.equals(AccessEvent.ACCESS_OK_EVENT)) {
removeAsListenerAndDispose(accessController);
accessController = null;
// check if on waiting list
List<BusinessGroupMembership> memberships = businessGroupService.getBusinessGroupMembership(Collections.singletonList(businessGroup.getKey()), getIdentity());
if (isOnWaitinglist(memberships)) {
Component cmp = getOnWaitingListMessage(ureq, businessGroup);
mainPanel.setContent(cmp);
} else {
mainPanel.setContent(main);
bgTree.setTreeModel(buildTreeModel());
needActivation = false;
}
} else if (event.equals(AccessEvent.ACCESS_FAILED_EVENT)) {
String msg = ((AccessEvent) event).getMessage();
if (StringHelper.containsNonWhitespace(msg)) {
getWindowControl().setError(msg);
} else {
showError("error.accesscontrol");
}
}
}
}
Aggregations