From 7756c7afc864857ffe8be0791294d12b72029b0e Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Fri, 14 Feb 2020 10:10:01 -0500 Subject: [PATCH] Detection and warning when a brick has more than one version. Each brick must have exactly one version. --- .../java/cbit/vcell/desktop/BioModelCellRenderer.java | 8 +++++++- .../java/cbit/vcell/desktop/VCDocumentDbCellRenderer.java | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/vcell-client/src/main/java/cbit/vcell/desktop/BioModelCellRenderer.java b/vcell-client/src/main/java/cbit/vcell/desktop/BioModelCellRenderer.java index 4c9971b78a..802a2990d7 100644 --- a/vcell-client/src/main/java/cbit/vcell/desktop/BioModelCellRenderer.java +++ b/vcell-client/src/main/java/cbit/vcell/desktop/BioModelCellRenderer.java @@ -259,7 +259,13 @@ public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, component.setText(modelName); component.setToolTipText(toolTip); } else { - component.setText(modelName); // keep it simple for anything else + String str = modelName; + if(node.getChildCount() > 1) { + String prefix = sel ? "" : ""; + String suffix = sel ? "" : ""; + str += prefix + " (" + node.getChildCount() + ")" + suffix; + } + component.setText("" + str + ""); component.setToolTipText(toolTip); } } else { diff --git a/vcell-client/src/main/java/cbit/vcell/desktop/VCDocumentDbCellRenderer.java b/vcell-client/src/main/java/cbit/vcell/desktop/VCDocumentDbCellRenderer.java index e869b0b598..9db9f69602 100644 --- a/vcell-client/src/main/java/cbit/vcell/desktop/VCDocumentDbCellRenderer.java +++ b/vcell-client/src/main/java/cbit/vcell/desktop/VCDocumentDbCellRenderer.java @@ -14,6 +14,7 @@ import javax.swing.JLabel; import javax.swing.JTree; +import org.omg.PortableInterceptor.USER_EXCEPTION; import org.vcell.util.document.GroupAccess; import org.vcell.util.document.User; import org.vcell.util.document.VCDocumentInfo; @@ -201,6 +202,11 @@ else if(userObject instanceof VCDocumentInfoNode) { } } } + } else if(sessionUser != null && nodeUser != null && VCDocumentDbTreeModel.USER_modelBricks.equals(nodeUser.getName())) { + // we warn if any brick has more than one version + if(node.getChildCount() != 1) { + setIcon(fieldFolderWarningIcon); + } } } }