Re: CodeMirror and GWT.

2013-06-14 Thread Joseph Lust
Håvard Moås, checkout the Chrome Markdown 
extensionto
 format code for these forums. :)

Sincerely,
Joseph



-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




CodeMirror and GWT.

2013-06-13 Thread Håvard Moås
Hey guys.

I've gotten a task to make a Textarea syntax highlighted and to have the 
autofill method implemented.

My Textarea will consist of XML markup and I am using gwt and smartgwt.

So, what I have done so far is to look into 
[url]http://codemirror.net/demo/xmlcomplete.html[/url] source code and 
tried that out. It all works if I copy paste this into my .html file.

But when Im trying to implement this dynamically using GWT, things start to 
get troublesome.

Here is my XMLWindow class that creates the textarea: (Its very primitive. 
The real textarea and form has more to it)
[CODE]
DynamicForm form2 = new DynamicForm();
TextAreaItem textA = new TextAreaItem();
textA.setValue("");
String id = "test";

form2.getElement().getElementsByTagName("textarea").getItem(0)
.setId(id);
form2.setNumCols(1);
form2.setItems(textA);
vl.setMembers(form2);
 addStyleToTextArea(String id)
[/CODE]

And a native method to call for my javascript function:
[CODE]
native void addStyleToTextArea(String id) /*-{
$wnd.addTest(id); //$wnd is a NSNI synonym for 'window'
}-*/;
[/CODE]


The javascript function is so to say a function including adding the 
codemirror functions and style to my textarea. It is very long, but it has 
everything from line 32 to line 108 in the source code from  
[url]http://codemirror.net/demo/xmlcomplete.html[/url], basically:
[CODE]
function addTest(id){
//All the styling done from the source code from  
[url]http://codemirror.net/demo/xmlcomplete.html[/url]

var editor = CodeMirror.fromTextArea(document.getElementById(id), { 
.
}

[/CODE]
I am getting a :
[CODE]
com.google.gwt.event.shared.UmbrellaException: Exception caught: 
(TypeError) 
@no.uninett.pncweb.client.XMLWindow::addStyleToTextArea(Ljava/lang/String;)([string:
 
'test']): place is null
[/CODE]
I have been looking into the 
[url]http://code.google.com/p/codemirror2-gwt/[/url].
But following his examples basically resulted in nothing happening at all.

Have anyone tried the same and would know If I am doing it right or have 
some tips on how to solve this?

Regards!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.