List of usage examples for com.google.gwt.user.cellview.client Column setFieldUpdater
public void setFieldUpdater(FieldUpdater<T, C> fieldUpdater)
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolsViewImpl.java
License:Apache License
private void addHardwareColumn() { Column<ProtocolRow, String> column = new ProtocolHardwareColumn(new EditTextCell(), new EditSelectionCell(sequencingHardware)) { @Override/* w ww .ja va 2 s . c o m*/ public String getValue(ProtocolRow row) { String v = row.getHardware(); return v == null ? "" : v; } }; column.setFieldUpdater(new FieldUpdater<ProtocolRow, String>() { @Override public void update(int index, ProtocolRow row, String value) { row.setHardware(value); updateRow(row); } }); column.setSortable(true); Comparator<ProtocolRow> comparator = new Comparator<ProtocolRow>() { @Override public int compare(ProtocolRow o1, ProtocolRow o2) { if (o1 == o2) { return 0; } String v1 = o1.getHardware(); String v2 = o2.getHardware(); return v1.compareTo(v2); } }; gridView.addPermanentColumn("Hardware", column, comparator, 150, Style.Unit.PX); }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolsViewImpl.java
License:Apache License
private void addSoftwareColumn() { Column<ProtocolRow, String> column = new Column<ProtocolRow, String>(new EditTextCell()) { @Override/*from w w w . j a v a 2s . co m*/ public String getValue(ProtocolRow row) { String v = row.getSoftware(); return v == null ? "" : v; } }; column.setFieldUpdater(new FieldUpdater<ProtocolRow, String>() { @Override public void update(int index, ProtocolRow row, String value) { row.setSoftware(value); updateRow(row); } }); column.setSortable(true); Comparator<ProtocolRow> comparator = new Comparator<ProtocolRow>() { @Override public int compare(ProtocolRow o1, ProtocolRow o2) { if (o1 == o2) { return 0; } String v1 = o1.getSoftware(); String v2 = o2.getSoftware(); return v1.compareTo(v2); } }; gridView.addPermanentColumn("Software", column, comparator, 150, Style.Unit.PX); }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolsViewImpl.java
License:Apache License
private void addPerformerColumn() { Column<ProtocolRow, String> column = new Column<ProtocolRow, String>(new EditTextCell()) { @Override//from w w w . ja v a2 s .co m public String getValue(ProtocolRow row) { String v = row.getPerformer(); return v == null ? "" : v; } }; column.setFieldUpdater(new FieldUpdater<ProtocolRow, String>() { @Override public void update(int index, ProtocolRow row, String value) { row.setPerformer(value); updateRow(row); } }); column.setSortable(true); Comparator<ProtocolRow> comparator = new Comparator<ProtocolRow>() { @Override public int compare(ProtocolRow o1, ProtocolRow o2) { if (o1 == o2) { return 0; } String v1 = o1.getPerformer(); String v2 = o2.getPerformer(); return v1.compareTo(v2); } }; gridView.addPermanentColumn("Performer", column, comparator, 150, Style.Unit.PX); }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.SamplesViewImpl.java
License:Apache License
private void addNameColumn() { final EditSuggestCell nameCell = new EditSuggestCell(null) { @Override/*from w w w . j a va2 s. c o m*/ public boolean validateInput(String value, int rowIndex) { if (value == null || trimValue(value).isEmpty()) { NotificationPopupPanel.error("Sample with empty name is not permitted.", true, false); return false; } if (!isNameUnique(value, rowIndex)) { NotificationPopupPanel.error("Sample with the name '" + value + "' already exists.", true, false); return false; } return true; } }; Column<SampleRow, String> column = new SampleNameColumn(nameCell); column.setFieldUpdater(new FieldUpdater<SampleRow, String>() { @Override public void update(int index, SampleRow row, String value) { row.setName(trimValue(value)); updateRow(row); } }); column.setSortable(true); Comparator<SampleRow> comparator = new Comparator<SampleRow>() { @Override public int compare(SampleRow o1, SampleRow o2) { if (o1 == o2) { return 0; } String v1 = o1.getName(); String v2 = o2.getName(); return v1.compareTo(v2); } }; gridView.addPermanentColumn("Name", column, comparator, 150, Style.Unit.PX); }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.SamplesViewImpl.java
License:Apache License
private void addTextColumn(final SampleColumn sampleColumn) { Column<SampleRow, String> column = new Column<SampleRow, String>(new EditSuggestCell(null)) { @Override//from w ww.ja v a 2s . co m public String getValue(SampleRow row) { return row.getValue(sampleColumn); } }; column.setFieldUpdater(new FieldUpdater<SampleRow, String>() { @Override public void update(int index, SampleRow row, String value) { row.setValue(trimValue(value), sampleColumn); updateRow(row); } }); //column.setSortable(true); gridView.addColumn(sampleColumn.getTitle(), column, null, COLUMN_WIDTH, Style.Unit.PX); }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.SamplesViewImpl.java
License:Apache License
private void addEfoSuggestColumn(final SampleColumn sampleColumn) { final SampleAttributeEfoSuggest efoSuggestService = presenter.getEfoTerms(); final OntologyTerm term = sampleColumn.getTerm(); Cell<String> efoSuggestCell = new EditSuggestCell(new EfoSuggestOracle(new SuggestService<OntologyTerm>() { @Override//from w w w . j av a 2 s.c om public void suggest(String query, int limit, AsyncCallback<ArrayList<OntologyTerm>> callback) { efoSuggestService.getTerms(query, term, limit, callback); } }), sampleColumn.getTemplate().isMandatory()); Column<SampleRow, String> column = new Column<SampleRow, String>(efoSuggestCell) { @Override public String getValue(SampleRow row) { return row.getValue(sampleColumn); } }; column.setFieldUpdater(new FieldUpdater<SampleRow, String>() { @Override public void update(int index, SampleRow row, String value) { row.setValue(trimValue(value), sampleColumn); updateRow(row); } }); //column.setSortable(true); gridView.addColumn(sampleColumn.getTitle(), column, null, COLUMN_WIDTH, Style.Unit.PX); }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.SamplesViewImpl.java
License:Apache License
private void addMaterialTypeColumn(final SampleColumn sampleColumn) { Column<SampleRow, String> column = new Column<SampleRow, String>(new EditSelectionCell(materialTypes)) { @Override/*from w w w . jav a 2 s. c o m*/ public String getValue(SampleRow row) { return row.getValue(sampleColumn); } }; column.setFieldUpdater(new FieldUpdater<SampleRow, String>() { @Override public void update(int index, SampleRow row, String value) { row.setValue(trimValue(value), sampleColumn); updateRow(row); } }); //column.setSortable(true); gridView.addPermanentColumn("Material Type", column, null, COLUMN_WIDTH, Style.Unit.PX); }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.user.client.view.SubmissionListViewImpl.java
License:Apache License
public SubmissionListViewImpl() { isCurator = false;/* w w w .ja v a2 s. com*/ dataGrid = new CustomDataGrid<SubmissionRow>(Integer.MAX_VALUE, false); dataGrid.addColumn(new TextColumn<SubmissionRow>() { @Override public String getValue(SubmissionRow object) { return formatDate(object.getCreated()); } }, new TextHeader("Created on")); /* TODO: uncomment when we have array submissions dataGrid.addColumn(new TextColumn<SubmissionRow>() { @Override public String getValue(SubmissionRow object) { return object.getType().getTitle(); } }, new TextHeader("Type")); */ dataGrid.addColumn(new TextColumn<SubmissionRow>() { @Override public String getValue(SubmissionRow object) { return object.getAccession(); } }, new TextHeader("Accession")); dataGrid.addColumn(new TextColumn<SubmissionRow>() { @Override public String getValue(SubmissionRow object) { if (object.getType().isImported() && null == object.getTitle()) { return "UNPROCESSED IMPORTED SUBMISSION"; } return object.getTitle(); } }, new TextHeader("Title")); dataGrid.addColumn(new TextColumn<SubmissionRow>() { @Override public String getValue(SubmissionRow object) { return object.getStatus().getTitle(); } }, new TextHeader("Status")); Column<SubmissionRow, ImageResource> editIconColumn = new Column<SubmissionRow, ImageResource>( new ClickableImageResourceCell()) { @Override public ImageResource getValue(SubmissionRow object) { return resourceBundle.editIcon(); } }; editIconColumn.setFieldUpdater(new FieldUpdater<SubmissionRow, ImageResource>() { public void update(int index, SubmissionRow row, ImageResource value) { SubmissionType type = row.getType(); if (type.isImported()) { presenter.onImportSubmission(row.getId()); } else { presenter.onEditSubmission(row.getId()); } } }); dataGrid.addColumn(editIconColumn); dataGrid.setColumnWidth(0, 11, Style.Unit.EM); dataGrid.setColumnWidth(1, 11, Style.Unit.EM); dataGrid.setColumnWidth(3, 14, Style.Unit.EM); dataGrid.setColumnWidth(4, 5, Style.Unit.EM); final SingleSelectionModel<SubmissionRow> selectionModel = new SingleSelectionModel<SubmissionRow>( new ProvidesKey<SubmissionRow>() { public Object getKey(SubmissionRow item) { return item.getId(); } }); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { SubmissionRow row = selectionModel.getSelectedObject(); if (null != row) { presenter.onSubmissionSelected(row.getId()); } } }); //todo create column black list dynamically dataGrid.setSelectionModel(selectionModel, DefaultSelectionEventManager.<SubmissionRow>createBlacklistManager(4)); dataGrid.addStyleName("no-cell-borders"); dataProvider = new ListDataProvider<SubmissionRow>(); dataProvider.addDataDisplay(dataGrid); Binder uiBinder = GWT.create(Binder.class); initWidget(uiBinder.createAndBindUi(this)); }