From 16aba6db7955b3aafe97a36cbafd6c387f30d277 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 26 Apr 2020 20:09:12 +0200 Subject: [PATCH] rename BasicTab -> BrowserTab --- .../fanfix_swing/gui/BrowserPanel.java | 23 +++++++++---------- .../BasicTab.java => BrowserTab.java} | 11 ++++----- 2 files changed, 16 insertions(+), 18 deletions(-) rename src/be/nikiroo/fanfix_swing/gui/{browser/BasicTab.java => BrowserTab.java} (95%) diff --git a/src/be/nikiroo/fanfix_swing/gui/BrowserPanel.java b/src/be/nikiroo/fanfix_swing/gui/BrowserPanel.java index c84e946e..12840f52 100644 --- a/src/be/nikiroo/fanfix_swing/gui/BrowserPanel.java +++ b/src/be/nikiroo/fanfix_swing/gui/BrowserPanel.java @@ -16,7 +16,6 @@ import javax.swing.event.ChangeListener; import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.library.BasicLibrary; import be.nikiroo.fanfix_swing.gui.book.BookInfo; -import be.nikiroo.fanfix_swing.gui.browser.BasicTab; import be.nikiroo.fanfix_swing.gui.utils.DataTreeAuthors; import be.nikiroo.fanfix_swing.gui.utils.DataTreeSources; import be.nikiroo.fanfix_swing.gui.utils.DataTreeTag; @@ -62,9 +61,9 @@ public class BrowserPanel extends ListenerPanel { static public final String TAB_CHANGE = "tab_change"; private JTabbedPane tabs; - private BasicTab sourceTab; - private BasicTab authorTab; - private BasicTab tagsTab; + private BrowserTab sourceTab; + private BrowserTab authorTab; + private BrowserTab tagsTab; private boolean keepSelection; @@ -78,11 +77,11 @@ public class BrowserPanel extends ListenerPanel { tabs = new JTabbedPane(); int index = 0; - tabs.add(sourceTab = new BasicTab(new DataTreeSources(false), index++, + tabs.add(sourceTab = new BrowserTab(new DataTreeSources(false), index++, SOURCE_SELECTION)); - tabs.add(authorTab = new BasicTab(new DataTreeAuthors(true), index++, + tabs.add(authorTab = new BrowserTab(new DataTreeAuthors(true), index++, AUTHOR_SELECTION)); - tabs.add(tagsTab = new BasicTab(new DataTreeTag(true), index++, + tabs.add(tagsTab = new BrowserTab(new DataTreeTag(true), index++, TAGS_SELECTION)); configureTab(tabs, sourceTab, "Sources", "Tooltip for Sources"); @@ -128,12 +127,12 @@ public class BrowserPanel extends ListenerPanel { if (i == tabs.getSelectedIndex()) continue; - BasicTab tab = (BasicTab) tabs.getComponent(i); + BrowserTab tab = (BrowserTab) tabs.getComponent(i); tab.unselect(); } } - private void configureTab(JTabbedPane tabs, BasicTab tab, String name, + private void configureTab(JTabbedPane tabs, BrowserTab tab, String name, String tooltip) { tab.setBaseTitle(name); tabs.setTitleAt(tab.getIndex(), tab.getTitle()); @@ -141,7 +140,7 @@ public class BrowserPanel extends ListenerPanel { listenTabs(tabs, tab); } - private void listenTabs(final JTabbedPane tabs, final BasicTab tab) { + private void listenTabs(final JTabbedPane tabs, final BrowserTab tab) { tab.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -163,9 +162,9 @@ public class BrowserPanel extends ListenerPanel { public BookInfo getHighlight() { String selected1 = null; Component selectedTab = tabs.getSelectedComponent(); - if (selectedTab instanceof BasicTab) { + if (selectedTab instanceof BrowserTab) { @SuppressWarnings({ "unchecked", "rawtypes" }) - List selectedAll = ((BasicTab) selectedTab) + List selectedAll = ((BrowserTab) selectedTab) .getSelectedElements(); if (!selectedAll.isEmpty()) { selected1 = selectedAll.get(0); diff --git a/src/be/nikiroo/fanfix_swing/gui/browser/BasicTab.java b/src/be/nikiroo/fanfix_swing/gui/BrowserTab.java similarity index 95% rename from src/be/nikiroo/fanfix_swing/gui/browser/BasicTab.java rename to src/be/nikiroo/fanfix_swing/gui/BrowserTab.java index 7e70253e..243402b4 100644 --- a/src/be/nikiroo/fanfix_swing/gui/browser/BasicTab.java +++ b/src/be/nikiroo/fanfix_swing/gui/BrowserTab.java @@ -1,4 +1,4 @@ -package be.nikiroo.fanfix_swing.gui.browser; +package be.nikiroo.fanfix_swing.gui; import java.awt.BorderLayout; import java.awt.Component; @@ -19,7 +19,6 @@ import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; -import be.nikiroo.fanfix_swing.gui.SearchBar; import be.nikiroo.fanfix_swing.gui.utils.DataNodeBook; import be.nikiroo.fanfix_swing.images.IconGenerator; import be.nikiroo.fanfix_swing.images.IconGenerator.Icon; @@ -31,7 +30,7 @@ import be.nikiroo.utils.ui.TreeCellSpanner; import be.nikiroo.utils.ui.TreeSnapshot; import be.nikiroo.utils.ui.UIUtils; -public class BasicTab extends ListenerPanel { +public class BrowserTab extends ListenerPanel { private int totalCount = 0; private List selectedElements = new ArrayList(); private String baseTitle; @@ -43,7 +42,7 @@ public class BasicTab extends ListenerPanel { private DataTree data; private SearchBar searchBar; - public BasicTab(DataTree data, int index, + public BrowserTab(DataTree data, int index, String listenerCommand) { setLayout(new BorderLayout()); @@ -83,9 +82,9 @@ public class BasicTab extends ListenerPanel { } } - BasicTab.this.selectedElements = elements; + BrowserTab.this.selectedElements = elements; - fireActionPerformed(BasicTab.this.listenerCommand); + fireActionPerformed(BrowserTab.this.listenerCommand); } }); -- 2.27.0