link gui frame to search
authorNiki Roo <niki@nikiroo.be>
Sat, 13 Apr 2019 11:38:22 +0000 (13:38 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 13 Apr 2019 11:38:22 +0000 (13:38 +0200)
src/be/nikiroo/fanfix/reader/ui/GuiReader.java
src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java

index 2ca61919cc5adb1aa714f3618e38e7b7f3f85bfb..2a4d7a942d4f67c5e7dd50553bb5ac9ba39de8f0 100644 (file)
@@ -218,15 +218,16 @@ class GuiReader extends BasicReader {
                        super.start(target, program, sync);
                }
        }
-       
+
        @Override
        public void search(SupportType searchOn, String keywords, int page, int item) {
                // TODO: !!!
                throw new java.lang.IllegalStateException("Not implemented yet.");
        }
-       
+
        @Override
-       public void searchTag(SupportType searchOn, int page, int item, String... tags) {
+       public void searchTag(SupportType searchOn, int page, int item,
+                       Integer... tags) {
                // TODO: !!!
                throw new java.lang.IllegalStateException("Not implemented yet.");
        }
index 7afaacc4e3747b37fe1b3684abb19b6248b42818..77cd7e019ef4363113e7605330c7ae82386fea7a 100644 (file)
@@ -80,7 +80,7 @@ class GuiReaderFrame extends JFrame implements FrameHelper {
         */
        public GuiReaderFrame(GuiReader reader, String type) {
                super(getAppTitle(reader.getLibrary().getLibraryName()));
-               
+
                this.reader = reader;
 
                mainPanel = new GuiReaderMainPanel(this, type);
@@ -185,22 +185,22 @@ class GuiReaderFrame extends JFrame implements FrameHelper {
 
                JMenu search = new JMenu(GuiReader.trans(StringIdGui.MENU_SEARCH));
                search.setMnemonic(KeyEvent.VK_H);
-               for (SupportType type : SupportType.values()) {
+               for (final SupportType type : SupportType.values()) {
                        BasicSearchable searchable = BasicSearchable.getSearchable(type);
                        if (searchable != null) {
                                JMenuItem searchItem = new JMenuItem(type.getSourceName());
                                searchItem.addActionListener(new ActionListener() {
                                        @Override
                                        public void actionPerformed(ActionEvent e) {
-                                               // TODO: open a search window
+                                               reader.search(type, "", 1, 0);
                                        }
                                });
                                search.add(searchItem);
                        }
                }
-               
+
                bar.add(search);
-               
+
                JMenu view = new JMenu(GuiReader.trans(StringIdGui.MENU_VIEW));
                view.setMnemonic(KeyEvent.VK_V);
                JMenuItem vauthors = new JMenuItem(
@@ -441,7 +441,8 @@ class GuiReaderFrame extends JFrame implements FrameHelper {
                                        fc.showDialog(GuiReaderFrame.this,
                                                        GuiReader.trans(StringIdGui.TITLE_SAVE));
                                        if (fc.getSelectedFile() != null) {
-                                               final OutputType type = otherFilters.get(fc.getFileFilter());
+                                               final OutputType type = otherFilters.get(fc
+                                                               .getFileFilter());
                                                final String path = fc.getSelectedFile()
                                                                .getAbsolutePath()
                                                                + type.getDefaultExtension(false);
@@ -738,21 +739,16 @@ class GuiReaderFrame extends JFrame implements FrameHelper {
                                final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
                                if (selectedBook != null) {
                                        final MetaData meta = selectedBook.getInfo().getMeta();
-                                       mainPanel.imprt(
-                                                       meta.getUrl(),
-                                                       new StoryRunnable() {
-                                                               @Override
-                                                               public void run(Story story) {
-                                                                       MetaData newMeta = story.getMeta();
-                                                                       if (!newMeta.getSource().equals(
-                                                                                       meta.getSource())) {
-                                                                               reader.changeSource(newMeta.getLuid(),
-                                                                                               meta.getSource());
-                                                                       }
-                                                               }
-                                                       },
-                                                       GuiReader
-                                                                       .trans(StringIdGui.PROGRESS_CHANGE_SOURCE));
+                                       mainPanel.imprt(meta.getUrl(), new StoryRunnable() {
+                                               @Override
+                                               public void run(Story story) {
+                                                       MetaData newMeta = story.getMeta();
+                                                       if (!newMeta.getSource().equals(meta.getSource())) {
+                                                               reader.changeSource(newMeta.getLuid(),
+                                                                               meta.getSource());
+                                                       }
+                                               }
+                                       }, GuiReader.trans(StringIdGui.PROGRESS_CHANGE_SOURCE));
                                }
                        }
                });