From afcd719b794963ad07d49e62cbfbbfd6e1571f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 16 Nov 2024 20:18:11 +0100 Subject: [PATCH] A little faster basic tag info panel. --- .../decompiler/flash/gui/TagInfoPanel.java | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java b/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java index 1305a6c11..3a35d4ead 100644 --- a/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java @@ -111,25 +111,26 @@ public class TagInfoPanel extends JPanel { private void updateHtmlContent(boolean expand, boolean showDetails) { String categoryName = "general"; - String result = ""; + StringBuilder result = new StringBuilder(); + result.append("
"); Boolean flipFlop = false; List items = tagInfo.getInfos().get(categoryName); if (View.isOceanic()) { - result += ""; + result.append(""); } else { - result += ""; + result.append(""); } - result += String.format( + result.append(String.format( "", mainPanel.translate("tagInfo.header.name") - ); - result += String.format( + )); + result.append(String.format( "", mainPanel.translate("tagInfo.header.value") - ); - result += ""; + )); + result.append(""); SWF swf = tagInfo.getSwf(); for (TagInfo.TagInfoItem item : items) { @@ -137,9 +138,9 @@ public class TagInfoPanel extends JPanel { flipFlop = !flipFlop; if (View.isOceanic()) { - result += ""; + result.append(""); } else { - result += ""; + result.append(""); } String name = item.getName(); @@ -156,16 +157,17 @@ public class TagInfoPanel extends JPanel { } } - result += ""; + result.append(""); + StringBuilder valueBuilder = new StringBuilder(); Object value = item.getValue(); if (value instanceof Boolean) { boolean boolValue = (boolean) value; - value = boolValue ? AppStrings.translate("yes") : AppStrings.translate("no"); + valueBuilder.append(boolValue ? AppStrings.translate("yes") : AppStrings.translate("no")); } else if (convertToLinkList) { String[] strIds = ((String) value).split(", "); List sortedIds = new ArrayList<>(); - String strValue = ""; + StringBuilder strValue = new StringBuilder(); for (String strId : strIds) { sortedIds.add(Integer.parseInt(strId)); @@ -188,7 +190,7 @@ public class TagInfoPanel extends JPanel { } else { charName = Helper.escapeHTML(character.toString()); } - strValue += String.format("%s
", scheme, id, charName, id); + strValue.append(String.format("%s
", scheme, id, charName, id)); } else { if (swf == null || character == null) { charName = "???"; @@ -196,30 +198,33 @@ public class TagInfoPanel extends JPanel { charName = character.getTagName(); } - strValue += String.format("%s (%d)
", scheme, id, charName, id); + strValue.append(String.format("%s (%d)
", scheme, id, charName, id)); } } else { - strValue += String.format("%d, ", scheme, id, displayId); + strValue.append(String.format("%d, ", scheme, id, displayId)); } } - value = strValue.substring(0, strValue.length() - 2); + String sVal = strValue.toString(); + valueBuilder.append(sVal.substring(0, sVal.length() - 2)); if (!frameList && !expand) { - value = value + " +"; + valueBuilder.append(" +"); } else if (!frameList && expand && !showDetails) { - value = value + "
+"; + valueBuilder.append("
+"); } + } else { + valueBuilder.append(value.toString()); } - result += "
"; + result.append(""); - result += ""; + result.append(""); } - result += "
%s%s
" + name + "").append(name).append("" + value + "").append(valueBuilder.toString()).append("
"; + result.append(""); - editorPane.setText(result); + editorPane.setText(result.toString()); } private void buildHtmlContent() {