use of org.opt4j.core.config.ModuleSaver in project opt4j by felixreimann.
the class FileOperations method save.
/**
* Saves the current selected modules to the specified file.
*
* @param file
* the configuration file
*/
public void save(File file) {
setFile(file);
ModuleSaver saver = new ModuleSaver();
Collection<PropertyModule> modules = selectedModules;
System.out.println(modules);
saver.save(file, modules);
System.out.println("Saved configuration to " + file);
}
use of org.opt4j.core.config.ModuleSaver in project opt4j by felixreimann.
the class ToolBar method startup.
/*
* (non-Javadoc)
*
* @see org.opt4j.conf.gui.Startupable#startup()
*/
@Override
public void startup() {
execute = new JButton("Run ", Icons.getIcon(Icons.PLAY)) {
{
setFocusable(false);
setMnemonic(KeyEvent.VK_R);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Set<Module> modules = new HashSet<Module>();
modules.addAll(selectedModules);
executionEnvironment.execute(modules);
}
});
}
};
load = new JButton("Load ... ", Icons.getIcon(Icons.FOLDER)) {
{
setFocusable(false);
setMnemonic(KeyEvent.VK_L);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fileOperations.load();
}
});
}
};
save = new JButton("Save ", Icons.getIcon(Icons.DISK)) {
{
setFocusable(false);
setMnemonic(KeyEvent.VK_S);
setEnabled(false);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fileOperations.save();
}
});
}
};
saveAs = new JButton("Save As ... ", Icons.getIcon(Icons.DISK)) {
{
setFocusable(false);
setMnemonic(KeyEvent.VK_A);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fileOperations.saveAs();
}
});
}
};
showXML = new JButton("Show configuration", Icons.getIcon(Icons.XML)) {
{
setFocusable(false);
setMnemonic(KeyEvent.VK_X);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ModuleSaver saver = new ModuleSaver();
ClipboardFrame clipboardFrame = new ClipboardFrame(saver.toXMLString(selectedModules));
clipboardFrame.pack();
clipboardFrame.setVisible(true);
}
});
}
};
add(execute);
addSeparator();
add(load);
add(save);
add(saveAs);
addSeparator();
add(showXML);
}
Aggregations