From a9492e155e71a566745637e39baf58a6afd77784 Mon Sep 17 00:00:00 2001 From: Raphael Girardot <raphael.girardot@synchrotron-soleil.fr> Date: Fri, 14 May 2021 08:07:47 +0000 Subject: [PATCH] - some code refactoring - respect java standards - No more use of DbData.splitDbData: directly return the expected data array at extraction (TANGOARCH-715) --- pom.xml | 11 +++++------ .../bensikin/models/AttributesTreeModel.java | 14 ++++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index f636797..e3d5189 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> @@ -72,6 +71,10 @@ <groupId>fr.soleil.lib</groupId> <artifactId>snapArchivingApi</artifactId> </dependency> + <dependency> + <groupId>fr.soleil.gui</groupId> + <artifactId>commonArchivingGUI</artifactId> + </dependency> <dependency> <groupId>org.swinglabs</groupId> <artifactId>swingx</artifactId> @@ -112,10 +115,6 @@ <groupId>fr.soleil.lib</groupId> <artifactId>ApplicationUtilities</artifactId> </dependency> - <dependency> - <groupId>fr.soleil.gui</groupId> - <artifactId>commonArchivingGUI</artifactId> - </dependency> <dependency> <groupId>net.sf.transmorph</groupId> <artifactId>transmorph</artifactId> diff --git a/src/main/java/fr/soleil/bensikin/models/AttributesTreeModel.java b/src/main/java/fr/soleil/bensikin/models/AttributesTreeModel.java index 6fc09bc..aed7d04 100644 --- a/src/main/java/fr/soleil/bensikin/models/AttributesTreeModel.java +++ b/src/main/java/fr/soleil/bensikin/models/AttributesTreeModel.java @@ -35,7 +35,6 @@ package fr.soleil.bensikin.models; import java.text.Collator; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -122,8 +121,7 @@ public class AttributesTreeModel extends DefaultTreeModel { ((DefaultMutableTreeNode) getRoot()).add(domainNode); - final List<Family> familiesToSort = new ArrayList<Family>(); - familiesToSort.addAll(domain.getFamilies().values()); + final List<Family> familiesToSort = domain.getFamilies(); Collections.sort(familiesToSort, new EntitiesComparator()); for (Family family : familiesToSort) { @@ -131,8 +129,7 @@ public class AttributesTreeModel extends DefaultTreeModel { final DefaultMutableTreeNode familyNode = new DefaultMutableTreeNode(family.getName()); domainNode.add(familyNode); - final List<Member> membersToSort = new ArrayList<Member>(); - membersToSort.addAll(family.getMembers().values()); + final List<Member> membersToSort = family.getMembers(); Collections.sort(membersToSort, new EntitiesComparator()); for (Member member : membersToSort) { @@ -140,9 +137,7 @@ public class AttributesTreeModel extends DefaultTreeModel { final DefaultMutableTreeNode memberNode = new DefaultMutableTreeNode(member.getName()); familyNode.add(memberNode); - final Collection<Attribute> coll = member.getAttributes().values(); - final List<Attribute> attributesToSort = new ArrayList<Attribute>(); - attributesToSort.addAll(coll); + final List<Attribute> attributesToSort = member.getAttributes(); Collections.sort(attributesToSort, new EntitiesComparator()); for (Attribute attribute : attributesToSort) { @@ -164,10 +159,13 @@ public class AttributesTreeModel extends DefaultTreeModel { } // END CURRENT ATTRIBUTE } + attributesToSort.clear(); // END CURRENT MEMBER } + membersToSort.clear(); // END CURRENT FAMILY } + familiesToSort.clear(); // END CURRENT DOMAIN } } -- GitLab