Author: tchemit Date: 2011-08-16 16:51:21 +0200 (Tue, 16 Aug 2011) New Revision: 3279 Url: http://chorem.org/repositories/revision/lima/3279 Log: Anomalie #436: Pas possible d'ajouter ou modifier le compte d'une ?\195?\169criture Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2011-08-16 14:09:44 UTC (rev 3278) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2011-08-16 14:51:21 UTC (rev 3279) @@ -25,32 +25,35 @@ package org.chorem.lima.ui.combobox; -import java.awt.Component; +import org.chorem.lima.entity.Account; import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; +import java.awt.Component; -import org.chorem.lima.entity.Account; +public class AccountRenderer extends DefaultListCellRenderer { -public class AccountRenderer extends DefaultListCellRenderer { - private static final long serialVersionUID = 1L; @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - + public Component getListCellRendererComponent(JList list, + Object value, + int index, + boolean isSelected, + boolean cellHasFocus) { + JLabel label = new JLabel(); Account account = (Account) value; - if (account != null){ + if (account != null) { String accountLabel = account.getLabel(); int nbChars = 30; - if (accountLabel.length()>nbChars){ - accountLabel = accountLabel.substring(0, nbChars)+"…"; + if (accountLabel != null && accountLabel.length() > nbChars) { + accountLabel = accountLabel.substring(0, nbChars) + "…"; } - label.setText(account.getAccountNumber() +" - " + accountLabel); + label.setText(account.getAccountNumber() + " - " + accountLabel); } - return label; + return label; } - + }