atom feed6 messages in org.codehaus.groovy.user[groovy-user] Swingbuilder.list and a...
FromSent OnAttachments
Bob BrownSep 11, 2009 5:12 am 
Danno FerrinSep 11, 2009 6:27 am 
Bob BrownSep 11, 2009 2:44 pm 
Bob BrownSep 11, 2009 7:51 pm 
Danno FerrinSep 11, 2009 11:20 pm 
Bob BrownSep 12, 2009 4:13 pm 
Subject:[groovy-user] Swingbuilder.list and actions?
From:Bob Brown (bo@transentia.com.au)
Date:Sep 11, 2009 5:12:34 am
List:org.codehaus.groovy.user

Hi All,

I have code like the following excerpt:

--- def masterAction = {e -> def l = e.source if (!e.valueIsAdjusting) { def i = l.selectedValue detailModel.clear() masterData[i].each { detailModel.addElement(it) } } }

scrollPane() { list(visibleRowCount: 3, valueChanged: masterAction, listData: masterData.collect {k,v-> k }) }

---

I am trying to convert it to a more 'proper' actions-based approach, ie:

--- swing.actions() { action(id: 'masterAction', name: 'masterAction', closure: { def l = e.source if (!e.valueIsAdjusting) { def i = l.selectedValue detailModel.clear() masterData[i].each { detailModel.addElement(it) } } }) }

scrollPane() { list(masterAction, visibleRowCount: 3, listData: masterData.collect {k, v -> k }) }

---

But it's not being nice to me! I get:

Caught: java.lang.RuntimeException: Failed to create component for 'list' reason: java.lang.RuntimeException: The value argument of 'list' must be of type javax.swing.JList

Clearly, my understanding is deficient. Searching the lists did not help me...

Can anyone point me in the correct direction, please...

This is with Grooy 1.6.4.

Many thanks.

BOB

--- Bob Brown Director, Transentia Pty. Ltd. Training, consulting, development at the leading edge of technology.

73 Frasers Rd. Mobile: 0416-078-813 Ashgrove Email: bo@transentia.com.au Brisbane Web: www.transentia.com.au Queensland 4060 Australia

NOTE: This email may NOT be taken to constitute an agreement to form a "prior relationship" or to give "prior affirmative consent" for the purposes of opt-in mass marketing.

    .(         | "Build a fire for a man,     /%/         |    and he'll be warm for a day.   (%(%))       |  Set a man on fire,  .-'..`-.      |    and he'll be warm for the rest of his life."  `-'.'`-'dd    |  --Terry Pratchett