mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Renamed "template" to "variant"
This commit is contained in:
Binary file not shown.
@@ -1993,6 +1993,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void deleteTemplate(String categoryName, String componentTypeName, String templateName) {
|
public void deleteTemplate(String categoryName, String componentTypeName, String templateName) {
|
||||||
|
LOG.debug(String.format("deleteTemplate(%s, %s, %s)", categoryName, componentTypeName, templateName));
|
||||||
Map<String, List<Template>> templateMap =
|
Map<String, List<Template>> templateMap =
|
||||||
(Map<String, List<Template>>) ConfigurationManager.getInstance().readObject(TEMPLATES_KEY, null);
|
(Map<String, List<Template>>) ConfigurationManager.getInstance().readObject(TEMPLATES_KEY, null);
|
||||||
if (templateMap != null) {
|
if (templateMap != null) {
|
||||||
@@ -2007,12 +2008,13 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConfigurationManager.getInstance().saveConfigration();
|
ConfigurationManager.getInstance().writeValue(TEMPLATES_KEY, templateMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void setTemplateDefault(String categoryName, String componentTypeName, String templateName, boolean defaultFlag) {
|
public void setTemplateDefault(String categoryName, String componentTypeName, String templateName, boolean defaultFlag) {
|
||||||
|
LOG.debug(String.format("setTemplateDefault(%s, %s, %s, %s)", categoryName, componentTypeName, templateName, defaultFlag));
|
||||||
Map<String, List<Template>> templateMap =
|
Map<String, List<Template>> templateMap =
|
||||||
(Map<String, List<Template>>) ConfigurationManager.getInstance().readObject(TEMPLATES_KEY, null);
|
(Map<String, List<Template>>) ConfigurationManager.getInstance().readObject(TEMPLATES_KEY, null);
|
||||||
if (templateMap != null) {
|
if (templateMap != null) {
|
||||||
@@ -2059,6 +2061,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void saveSelectionAsBlock(String blockName) {
|
public void saveSelectionAsBlock(String blockName) {
|
||||||
|
LOG.debug(String.format("saveSelectionAsBlock(%s)", blockName));
|
||||||
Map<String, Collection<IDIYComponent<?>>> blocks =
|
Map<String, Collection<IDIYComponent<?>>> blocks =
|
||||||
(Map<String, Collection<IDIYComponent<?>>>) ConfigurationManager.getInstance().readObject(BLOCKS_KEY, null);
|
(Map<String, Collection<IDIYComponent<?>>>) ConfigurationManager.getInstance().readObject(BLOCKS_KEY, null);
|
||||||
if (blocks == null)
|
if (blocks == null)
|
||||||
@@ -2070,6 +2073,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void loadBlock(String blockName) throws InvalidBlockException {
|
public void loadBlock(String blockName) throws InvalidBlockException {
|
||||||
|
LOG.debug(String.format("loadBlock(%s)", blockName));
|
||||||
Map<String, Collection<IDIYComponent<?>>> blocks =
|
Map<String, Collection<IDIYComponent<?>>> blocks =
|
||||||
(Map<String, Collection<IDIYComponent<?>>>) ConfigurationManager.getInstance().readObject(BLOCKS_KEY, null);
|
(Map<String, Collection<IDIYComponent<?>>>) ConfigurationManager.getInstance().readObject(BLOCKS_KEY, null);
|
||||||
if (blocks != null) {
|
if (blocks != null) {
|
||||||
@@ -2098,6 +2102,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void deleteBlock(String blockName) {
|
public void deleteBlock(String blockName) {
|
||||||
|
LOG.debug(String.format("deleteBlock(%s)", blockName));
|
||||||
Map<String, Collection<IDIYComponent<?>>> blocks =
|
Map<String, Collection<IDIYComponent<?>>> blocks =
|
||||||
(Map<String, Collection<IDIYComponent<?>>>) ConfigurationManager.getInstance().readObject(BLOCKS_KEY, null);
|
(Map<String, Collection<IDIYComponent<?>>>) ConfigurationManager.getInstance().readObject(BLOCKS_KEY, null);
|
||||||
if (blocks != null) {
|
if (blocks != null) {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -853,7 +853,7 @@ public class ActionFactory {
|
|||||||
public SaveAsTemplateAction(IPlugInPort plugInPort) {
|
public SaveAsTemplateAction(IPlugInPort plugInPort) {
|
||||||
super();
|
super();
|
||||||
this.plugInPort = plugInPort;
|
this.plugInPort = plugInPort;
|
||||||
putValue(AbstractAction.NAME, "Save as Template");
|
putValue(AbstractAction.NAME, "Save as Variant");
|
||||||
putValue(AbstractAction.SMALL_ICON, IconLoader.BriefcaseAdd.getIcon());
|
putValue(AbstractAction.SMALL_ICON, IconLoader.BriefcaseAdd.getIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -861,7 +861,7 @@ public class ActionFactory {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
LOG.info("Save as template triggered");
|
LOG.info("Save as template triggered");
|
||||||
String templateName =
|
String templateName =
|
||||||
JOptionPane.showInputDialog(null, "Template name:", "Save as Template", JOptionPane.PLAIN_MESSAGE);
|
JOptionPane.showInputDialog(null, "Variant name:", "Save as Variant", JOptionPane.PLAIN_MESSAGE);
|
||||||
if (templateName != null && !templateName.trim().isEmpty()) {
|
if (templateName != null && !templateName.trim().isEmpty()) {
|
||||||
plugInPort.saveSelectedComponentAsTemplate(templateName);
|
plugInPort.saveSelectedComponentAsTemplate(templateName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
|
|
||||||
public JMenu getApplyTemplateMenu() {
|
public JMenu getApplyTemplateMenu() {
|
||||||
if (applyTemplateMenu == null) {
|
if (applyTemplateMenu == null) {
|
||||||
applyTemplateMenu = new JMenu("Apply Template");
|
applyTemplateMenu = new JMenu("Apply Variant");
|
||||||
applyTemplateMenu.setIcon(IconLoader.BriefcaseInto.getIcon());
|
applyTemplateMenu.setIcon(IconLoader.BriefcaseInto.getIcon());
|
||||||
}
|
}
|
||||||
return applyTemplateMenu;
|
return applyTemplateMenu;
|
||||||
@@ -347,7 +347,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
try {
|
try {
|
||||||
templates = plugInPort.getTemplatesForSelection();
|
templates = plugInPort.getTemplatesForSelection();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.info("Could not get templates for selection");
|
LOG.info("Could not load variants for selection");
|
||||||
getApplyTemplateMenu().setEnabled(false);
|
getApplyTemplateMenu().setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class ComponentButtonFactory {
|
|||||||
});
|
});
|
||||||
|
|
||||||
JLabel label = new JLabel(template.isDefaultFlag() ? IconLoader.PinGreen.getIcon() : IconLoader.PinGrey.getIcon());
|
JLabel label = new JLabel(template.isDefaultFlag() ? IconLoader.PinGreen.getIcon() : IconLoader.PinGrey.getIcon());
|
||||||
label.setToolTipText(template.isDefaultFlag() ? "Remove default template" : "Set default template");
|
label.setToolTipText(template.isDefaultFlag() ? "Remove default variant" : "Set default variant");
|
||||||
label.addMouseListener(new MouseAdapter() {
|
label.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -131,7 +131,7 @@ public class ComponentButtonFactory {
|
|||||||
item.add(label);
|
item.add(label);
|
||||||
|
|
||||||
label = new JLabel(IconLoader.Garbage.getIcon());
|
label = new JLabel(IconLoader.Garbage.getIcon());
|
||||||
label.setToolTipText("Delete template");
|
label.setToolTipText("Delete variant");
|
||||||
label.addMouseListener(new MouseAdapter() {
|
label.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -143,7 +143,7 @@ public class ComponentButtonFactory {
|
|||||||
m.setVisible(false);
|
m.setVisible(false);
|
||||||
}
|
}
|
||||||
int result =
|
int result =
|
||||||
JOptionPane.showConfirmDialog(SwingUtilities.getRoot(item), "Are you sure you want to delete template \""
|
JOptionPane.showConfirmDialog(SwingUtilities.getRoot(item), "Are you sure you want to delete variant \""
|
||||||
+ template.getName() + "\"", "Delete", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
+ template.getName() + "\"", "Delete", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||||
if (result != JOptionPane.YES_OPTION) {
|
if (result != JOptionPane.YES_OPTION) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -138,8 +138,12 @@ class ComponentTabbedPane extends JTabbedPane {
|
|||||||
Collections.sort(componentTypes, ComparatorFactory.getInstance().getComponentTypeComparator());
|
Collections.sort(componentTypes, ComparatorFactory.getInstance().getComponentTypeComparator());
|
||||||
toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS));
|
toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS));
|
||||||
for (ComponentType componentType : componentTypes) {
|
for (ComponentType componentType : componentTypes) {
|
||||||
|
try {
|
||||||
Component button = ComponentButtonFactory.create(plugInPort, componentType, createTemplatePopup(componentType));
|
Component button = ComponentButtonFactory.create(plugInPort, componentType, createTemplatePopup(componentType));
|
||||||
toolbar.add(button);
|
toolbar.add(button);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Could not create recent component button for " + componentType.getName(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return toolbar;
|
return toolbar;
|
||||||
@@ -181,7 +185,7 @@ class ComponentTabbedPane extends JTabbedPane {
|
|||||||
(Class<? extends IDIYComponent<?>>) Class.forName(componentClassName));
|
(Class<? extends IDIYComponent<?>>) Class.forName(componentClassName));
|
||||||
Component button = ComponentButtonFactory.create(plugInPort, componentType, createTemplatePopup(componentType));
|
Component button = ComponentButtonFactory.create(plugInPort, componentType, createTemplatePopup(componentType));
|
||||||
toolbar.add(button);
|
toolbar.add(button);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Could not create recent component button for " + componentClassName, e);
|
LOG.error("Could not create recent component button for " + componentClassName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +201,7 @@ class ComponentTabbedPane extends JTabbedPane {
|
|||||||
templatePopup.removeAll();
|
templatePopup.removeAll();
|
||||||
List<Template> templates = plugInPort.getTemplatesFor(componentType.getCategory(), componentType.getName());
|
List<Template> templates = plugInPort.getTemplatesFor(componentType.getCategory(), componentType.getName());
|
||||||
if (templates == null || templates.isEmpty()) {
|
if (templates == null || templates.isEmpty()) {
|
||||||
JMenuItem item = new JMenuItem("<no templates>");
|
JMenuItem item = new JMenuItem("<no variants>");
|
||||||
item.setEnabled(false);
|
item.setEnabled(false);
|
||||||
templatePopup.add(item);
|
templatePopup.add(item);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ public class TreePanel extends JPanel {
|
|||||||
|
|
||||||
List<Template> templates = plugInPort.getTemplatesFor(componentType.getCategory(), componentType.getName());
|
List<Template> templates = plugInPort.getTemplatesFor(componentType.getCategory(), componentType.getName());
|
||||||
if (templates == null || templates.isEmpty()) {
|
if (templates == null || templates.isEmpty()) {
|
||||||
JMenuItem item = new JMenuItem("<no templates>");
|
JMenuItem item = new JMenuItem("<no variants>");
|
||||||
item.setEnabled(false);
|
item.setEnabled(false);
|
||||||
popup.add(item);
|
popup.add(item);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1572,7 +1572,11 @@
|
|||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Applying a template shouldn't affect component placement</description>
|
<description>Renamed "template" to "variant" as it is describes the meaning more closely</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Applying a variant/template shouldn't affect component placement</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
|||||||
Reference in New Issue
Block a user