|
From: Scott R. (JIRA) <no...@at...> - 2005-10-18 12:21:10
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-215?page=comments#action_15016 ] Scott Russell commented on RCP-215: ----------------------------------- That would also work, except when a user has a component that changes colour for some other reason (eg. button press changes a background to yellow ?) after the form has been setup. I don't currently have a use case that requires such functionality, but that's not to say someone else might not sometime later. > ColorValidationInterceptorFactory.ColorChanger does not respond to changing component background > ------------------------------------------------------------------------------------------------ > > Key: RCP-215 > URL: http://opensource.atlassian.com/projects/spring/browse/RCP-215 > Project: Spring Framework Rich Client Project > Type: Bug > Components: Binding System > Versions: PR1 > Reporter: Scott Russell > Assignee: Peter De Bruycker > Priority: Minor > Attachments: ColorValidationInterceptorFactory.patch, rcp-215.patch.txt > > ColorValidationInterceptorFactory.ColorChanger stores the JComponent background color upon creation, then uses this color to reset component background to if no errors exist. However, in some circumstances the component might change its background color during form interaction (eg. a JTextField starts off non-editable (bg: grey) when first bound, then changes to editable (bg: white) upon a button click). > a suitable fix would be to replace ColorChanger as follows: > private class ColorChanger implements Guarded { > private Color normalColor; > private boolean enabled = false; > private JComponent component; > public ColorChanger(JComponent component) { > this.component = component; > normalColor = component.getBackground(); > } > public boolean isEnabled() { > return enabled; > } > public void setEnabled(boolean enabled) { > if (enabled == this.enabled) > return; > > this.enabled = enabled; > > if (enabled){ > component.setBackground(normalColor); > } > else { > normalColor = component.getBackground(); > component.setBackground(errorColor); > } > } > } > -Scott -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |