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
@@ -78,7 +78,7 @@ import net.java.balloontip.BalloonTip;
import net.java.balloontip.styles.EdgedBalloonStyle;
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_SET_POINT =
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);
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 UpdateLabel updateLabel;
@@ -531,9 +532,9 @@ public class StatusBar extends JPanel implements IPlugIn {
} else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) {
StringBuilder builder = new StringBuilder();
builder.append(Utils.toCommaString(selectedComponentNames.subList(0,
Math.min(20, selectedComponentNames.size()))));
if (selectedComponentNames.size() > 15) {
builder.append(" and " + (selectedComponentNames.size() - 15) + " more");
Math.min(MAX_SELECTED_COMPONENTS, selectedComponentNames.size()))));
if (selectedComponentNames.size() > MAX_SELECTED_COMPONENTS) {
builder.append(" and " + (selectedComponentNames.size() - MAX_SELECTED_COMPONENTS) + " more");
}
if (!stuckComponentNames.isEmpty()) {
builder.append(" (" + String.format(HOLD_TO_UNSTUCK, "<b>Ctrl</b>") + " ");