List of usage examples for com.google.gwt.user.cellview.client Column Column
public Column(Cell<C> cell)
From source file:org.drools.guvnor.client.widgets.tables.QueryPagedTable.java
License:Apache License
@Override protected void addAncillaryColumns(ColumnPicker<QueryPageRow> columnPicker, SortableHeaderGroup<QueryPageRow> sortableHeaderGroup) { Column<QueryPageRow, ComparableImageResource> formatColumn = new Column<QueryPageRow, ComparableImageResource>( new ComparableImageResourceCell()) { public ComparableImageResource getValue(QueryPageRow row) { AssetEditorFactory factory = clientFactory.getAssetEditorFactory(); return new ComparableImageResource(row.getFormat(), factory.getAssetEditorIcon(row.getFormat())); }/* w w w .java 2s . c om*/ }; columnPicker.addColumn(formatColumn, new SortableHeader<QueryPageRow, ComparableImageResource>( sortableHeaderGroup, constants.Format(), formatColumn), true); TitledTextColumn<QueryPageRow> titleColumn = new TitledTextColumn<QueryPageRow>() { public TitledText getValue(QueryPageRow row) { return new TitledText(row.getName(), row.getAbbreviatedDescription()); } }; columnPicker.addColumn(titleColumn, new SortableHeader<QueryPageRow, TitledText>(sortableHeaderGroup, constants.Name(), titleColumn), true); TextColumn<QueryPageRow> packageNameColumn = new TextColumn<QueryPageRow>() { public String getValue(QueryPageRow row) { return row.getPackageName(); } }; columnPicker.addColumn(packageNameColumn, new SortableHeader<QueryPageRow, String>(sortableHeaderGroup, constants.PackageName(), packageNameColumn), false); Column<QueryPageRow, Date> createdDateColumn = new Column<QueryPageRow, Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) { public Date getValue(QueryPageRow row) { return row.getCreatedDate(); } }; columnPicker.addColumn(createdDateColumn, new SortableHeader<QueryPageRow, Date>(sortableHeaderGroup, constants.CreatedDate(), createdDateColumn), false); Column<QueryPageRow, Date> lastModifiedColumn = new Column<QueryPageRow, Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) { public Date getValue(QueryPageRow row) { return row.getLastModified(); } }; columnPicker.addColumn(lastModifiedColumn, new SortableHeader<QueryPageRow, Date>(sortableHeaderGroup, constants.LastModified(), lastModifiedColumn), true); }
From source file:org.drools.guvnor.client.widgets.tables.SnapshotComparisonPagedTable.java
License:Apache License
@Override protected void doCellTable() { ProvidesKey<SnapshotComparisonPageRow> providesKey = new ProvidesKey<SnapshotComparisonPageRow>() { public Object getKey(SnapshotComparisonPageRow row) { return row.getDiff().leftUuid; }/*from ww w .j av a2 s.co m*/ }; cellTable = new CellTable<SnapshotComparisonPageRow>(providesKey); selectionModel = new MultiSelectionModel<SnapshotComparisonPageRow>(providesKey); cellTable.setSelectionModel(selectionModel); SelectionColumn.createAndAddSelectionColumn(cellTable); ColumnPicker<SnapshotComparisonPageRow> columnPicker = new ColumnPicker<SnapshotComparisonPageRow>( cellTable); SortableHeaderGroup<SnapshotComparisonPageRow> sortableHeaderGroup = new SortableHeaderGroup<SnapshotComparisonPageRow>( cellTable); final TextColumn<SnapshotComparisonPageRow> uuidNumberColumn = new TextColumn<SnapshotComparisonPageRow>() { public String getValue(SnapshotComparisonPageRow row) { return row.getDiff().rightUuid; } }; columnPicker.addColumn(uuidNumberColumn, new SortableHeader<SnapshotComparisonPageRow, String>( sortableHeaderGroup, constants.uuid(), uuidNumberColumn), false); // Add any additional columns addAncillaryColumns(columnPicker, sortableHeaderGroup); // Add "Open" button column Column<SnapshotComparisonPageRow, String> openColumn = new Column<SnapshotComparisonPageRow, String>( new ButtonCell()) { public String getValue(SnapshotComparisonPageRow row) { return constants.Open(); } }; openColumn.setFieldUpdater(new FieldUpdater<SnapshotComparisonPageRow, String>() { public void update(int index, SnapshotComparisonPageRow row, String value) { openSelectedCommand.open(row.getDiff().rightUuid); } }); columnPicker.addColumn(openColumn, new TextHeader(constants.Open()), true); cellTable.setWidth("100%"); columnPickerButton = columnPicker.createToggleButton(); }
From source file:org.drools.guvnor.client.widgets.tables.SnapshotComparisonPagedTable.java
License:Apache License
@Override protected void addAncillaryColumns(ColumnPicker<SnapshotComparisonPageRow> columnPicker, SortableHeaderGroup<SnapshotComparisonPageRow> sortableHeaderGroup) { Column<SnapshotComparisonPageRow, String> lhsSnapshotColumn = new Column<SnapshotComparisonPageRow, String>( new TextCell()) { public String getValue(SnapshotComparisonPageRow row) { return row.getDiff().name; }/*w w w. j a va2s. c o m*/ }; // Header text is set in call-back from Repository service this.lhsSnapshotHeader = new SortableHeader<SnapshotComparisonPageRow, String>(sortableHeaderGroup, "", lhsSnapshotColumn); columnPicker.addColumn(lhsSnapshotColumn, this.lhsSnapshotHeader, true); Column<SnapshotComparisonPageRow, String> comparisonTypeColumn = new Column<SnapshotComparisonPageRow, String>( new SnapshotComparisonTypeCell()) { public String getValue(SnapshotComparisonPageRow row) { return row.getDiff().diffType; } }; columnPicker.addColumn(comparisonTypeColumn, new SortableHeader<SnapshotComparisonPageRow, String>( sortableHeaderGroup, constants.Type(), comparisonTypeColumn), true); Column<SnapshotComparisonPageRow, String> rhsSnapshotColumn = new Column<SnapshotComparisonPageRow, String>( new TextCell()) { public String getValue(SnapshotComparisonPageRow row) { return row.getDiff().name; } }; // Header text is set in call-back from Repository service this.rhsSnapshotHeader = new SortableHeader<SnapshotComparisonPageRow, String>(sortableHeaderGroup, "", rhsSnapshotColumn); columnPicker.addColumn(rhsSnapshotColumn, this.rhsSnapshotHeader, true); }
From source file:org.drools.guvnor.client.widgets.tables.StatePagedTable.java
License:Apache License
@Override protected void addAncillaryColumns(ColumnPicker<StatePageRow> columnPicker, SortableHeaderGroup<StatePageRow> sortableHeaderGroup) { Column<StatePageRow, ComparableImageResource> formatColumn = new Column<StatePageRow, ComparableImageResource>( new ComparableImageResourceCell()) { public ComparableImageResource getValue(StatePageRow row) { AssetEditorFactory factory = clientFactory.getAssetEditorFactory(); return new ComparableImageResource(row.getFormat(), factory.getAssetEditorIcon(row.getFormat())); }//from w w w . j a v a 2 s. c o m }; columnPicker.addColumn(formatColumn, new SortableHeader<StatePageRow, ComparableImageResource>( sortableHeaderGroup, constants.Format(), formatColumn), true); TitledTextColumn<StatePageRow> titleColumn = new TitledTextColumn<StatePageRow>() { public TitledText getValue(StatePageRow row) { return new TitledText(row.getName(), row.getAbbreviatedDescription()); } }; columnPicker.addColumn(titleColumn, new SortableHeader<StatePageRow, TitledText>(sortableHeaderGroup, constants.Name(), titleColumn), true); TextColumn<StatePageRow> packageNameColumn = new TextColumn<StatePageRow>() { public String getValue(StatePageRow row) { return row.getPackageName(); } }; columnPicker.addColumn(packageNameColumn, new SortableHeader<StatePageRow, String>(sortableHeaderGroup, constants.PackageName(), packageNameColumn), true); TextColumn<StatePageRow> statusNameColumn = new TextColumn<StatePageRow>() { public String getValue(StatePageRow row) { return row.getStateName(); } }; columnPicker.addColumn(statusNameColumn, new SortableHeader<StatePageRow, String>(sortableHeaderGroup, constants.Status(), statusNameColumn), true); Column<StatePageRow, Date> lastModifiedColumn = new Column<StatePageRow, Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) { public Date getValue(StatePageRow row) { return row.getLastModified(); } }; columnPicker.addColumn(lastModifiedColumn, new SortableHeader<StatePageRow, Date>(sortableHeaderGroup, constants.LastModified(), lastModifiedColumn), true); }
From source file:org.drools.workbench.screens.enums.client.editor.EnumEditorViewImpl.java
License:Apache License
@PostConstruct public void init() { final CellTable<EnumRow> cellTable = new CellTable<EnumRow>(Integer.MAX_VALUE); cellTable.setStriped(true);//from w w w. j a v a 2 s . c o m cellTable.setCondensed(true); cellTable.setBordered(true); cellTable.setEmptyTableWidget(new Label(EnumEditorConstants.INSTANCE.noEnumsDefined())); cellTable.setWidth("100%"); final VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); //Column definitions final Column<EnumRow, String> factNameColumn = new Column<EnumRow, String>(new EditTextCell()) { @Override public String getValue(final EnumRow enumRow) { return enumRow.getFactName(); } }; final Column<EnumRow, String> fieldNameColumn = new Column<EnumRow, String>(new EditTextCell()) { @Override public String getValue(final EnumRow enumRow) { return enumRow.getFieldName(); } }; final Column<EnumRow, String> contextColumn = new Column<EnumRow, String>(new EditTextCell()) { @Override public String getValue(final EnumRow enumRow) { return enumRow.getContext(); } }; //See https://bugzilla.redhat.com/show_bug.cgi?id=1167360 //Replaced image-based ButtonCell with a button due to IE10 interpreting it as a form-submit button and hence responding to ENTER key presses. //See http://stackoverflow.com/questions/12325066/button-click-event-fires-when-pressing-enter-key-in-different-input-no-forms final ButtonCell deleteEnumButton = new ButtonCell(ButtonSize.SMALL); deleteEnumButton.setType(ButtonType.DANGER); deleteEnumButton.setIcon(IconType.MINUS_SIGN); final Column<EnumRow, String> deleteEnumColumn = new Column<EnumRow, String>(deleteEnumButton) { @Override public String getValue(final EnumRow global) { return EnumEditorConstants.INSTANCE.remove(); } }; //Write updates back to the model deleteEnumColumn.setFieldUpdater(new FieldUpdater<EnumRow, String>() { @Override public void update(final int index, final EnumRow object, final String value) { dataProvider.getList().remove(index); } }); factNameColumn.setFieldUpdater(new FieldUpdater<EnumRow, String>() { @Override public void update(final int index, final EnumRow object, final String value) { object.setFactName(value); } }); fieldNameColumn.setFieldUpdater(new FieldUpdater<EnumRow, String>() { @Override public void update(final int index, final EnumRow object, final String value) { object.setFieldName(value); } }); contextColumn.setFieldUpdater(new FieldUpdater<EnumRow, String>() { @Override public void update(final int index, final EnumRow object, final String value) { object.setContext(value); } }); cellTable.addColumn(factNameColumn, EnumEditorConstants.INSTANCE.FactColumnHeader()); cellTable.addColumn(fieldNameColumn, EnumEditorConstants.INSTANCE.FieldColumnHeader()); cellTable.addColumn(contextColumn, EnumEditorConstants.INSTANCE.ContextColumnHeader()); cellTable.addColumn(deleteEnumColumn); // Connect the table to the data provider. dataProvider.addDataDisplay(cellTable); final Button addButton = new Button(EnumEditorConstants.INSTANCE.AddEnum(), new ClickHandler() { public void onClick(ClickEvent clickEvent) { final EnumRow enumRow = new EnumRow(); dataProvider.getList().add(enumRow); } }); panel.add(addButton); panel.add(cellTable); initWidget(panel); }
From source file:org.drools.workbench.screens.guided.scorecard.client.widget.GuidedScoreCardEditor.java
License:Apache License
private Widget addAttributeCellTable(final FlexTable cGrid, final Characteristic characteristic, final boolean enumColumn, final String dataType, final List<String> operators) { String[] enumValues = null;/* w ww . j av a 2s . co m*/ if (characteristic != null) { //enum values if (enumColumn) { String factName = characteristic.getFact(); String fieldName = characteristic.getField(); enumValues = oracle.getEnumValues(factName, fieldName); } } final CellTable<Attribute> attributeCellTable = new CellTable<Attribute>(); //Operators column final DynamicSelectionCell categoryCell = new DynamicSelectionCell(operators); final Column<Attribute, String> operatorColumn = new Column<Attribute, String>(categoryCell) { public String getValue(final Attribute object) { return object.getOperator(); } }; operatorColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { object.setOperator(value); attributeCellTable.redraw(); } }); //Value column Column<Attribute, String> valueColumn = null; if (enumValues != null && enumValues.length > 0) { valueColumn = new Column<Attribute, String>(new DynamicSelectionCell(Arrays.asList(enumValues))) { public String getValue(final Attribute object) { return object.getValue(); } }; valueColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { object.setValue(value); attributeCellTable.redraw(); } }); } if (valueColumn == null) { valueColumn = new Column<Attribute, String>(new CustomEditTextCell()) { public String getValue(final Attribute attribute) { return attribute.getValue(); } }; valueColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { object.setValue(value); attributeCellTable.redraw(); } }); } //Partial Score column final EditTextCell partialScoreCell = new EditTextCell(); final Column<Attribute, String> partialScoreColumn = new Column<Attribute, String>(partialScoreCell) { public String getValue(final Attribute attribute) { return "" + attribute.getPartialScore(); } }; partialScoreColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { try { double d = Double.parseDouble(value); object.setPartialScore(d); } catch (Exception e1) { partialScoreCell.clearViewData(object); } attributeCellTable.redraw(); } }); //Reason Code column final Column<Attribute, String> reasonCodeColumn = new Column<Attribute, String>(new EditTextCell()) { public String getValue(final Attribute attribute) { return attribute.getReasonCode(); } }; reasonCodeColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { object.setReasonCode(value); attributeCellTable.redraw(); } }); final ActionCell.Delegate<Attribute> delegate = new ActionCell.Delegate<Attribute>() { public void execute(final Attribute attribute) { if (Window.confirm(GuidedScoreCardConstants.INSTANCE.promptDeleteAttribute())) { final List<Attribute> list = characteristicsAttrMap.get(cGrid).getList(); list.remove(attribute); if ("boolean".equalsIgnoreCase(dataType)) { ((Button) cGrid.getWidget(0, 3)).setEnabled(list.size() != 2); } attributeCellTable.redraw(); } } }; final Cell<Attribute> actionCell = new ActionCell<Attribute>(GuidedScoreCardConstants.INSTANCE.remove(), delegate); final Column<Attribute, String> actionColumn = new IdentityColumn(actionCell); // Add the columns. attributeCellTable.addColumn(operatorColumn, GuidedScoreCardConstants.INSTANCE.operator()); attributeCellTable.addColumn(valueColumn, GuidedScoreCardConstants.INSTANCE.value()); attributeCellTable.addColumn(partialScoreColumn, GuidedScoreCardConstants.INSTANCE.partialScore()); attributeCellTable.addColumn(reasonCodeColumn, GuidedScoreCardConstants.INSTANCE.reasonCode()); attributeCellTable.addColumn(actionColumn, GuidedScoreCardConstants.INSTANCE.actions()); attributeCellTable.setWidth("100%", true); attributeCellTable.setColumnWidth(operatorColumn, 20.0, Style.Unit.PCT); attributeCellTable.setColumnWidth(valueColumn, 20.0, Style.Unit.PCT); attributeCellTable.setColumnWidth(partialScoreColumn, 20.0, Style.Unit.PCT); attributeCellTable.setColumnWidth(reasonCodeColumn, 20.0, Style.Unit.PCT); attributeCellTable.setColumnWidth(actionColumn, 20.0, Style.Unit.PCT); ListDataProvider<Attribute> dataProvider = new ListDataProvider<Attribute>(); dataProvider.addDataDisplay(attributeCellTable); characteristicsAttrMap.put(cGrid, dataProvider); if ("boolean".equalsIgnoreCase(dataType)) { CustomEditTextCell etc = (CustomEditTextCell) attributeCellTable.getColumn(1).getCell(); etc.setEnabled(false); } return (attributeCellTable); }
From source file:org.ebayopensource.turmeric.policy.adminui.client.view.common.SelectBoxesWidget.java
License:Open Source License
/** * Configure available table.//from ww w . j a va 2 s. c o m */ private void configureAvailableTable() { availTable = new CellTable<String>(availKeyProvider); availSelectionModel = new MultiSelectionModel<String>(availKeyProvider); availTable.setSelectionModel(availSelectionModel); availSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { Set<String> x = availSelectionModel.getSelectedSet(); availSelections.clear(); if (x != null) availSelections.addAll(x); } }); availDataProvider = new ListDataProvider<String>(); availDataProvider.addDataDisplay(availTable); availPager = new TurmericPager(); availPager.setPageSize(5); availPager.setDisplay(availTable); // text column for type ClickableTextCell sbTypeCellClickable = new ClickableTextCell(); Column<String, String> typeCol = new Column<String, String>(sbTypeCellClickable) { @Override public String getValue(String value) { return value; } }; availTable.addColumn(typeCol, ""); }
From source file:org.ebayopensource.turmeric.policy.adminui.client.view.common.SelectBoxesWidget.java
License:Open Source License
/** * Configure selected table./* w ww . ja va 2s. co m*/ */ private void configureSelectedTable() { selectedTable = new CellTable<String>(selectedKeyProvider); selectedSelectionModel = new MultiSelectionModel<String>(selectedKeyProvider); selectedTable.setSelectionModel(selectedSelectionModel); selectedSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { Set<String> x = selectedSelectionModel.getSelectedSet(); selectedSelections.clear(); if (x != null) selectedSelections.addAll(x); } }); selectedDataProvider = new ListDataProvider<String>(); selectedDataProvider.addDataDisplay(selectedTable); selectedPager = new TurmericPager(); selectedPager.setPageSize(5); selectedPager.setDisplay(selectedTable); // text column for type ClickableTextCell sbTypeCellClickable = new ClickableTextCell(); Column<String, String> typeCol = new Column<String, String>(sbTypeCellClickable) { @Override public String getValue(String arg0) { return arg0; } }; selectedTable.addColumn(typeCol, ""); }
From source file:org.ebayopensource.turmeric.policy.adminui.client.view.policy.PolicyCreateView.java
License:Open Source License
@Override public void setPolicyType(final String policyType) { if ("RL".equalsIgnoreCase(policyType)) { CellTable<PolicySubjectAssignment> cellTable = ((SubjectContentView) subjectContentView).getCellTable(); // text column for Exclusion Subject names Column<PolicySubjectAssignment, List<String>> exclusionSubjectNamesCol = new Column<PolicySubjectAssignment, List<String>>( new CustomListCell(MIN_SCROLLBAR_SIZE)) { public List<String> getValue(PolicySubjectAssignment assignment) { if (assignment == null || assignment.getExclusionSubjects() == null) { return null; }// ww w. j ava2 s.co m ArrayList<String> namesList = new ArrayList<String>(); for (Subject subject : assignment.getExclusionSubjects()) { namesList.add(subject.getName()); } return namesList; } }; cellTable.addColumn(exclusionSubjectNamesCol, PolicyAdminUIUtil.policyAdminConstants.exclusionSubjects()); // text column for Exclusion Subject Group names Column<PolicySubjectAssignment, List<String>> exclusionSGNamesCol = new Column<PolicySubjectAssignment, List<String>>( new CustomListCell(MIN_SCROLLBAR_SIZE)) { public List<String> getValue(PolicySubjectAssignment assignment) { if (assignment == null || assignment.getExclusionSubjectGroups() == null) { return null; } ArrayList<String> namesList = new ArrayList<String>(); for (SubjectGroup subjectGroup : assignment.getExclusionSubjectGroups()) { namesList.add(subjectGroup.getName()); } return namesList; } }; cellTable.addColumn(exclusionSGNamesCol, PolicyAdminUIUtil.policyAdminConstants.exclusionSubjectGroups()); } this.policyType.setText(policyType); }
From source file:org.ebayopensource.turmeric.policy.adminui.client.view.policy.PolicyViewView.java
License:Open Source License
public void setPolicyType(final String policyType) { if ("RL".equalsIgnoreCase(policyType)) { CellTable<PolicySubjectAssignment> cellTable = ((SubjectContentView) subjectContentView).getCellTable(); // text column for Exclusion Subject names Column<PolicySubjectAssignment, List<String>> excluionSubjectNamesCol = new Column<PolicySubjectAssignment, List<String>>( new CustomListCell(MIN_SCROLLBAR_SIZE)) { public List<String> getValue(PolicySubjectAssignment assignment) { if (assignment == null || assignment.getExclusionSubjects() == null) { return null; }/*w w w . j a v a 2 s. c o m*/ ArrayList<String> namesList = new ArrayList<String>(); for (Subject subject : assignment.getExclusionSubjects()) { namesList.add(subject.getName()); } return namesList; } }; cellTable.addColumn(excluionSubjectNamesCol, PolicyAdminUIUtil.policyAdminConstants.exclusionSubjects()); // text column for Exclusion Subject Group names Column<PolicySubjectAssignment, List<String>> exclusionSGNamesCol = new Column<PolicySubjectAssignment, List<String>>( new CustomListCell(MIN_SCROLLBAR_SIZE)) { public List<String> getValue(PolicySubjectAssignment assignment) { if (assignment == null || assignment.getExclusionSubjectGroups() == null) { return null; } ArrayList<String> namesList = new ArrayList<String>(); for (SubjectGroup subjectGroup : assignment.getExclusionSubjectGroups()) { namesList.add(subjectGroup.getName()); } return namesList; } }; cellTable.addColumn(exclusionSGNamesCol, PolicyAdminUIUtil.policyAdminConstants.exclusionSubjectGroups()); } this.policyType.setText(policyType); }