|
From: Jan H. (JIRA) <no...@at...> - 2007-07-10 06:48:01
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jan Hoskens closed RCP-477.
---------------------------
Assignee: Jan Hoskens
Resolution: Fixed
Fix Version/s: 0.3.0
Added to spring-richclient-tiger module with a slight change in the code (a little more compact).
Tests added as a single file in order to be self-contained.
Thanks for the files.
> TigerEnumTableCellRenderer
> --------------------------
>
> Key: RCP-477
> URL: http://opensource.atlassian.com/projects/spring/browse/RCP-477
> Project: Spring Framework Rich Client Project
> Issue Type: New Feature
> Components: Binding System
> Affects Versions: 0.3.0
> Environment: Ubuntu Linux with Java 5
> Reporter: Xavier Breton
> Assignee: Jan Hoskens
> Fix For: 0.3.0
>
> Attachments: messages.properties, TigerEnum.java, TigerEnumTableCellRenderer.java, TigerEnumTableCellRendererTests.java
>
>
> Hi I developed a TableCellRender with i18n support for my project, I save it in the spring-richclient-tiger project in my development environment that I download from svn.
> Here is the code:
> package org.springframework.richclient.table.renderer;
> import java.awt.Component;
> import javax.swing.JTable;
> import javax.swing.table.DefaultTableCellRenderer;
> import org.springframework.context.support.MessageSourceAccessor;
> /**
> * @author Xavier Breton
> */
> public class TigerEnumTableCellRenderer extends DefaultTableCellRenderer {
>
> private static final long serialVersionUID = -1737388077316919179L;
>
> private MessageSourceAccessor messageSourceAccessor;
>
> public TigerEnumTableCellRenderer(MessageSourceAccessor messageSourceAccesor) {
> this.messageSourceAccessor = messageSourceAccesor;
> }
>
> public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
> int row, int column) {
> if (value != null) {
> Enum valueEnum = (Enum) value;
> Class<? extends Enum> valueClass = valueEnum.getClass();
> value = messageSourceAccessor.getMessage(valueClass.getName() + "." + valueEnum.name());
> }
> return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
> }
> }
--
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
|