This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit e0e5402981fbeec4ca32042fb4e5b4e6645e409a Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Aug 11 11:39:59 2016 +0200 amélioration renderer --- .../ReferentialSynchronizeTreeCellRenderer.java | 41 +++++++--------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/synchronize/referential/ng/tree/ReferentialSynchronizeTreeCellRenderer.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/synchronize/referential/ng/tree/ReferentialSynchronizeTreeCellRenderer.java index 843511b..5955104 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/synchronize/referential/ng/tree/ReferentialSynchronizeTreeCellRenderer.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/synchronize/referential/ng/tree/ReferentialSynchronizeTreeCellRenderer.java @@ -33,7 +33,6 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; import javax.swing.Icon; -import javax.swing.JComponent; import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.tree.DefaultTreeCellRenderer; @@ -87,49 +86,35 @@ public class ReferentialSynchronizeTreeCellRenderer extends DefaultTreeCellRende int row, boolean hasFocus) { + if (!(value instanceof ReferentialSynchroNodeSupport)) { + return this; + } + // get the icon to set for the node ReferentialSynchroNodeSupport node = (ReferentialSynchroNodeSupport) value; - if (node == null) { - return super.getTreeCellRendererComponent( - tree, - value, - sel, - expanded, - leaf, - row, - hasFocus - ); - } - String text = null; Icon icon = null; if (node instanceof TypeReferentialSynchroNode) { TypeReferentialSynchroNode node1 = (TypeReferentialSynchroNode) node; - icon = UIManager.getIcon("icon.navigation.sub.referentiel16"); - text = t(DecoratorService.getEntityLabel(ObserveTreeHelper.TREE_NODE_PREFIX, node1.getUserObject())); + icon = UIManager.getIcon("navigation.sub.referentiel-16"); + text = "<html><body>" + t(DecoratorService.getEntityLabel(ObserveTreeHelper.TREE_NODE_PREFIX, node1.getUserObject())); + int childCount = node1.getChildCount(); + text += " <i>(" + childCount + ")</i>"; } else if (node instanceof ReferenceReferentialSynchroNode) { ReferenceReferentialSynchroNode node1 = (ReferenceReferentialSynchroNode) node; icon = node1.getType().icon(); ReferentialReference reference = node1.getUserObject(); Decorator<?> decorator = getDecoratorService().getReferentialReferenceDecorator(reference.getType()); - text = decorator.toString(node); + text = "<html><body>" + decorator.toString(reference); + text += " <i>(" + reference.getVersion() + " - " + reference.getLastUpdateDate() + ")</i>"; } - setIcon(icon); + Component comp = super.getTreeCellRendererComponent(tree, text, sel, expanded, leaf, row, hasFocus); - Component comp = super.getTreeCellRendererComponent( - tree, - text, - sel, - expanded, - leaf, - row, - hasFocus - ); - - ((JComponent) comp).setToolTipText(text); + setIcon(icon); + setToolTipText(text); return comp; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.