Threaded View

  1. #1
    Ext User
    Join Date
    Jul 2007
    Posts
    48
    Vote Rating
    0
    Webflash is on a distinguished road

      0  

    Default Integration TinyMCE in GXT

    Integration TinyMCE in GXT


    Download latest version http://tinymce.moxiecode.com/download.php unzip under public folder
    in your html file <script language='javascript' rc='gwtproject.nocache.js'></script>
    put:
    PHP Code:
    <script language="javascript" type="text/javascript" src="tinymce/tiny_mce.js"></script>
            <script language="javascript" type="text/javascript">
                tinyMCE.init({
                    mode : "none",
                    theme : "advanced",
                    plugins : "safari,layer,table,advhr,advimage,advlink,iespell,inlinepopups,media,searchreplace,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak",
                    theme_advanced_buttons1_add_before : "newdocument,separator",
                    theme_advanced_buttons1_add : "fontselect,fontsizeselect",
                    theme_advanced_buttons2_add : "separator,separator,forecolor,backcolor",
                    theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
                    theme_advanced_buttons3_add_before : "tablecontrols,separator",
                    theme_advanced_buttons3_add : "iespell,media,advhr,separator,separator,ltr,rtl,separator",
                    theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak",
                    theme_advanced_toolbar_location : "top",
                    theme_advanced_toolbar_align : "left",
                    theme_advanced_statusbar_location : "bottom",
                    theme_advanced_resize_horizontal : false,
                    theme_advanced_resizing : true,
                    apply_source_formatting : true,
                    spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
                });
            
            </script> 
    PHP Code:
    import com.extjs.gxt.ui.client.widget.form.Field;
    import com.google.gwt.user.client.DOM;
    import com.google.gwt.user.client.Element;
    import com.google.gwt.user.client.ui.HTMLPanel;

    /**
     * @author webflash
     */
    public class TinyMCE extends Field<String> {
        private 
    String id;

        @
    Override
        
    protected void onRender(Element targetint index) {
            if (
    el() == null) {
                
    setElement(DOM.createTextArea());
                
    el().insertInto(targetindex);
                
    getElement().setAttribute("id"id HTMLPanel.createUniqueId());
            }
            
    initTinyMCE(id);
            
    super.onRender(targetindex);
        }

        @
    Override
        
    public String getValue() {
            if(
    rendered){
                
    super.setValue(getTextData(id));
            }
            return 
    super.getValue();
        }

        @
    Override
        
    public void setValue(String value) {
            
    super.setValue(value);
            if (
    rendered) {
                
    updateContent(id,value);
            }
        }
        
        protected 
    native String getTextData(String id/*-{
            return $wnd.tinyMCE.getInstanceById(id).getContent({format : 'raw'});
        }-*/
    ;

        protected 
    native void updateContent(String id,String value/*-{
           var editor = $wnd.tinyMCE.getInstanceById(id);
           if(editor){
               editor.setContent(value);
           }
        }-*/
    ;

        private 
    native void initTinyMCE(String id)/*-{
                $wnd.tinyMCE.execCommand("mceAddControl", true, id);
            }-*/
    ;

        @
    Override
        
    public void focus() {
            
    super.focus();
            
    focusMCE(id);
        }

        protected 
    native void focusMCE(String id/*-{
               $wnd.tinyMCE.execCommand('mceFocus', true, id);
        }-*/
    ;

    }



    public class 
    UIWiget implements EntryPoint {

        public 
    void onModuleLoad() {
            
    Viewport viewPort = new Viewport();
            
    viewPort.setLayout(new FitLayout());
            
            
            
    FormPanel formPanel = new FormPanel();
            final 
    TinyMCE field = new TinyMCE();
            
    field.setValue("test");
            
    formPanel.add(field);
            
    formPanel.addButton(new Button("test",new SelectionListener<ButtonEvent>(){
                public 
    void componentSelected(ButtonEvent ce) {
                    
    Window.alert(field.getValue());
                }}));
            
    viewPort.add(formPanel);
            
    RootPanel.get().add(viewPort);    
        }


    Last edited by Webflash; 25 Aug 2008 at 12:57 AM. Reason: forgot hilite code

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."