package net.sf.pummel;
import javax.swing.DefaultListSelectionModel;
import javax.swing.ListSelectionModel;
import javax.swing.table.TableColumnModel;
import net.sf.pummel.library.LibraryManager;
import net.sf.pummel.library.MusicLibraryTableModel;
import net.sf.pummel.loader.Loader;
import net.sf.pummel.loader.LoaderListener;
import net.sf.pummel.view.LoaderView;
import net.sf.pummel.view.PummelView;
public class Pummel {
/**
* @param args
*/
public static void main(String[] args) {
Pummel app = new Pummel();
app.launch();
}
private final MusicLibraryTableModel tableModel = new MusicLibraryTableModel();
private final ListSelectionModel selectionModel = new DefaultListSelectionModel();
private final LibraryManager manager = new LibraryManager(this);
private PummelView view;
public void close() {
view.dispose();
manager.close();
System.exit(0);
}
public LibraryManager getLibraryManager() {
return manager;
}
public MusicLibraryTableModel getTableModel() {
return tableModel;
}
private void launch() {
LoaderView splashView = new LoaderView();
Loader loader = new Loader(this);
loader.addLoaderListener(splashView);
loader.addLoaderListener(new LoaderListener() {
@Override
public void done() {
showMainWindow();
}
@Override
public void loading(String task) {
// no-op
}
});
splashView.show();
loader.execute();
}
private void showMainWindow() {
view = new PummelView(this);
view.show();
}
public TableColumnModel getColumnModel() {
return tableModel.getColumnModel();
}
public ListSelectionModel getSelectionModel() {
return selectionModel;
}
}