This is an automated email from the git hooks/post-receive script. New commit to branch feature/1206 in repository lima. See http://git.chorem.org/lima.git commit d77d66d27b592989e4030442eae4cc9fbda95f04 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Mar 20 16:34:57 2015 +0100 prefer use inner class than anonymous class --- .../java/org/chorem/lima/ui/MainViewHandler.java | 41 ++++++++++++++++------ 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java index 7c23447..5642ced 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java @@ -49,12 +49,19 @@ import org.chorem.lima.ui.vatchart.VatChartView; import org.nuiton.util.DesktopUtil; import org.nuiton.widget.SwingSession; -import javax.swing.*; +import javax.swing.DefaultCellEditor; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JEditorPane; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.UIManager; import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.BorderUIResource; -import java.awt.*; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -360,15 +367,8 @@ public class MainViewHandler { MainView mainView = getUI(rootContext); final HomeView homeView = new HomeView(mainView); showTab(mainView, t("lima.home"), homeView, false); - final JTabbedPane contentTabbedPane = mainView.getContentTabbedPane(); - contentTabbedPane.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (contentTabbedPane.getSelectedComponent().equals(homeView)) { - homeView.refresh(); - } - } - }); + JTabbedPane contentTabbedPane = mainView.getContentTabbedPane(); + contentTabbedPane.addChangeListener(new OnTabChangeListener(homeView)); } @@ -572,4 +572,23 @@ public class MainViewHandler { protected void showTab(MainView ui, String name, Component container) { showTab(ui, name, container, true); } + + protected static class OnTabChangeListener implements ChangeListener { + + protected final HomeView homeView; + + public OnTabChangeListener(HomeView homeView) { + this.homeView = homeView; + } + + @Override + public void stateChanged(ChangeEvent e) { + JTabbedPane source = (JTabbedPane) e.getSource(); + if (source.getSelectedIndex()==0) { + homeView.refresh(); + } + } + + } + } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.