|
From: Xavier B. (JIRA) <no...@at...> - 2007-06-13 05:28:30
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xavier Breton updated RCP-477:
------------------------------
Attachment: TigerEnumTableCellRenderer.java
The src
> 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
> Attachments: TigerEnumTableCellRenderer.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
|