git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 3.0.1
[fanfix.git]
/
src
/
be
/
nikiroo
/
utils
/
ui
/
ConfigEditor.java
diff --git
a/src/be/nikiroo/utils/ui/ConfigEditor.java
b/src/be/nikiroo/utils/ui/ConfigEditor.java
index 45a534ea0c1c576d02e76e71fc5d32cbe04ff270..c687c98fee5637dfb8e10b7bad32f6be102ef9d5 100644
(file)
--- a/
src/be/nikiroo/utils/ui/ConfigEditor.java
+++ b/
src/be/nikiroo/utils/ui/ConfigEditor.java
@@
-50,12
+50,8
@@
public class ConfigEditor<E extends Enum<E>> extends JPanel {
*/
public ConfigEditor(Class<E> type, final Bundle<E> bundle, String title) {
this.setLayout(new BorderLayout());
*/
public ConfigEditor(Class<E> type, final Bundle<E> bundle, String title) {
this.setLayout(new BorderLayout());
- JPanel main = new JPanel();
-
- JScrollPane scroll = new JScrollPane(main);
- scroll.getVerticalScrollBar().setUnitIncrement(16);
- this.add(scroll, BorderLayout.CENTER);
+ JPanel main = new JPanel();
main.setLayout(new BoxLayout(main, BoxLayout.PAGE_AXIS));
main.setBorder(new EmptyBorder(5, 5, 5, 5));
main.setLayout(new BoxLayout(main, BoxLayout.PAGE_AXIS));
main.setBorder(new EmptyBorder(5, 5, 5, 5));
@@
-68,7
+64,11
@@
public class ConfigEditor<E extends Enum<E>> extends JPanel {
addItem(main, item, 0);
}
addItem(main, item, 0);
}
- main.add(createButton("Reset", new ActionListener() {
+ JPanel buttons = new JPanel();
+ buttons.setLayout(new BoxLayout(buttons, BoxLayout.PAGE_AXIS));
+ buttons.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+ buttons.add(createButton("Reset", new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (MetaInfo<E> item : items) {
@Override
public void actionPerformed(ActionEvent e) {
for (MetaInfo<E> item : items) {
@@
-77,7
+77,7
@@
public class ConfigEditor<E extends Enum<E>> extends JPanel {
}
}));
}
}));
-
main
.add(createButton("Default", new ActionListener() {
+
buttons
.add(createButton("Default", new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Object snap = bundle.takeSnapshot();
@Override
public void actionPerformed(ActionEvent e) {
Object snap = bundle.takeSnapshot();
@@
-90,11
+90,11
@@
public class ConfigEditor<E extends Enum<E>> extends JPanel {
}
}));
}
}));
-
main
.add(createButton("Save", new ActionListener() {
+
buttons
.add(createButton("Save", new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (MetaInfo<E> item : items) {
@Override
public void actionPerformed(ActionEvent e) {
for (MetaInfo<E> item : items) {
- item.save();
+ item.save(
true
);
}
try {
}
try {
@@
-104,6
+104,12
@@
public class ConfigEditor<E extends Enum<E>> extends JPanel {
}
}
}));
}
}
}));
+
+ JScrollPane scroll = new JScrollPane(main);
+ scroll.getVerticalScrollBar().setUnitIncrement(16);
+
+ this.add(scroll, BorderLayout.CENTER);
+ this.add(buttons, BorderLayout.SOUTH);
}
private void addItem(JPanel main, MetaInfo<E> item, int nhgap) {
}
private void addItem(JPanel main, MetaInfo<E> item, int nhgap) {
@@
-133,7
+139,7
@@
public class ConfigEditor<E extends Enum<E>> extends JPanel {
main.add(bpane);
} else {
items.add(item);
main.add(bpane);
} else {
items.add(item);
- main.add(
new ConfigItem<E>
(item, nhgap));
+ main.add(
ConfigItem.createItem
(item, nhgap));
}
}
}
}