All building blocks of the same type get added to the same group

This commit is contained in:
Bane Stojkovic
2026-01-20 20:34:32 +01:00
parent a32ad6b733
commit 6fde016ed4
5 changed files with 21 additions and 18 deletions
@@ -174,6 +174,9 @@ public class Project implements Serializable, Cloneable {
groups.clear();
}
}
groupsEx.removeAll(groupsEx.stream().
filter(x -> x.getComponentIds() == null ||
x.getComponentIds().stream().noneMatch(Objects::nonNull)).collect(Collectors.toSet()));
return groupsEx;
}
@@ -18,13 +18,8 @@
package org.diylc.presenter;
import java.io.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.IConfigurationManager;
@@ -145,6 +140,7 @@ public class BuildingBlockManager {
clone.setName(instantiationManager.createUniqueName(ComponentProcessor.getInstance()
.extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) clone.getClass()),
testComponents));
clone.setId(UUID.randomUUID());
testComponents.add(clone);
clones.add(clone);
} catch (CloneNotSupportedException e) {
@@ -1744,7 +1744,7 @@ public class Presenter implements IPlugInPort {
// Filter out any null IDs to prevent creating groups with null component IDs.
Set<UUID> componentIds = selectedComponents.stream()
.map(IDIYComponent::getId)
.filter(id -> id != null)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// Only create the group if there are valid component IDs
@@ -558,13 +558,9 @@
<minor>10</minor>
<build>0</build>
</versionNumber>
<releaseDate>2026-01-10 00:00:00.000 CET</releaseDate>
<releaseDate>2026-01-20 00:00:00.000 CET</releaseDate>
<name></name>
<changes>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>Added Box style multi-turn potentiometer component (thank you chayward)</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>Added 'M' and 'N' potentiometer taper options (thank you mm-rnd)</description>
@@ -577,6 +573,10 @@
<changeType>BUG_FIX</changeType>
<description>Fixed the performance issue that happens when groups of components are copy-pasted and the project size grows uncontrollably</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>All building blocks of the same type get added to the same group</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>'Tactile Micro Switch' editor doesn't show up on double click</description>
@@ -40,11 +40,15 @@ import java.awt.*;
import java.awt.geom.Point2D;
import java.io.Serial;
@ComponentDescriptor(name = "Box Multi-Turn Pot", author = "Clive", category = "Passive",
instanceNamePrefix = "VR",
description = "Box style multi-turn potentiometer (e.g. Bourns PV36)",
zOrder = IDIYComponent.COMPONENT,
transformer = org.diylc.components.transform.BoxTrimmerTransformer.class)
//@ComponentDescriptor(name = "Box Multi-Turn Pot", author = "Clive", category = "Passive",
// instanceNamePrefix = "VR",
// description = "Box style multi-turn potentiometer (e.g. Bourns PV36)",
// zOrder = IDIYComponent.COMPONENT,
// transformer = org.diylc.components.transform.BoxTrimmerTransformer.class)
//<org.diylc.appframework.update.Change>
// <changeType>NEW_FEATURE</changeType>
// <description>Added Box style multi-turn potentiometer component (thank you chayward)</description>
// </org.diylc.appframework.update.Change>
public class BoxTrimmer extends AbstractTransparentComponent<Resistance> {
@Serial