r548 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing: content/operation/catches/accidental content/operation/catches/benthos content/operation/catches/macrowaste content/operation/catches/plankton content/operation/catches/species util/attachment
Author: tchemit Date: 2013-03-06 10:34:33 +0100 (Wed, 06 Mar 2013) New Revision: 548 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/548 Log: use a separate cell renderer in cell editor (refs #2080: [CAPTURE] Impossible de cr?\195?\169er des pi?\195?\168ces-jointes dans le tableau) Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentCellRenderer.java Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2013-03-06 08:15:49 UTC (rev 547) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2013-03-06 09:34:33 UTC (rev 548) @@ -246,15 +246,14 @@ { // File column - AttachmentCellRenderer renderer = AttachmentCellRenderer.newRender( - getDecorator(Attachment.class, null), - n_("tutti.tooltip.attachment.none")); + Decorator<Attachment> decorator = getDecorator(Attachment.class, null); addColumnToModel(columnModel, - AttachmentCellEditor.newEditor(ui, - renderer, - AttachementObjectTypeEnum.SAMPLE + AttachmentCellEditor.newEditor( + ui, + AttachmentCellRenderer.newRender(decorator), + AttachementObjectTypeEnum.SAMPLE ), - renderer, + AttachmentCellRenderer.newRender(decorator), AccidentalBatchTableModel.ATTACHMENTS); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-03-06 08:15:49 UTC (rev 547) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-03-06 09:34:33 UTC (rev 548) @@ -264,14 +264,11 @@ { // File column - AttachmentCellRenderer renderer = AttachmentCellRenderer.newRender( - getDecorator(Attachment.class, null), - n_("tutti.tooltip.attachment.none")); addColumnToModel(columnModel, AttachmentCellEditor.newEditor(ui, - renderer, + AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), AttachementObjectTypeEnum.SAMPLE), - renderer, + AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), BenthosBatchTableModel.ATTACHMENT); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java 2013-03-06 08:15:49 UTC (rev 547) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java 2013-03-06 09:34:33 UTC (rev 548) @@ -47,7 +47,6 @@ import java.util.List; -import static org.nuiton.i18n.I18n._; import static org.nuiton.i18n.I18n.n_; /** @@ -256,14 +255,11 @@ { // File column - AttachmentCellRenderer renderer = AttachmentCellRenderer.newRender( - getDecorator(Attachment.class, null), - n_("tutti.tooltip.attachment.none")); addColumnToModel(columnModel, AttachmentCellEditor.newEditor(ui, - renderer, + AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), AttachementObjectTypeEnum.SAMPLE), - renderer, + AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), MacroWasteBatchTableModel.ATTACHMENTS); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java 2013-03-06 08:15:49 UTC (rev 547) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java 2013-03-06 09:34:33 UTC (rev 548) @@ -48,7 +48,6 @@ import java.util.List; -import static org.nuiton.i18n.I18n._; import static org.nuiton.i18n.I18n.n_; /** @@ -252,14 +251,11 @@ { // File column - AttachmentCellRenderer renderer = AttachmentCellRenderer.newRender( - getDecorator(Attachment.class, null), - n_("tutti.tooltip.attachment.none")); addColumnToModel(columnModel, AttachmentCellEditor.newEditor(ui, - renderer, + AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), AttachementObjectTypeEnum.SAMPLE), - renderer, + AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), PlanktonBatchTableModel.ATTACHMENTS); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-06 08:15:49 UTC (rev 547) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-06 09:34:33 UTC (rev 548) @@ -628,14 +628,11 @@ { // File column - AttachmentCellRenderer renderer = AttachmentCellRenderer.newRender( - getDecorator(Attachment.class, null), - n_("tutti.tooltip.attachment.none")); addColumnToModel(columnModel, AttachmentCellEditor.newEditor(ui, - renderer, + AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), AttachementObjectTypeEnum.SAMPLE), - renderer, + AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), SpeciesBatchTableModel.ATTACHMENT); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentCellRenderer.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentCellRenderer.java 2013-03-06 08:15:49 UTC (rev 547) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentCellRenderer.java 2013-03-06 09:34:33 UTC (rev 548) @@ -35,6 +35,7 @@ import java.util.Collection; import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; /** * Renderer of a attachement editor in a table cell. @@ -54,16 +55,14 @@ private final Decorator<Attachment> decorator; - public static AttachmentCellRenderer newRender(Decorator<Attachment> decorator, - String noneText) { - return new AttachmentCellRenderer(decorator, noneText); + public static AttachmentCellRenderer newRender(Decorator<Attachment> decorator) { + return new AttachmentCellRenderer(decorator); } - protected AttachmentCellRenderer(Decorator<Attachment> decorator, - String noneText) { + protected AttachmentCellRenderer(Decorator<Attachment> decorator) { setHorizontalAlignment(CENTER); setIcon(SwingUtil.createActionIcon("edit-attachment")); - this.noneText = noneText; + this.noneText = n_("tutti.tooltip.attachment.none"); this.decorator = decorator; }
participants (1)
-
tchemit@users.forge.codelutin.com