Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

RichTextAreaTest.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.vaadin.tests.components.richtextarea;
  2. import java.util.LinkedHashMap;
  3. import com.vaadin.tests.components.abstractfield.AbstractFieldTest;
  4. import com.vaadin.ui.RichTextArea;
  5. public class RichTextAreaTest extends AbstractFieldTest<RichTextArea> {
  6. @Override
  7. protected Class<RichTextArea> getTestClass() {
  8. return RichTextArea.class;
  9. }
  10. private Command<RichTextArea, Boolean> nullSelectionAllowedCommand = new Command<RichTextArea, Boolean>() {
  11. @Override
  12. public void execute(RichTextArea c, Boolean value, Object data) {
  13. c.setNullSettingAllowed(value);
  14. }
  15. };
  16. private Command<RichTextArea, String> nullRepresentationCommand = new Command<RichTextArea, String>() {
  17. @Override
  18. public void execute(RichTextArea c, String value, Object data) {
  19. c.setNullRepresentation(value);
  20. }
  21. };
  22. @Override
  23. protected void createActions() {
  24. super.createActions();
  25. createSetTextValueAction(CATEGORY_ACTIONS);
  26. createNullSettingAllowedAction(CATEGORY_FEATURES);
  27. createNullRepresentationAction(CATEGORY_FEATURES);
  28. }
  29. private void createNullSettingAllowedAction(String category) {
  30. createBooleanAction("Null selection allowed", category, true,
  31. nullSelectionAllowedCommand);
  32. }
  33. private void createNullRepresentationAction(String category) {
  34. LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
  35. options.put("-", null);
  36. options.put("null", "null");
  37. options.put("This is empty", "This is empty");
  38. options.put("- Nothing -", "- Nothing -");
  39. createSelectAction("Null representation", category, options, "null",
  40. nullRepresentationCommand);
  41. }
  42. }