|
From: Scott R. (JIRA) <no...@at...> - 2005-10-03 00:05:10
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-215?page=all ] Scott Russell updated RCP-215: ------------------------------ Attachment: ColorValidationInterceptorFactory.patch Patch supplied. -Scott > 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: Oliver Hutchison > Priority: Minor > Attachments: ColorValidationInterceptorFactory.patch > > 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 |