Raphaël Piéroni | 18 Jul 22:58

[groovy-user] Usage of Factory to extend SwingBuilder

Hi folks,

I'd like to enhance the SwingBuilder with s custom made factory.

I successfully had
animatedPane = panel {
                imageLabel = label(id: 'imageLabel', text: 'Image goes here')
            }
            imageTransition = animate(duration: 1000, acceleration:
0.3f, deceleration: 0.15f, component: animatedPane, closure: {
                animatedPane.removeAll()
                animatedPane.add label(icon: model.image)
                animatedPane.revalidate()
            })

in my swing builder script.

I registered a factory to animate which override newInstance only
    Object newInstance(FactoryBuilderSupport builder, def name, def
value, Map attributes) {
        def animator = new Animator(attributes.duration)
        animator.acceleration = attributes.acceleration
        animator.deceleration = attributes.deceleration
        new ScreenTransition(attributes.component, attributes.closure
as TransitionTarget, animator)
    }

I would like to enable
animate(...) {...}
and give retreive the closure

I also would like to have deault values whe not given.

Regards,

Raphaël

Gmane