use of com.extjs.gxt.ui.client.widget.grid.ColumnData in project activityinfo by bedatadriven.
the class ColumnModelBuilder method addDatabaseColumn.
public ColumnModelBuilder addDatabaseColumn(final SchemaDTO schema) {
ColumnConfig config = new ColumnConfig("activityId", I18N.CONSTANTS.activity(), 100);
config.setRenderer(new GridCellRenderer<SiteDTO>() {
@Override
public Object render(SiteDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<SiteDTO> store, Grid<SiteDTO> grid) {
ActivityDTO activity = schema.getActivityById(model.getActivityId());
return activity == null ? "" : activity.getDatabase().getName();
}
});
columns.add(config);
return this;
}
use of com.extjs.gxt.ui.client.widget.grid.ColumnData in project activityinfo by bedatadriven.
the class ShareReportDialog method createColumnModel.
private ColumnModel createColumnModel() {
ColumnConfig icon = new ColumnConfig("icon", "", 26);
icon.setSortable(false);
icon.setResizable(false);
icon.setMenuDisabled(true);
icon.setRenderer(new GridCellRenderer<ReportVisibilityDTO>() {
@Override
public Object render(ReportVisibilityDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ReportVisibilityDTO> store, Grid<ReportVisibilityDTO> grid) {
return IconImageBundle.ICONS.group().getHTML();
}
});
ColumnConfig name = new ColumnConfig("databaseName", I18N.CONSTANTS.group(), 150);
name.setRenderer(new GridCellRenderer<ReportVisibilityDTO>() {
@Override
public Object render(ReportVisibilityDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ReportVisibilityDTO> store, Grid<ReportVisibilityDTO> grid) {
return model.getDatabaseName() + " Users";
}
});
visibleColumn = new CheckColumnConfig("visible", I18N.CONSTANTS.shared(), 75);
visibleColumn.setDataIndex("visible");
dashboardColumn = new CheckColumnConfig("defaultDashboard", I18N.CONSTANTS.defaultDashboard(), 75);
dashboardColumn.setDataIndex("defaultDashboard");
ColumnModel columnModel = new ColumnModel(Arrays.asList(icon, name, visibleColumn, dashboardColumn));
return columnModel;
}
use of com.extjs.gxt.ui.client.widget.grid.ColumnData in project activityinfo by bedatadriven.
the class DatabaseGridPanel method createColumnModel.
private ColumnModel createColumnModel() {
ColumnConfig icon = new ColumnConfig("icon", 28);
icon.setSortable(false);
icon.setMenuDisabled(true);
icon.setRenderer(new GridCellRenderer<UserDatabaseDTO>() {
@Override
public Object render(UserDatabaseDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<UserDatabaseDTO> store, Grid<UserDatabaseDTO> grid) {
return linked.contains(model.getId()) ? IconImageBundle.ICONS.link().getHTML() : "";
}
});
ColumnConfig name = new ColumnConfig("name", I18N.CONSTANTS.database(), 150);
name.setSortable(false);
name.setMenuDisabled(true);
name.setRenderer(new GridCellRenderer<UserDatabaseDTO>() {
@Override
public Object render(UserDatabaseDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<UserDatabaseDTO> store, Grid<UserDatabaseDTO> grid) {
if (hasPermission(model)) {
return model.getName();
} else {
StringBuilder html = new StringBuilder();
html.append("<span style=\"color: gray\">").append(model.getName()).append("</span>");
return html.toString();
}
}
});
return new ColumnModel(Arrays.asList(icon, name));
}
use of com.extjs.gxt.ui.client.widget.grid.ColumnData in project activityinfo by bedatadriven.
the class ColumnModelBuilder method addActivityColumn.
public ColumnModelBuilder addActivityColumn(final SchemaDTO schema) {
ColumnConfig config = new ColumnConfig("activityId", I18N.CONSTANTS.activity(), 100);
config.setRenderer(new GridCellRenderer<SiteDTO>() {
@Override
public Object render(SiteDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<SiteDTO> store, Grid<SiteDTO> grid) {
ActivityDTO activity = schema.getActivityById(model.getActivityId());
return activity == null ? "" : activity.getName();
}
});
columns.add(config);
return this;
}
use of com.extjs.gxt.ui.client.widget.grid.ColumnData in project activityinfo by bedatadriven.
the class ReportGridPanel method createColumnModel.
private ColumnModel createColumnModel() {
ColumnConfig dashboard = new ColumnConfig("dashboard", "", 28);
dashboard.setHeader(IconImageBundle.ICONS.star().getHTML());
dashboard.setResizable(false);
dashboard.setMenuDisabled(true);
dashboard.setRenderer(new GridCellRenderer<ReportMetadataDTO>() {
@Override
public Object render(ReportMetadataDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ReportMetadataDTO> store, Grid<ReportMetadataDTO> grid) {
return "<div style='cursor:pointer'>" + (model.isDashboard() ? IconImageBundle.ICONS.star().getHTML() : IconImageBundle.ICONS.starWhite().getHTML()) + "</div>";
}
});
ColumnConfig title = new ColumnConfig("title", I18N.CONSTANTS.title(), 150);
ColumnConfig owner = new ColumnConfig("ownerName", I18N.CONSTANTS.ownerName(), 100);
owner.setRenderer(new GridCellRenderer<ReportMetadataDTO>() {
@Override
public Object render(ReportMetadataDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ReportMetadataDTO> store, Grid<ReportMetadataDTO> grid) {
if (model.getAmOwner()) {
return "Me";
} else {
return model.getOwnerName();
}
}
});
ColumnConfig email = new ColumnConfig("email", I18N.CONSTANTS.emailSubscription(), 100);
email.setRenderer(new GridCellRenderer<ReportMetadataDTO>() {
@Override
public Object render(ReportMetadataDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ReportMetadataDTO> store, Grid<ReportMetadataDTO> grid) {
switch(model.getEmailDelivery()) {
case NONE:
return "<i>" + I18N.CONSTANTS.none() + "</i>";
case MONTHLY:
return I18N.CONSTANTS.monthly();
case WEEKLY:
default:
return I18N.CONSTANTS.weekly();
}
}
});
return new ColumnModel(Arrays.asList(dashboard, title, owner, email));
}
Aggregations