use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project openolat by klemens.
the class UserTableDataModel method addColumnDescriptors.
/**
* Add all column descriptors to this table that are available in the table
* model
*
* @param tableCtr
* @param actionCommand command fired when the login name is clicked or NULL when no command is used
*/
public void addColumnDescriptors(TableController tableCtr, String actionCommand) {
// first column is users login name
if (isAdministrativeUser) {
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.login", 0, actionCommand, getLocale()));
}
// followed by the users fields
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = UserManager.getInstance().isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(i + 1, actionCommand, getLocale()));
}
}
use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project openolat by klemens.
the class NotificationSubscriptionTableDataModel method addTableColumns.
/**
* Add the column descriptors to the given table controller that matches with
* this data model
*
* @param subscriptionsTableCtr
*/
void addTableColumns(TableController subscriptionsTableCtr, boolean admin) {
subscriptionsTableCtr.addColumnDescriptor(false, new DefaultColumnDescriptor("overview.column.key", 0, "launch", getLocale()));
subscriptionsTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("overview.column.type", 1, "launch", getLocale()));
subscriptionsTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("overview.column.resname", 2, null, getLocale()));
subscriptionsTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("overview.column.subidentifier", 3, null, getLocale()));
subscriptionsTableCtr.addColumnDescriptor(admin, new DefaultColumnDescriptor("overview.column.creationDate", 4, null, getLocale()));
subscriptionsTableCtr.addColumnDescriptor(admin, new DefaultColumnDescriptor("overview.column.lastEmail", 5, null, getLocale()));
subscriptionsTableCtr.addColumnDescriptor(new StaticColumnDescriptor("del", "overview.column.action", trans.translate("overview.column.action.cellvalue")));
}
use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project openolat by klemens.
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 klemens.
the class CourseCalendarPeekViewController method init.
private void init(UserRequest ureq, CalCourseNode courseNode, UserCourseEnvironment courseEnv, NodeEvaluation ne) {
CourseCalendars myCal = CourseCalendars.createCourseCalendarsWrapper(ureq, getWindowControl(), courseEnv, ne);
Date refDate;
ModuleConfiguration config = courseNode.getModuleConfiguration();
if (CalEditController.getAutoDate(config)) {
refDate = new Date();
} else {
refDate = CalEditController.getStartDate(config);
if (refDate == null)
refDate = new Date();
}
List<KalendarEvent> nextEvents = new ArrayList<KalendarEvent>();
for (KalendarRenderWrapper calendar : myCal.getCalendars()) {
Kalendar cal = calendar.getKalendar();
Collection<KalendarEvent> events = cal.getEvents();
for (KalendarEvent event : events) {
if (refDate.compareTo(event.getBegin()) <= 0) {
nextEvents.add(event);
}
}
}
Collections.sort(nextEvents, new KalendarEventComparator());
List<KalendarEvent> nextThreeEvents = nextEvents.subList(0, Math.min(3, nextEvents.size()));
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("calendar.noEvents"));
tableConfig.setDisplayTableHeader(false);
tableConfig.setCustomCssClass("o_portlet_table");
tableConfig.setDisplayRowCount(false);
tableConfig.setPageingEnabled(false);
tableConfig.setDownloadOffered(false);
tableConfig.setSortingEnabled(false);
removeAsListenerAndDispose(tableController);
tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(tableController);
// dummy header key, won't be used since setDisplayTableHeader is set to
// false
tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.date", 0, null, ureq.getLocale()));
tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.subject", 1, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
tableController.setTableDataModel(new CourseCalendarPeekViewModel(nextThreeEvents, getTranslator()));
}
use of org.olat.core.gui.components.table.DefaultColumnDescriptor in project openolat by klemens.
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;
}
Aggregations