importer frame: step 1
[fanfix.git] / src / be / nikiroo / fanfix_swing / gui / MainFrame.java
index 39762a8710ae4abc389966b3be66beac87e9d799..313f086eb18f01b1d9b60654c0f19ad08f97900b 100644 (file)
@@ -12,7 +12,6 @@ import javax.swing.JMenuBar;
 import javax.swing.JMenuItem;
 import javax.swing.JSplitPane;
 
-import be.nikiroo.fanfix_swing.Actions;
 import be.nikiroo.utils.Version;
 
 public class MainFrame extends JFrame {
@@ -29,6 +28,7 @@ public class MainFrame extends JFrame {
                detailsPanel = true;
 
                browser = new BrowserPanel();
+               books = new BooksPanel(true);
 
                JComponent other = null;
                boolean orientationH = true;
@@ -47,12 +47,12 @@ public class MainFrame extends JFrame {
                        other = split(goBack, details, false, 0.5, 1);
                }
 
-               books = new BooksPanel(true);
-
                browser.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
-                               books.load(browser.getSelectedSources(), browser.getSelectedAuthors(), browser.getSelectedTags());
+                               books.load(browser.getSelectedSources(),
+                                               browser.getSelectedAuthors(),
+                                               browser.getSelectedTags());
                                details.setBook(browser.getHighlight());
                        }
                });
@@ -70,10 +70,12 @@ public class MainFrame extends JFrame {
                this.add(split);
        }
 
-       private JSplitPane split(JComponent leftTop, JComponent rightBottom, boolean horizontal, double ratio,
-                       double weight) {
-               JSplitPane split = new JSplitPane(horizontal ? JSplitPane.HORIZONTAL_SPLIT : JSplitPane.VERTICAL_SPLIT, leftTop,
-                               rightBottom);
+       private JSplitPane split(JComponent leftTop, JComponent rightBottom,
+                       boolean horizontal, double ratio, double weight) {
+               JSplitPane split = new JSplitPane(
+                               horizontal ? JSplitPane.HORIZONTAL_SPLIT
+                                               : JSplitPane.VERTICAL_SPLIT,
+                               leftTop, rightBottom);
                split.setOneTouchExpandable(true);
                split.setResizeWeight(weight);
                split.setContinuousLayout(true);
@@ -92,11 +94,13 @@ public class MainFrame extends JFrame {
                item1.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
-                               Actions.imprt(MainFrame.this, true, new Runnable() {
+                               // TODO: correctly use the importer (wip)
+                               new ImporterFrame().imprtUrl(MainFrame.this, new Runnable() {
                                        @Override
                                        public void run() {
                                                browser.reloadData();
-                                               books.load(browser.getSelectedSources(), browser.getSelectedAuthors(),
+                                               books.load(browser.getSelectedSources(),
+                                                               browser.getSelectedAuthors(),
                                                                browser.getSelectedTags());
                                                details.setBook(browser.getHighlight());
                                        }
@@ -108,11 +112,13 @@ public class MainFrame extends JFrame {
                item2.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
-                               Actions.imprt(MainFrame.this, false, new Runnable() {
+                               // TODO: correctly use the importer (wip)
+                               new ImporterFrame().imprtFile(MainFrame.this, new Runnable() {
                                        @Override
                                        public void run() {
                                                browser.reloadData();
-                                               books.load(browser.getSelectedSources(), browser.getSelectedAuthors(),
+                                               books.load(browser.getSelectedSources(),
+                                                               browser.getSelectedAuthors(),
                                                                browser.getSelectedTags());
                                                details.setBook(browser.getHighlight());
                                        }