Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

GridDefaultTextRendererWidget.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.widgetset.client.grid;
  17. import com.vaadin.v7.client.widget.grid.datasources.ListDataSource;
  18. import com.vaadin.v7.client.widgets.Grid;
  19. import com.vaadin.v7.client.widgets.Grid.Column;
  20. import com.vaadin.v7.client.widgets.Grid.SelectionMode;
  21. import com.vaadin.v7.shared.ui.grid.HeightMode;
  22. public class GridDefaultTextRendererWidget
  23. extends PureGWTTestApplication<Grid<String>> {
  24. /*
  25. * This can't be null, because grid thinks that a row object of null means
  26. * "data is still being fetched".
  27. */
  28. private static final String NULL_STRING = "";
  29. private Grid<String> grid;
  30. public GridDefaultTextRendererWidget() {
  31. super(new Grid<String>());
  32. grid = getTestedWidget();
  33. grid.setDataSource(new ListDataSource<String>(NULL_STRING, "string"));
  34. grid.addColumn(new Column<String, String>() {
  35. @Override
  36. public String getValue(String row) {
  37. if (!NULL_STRING.equals(row)) {
  38. return row;
  39. } else {
  40. return null;
  41. }
  42. }
  43. });
  44. grid.addColumn(new Column<String, String>() {
  45. @Override
  46. public String getValue(String row) {
  47. return "foo";
  48. }
  49. });
  50. grid.setHeightByRows(2);
  51. grid.setHeightMode(HeightMode.ROW);
  52. grid.setSelectionMode(SelectionMode.NONE);
  53. addNorth(grid, 500);
  54. }
  55. }