Advertisement
Guest User

Vaadin CKeditor problem

a guest
Jul 29th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 19.07 KB | None | 0 0
  1. package com.example.test7;
  2.  
  3. import javax.servlet.annotation.WebServlet;
  4.  
  5. import org.vaadin.openesignforms.ckeditor.CKEditorConfig;
  6. import org.vaadin.openesignforms.ckeditor.CKEditorTextField;
  7.  
  8. import com.vaadin.annotations.Theme;
  9. import com.vaadin.annotations.VaadinServletConfiguration;
  10. import com.vaadin.data.Item;
  11. import com.vaadin.data.fieldgroup.FieldGroup;
  12. import com.vaadin.data.util.ObjectProperty;
  13. import com.vaadin.data.util.PropertysetItem;
  14. import com.vaadin.event.FieldEvents.FocusEvent;
  15. import com.vaadin.event.FieldEvents.FocusListener;
  16. import com.vaadin.event.MouseEvents;
  17. import com.vaadin.server.VaadinRequest;
  18. import com.vaadin.server.VaadinServlet;
  19. import com.vaadin.server.ClientConnector.AttachEvent;
  20. import com.vaadin.ui.Button;
  21. import com.vaadin.ui.Button.ClickEvent;
  22. import com.vaadin.ui.Button.ClickListener;
  23. import com.vaadin.ui.Window.ResizeEvent;
  24. import com.vaadin.ui.FormLayout;
  25. import com.vaadin.ui.Label;
  26. import com.vaadin.ui.UI;
  27. import com.vaadin.ui.VerticalLayout;
  28. import com.vaadin.ui.Window;
  29. import com.vaadin.ui.Window.ResizeListener;
  30.  
  31. @SuppressWarnings("serial")
  32. @Theme("test7")
  33. public class Test7UI extends UI {
  34.  
  35.     private CKEditorTextField txt;
  36.  
  37.     @WebServlet(value = "/*", asyncSupported = true)
  38.     @VaadinServletConfiguration(productionMode = false, ui =Test7UI.class, widgetset= "com.example.test7.widgetset.Test7Widgetset" )
  39.     public static class Servlet extends VaadinServlet {
  40.     }
  41.  
  42.     @Override
  43.     protected void init(VaadinRequest request) {
  44.         final VerticalLayout layout = new VerticalLayout();
  45.        
  46.        
  47.        
  48.         layout.setMargin(true);
  49.         Button btn1 = new Button("Before Fieldgroup bind");
  50.         btn1.addClickListener(new ClickListener() {
  51.            
  52.             @Override
  53.             public void buttonClick(ClickEvent event) {
  54.                 Window w = new Window();
  55.                
  56.                 FormLayout fl = new FormLayout();
  57.                 fl.setMargin(true);
  58.                 Label lbl = new Label("It is expected behaviour that this CKEditor is not set readonly");
  59.                 fl.addComponent(lbl);
  60.                 txt = new CKEditorTextField();
  61.                
  62.                 CKEditorConfig config = new CKEditorConfig();
  63.                 config.setInPageConfig("{ toolbar: 'custom',"+
  64.                         "toolbar_custom: " +
  65.                         "[" +
  66.                         "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, " +
  67.                         "], ignoreEmptyParagraph: false, resize_enabled: false, language: 'nl', enterMode: 2, removePlugins: 'elementspath', customConfig: '', defaultLanguage: 'nl',"+ //enterMode 2  = BR mode naam is niet bruikbaar, getal wel
  68.                         "colorButton_enableMore :false, readOnly: true, }");//http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations
  69.  
  70.                 txt.setConfig(config);
  71.  
  72.                 txt.setReadOnly(true);
  73.                 PropertysetItem item = new PropertysetItem();
  74.                 item.addItemProperty("ckeditor", new ObjectProperty<String>("Zaphod"));
  75.                
  76.                 FieldGroup fg = new FieldGroup(item);
  77.                 fg.bind(txt, "ckeditor");
  78.                
  79.                
  80.                 fl.addComponent(txt);
  81.                 Button button = new Button("SetReadOnly");
  82.                 button.addClickListener(new Button.ClickListener() {
  83.                     public void buttonClick(ClickEvent event) {
  84.                         txt.setReadOnly(!txt.isReadOnly());
  85.                         layout.addComponent(new Label("Thank you for clicking"));
  86.                     }
  87.                 });
  88.                 fl.addComponent(button);
  89.                 w.setContent(fl);
  90.                 w.setModal(true);
  91.                 w.center();
  92.                 w.setWidth("400px");
  93.                 w.setHeight("500px");
  94.                 getUI().addWindow(w);
  95.                
  96.                
  97.             }
  98.         });
  99.         layout.addComponent(btn1);
  100.        
  101.         Button btn2 = new Button("After Fieldgroup bind");
  102.         btn2.addClickListener(new ClickListener() {
  103.            
  104.             @Override
  105.             public void buttonClick(ClickEvent event) {
  106.                 Window w = new Window();
  107.                
  108.                 FormLayout fl = new FormLayout();
  109.                 fl.setMargin(true);
  110.                 Label lbl = new Label("It is expected behaviour that this CKEditor is set readonly");
  111.                 fl.addComponent(lbl);
  112.                 txt = new CKEditorTextField();
  113.                
  114.                 CKEditorConfig config = new CKEditorConfig();
  115.                 config.setInPageConfig("{ toolbar: 'custom',"+
  116.                         "toolbar_custom: " +
  117.                         "[" +
  118.                         "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, " +
  119.                         "], ignoreEmptyParagraph: false, resize_enabled: false, language: 'nl', enterMode: 2, removePlugins: 'elementspath', customConfig: '', defaultLanguage: 'nl',"+ //enterMode 2  = BR mode naam is niet bruikbaar, getal wel
  120.                         "colorButton_enableMore :false, readOnly: true, }");//http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations
  121.  
  122.                 txt.setConfig(config);
  123.  
  124.                 PropertysetItem item = new PropertysetItem();
  125.                 item.addItemProperty("ckeditor", new ObjectProperty<String>("Zaphod"));
  126.                
  127.                 FieldGroup fg = new FieldGroup(item);
  128.                 fg.bind(txt, "ckeditor");
  129.                 txt.setReadOnly(true);
  130.                
  131.                 fl.addComponent(txt);
  132.                 Button button = new Button("SetReadOnly");
  133.                 button.addClickListener(new Button.ClickListener() {
  134.                     public void buttonClick(ClickEvent event) {
  135.                         txt.setReadOnly(!txt.isReadOnly());
  136.                         layout.addComponent(new Label("Thank you for clicking"));
  137.                     }
  138.                 });
  139.                 fl.addComponent(button);
  140.                 w.setContent(fl);
  141.                 w.setModal(true);
  142.                 w.center();
  143.                 w.setWidth("400px");
  144.                 w.setHeight("500px");
  145.                 getUI().addWindow(w);
  146.                
  147.                
  148.             }
  149.         });
  150.         layout.addComponent(btn2);
  151.        
  152.         Button btn3 = new Button("After Field add to formlayout");
  153.         btn3.addClickListener(new ClickListener() {
  154.            
  155.             @Override
  156.             public void buttonClick(ClickEvent event) {
  157.                 Window w = new Window();
  158.                
  159.                 FormLayout fl = new FormLayout();
  160.                 fl.setMargin(true);
  161.                 Label lbl = new Label("It is expected behaviour that this CKEditor is set readonly");
  162.                 fl.addComponent(lbl);
  163.                 txt = new CKEditorTextField();
  164.                
  165.                 CKEditorConfig config = new CKEditorConfig();
  166.                 config.setInPageConfig("{ toolbar: 'custom',"+
  167.                         "toolbar_custom: " +
  168.                         "[" +
  169.                         "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, " +
  170.                         "], ignoreEmptyParagraph: false, resize_enabled: false, language: 'nl', enterMode: 2, removePlugins: 'elementspath', customConfig: '', defaultLanguage: 'nl',"+ //enterMode 2  = BR mode naam is niet bruikbaar, getal wel
  171.                         "colorButton_enableMore :false, readOnly: true, }");//http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations
  172.  
  173.                 txt.setConfig(config);
  174.  
  175.                 PropertysetItem item = new PropertysetItem();
  176.                 item.addItemProperty("ckeditor", new ObjectProperty<String>("Zaphod"));
  177.                
  178.                 FieldGroup fg = new FieldGroup(item);
  179.                 fg.bind(txt, "ckeditor");
  180.                
  181.                
  182.                 fl.addComponent(txt);
  183.                 txt.setReadOnly(true); //XXX READONLY
  184.                 Button button = new Button("SetReadOnly");
  185.                 button.addClickListener(new Button.ClickListener() {
  186.                     public void buttonClick(ClickEvent event) {
  187.                         txt.setReadOnly(!txt.isReadOnly());
  188.                         layout.addComponent(new Label("Thank you for clicking"));
  189.                     }
  190.                 });
  191.                 fl.addComponent(button);
  192.                 w.setContent(fl);
  193.                 w.setModal(true);
  194.                 w.center();
  195.                 w.setWidth("400px");
  196.                 w.setHeight("500px");
  197.                 getUI().addWindow(w);
  198.                
  199.                
  200.             }
  201.         });
  202.         layout.addComponent(btn3);
  203.        
  204.        
  205.         Button btn4 = new Button("After window add");
  206.         btn4.addClickListener(new ClickListener() {
  207.            
  208.             @Override
  209.             public void buttonClick(ClickEvent event) {
  210.                 Window w = new Window();
  211.                
  212.                 FormLayout fl = new FormLayout();
  213.                 fl.setMargin(true);
  214.                 Label lbl = new Label("It is expected behaviour that this CKEditor is set readonly");
  215.                 fl.addComponent(lbl);
  216.                 txt = new CKEditorTextField();
  217.                
  218.                 CKEditorConfig config = new CKEditorConfig();
  219.                 config.setInPageConfig("{ toolbar: 'custom',"+
  220.                         "toolbar_custom: " +
  221.                         "[" +
  222.                         "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, " +
  223.                         "], ignoreEmptyParagraph: false, resize_enabled: false, language: 'nl', enterMode: 2, removePlugins: 'elementspath', customConfig: '', defaultLanguage: 'nl',"+ //enterMode 2  = BR mode naam is niet bruikbaar, getal wel
  224.                         "colorButton_enableMore :false, readOnly: true, }");//http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations
  225.  
  226.                 txt.setConfig(config);
  227.  
  228.                
  229.                 PropertysetItem item = new PropertysetItem();
  230.                 item.addItemProperty("ckeditor", new ObjectProperty<String>("Zaphod"));
  231.                
  232.                 FieldGroup fg = new FieldGroup(item);
  233.                 fg.bind(txt, "ckeditor");
  234.                
  235.                
  236.                 fl.addComponent(txt);
  237.                
  238.                 Button button = new Button("SetReadOnly");
  239.                 button.addClickListener(new Button.ClickListener() {
  240.                     public void buttonClick(ClickEvent event) {
  241.                         txt.setReadOnly(!txt.isReadOnly());
  242.                         layout.addComponent(new Label("Thank you for clicking"));
  243.                     }
  244.                 });
  245.                 fl.addComponent(button);
  246.                 w.setContent(fl);
  247.                 w.setModal(true);
  248.                 w.center();
  249.                 w.setWidth("400px");
  250.                 w.setHeight("500px");
  251.                 getUI().addWindow(w);
  252.                 txt.setReadOnly(true);//XXX READONLY
  253.                
  254.                
  255.             }
  256.         });
  257.         layout.addComponent(btn4);
  258.        
  259.         Button btn5 = new Button("With hidden button and button that activates it");
  260.         btn5.addClickListener(new ClickListener() {
  261.            
  262.             private Button hidden;
  263.  
  264.             @Override
  265.             public void buttonClick(ClickEvent event) {
  266.                 Window w = new Window();
  267.                
  268.                 FormLayout fl = new FormLayout();
  269.                 fl.setMargin(true);
  270.                 Label lbl = new Label("Hit the button to click the hidden button (in code). It is expected behaviour that this CKEditor is set readonly. ");
  271.                 fl.addComponent(lbl);
  272.                 txt = new CKEditorTextField();
  273.                
  274.                 CKEditorConfig config = new CKEditorConfig();
  275.                 config.setInPageConfig("{ toolbar: 'custom',"+
  276.                         "toolbar_custom: " +
  277.                         "[" +
  278.                         "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, " +
  279.                         "], ignoreEmptyParagraph: false, resize_enabled: false, language: 'nl', enterMode: 2, removePlugins: 'elementspath', customConfig: '', defaultLanguage: 'nl',"+ //enterMode 2  = BR mode naam is niet bruikbaar, getal wel
  280.                         "colorButton_enableMore :false, readOnly: true, }");//http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations
  281.  
  282.                 txt.setConfig(config);
  283.  
  284.                
  285.                 PropertysetItem item = new PropertysetItem();
  286.                 item.addItemProperty("ckeditor", new ObjectProperty<String>("Zaphod"));
  287.                
  288.                 FieldGroup fg = new FieldGroup(item);
  289.                 fg.bind(txt, "ckeditor");
  290.                
  291.                
  292.                 fl.addComponent(txt);
  293.                
  294.                 hidden = new Button("hidden");
  295.                 hidden.setVisible(false);
  296.                 hidden.addClickListener(new Button.ClickListener() {
  297.                     public void buttonClick(ClickEvent event) {
  298.                         txt.setReadOnly(!txt.isReadOnly());
  299.                         layout.addComponent(new Label("Hidden is clicked!"));
  300.                     }
  301.                 });
  302.                
  303.                 Button button = new Button("SetReadOnly");
  304.                 button.addClickListener(new Button.ClickListener() {
  305.                     public void buttonClick(ClickEvent event) {
  306.                         txt.setReadOnly(!txt.isReadOnly());
  307.                         layout.addComponent(new Label("SetReadOnly is clicked!"));
  308.                     }
  309.                 });
  310.                
  311.                
  312.                 fl.addComponent(button);
  313.                
  314.                 Button button2 = new Button("doAutoClick");
  315.                 button2.addClickListener(new Button.ClickListener() {
  316.                     public void buttonClick(ClickEvent event) {
  317.                         hidden.click();
  318.                         layout.addComponent(new Label("doAutoClick is clicked!"));
  319.                     }
  320.                 });
  321.                 fl.addComponent(button2);
  322.                
  323.                
  324.                
  325.                 w.setContent(fl);
  326.                 w.setModal(true);
  327.                 w.center();
  328.                 w.setWidth("400px");
  329.                 w.setHeight("500px");
  330.                 getUI().addWindow(w);
  331.                
  332.                
  333.                
  334.             }
  335.         });
  336.         layout.addComponent(btn5);
  337.        
  338.  
  339.         Button btn6 = new Button("With hidden button and click after window add");
  340.         btn6.addClickListener(new ClickListener() {
  341.            
  342.             private Button hidden;
  343.  
  344.             @Override
  345.             public void buttonClick(ClickEvent event) {
  346.                 Window w = new Window();
  347.                
  348.                 FormLayout fl = new FormLayout();
  349.                 fl.setMargin(true);
  350.                 Label lbl = new Label("It is expected behaviour that this CKEditor is set readonly");
  351.                 fl.addComponent(lbl);
  352.                 txt = new CKEditorTextField();
  353.                
  354.                 CKEditorConfig config = new CKEditorConfig();
  355.                 config.setInPageConfig("{ toolbar: 'custom',"+
  356.                         "toolbar_custom: " +
  357.                         "[" +
  358.                         "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, " +
  359.                         "], ignoreEmptyParagraph: false, resize_enabled: false, language: 'nl', enterMode: 2, removePlugins: 'elementspath', customConfig: '', defaultLanguage: 'nl',"+ //enterMode 2  = BR mode naam is niet bruikbaar, getal wel
  360.                         "colorButton_enableMore :false, readOnly: true, }");//http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations
  361.  
  362.                 txt.setConfig(config);
  363.  
  364.                 PropertysetItem item = new PropertysetItem();
  365.                 item.addItemProperty("ckeditor", new ObjectProperty<String>("Zaphod"));
  366.                
  367.                 FieldGroup fg = new FieldGroup(item);
  368.                 fg.bind(txt, "ckeditor");
  369.                
  370.                
  371.                 fl.addComponent(txt);
  372.                
  373.                 hidden = new Button("hidden");
  374.                 hidden.setVisible(false);
  375.                 hidden.addClickListener(new Button.ClickListener() {
  376.                     public void buttonClick(ClickEvent event) {
  377.                         txt.setReadOnly(true);
  378.                         layout.addComponent(new Label("Hidden is clicked!"));
  379.                     }
  380.                 });
  381.                
  382.                 Button button = new Button("SetReadOnly");
  383.                 button.addClickListener(new Button.ClickListener() {
  384.                     public void buttonClick(ClickEvent event) {
  385.                         txt.setReadOnly(!txt.isReadOnly());
  386.                         layout.addComponent(new Label("SetReadOnly is clicked!"));
  387.                     }
  388.                 });
  389.                
  390.                
  391.                 fl.addComponent(button);
  392.                
  393.                
  394.                
  395.                
  396.                 w.setContent(fl);
  397.                 w.setModal(true);
  398.                 w.center();
  399.                 w.setWidth("400px");
  400.                 w.setHeight("500px");
  401.                 getUI().addWindow(w);
  402.                 hidden.click();
  403.                
  404.                
  405.             }
  406.         });
  407.  
  408.         layout.addComponent(btn6);
  409.  
  410.        
  411.         Button btn7 = new Button("With window listeners");
  412.         btn7.addClickListener(new ClickListener() {
  413.            
  414.             @Override
  415.             public void buttonClick(ClickEvent event) {
  416.                 Window w = new Window();
  417.                
  418.                 FormLayout fl = new FormLayout();
  419.                 fl.setMargin(true);
  420.                 Label lbl = new Label("This was a try to fix it. It fixes things but it is not a good way. (Editor only gets readOnly after click in form/textarea)");
  421.                 fl.addComponent(lbl);
  422.                 txt = new CKEditorTextField();
  423.                
  424.                 CKEditorConfig config = new CKEditorConfig();
  425.                 config.setInPageConfig("{ toolbar: 'custom',"+
  426.                         "toolbar_custom: " +
  427.                         "[" +
  428.                         "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, " +
  429.                         "], ignoreEmptyParagraph: false, resize_enabled: false, language: 'nl', enterMode: 2, removePlugins: 'elementspath', customConfig: '', defaultLanguage: 'nl',"+ //enterMode 2  = BR mode naam is niet bruikbaar, getal wel
  430.                         "colorButton_enableMore :false, readOnly: true, }");//http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations
  431.  
  432.                 txt.setConfig(config);
  433.  
  434.                
  435.                
  436.                 PropertysetItem item = new PropertysetItem();
  437.                 item.addItemProperty("ckeditor", new ObjectProperty<String>("Zaphod"));
  438.                
  439.                 FieldGroup fg = new FieldGroup(item);
  440.                 fg.bind(txt, "ckeditor");
  441.                
  442.                
  443.                 fl.addComponent(txt);
  444.                
  445.                
  446.                 Button button = new Button("SetReadOnly");
  447.                 button.addClickListener(new Button.ClickListener() {
  448.                     public void buttonClick(ClickEvent event) {
  449.                         txt.setReadOnly(!txt.isReadOnly());
  450.                         layout.addComponent(new Label("SetReadOnly is clicked!"));
  451.                     }
  452.                 });
  453.                
  454.                
  455.                 fl.addComponent(button);
  456.                
  457.                
  458.                
  459.                
  460.                 w.setContent(fl);
  461.                 w.setModal(true);
  462.                 w.center();
  463.                 w.setWidth("400px");
  464.                 w.setHeight("500px");
  465.                 w.addResizeListener( new ResizeListener() {
  466.                    
  467.                     @Override
  468.                     public void windowResized(ResizeEvent e) {
  469.                         layout.addComponent(new Label("ResizeEvent happened!"));
  470.                        
  471.                     }
  472.                 });
  473.                 w.addAttachListener(new AttachListener() {
  474.                    
  475.                     @Override
  476.                     public void attach(AttachEvent event) {
  477.                         //txt.setReadOnly(true);// Same problem
  478.                         layout.addComponent(new Label("AttachEvent happened!"));
  479.                        
  480.                     }
  481.                 });
  482.                
  483.                 w.addFocusListener(new FocusListener() {
  484.                    
  485.                     @Override
  486.                     public void focus(FocusEvent event) {
  487.                         layout.addComponent(new Label("FocusEvent happened!"));
  488.                        
  489.                     }
  490.                 });
  491.                
  492.                 w.addClickListener(new MouseEvents.ClickListener() {
  493.                    
  494.                     @Override
  495.                     public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
  496.                         layout.addComponent(new Label("MouseEvents.ClickEvent happened!"));
  497.                         txt.setReadOnly(true);
  498.                        
  499.                     }
  500.                 });
  501.                 txt.addFocusListener( new FocusListener() {
  502.                    
  503.                     @Override
  504.                     public void focus(FocusEvent event) {
  505.                         layout.addComponent(new Label("FocusEvent on txt happened!"));
  506.                         txt.setReadOnly(true);
  507.                        
  508.                     }
  509.                 });
  510.                
  511.                 getUI().addWindow(w);
  512.                
  513.                
  514.                
  515.             }
  516.         });
  517.  
  518.         layout.addComponent(btn7);
  519.        
  520.         Button btn8 = new Button("With js config");
  521.         btn8.addClickListener(new ClickListener() {
  522.            
  523.  
  524.             @Override
  525.             public void buttonClick(ClickEvent event) {
  526.                 Window w = new Window();
  527.                
  528.                
  529.                
  530.                
  531.                 FormLayout fl = new FormLayout();
  532.                 fl.setMargin(true);
  533.                 Label lbl = new Label("It is expected behaviour that this CKEditor is set readonly");
  534.                 fl.addComponent(lbl);
  535.                 txt = new CKEditorTextField();
  536.                
  537.                 PropertysetItem item = new PropertysetItem();
  538.                 item.addItemProperty("ckeditor", new ObjectProperty<String>("Zaphod"));
  539.                
  540.                 FieldGroup fg = new FieldGroup(item);
  541.                 fg.bind(txt, "ckeditor");
  542.                
  543.                
  544.                 CKEditorConfig config = new CKEditorConfig();
  545.                 config.setInPageConfig("{ toolbar: 'custom',"+
  546.                         "toolbar_custom: " +
  547.                         "[" +
  548.                         "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, " +
  549.                         "], ignoreEmptyParagraph: false, resize_enabled: false, language: 'nl', enterMode: 2, removePlugins: 'elementspath', customConfig: '', defaultLanguage: 'nl',"+ //enterMode 2  = BR mode naam is niet bruikbaar, getal wel
  550.                         "colorButton_enableMore :false, readOnly: true, }");//http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations
  551.  
  552.                 txt.setConfig(config);
  553.                
  554.                
  555.                
  556.                
  557.                 fl.addComponent(txt);
  558.                
  559.                
  560.                 Button button = new Button("SetReadOnly");
  561.                 button.addClickListener(new Button.ClickListener() {
  562.                     public void buttonClick(ClickEvent event) {
  563.                         txt.setReadOnly(!txt.isReadOnly());
  564.                         layout.addComponent(new Label("SetReadOnly is clicked!"));
  565.                     }
  566.                 });
  567.                
  568.                
  569.                 fl.addComponent(button);
  570.                
  571.                
  572.                 w.setContent(fl);
  573.                 w.setModal(true);
  574.                 w.center();
  575.                 w.setWidth("400px");
  576.                 w.setHeight("500px");
  577.                
  578.                
  579.                 getUI().addWindow(w);
  580.                
  581.                
  582.                
  583.             }
  584.         });
  585.  
  586.         layout.addComponent(btn8);
  587.        
  588.         setContent(layout);
  589.        
  590.        
  591.     }
  592.  
  593. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement