use of org.activityinfo.ui.client.page.common.columns.ReadTextColumn in project activityinfo by bedatadriven.
the class ColumnModelBuilder method maybeAddTwoLineLocationColumn.
public ColumnModelBuilder maybeAddTwoLineLocationColumn(ActivityFormDTO activity) {
if (activity.getLocationType().getBoundAdminLevelId() == null) {
ReadTextColumn column = new ReadTextColumn(SiteDTO.LOCATION_NAME_PROPERTY, activity.getLocationType().getName(), 100);
column.setRenderer(new LocationColumnRenderer());
columns.add(column);
}
return this;
}
use of org.activityinfo.ui.client.page.common.columns.ReadTextColumn in project activityinfo by bedatadriven.
the class ColumnModelBuilder method addLocationColumn.
public ColumnModelBuilder addLocationColumn() {
ReadTextColumn column = new ReadTextColumn(SiteDTO.LOCATION_NAME_PROPERTY, I18N.CONSTANTS.location(), 100);
columns.add(column);
return this;
}
use of org.activityinfo.ui.client.page.common.columns.ReadTextColumn in project activityinfo by bedatadriven.
the class LockedPeriodGrid method createGrid.
private void createGrid() {
List<ColumnConfig> configs = new ArrayList<>();
columnEnabled = new EditCheckColumnConfig("enabled", I18N.CONSTANTS.enabledColumn(), 55);
columnEnabled.setSortable(false);
ColumnConfig columnPeriodType = new ColumnConfig();
columnPeriodType.setHeaderText(I18N.CONSTANTS.type());
columnPeriodType.setToolTip(I18N.CONSTANTS.type());
columnPeriodType.setWidth(48);
columnPeriodType.setRowHeader(true);
columnPeriodType.setRenderer(new LockTypeIconCellRenderer());
configs.add(columnEnabled);
configs.add(columnPeriodType);
configs.add(new ReadTextColumn("parentName", I18N.CONSTANTS.parentName(), 150));
configs.add(new ReadTextColumn("name", I18N.CONSTANTS.name(), 100));
configs.add(new EditableLocalDateColumn("fromDate", I18N.CONSTANTS.fromDate(), 100));
configs.add(new EditableLocalDateColumn("toDate", I18N.CONSTANTS.toDate(), 100));
lockedPeriodGrid = new EditorGrid<>(lockedPeriodStore, new ColumnModel(configs));
lockedPeriodGrid.addListener(Events.ValidateEdit, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent baseEvent) {
GridEvent gridEvent = (GridEvent) baseEvent;
LockedPeriodDTO model = (LockedPeriodDTO) gridEvent.getModel();
LocalDate fromDate = model.getFromDate();
LocalDate toDate = model.getToDate();
if ("fromDate".equals(gridEvent.getProperty())) {
fromDate = (LocalDate) gridEvent.getValue();
}
if ("toDate".equals(gridEvent.getProperty())) {
toDate = (LocalDate) gridEvent.getValue();
}
if (!fromDate.before(toDate) && !fromDate.equals(toDate)) {
MessageBox.alert(I18N.CONSTANTS.alert(), I18N.CONSTANTS.fromDateIsBeforeToDate(), null);
lockedPeriodGrid.getActiveEditor().cancelEdit();
}
}
});
lockedPeriodGrid.addListener(Events.OnClick, new Listener<ComponentEvent>() {
@Override
public void handleEvent(ComponentEvent be) {
updateState(be);
}
});
add(lockedPeriodGrid);
}
use of org.activityinfo.ui.client.page.common.columns.ReadTextColumn in project activityinfo by bedatadriven.
the class PiechartLayerOptions method setupIndicatorOptionsGrid.
private void setupIndicatorOptionsGrid() {
List<ColumnConfig> columnConfigs = new ArrayList<ColumnConfig>();
columnConfigs.add(new EditColorColumn());
columnConfigs.add(new ReadTextColumn("name", I18N.CONSTANTS.indicators(), 50));
ColumnModel columnmodelIndicators = new ColumnModel(columnConfigs);
EditorGrid<NamedSlice> indicatorOptionGrid = new EditorGrid<NamedSlice>(indicatorsStore, columnmodelIndicators);
indicatorOptionGrid.setBorders(false);
indicatorOptionGrid.setAutoExpandColumn("name");
indicatorOptionGrid.setAutoWidth(true);
indicatorOptionGrid.setHeight(100);
indicatorOptionGrid.getView().setShowDirtyCells(false);
indicatorOptionGrid.setSelectionModel(new CellSelectionModel<PiechartLayerOptions.NamedSlice>());
indicatorOptionGrid.addListener(Events.AfterEdit, new Listener<GridEvent<NamedSlice>>() {
@Override
public void handleEvent(GridEvent<NamedSlice> be) {
be.getModel().getSlice().setColor(be.getModel().getColor());
ValueChangeEvent.fire(PiechartLayerOptions.this, piechartMapLayer);
}
});
VBoxLayoutData vbld = new VBoxLayoutData();
vbld.setFlex(1);
panel.add(indicatorOptionGrid);
}
use of org.activityinfo.ui.client.page.common.columns.ReadTextColumn in project activityinfo by bedatadriven.
the class ColumnModelBuilder method maybeAddSingleLineLocationColumn.
public ColumnModelBuilder maybeAddSingleLineLocationColumn(ActivityFormDTO activity) {
if (activity.getLocationType().getBoundAdminLevelId() == null) {
ReadTextColumn column = new ReadTextColumn(SiteDTO.LOCATION_NAME_PROPERTY, activity.getLocationType().getName(), 100);
columns.add(column);
}
return this;
}
Aggregations