use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project OpenOLAT by OpenOLAT.
the class GroupController method initGroupTable.
/**
* Init GroupList-table-controller for non-waitinglist (participant-list,
* owner-list).
*/
protected void initGroupTable(TableController tableCtr, UserRequest ureq, boolean enableTablePreferences, boolean enableUserSelection) {
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(usageIdentifyer, isAdministrativeUser);
if (isAdministrativeUser) {
// first the login name, but only if administrative user
DefaultColumnDescriptor cd0 = new DefaultColumnDescriptor("table.user.login", 0, COMMAND_VCARD, ureq.getLocale());
cd0.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
tableCtr.addColumnDescriptor(cd0);
}
if (chatEnabled) {
tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.online", 1, COMMAND_IM, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new OnlineIconRenderer()));
}
int visibleColId = 0;
// followed by the users fields
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = userManager.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
ColumnDescriptor cd = userPropertyHandler.getColumnDescriptor(i + 3, COMMAND_VCARD, ureq.getLocale());
// make all user attributes clickable to open visiting card
if (cd instanceof DefaultColumnDescriptor) {
DefaultColumnDescriptor dcd = (DefaultColumnDescriptor) cd;
dcd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
}
tableCtr.addColumnDescriptor(visible, cd);
if (visible) {
visibleColId++;
}
}
// in the end
if (enableTablePreferences) {
DefaultColumnDescriptor cd = new DefaultColumnDescriptor("table.subject.addeddate", 2, COMMAND_VCARD, ureq.getLocale());
cd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
tableCtr.addColumnDescriptor(true, cd);
tableCtr.setSortColumn(++visibleColId, true);
}
if (enableUserSelection) {
tableCtr.addColumnDescriptor(new StaticColumnDescriptor(COMMAND_SELECTUSER, "table.subject.action", myTrans.translate("action.general")));
}
if (mayModifyMembers) {
tableCtr.addMultiSelectAction("action.remove", COMMAND_REMOVEUSER);
tableCtr.setMultiSelect(true);
}
}
use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project OpenOLAT by OpenOLAT.
the class ProjectListController method createTableController.
private TableController createTableController(final UserRequest ureq, WindowControl wControl) {
numberOfCustomFieldInTable = 0;
numberOfEventInTable = 0;
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("projectlist.no.projects"));
tableConfig.setPreferencesOffered(true, "projectbrokerList");
// Do not allow show all because many entries takes too long to render
tableConfig.setShowAllLinkEnabled(false);
removeAsListenerAndDispose(tableController);
tableController = new TableController(tableConfig, ureq, wControl, this.getTranslator(), true);
listenTo(tableController);
int dataColumn = 0;
tableController.addColumnDescriptor(new DefaultColumnDescriptor("projectlist.tableheader.title", dataColumn++, TABLE_ACTION_SHOW_DETAIL, getLocale()));
CustomRenderColumnDescriptor projectManagerDescriptor = new CustomRenderColumnDescriptor("projectlist.tableheader.account.manager", dataColumn++, TABLE_ACTION_ACCOUNT_MANAGER, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectManagerColumnRenderer()) {
/**
* @see org.olat.core.gui.components.table.DefaultColumnDescriptor#compareTo(int, int)
*/
@Override
public int compareTo(int rowa, int rowb) {
return super.compareTo(rowa, rowb);
}
/**
* @see org.olat.core.gui.components.table.CustomRenderColumnDescriptor#renderValue(org.olat.core.gui.render.StringOutput, int, org.olat.core.gui.render.Renderer)
*/
@Override
public void renderValue(StringOutput sb, int row, Renderer renderer) {
Object val = getModelData(row);
// to get info about row in Renderer!
String rowSt = Integer.toString(row);
getCustomCellRenderer().render(sb, renderer, val, getLocale(), getAlignment(), rowSt);
}
};
tableController.addColumnDescriptor(projectManagerDescriptor);
// Custom-Fields
List<CustomField> customFieldList = moduleConfig.getCustomFields();
for (Iterator<CustomField> iterator = customFieldList.iterator(); iterator.hasNext(); ) {
CustomField customField = iterator.next();
if (customField.isTableViewEnabled()) {
numberOfCustomFieldInTable++;
DefaultColumnDescriptor columnDescriptor = new DefaultColumnDescriptor(customField.getName(), dataColumn++, null, getLocale());
columnDescriptor.setTranslateHeaderKey(false);
tableController.addColumnDescriptor(columnDescriptor);
}
}
// Project Events
for (Project.EventType eventType : Project.EventType.values()) {
if (moduleConfig.isProjectEventEnabled(eventType) && moduleConfig.isProjectEventTableViewEnabled(eventType)) {
numberOfEventInTable++;
tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("projectlist.tableheader.event." + eventType.getI18nKey(), dataColumn++, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectEventColumnRenderer()));
}
}
tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("projectlist.tableheader.state", dataColumn++, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectStateColumnRenderer()));
tableController.addColumnDescriptor(new DefaultColumnDescriptor("projectlist.tableheader.numbers", dataColumn++, null, getLocale()) {
@Override
public int compareTo(int rowa, int rowb) {
Object a = table.getTableDataModel().getValueAt(rowa, dataColumn);
Object b = table.getTableDataModel().getValueAt(rowb, dataColumn);
if (a == null || b == null) {
boolean bb = (b == null);
return (a == null) ? (bb ? 0 : -1) : (bb ? 1 : 0);
}
try {
Long la = new Long((String) a);
Long lb = new Long((String) b);
return la.compareTo(lb);
} catch (NumberFormatException e) {
return super.compareTo(rowa, rowb);
}
}
});
String selectCmd = userCourseEnv.isCourseReadOnly() ? null : TABLE_ACTION_SELECT;
tableController.addColumnDescriptor(new BooleanColumnDescriptor("projectlist.tableheader.select", dataColumn++, selectCmd, translate("table.action.select"), "-"));
String cancelCmd = userCourseEnv.isCourseReadOnly() ? null : TABLE_ACTION_CANCEL_SELECT;
tableController.addColumnDescriptor(new BooleanColumnDescriptor("projectlist.tableheader.cancel.select", dataColumn++, cancelCmd, translate("projectlist.tableheader.cancel.select"), "-"));
return tableController;
}
use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project OpenOLAT by OpenOLAT.
the class GenericArchiveController method doNodeChoose.
/**
* @param ureq
*/
private void doNodeChoose(UserRequest ureq, VelocityContainer nodeChoose) {
// table configuraton
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("nodesoverview.nonodes"));
tableConfig.setDownloadOffered(false);
tableConfig.setSortingEnabled(false);
tableConfig.setDisplayTableHeader(true);
tableConfig.setDisplayRowCount(false);
tableConfig.setPageingEnabled(false);
removeAsListenerAndDispose(nodeListCtr);
nodeListCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(nodeListCtr);
// table columns
nodeListCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.node", 0, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new IndentedNodeRenderer()));
nodeListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.action.select", 1, CMD_SELECT_NODE, getLocale()));
// get list of course node data and populate table data model
ICourse course = CourseFactory.loadCourse(ores);
CourseNode rootNode = course.getRunStructure().getRootNode();
List<AssessmentNodeData> nodesTableObjectArrayList = addNodesAndParentsToList(0, rootNode);
// only populate data model if data available
if (nodesTableObjectArrayList == null) {
nodeChoose.contextPut("hasNodes", Boolean.FALSE);
} else {
nodeChoose.contextPut("hasNodes", Boolean.TRUE);
nodeTableModel = new NodeTableDataModel(nodesTableObjectArrayList, getTranslator());
nodeListCtr.setTableDataModel(nodeTableModel);
nodeChoose.put("nodeTable", nodeListCtr.getInitialComponent());
}
// set main content to nodechoose, do not use wrapper
main.setContent(nodeChoose);
}
use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project OpenOLAT by OpenOLAT.
the class HourOfDayStatisticManager method createColumnDescriptor.
@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
if (column == 0) {
return new DefaultColumnDescriptor("stat.table.header.node", 0, null, ureq.getLocale());
}
String hourOfDayLocaled = headerId;
try {
Calendar c = Calendar.getInstance(ureq.getLocale());
c.setTime(new Date());
c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(headerId));
c.set(Calendar.MINUTE, 0);
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT, ureq.getLocale());
hourOfDayLocaled = df.format(c.getTime());
} catch (RuntimeException re) {
re.printStackTrace(System.out);
}
TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(hourOfDayLocaled, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
cd.setTranslateHeaderKey(false);
return cd;
}
use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project OpenOLAT by OpenOLAT.
the class StudyLevelStatisticManager method createColumnDescriptor.
@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
if (column == 0) {
return new DefaultColumnDescriptor("stat.table.header.node", 0, null, ureq.getLocale());
}
if (headerId != null) {
Translator translator = Util.createPackageTranslator(ShibbolethModule.class, ureq.getLocale());
if (translator != null) {
String newHeaderId = translator.translate("swissEduPersonStudyLevel." + headerId);
if (newHeaderId != null && !newHeaderId.startsWith(Translator.NO_TRANSLATION_ERROR_PREFIX)) {
headerId = newHeaderId;
}
}
}
TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(headerId, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
cd.setTranslateHeaderKey(false);
return cd;
}
Aggregations