Status bar shows a wrong number of selected components

This commit is contained in:
Bane Stojkovic
2022-06-10 09:58:00 +02:00
parent 29c2240920
commit 9bf5b57663
2 changed files with 22 additions and 5 deletions
@@ -3849,5 +3849,21 @@
</changes> </changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url> <url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version> </org.diylc.appframework.update.Version>
<org.diylc.appframework.update.Version>
<versionNumber>
<major>4</major>
<minor>25</minor>
<build>0</build>
</versionNumber>
<releaseDate>2022-06-05 00:00:00.000 CET</releaseDate>
<name></name>
<changes>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Status bar shows a wrong number of selected components</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>
</a> </a>
</java.util.Arrays_-ArrayList> </java.util.Arrays_-ArrayList>
@@ -78,7 +78,7 @@ import net.java.balloontip.BalloonTip;
import net.java.balloontip.styles.EdgedBalloonStyle; import net.java.balloontip.styles.EdgedBalloonStyle;
public class StatusBar extends JPanel implements IPlugIn { public class StatusBar extends JPanel implements IPlugIn {
private static final String CLICK_TO_CREATE = LangUtil.translate("Click on the canvas to create a new %s or press %s to cancel"); private static final String CLICK_TO_CREATE = LangUtil.translate("Click on the canvas to create a new %s or press %s to cancel");
private static final String CLICK_TO_SET_POINT = private static final String CLICK_TO_SET_POINT =
LangUtil.translate("Click on the canvas to set the %s control point of a new %s or press %s to cancel"); LangUtil.translate("Click on the canvas to set the %s control point of a new %s or press %s to cancel");
@@ -106,7 +106,8 @@ public class StatusBar extends JPanel implements IPlugIn {
private static final Logger LOG = Logger.getLogger(StatusBar.class); private static final Logger LOG = Logger.getLogger(StatusBar.class);
public static String UPDATE_URL = "http://diy-fever.com/diylc/api/v1/update.xml"; public static String UPDATE_URL = "http://diy-fever.com/diylc/api/v1/update.xml";
private static final Format sizeFormat = new DecimalFormat("0.##"); private static final Format sizeFormat = new DecimalFormat("0.##");
private static final int MAX_SELECTED_COMPONENTS = 15;
private JComboBox zoomBox; private JComboBox zoomBox;
private UpdateLabel updateLabel; private UpdateLabel updateLabel;
@@ -531,9 +532,9 @@ public class StatusBar extends JPanel implements IPlugIn {
} else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) { } else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(Utils.toCommaString(selectedComponentNames.subList(0, builder.append(Utils.toCommaString(selectedComponentNames.subList(0,
Math.min(20, selectedComponentNames.size())))); Math.min(MAX_SELECTED_COMPONENTS, selectedComponentNames.size()))));
if (selectedComponentNames.size() > 15) { if (selectedComponentNames.size() > MAX_SELECTED_COMPONENTS) {
builder.append(" and " + (selectedComponentNames.size() - 15) + " more"); builder.append(" and " + (selectedComponentNames.size() - MAX_SELECTED_COMPONENTS) + " more");
} }
if (!stuckComponentNames.isEmpty()) { if (!stuckComponentNames.isEmpty()) {
builder.append(" (" + String.format(HOLD_TO_UNSTUCK, "<b>Ctrl</b>") + " "); builder.append(" (" + String.format(HOLD_TO_UNSTUCK, "<b>Ctrl</b>") + " ");