You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CodeLabel.java 846B

1234567891011121314151617181920212223242526272829303132333435
  1. package com.vaadin.demo.sampler;
  2. import com.vaadin.demo.sampler.gwt.client.ui.VCodeLabel;
  3. import com.vaadin.ui.ClientWidget;
  4. import com.vaadin.ui.Label;
  5. @ClientWidget(VCodeLabel.class)
  6. @SuppressWarnings("serial")
  7. public class CodeLabel extends Label {
  8. private static final String TAG = "codelabel";
  9. public CodeLabel() {
  10. setContentMode(CONTENT_PREFORMATTED);
  11. }
  12. public CodeLabel(String content) {
  13. super(content, CONTENT_PREFORMATTED);
  14. }
  15. @Override
  16. public String getTag() {
  17. return TAG;
  18. }
  19. @Override
  20. public void setContentMode(int contentMode) {
  21. if (contentMode != CONTENT_PREFORMATTED) {
  22. throw new UnsupportedOperationException(
  23. "Only preformatted content supported");
  24. }
  25. super.setContentMode(CONTENT_PREFORMATTED);
  26. }
  27. }