mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Added visual indicator to the component tree showing how many variants,
if any, exist for a component Rename multi-section cap class
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -149,13 +149,22 @@ public class TreePanel extends JPanel {
|
||||
Collections.sort(blockNames);
|
||||
if (!blockNames.equals(TreePanel.this.blocks)) {
|
||||
LOG.info("Detected block change");
|
||||
refreshBlocks(blockNames);
|
||||
refreshBuildingBlocks(blockNames);
|
||||
} else
|
||||
LOG.info("Detected no block change");
|
||||
} else
|
||||
LOG.info("Detected no block change");
|
||||
}
|
||||
});
|
||||
|
||||
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.TEMPLATES_KEY, new IConfigListener() {
|
||||
|
||||
@Override
|
||||
public void valueChanged(String key, Object value) {
|
||||
LOG.info("Detected variants change, repainting the tree");
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
|
||||
getTree().expandRow(0);
|
||||
}
|
||||
@@ -194,7 +203,7 @@ public class TreePanel extends JPanel {
|
||||
if (newBlocks != null) {
|
||||
List<String> blockNames = new ArrayList<String>(newBlocks.keySet());
|
||||
Collections.sort(blockNames);
|
||||
refreshBlocks(blockNames);
|
||||
refreshBuildingBlocks(blockNames);
|
||||
this.blocks = blockNames;
|
||||
} else {
|
||||
this.blocks = new ArrayList<String>();
|
||||
@@ -235,7 +244,7 @@ public class TreePanel extends JPanel {
|
||||
getTreeModel().nodeStructureChanged(getRecentNode());
|
||||
}
|
||||
|
||||
private void refreshBlocks(List<String> blocks) {
|
||||
private void refreshBuildingBlocks(List<String> blocks) {
|
||||
getBlocksNode().removeAllChildren();
|
||||
for (final String block : blocks) {
|
||||
Payload payload = new Payload(block, new MouseAdapter() {
|
||||
@@ -597,6 +606,9 @@ public class TreePanel extends JPanel {
|
||||
else
|
||||
setPreferredSize(new Dimension(0, 0));
|
||||
}
|
||||
|
||||
String shortCutHtml = "";
|
||||
String variantsHtml = "";
|
||||
|
||||
if (payload.isVisible()) {
|
||||
HashMap<String, String> shortcutMap =
|
||||
@@ -608,14 +620,22 @@ public class TreePanel extends JPanel {
|
||||
if (shortcutMap != null && shortcutMap.containsValue(identifier)) {
|
||||
for (String key : shortcutMap.keySet()) {
|
||||
if (shortcutMap.get(key).equals(identifier)) {
|
||||
setText("<html>"
|
||||
+ payload.toString()
|
||||
+ " <a style=\"text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; background-color: #eeeeee; color: #666666;\"><sup> "
|
||||
+ key + " </sup></a></html>");
|
||||
shortCutHtml = " <a style=\"text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; background-color: #eeeeee; color: #666666;\"> "
|
||||
+ key + " </a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (payload.getComponentType() != null) {
|
||||
List<Template> variants = plugInPort.getTemplatesFor(payload.getComponentType().getCategory(), payload.getComponentType().getName());
|
||||
if (variants != null && !variants.isEmpty()) {
|
||||
variantsHtml = " <a style=\"text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; background-color: #D7FFC6; color: #666666;\">[+"
|
||||
+ variants.size() + "]</a>";
|
||||
}
|
||||
}
|
||||
|
||||
setText("<html>" + payload.toString() + shortCutHtml + variantsHtml + "</html>");
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
@@ -2093,7 +2093,15 @@
|
||||
</versionNumber>
|
||||
<releaseDate>2018-12-26 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Multi-section Electrolytic "Can" Capacitor added</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added visual indicator to the component tree showing how many variants, if any, exist for a component</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Fix "Mouse Wheel Zoom" feature that got broken in 3.46.1</description>
|
||||
|
||||
Reference in New Issue
Block a user