1 Dec 2011 01:32
1 Dec 2011 07:23
Re: [groovy-user] Re: GroovyFx getting error in TableView
Hi!
In fact there should be a problem only with class nodes which use
generics. In that case, instead of creating a new node like in your
example, it is advisable to use the ClassNode#getPlainNodeReference
method which will return a new classnode for which generic types can be
set. Calling ClassNode#getTypeClass is in general not safe, as the type
may not have been set when the method is called (for example, if the
class is being compiled, no real Class node exists).
getPlainNodeReference handles this case, so instead of
newClass(classNode), you could just do classNode.getPlainNodeReference().
Cedric
Le 30/11/2011 23:56, aalmiray a écrit :
> Jim,
>
> This is a recent problem that appeared in 1.8.4. It looks like we can no
> longer rely on reusing ClassNodes cached found as constants in
ClassHelper,
> such as CLOSURE_TYPE. Instead you have to create a new ClassNode
instance.
>
> We had the same trouble in Griffon, so we added the following base method
>
> protected static ClassNode newClass(ClassNode classNode) {
> return new ClassNode(classNode.getTypeClass());
> }
>
> and here's a sample usage of it
>
> // List createMVCGroup(Map args, String mvcType)
> classNode.addMethod(new MethodNode(
> CREATE_MVC_GROUP,
> ACC_PUBLIC,
> newClass(ClassHelper.LIST_TYPE),
> params(
> param(newClass(ClassHelper.MAP_TYPE), ARGS),
> param(ClassHelper.STRING_TYPE, MVC_TYPE)),
> ClassNode.EMPTY_ARRAY,
> returns(call(
> mvcGroupManagerInstance(),
> CREATE_MVC_GROUP,
> args(var(MVC_TYPE), var(MVC_TYPE), var(ARGS))))
> ));
>
> Cheers,
> Andres
>
>
>
> --
> View this message in context:
http://groovy.329449.n5.nabble.com/GroovyFx-getting-error-in-TableView-tp5032182p5037001.html
> Sent from the groovy - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
--
--
Cédric Champeau
SpringSource - A Division Of VMware
http://www.springsource.com/
http://twitter.com/CedricChampeau
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
1 Dec 2011 11:01
[groovy-user] Re: GroovyFx getting error in TableView
getTypeClass() seemed to work OK for all references coming from ClassHelper. All other classes we use in AST injection do not require generics. Thanks for the pointer, we'll update our codebase-- View this message in context: http://groovy.329449.n5.nabble.com/GroovyFx-getting-error-in-TableView-tp5032182p5038214.html Sent from the groovy - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
1 Dec 2011 13:27
[groovy-user] Encoding issue with groovy.xml.XmlUtil.serialize()
Hi, Any ideas why the serialized xml becomes empty in this case? I think it should be possible to put an 'ü' charter in the xml element. Thanks! def xml ="""<?xml version="1.0" encoding="UTF-8"?> <Schlüssel> text content </Schlüssel>""" groovy.util.slurpersupport.GPathResult s = new XmlSlurper().parseText(xml) println groovy.xml.XmlUtil.serialize(s) // results in empty xml, why? ----- OUTPUT <?xml version="1.0" encoding="UTF-8"?> ----- Project pages AndersTool earBuddy -- View this message in context: http://groovy.329449.n5.nabble.com/Encoding-issue-with-groovy-xml-XmlUtil-serialize-tp5038513p5038513.html Sent from the groovy - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
1 Dec 2011 13:52
Re: [groovy-user] Encoding issue with groovy.xml.XmlUtil.serialize()
Had a quick look, and I believe that asString( GPathResult ) inside XmlUtil doesn't set the encoding property on the builder after it is constructed...
As a workaround, you can do:
def outxml = new groovy.xml.StreamingMarkupBuilder().with {
encoding = 'UTF-8'
'<?xml version="1.0" encoding="UTF-8"?>\n' + bindNode( s )
}
println outxml
Can you add this to the JIRA though, as it looks like a bug
Tim
On 1 December 2011 12:27, citron <viklund_anders-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:
Hi,
Any ideas why the serialized xml becomes empty in this case?
I think it should be possible to put an 'ü' charter in the xml element.
Thanks!
def xml ="""<?xml version="1.0" encoding="UTF-8"?>
<Schlüssel>
text content
</Schlüssel>"""
groovy.util.slurpersupport.GPathResult s = new XmlSlurper().parseText(xml)
println groovy.xml.XmlUtil.serialize(s) // results in empty xml, why?
----- OUTPUT
<?xml version="1.0" encoding="UTF-8"?>
-----
Project pages
AndersTool
earBuddy
--
View this message in context: http://groovy.329449.n5.nabble.com/Encoding-issue-with-groovy-xml-XmlUtil-serialize-tp5038513p5038513.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
1 Dec 2011 18:26
[groovy-user] Strange syntax issue - eliding function call parens
Is this a bug, or is it some peculiarity with the grammar?
assume:
def doSomething(Map args,arg1) {println(args); println(arg1)}
then:
doSomething(['str'], on: [1])
performs as expected, but:
doSomething ['str'], on: [1]
gives a syntax error. However,
doSomething 'str', on: [1]
runs perfectly, as expected
What gives ?
This is in the context of building a DSL. We would really like to pass both single an multiple elements as the first arg to 'doSomething', without needing parens. This prevents doing that in the multiple (List) case.
Thanks!
-pb
1 Dec 2011 19:00
Re: [groovy-user] Strange syntax issue - eliding function call parens
Am 01.12.2011 18:26, schrieb Paul Bennett:
> Is this a bug, or is it some peculiarity with the grammar?
>
> assume:
>
> def doSomething(Map args,arg1) {
> println(args); println(arg1)
> }
>
>
> then:
>
> doSomething(['str'], on: [1])
>
>
> performs as expected, but:
>
> doSomething ['str'], on: [1]
on that one the parser reads only to the ] to conclude it is a getAt you
are doing and not a method call. Imagine you would have no on:[1] there,
only doSomething['str'] How is the parser supposed to know you mean a
method and not a getAt on a property?
> gives a syntax error. However,
>
> doSomething'str', on: [1]
>
>
> runs perfectly, as expected
>
> What gives ?
in that case it is no problem for the parser.
bye blackdrag
--
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
2 Dec 2011 00:43
[groovy-user] Re: Encoding issue with groovy.xml.XmlUtil.serialize()
Thanks Tim! Your suggestion is working and I added this to Jira. http://jira.codehaus.org/browse/GROOVY-5158 http://jira.codehaus.org/browse/GROOVY-5158 ----- Project pages AndersTool earBuddy -- View this message in context: http://groovy.329449.n5.nabble.com/Encoding-issue-with-groovy-xml-XmlUtil-serialize-tp5038513p5040216.html Sent from the groovy - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
2 Dec 2011 08:24
[groovy-user] RE: Pretty print XML from XMLSlurper
This code puts the content for each element on separate lines ex. <title> XML Developer's Guide </title> I would like to have the output formatted slightly different, like this <title>XML Developer's Guide</title> Any ideas how to do this? Thanks! ----- Project pages AndersTool earBuddy -- View this message in context: http://groovy.329449.n5.nabble.com/Pretty-print-XML-from-XMLSlurper-tp372758p5040878.html Sent from the groovy - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
2 Dec 2011 12:02
[groovy-user] SwinBuilder tableModel support for observable lists
Is there any reason that the SwingBuilder does not support neither binding,
nor observable lists?
I.e. I would have expected this to work by firing data changed on every
update:
class Model { <at> Bindable list }
view.edt { frame(....) { table {tableModel: bind {model.list } }}}
while(true) { view.edt { model.list = updatedList() } }
In addition, I would have expected this to work by firing fine-grained
updates:
class Model { def list = new ObservableList() }
view.edt { frame(....) { table {tableModel: bind {model.list } }}}
while(true) { view.edt { model.list[idx].update(); model << someMoreData;
model.removeAll(someData) } }
Is there any plan and would it be appreciated if I contribute these two
enhancements?
--
View this message in context: http://groovy.329449.n5.nabble.com/SwinBuilder-tableModel-support-for-observable-lists-tp5041429p5041429.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
--
View this message in context:
RSS Feed