From aab5a94e1047de8f1b7a4c9916a2a553298119d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Sim=C3=A3o?= Date: Fri, 5 Jun 2009 10:54:46 +0000 Subject: [PATCH] git-svn-id: https://svn.coded.pt/svn/SIPRP@1050 bb69d46d-e84e-40c8-a05a-06db0d633741 --- .../gestao/riscos/GerirRiscosPanel.java | 23 +++++++++++++++++++ .../cayenne/objects/HsNormalizacao.java | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/trunk/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirRiscosPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirRiscosPanel.java index 5e9135d1..79e22361 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirRiscosPanel.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/gestao/riscos/GerirRiscosPanel.java @@ -536,9 +536,32 @@ public class GerirRiscosPanel extends JPanel implements LeafUIConstants private void refresh() { + TreePath selPath = tree.getSelectionPath(); + Object selObject = null; + if( selPath != null ) + { + Object selNode = selPath.getLastPathComponent(); + if( selNode != null && (selNode instanceof DefaultMutableTreeNode )) + { + selObject = ((DefaultMutableTreeNode)selNode).getUserObject(); + } + } root.removeAllChildren(); TreeTools.merge( root, HigieneSegurancaLogic.getRiscosTree() ); TreeTools.refreshTree( tree, root, false ); + if( selObject != null ) + { + DefaultMutableTreeNode found = TreeTools.findNodeWithUserObject( selObject, root ); + if( found != null ) + { + TreePath selNew = TreeTools.getPathFor( found ); + if( selNew != null ) + { + tree.setSelectionPath( selNew ); + TreeTools.refreshTree( tree, found, false ); + } + } + } setEnabled(); } diff --git a/trunk/common/src/siprp/database/cayenne/objects/HsNormalizacao.java b/trunk/common/src/siprp/database/cayenne/objects/HsNormalizacao.java index 4d834b82..73a1af1c 100644 --- a/trunk/common/src/siprp/database/cayenne/objects/HsNormalizacao.java +++ b/trunk/common/src/siprp/database/cayenne/objects/HsNormalizacao.java @@ -9,7 +9,7 @@ public class HsNormalizacao extends _HsNormalizacao { private static final int TO_STRING_LENGTH = 58; @Override - public String getCodigo() + public String getCodigo() { return parseFromUnicode( super.getCodigo() ); }