Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

TableColumnWidthsAndSorting.java 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2000-2014 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.components.table;
  17. import com.vaadin.annotations.Theme;
  18. import com.vaadin.server.VaadinRequest;
  19. import com.vaadin.tests.components.AbstractTestUIWithLog;
  20. import com.vaadin.tests.fieldgroup.ComplexPerson;
  21. import com.vaadin.ui.Button;
  22. import com.vaadin.ui.Button.ClickEvent;
  23. import com.vaadin.ui.Button.ClickListener;
  24. import com.vaadin.ui.Table;
  25. @Theme("valo")
  26. public class TableColumnWidthsAndSorting extends AbstractTestUIWithLog {
  27. @Override
  28. protected void setup(VaadinRequest request) {
  29. final Table t = new Table();
  30. t.setContainerDataSource(ComplexPerson.createContainer(100));
  31. t.setVisibleColumns("firstName", "lastName", "age", "gender", "salary");
  32. t.setColumnWidth("firstName", 200);
  33. t.setColumnWidth("lastName", 200);
  34. t.setSelectable(true);
  35. addComponent(t);
  36. Button b = new Button("Sort according to gender", new ClickListener() {
  37. @Override
  38. public void buttonClick(ClickEvent event) {
  39. t.sort(new Object[] { "gender" }, new boolean[] { true });
  40. }
  41. });
  42. addComponent(b);
  43. }
  44. }