mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
added default templates
This commit is contained in:
Binary file not shown.
@@ -36,8 +36,9 @@ public enum IconLoader {
|
||||
"cloud_edit.png"), CloudUpload("cloud_upload.png"), NavLeftBlue("nav_left_blue.png"), NavRightBlue(
|
||||
"nav_right_blue.png"), MissingImage("missing_image.png"), CloudBg("cloud_bg.png"), CloudBig("cloud_big.png"), CloudWait(
|
||||
"cloud_wait.png"), Spinning("spinning.gif"), Megaphone("megaphone.png"), Download("download.png"), Eye("eye.png"), Messages(
|
||||
"messages.png"), SearchBox("search-box.png"), Screwdriver("screwdriver.png"), Hammer("hammer.png"), FlipHorizontal("flip_horizontal.png"),
|
||||
FlipVertical("flip_vertical.png"), MagicWand("magic_wand.png");
|
||||
"messages.png"), SearchBox("search-box.png"), Screwdriver("screwdriver.png"), Hammer("hammer.png"), FlipHorizontal(
|
||||
"flip_horizontal.png"), FlipVertical("flip_vertical.png"), MagicWand("magic_wand.png"), PinGrey("pin_grey.png"), PinGreen(
|
||||
"pin_green.png");
|
||||
|
||||
protected String name;
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 722 B |
Binary file not shown.
|
After Width: | Height: | Size: 708 B |
@@ -97,7 +97,7 @@ public class ComponentButtonFactory {
|
||||
// Customize item size to fit the delete button
|
||||
public java.awt.Dimension getPreferredSize() {
|
||||
Dimension d = super.getPreferredSize();
|
||||
return new Dimension(d.width + 18, d.height);
|
||||
return new Dimension(d.width + 32, d.height);
|
||||
}
|
||||
};
|
||||
item.addActionListener(new ActionListener() {
|
||||
@@ -107,7 +107,30 @@ public class ComponentButtonFactory {
|
||||
plugInPort.setNewComponentTypeSlot(componentType, template);
|
||||
}
|
||||
});
|
||||
JLabel label = new JLabel(IconLoader.Garbage.getIcon());
|
||||
|
||||
JLabel label = new JLabel(template.isDefaultFlag() ? IconLoader.PinGreen.getIcon() : IconLoader.PinGrey.getIcon());
|
||||
label.setToolTipText(template.isDefaultFlag() ? "Remove default template" : "Set default template");
|
||||
label.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
// Hide the menu
|
||||
Container c = item.getParent();
|
||||
if (c != null && c instanceof JPopupMenu) {
|
||||
JPopupMenu m = (JPopupMenu) c;
|
||||
m.setVisible(false);
|
||||
}
|
||||
plugInPort.setTemplateDefault(componentType.getCategory(), componentType.getName(), template.getName(),
|
||||
!template.isDefaultFlag());
|
||||
e.consume();
|
||||
}
|
||||
});
|
||||
Border margin = new EmptyBorder(4, 0, 0, 0);
|
||||
label.setBorder(margin);
|
||||
item.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
||||
item.add(label);
|
||||
|
||||
label = new JLabel(IconLoader.Garbage.getIcon());
|
||||
label.setToolTipText("Delete template");
|
||||
label.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@@ -129,7 +152,7 @@ public class ComponentButtonFactory {
|
||||
e.consume();
|
||||
}
|
||||
});
|
||||
Border margin = new EmptyBorder(4, 0, 0, 0);
|
||||
margin = new EmptyBorder(4, 2, 0, 0);
|
||||
label.setBorder(margin);
|
||||
item.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
||||
item.add(label);
|
||||
|
||||
@@ -1522,6 +1522,10 @@
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Mirror selection horizontally and vertically</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Ability to set a default template for component type (grey "pin" icon in the template popup)</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Default focus on "Text" field for label</description>
|
||||
|
||||
Reference in New Issue
Block a user