From: Niki Roo Date: Sat, 13 Apr 2019 11:38:22 +0000 (+0200) Subject: link gui frame to search X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=0b39fb9f4fc11d0880158a3b182900b9fe82da42;p=nikiroo-utils.git link gui frame to search --- diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReader.java b/src/be/nikiroo/fanfix/reader/ui/GuiReader.java index 2ca6191..2a4d7a9 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReader.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReader.java @@ -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."); } diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java index 7afaacc..77cd7e0 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java @@ -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)); } } });