[
https://issues.apache.org/jira/browse/PIVOT-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13075990#comment-13075990
]
Bill van Melle commented on PIVOT-783:
--------------------------------------
I see. Should this at least be changed to a feature request then? Any time
user code has to call repaint() for something it isn't otherwise responsible
for painting strikes me as a defect in the framework. The rest of the system
is pretty good at figuring out what needs to happen when user code changes
something that affects the display, and it seems funny that users should have
to be aware of this one.
Thanks for the workaround. It hints at what I'd be tempted to do to Pivot to
make it really work -- add some methods to the Decorator interface (say,
addedToComponent and removedFromComponent) that would be called by the various
updaters in a Component's DecoratorSequence. Then define an abstract decorator
base class that defines those methods to update an internal list of component's
it's attached to, and defines an invalidate method that calls repaint on the
currently attached components. Fix all decorators to call invalidate when one
of their properties changes. No doubt there are complexities that I don't
understand here.
> Calling setScale on scaleDecorator doesn't update the display
> -------------------------------------------------------------
>
> Key: PIVOT-783
> URL: https://issues.apache.org/jira/browse/PIVOT-783
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Affects Versions: 2.0
> Reporter: Bill van Melle
> Priority: Minor
> Fix For: 2.0.1
>
>
> When you call setScale on a scaleDecorator that's already in the display
> tree, the display does not update. You can't see the effect of the change
> until something else causes a repaint.
> Looking at the code, isn't this an issue for decorators in general? I don't
> see any mechanism for decorators to notify the component (or components?)
> that they are attached to that they've changed. If you're not going to
> notify, then shouldn't decorators be immutable objects? (Of course, that
> would break a lot of code.)
> FWIW, a demonstration:
> <Window title="Scale change" maximized="true"
> xmlns:bxml="http://pivot.apache.org/bxml"
> xmlns:effects="org.apache.pivot.wtk.effects"
> xmlns="org.apache.pivot.wtk">
> <BoxPane orientation="vertical" preferredWidth="300">
> <PushButton buttonData="Change">
> <buttonPressListeners>
> function buttonPressed(button) {
> scaleDecorator.setScale(2.0);
> }
> </buttonPressListeners>
> </PushButton>
> <Label text="This text should get twice as big when I push the button">
> <decorators>
> <effects:ScaleDecorator bxml:id="scaleDecorator"
> horizontalAlignment="left" verticalAlignment="top" />
> </decorators>
> </Label>
> </BoxPane>
> </Window>
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira