[ https://issues.apache.org/jira/browse/PIVOT-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13424194#comment-13424194 ]
Roger Whitcomb commented on PIVOT-783: -------------------------------------- A very easy workaround is simply to call "repaint()" on the component after changing the decorator scale value: <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); scaledLabel.repaint(); } </buttonPressListeners> </PushButton> <Label bxml:id="scaledLabel" 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> Seems like we could simply document this for potential users rather than change all the infrastructure around Decorators. (Tested this code and it works as it should.) Because, as you say: Decorators can be applied to many different components, so we would have to implement a list of Components inside Decorator and do all the listeners and notifications, etc. which seems overkill for this one issue. Generally decorators don't change their values anyway once they are instantiated. So, another solution is just to remove the decorator and add it again after changing scale, which also works: <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) { scaledLabel.getDecorators().remove(scaleDecorator); scaleDecorator.setScale(2.0); scaledLabel.getDecorators().add(scaleDecorator); } </buttonPressListeners> </PushButton> <Label bxml:id="scaledLabel" 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> So, generally I would say this is a non-issue, except that it could be documented what to do for ScaleDecorator to force a repaint when changing scale. > 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: Improvement > Components: wtk > Affects Versions: 2.0 > Reporter: Bill van Melle > Priority: Minor > Fix For: 2.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. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira