From: <aki...@us...> - 2007-01-07 15:36:40
|
Revision: 1500 http://svn.sourceforge.net/gridarta/?rev=1500&view=rev Author: akirschbaum Date: 2007-01-07 07:36:39 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Extract inner classes to separate files. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapChooserControl.java trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapChooserControl.java Added Paths: ----------- trunk/crossfire/src/cfeditor/gui/pickmapchooser/ArchNPickChangeListener.java trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapSelectionListener.java trunk/daimonin/src/daieditor/gui/pickmapchooser/ArchNPickChangeListener.java trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapSelectionListener.java Added: trunk/crossfire/src/cfeditor/gui/pickmapchooser/ArchNPickChangeListener.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/pickmapchooser/ArchNPickChangeListener.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/pickmapchooser/ArchNPickChangeListener.java 2007-01-07 15:36:39 UTC (rev 1500) @@ -0,0 +1,66 @@ +/* + * Gridarta Map Editor. + * Copyright (C) 2007 The Gridarta Developers + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package cfeditor.gui.pickmapchooser; + +import cfeditor.CMainView; +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +/** + * In the left-side panel, archlist and pickmaps are exclusive + * (only the one being displayed is active). + * This listener gets to know which of them is active and + * keeps the main view informed whenever the state changes. + */ +public final class ArchNPickChangeListener implements ChangeListener { + + private final CMainView mainView; // main view + + private final JTabbedPane tabpane; // parent pane for archlist & pickmaps + + private int selectedIndex; // current state of selection + + /** + * Create an ArchNPickChangeListener. + * @param mainView the main view + * @param pane the JTabbedPane containing both archlist and pickmaps + */ + public ArchNPickChangeListener(final CMainView mainView, final JTabbedPane pane) { + this.mainView = mainView; + tabpane = pane; + selectedIndex = tabpane.getSelectedIndex(); + } + + public void stateChanged(final ChangeEvent e) { + if (tabpane.getSelectedIndex() != selectedIndex) { + // the state has changed, user has switched panels + if (tabpane.getSelectedIndex() == 0) { + mainView.setPickmapActive(false); + } else { + mainView.setPickmapActive(true); + } + + selectedIndex = tabpane.getSelectedIndex(); // save new state + } + } + +} // class ArchNPickChangeListener Property changes on: trunk/crossfire/src/cfeditor/gui/pickmapchooser/ArchNPickChangeListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapChooserControl.java 2007-01-07 15:14:50 UTC (rev 1499) +++ trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapChooserControl.java 2007-01-07 15:36:39 UTC (rev 1500) @@ -41,8 +41,6 @@ import java.util.List; import java.util.Map; import javax.swing.JTabbedPane; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -278,7 +276,7 @@ } /** Update info which pickmap is currently on top. */ - private void updateActivePickmap() { + void updateActivePickmap() { if (tabpane == null) { return; // for safety, shouldn't happen } @@ -313,7 +311,7 @@ * @todo this method's name is a Bad Thing */ public void addPickmapSelectionListener(final JTabbedPane pickpane) { - pickpane.addChangeListener(new PickmapSelectionListener(pickpane)); + pickpane.addChangeListener(new PickmapSelectionListener(this, pickpane)); } /** @@ -326,67 +324,4 @@ pane.addChangeListener(new ArchNPickChangeListener(mainControl.getMainView(), pane)); } - // ------------------------ nested and inner classes ------------------------ - - /** Listener class to keep track of the currently active pickmap. */ - private final class PickmapSelectionListener implements ChangeListener { - - private final String activePickmap; // file-name of active pickmap - - private final JTabbedPane tabpane; - - private PickmapSelectionListener(final JTabbedPane pane) { - tabpane = pane; - activePickmap = null; - } - - public void stateChanged(final ChangeEvent e) { - if (activePickmap == null || activePickmap.length() <= 0 || !tabpane.getTitleAt(tabpane.getSelectedIndex()).equals(activePickmap)) { - // new pickmap is active - updateActivePickmap(); - } - } - - } // class PickmapSelectionListener - - /** - * In the left-side panel, archlist and pickmaps are exclusive - * (only the one being displayed is active). - * This listener gets to know which of them is active and - * keeps the main view informed whenever the state changes. - */ - private static final class ArchNPickChangeListener implements ChangeListener { - - private final CMainView mainView; // main view - - private final JTabbedPane tabpane; // parent pane for archlist & pickmaps - - private int selectedIndex; // current state of selection - - /** - * Create an ArchNPickChangeListener. - * @param mainView the main view - * @param pane the JTabbedPane containing both archlist and pickmaps - */ - private ArchNPickChangeListener(final CMainView mainView, final JTabbedPane pane) { - this.mainView = mainView; - tabpane = pane; - selectedIndex = tabpane.getSelectedIndex(); - } - - public void stateChanged(final ChangeEvent e) { - if (tabpane.getSelectedIndex() != selectedIndex) { - // the state has changed, user has switched panels - if (tabpane.getSelectedIndex() == 0) { - mainView.setPickmapActive(false); - } else { - mainView.setPickmapActive(true); - } - - selectedIndex = tabpane.getSelectedIndex(); // save new state - } - } - - } // class ArchNPickChangeListener - } // class PickmapChooserControl Added: trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapSelectionListener.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapSelectionListener.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapSelectionListener.java 2007-01-07 15:36:39 UTC (rev 1500) @@ -0,0 +1,49 @@ +/* + * Gridarta Map Editor. + * Copyright (C) 2007 The Gridarta Developers + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package cfeditor.gui.pickmapchooser; + +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +/** Listener class to keep track of the currently active pickmap. */ +public final class PickmapSelectionListener implements ChangeListener { + + private final PickmapChooserControl control; + + private final String activePickmap; // file-name of active pickmap + + private final JTabbedPane tabpane; + + public PickmapSelectionListener(final PickmapChooserControl control, final JTabbedPane pane) { + this.control = control; + tabpane = pane; + activePickmap = null; + } + + public void stateChanged(final ChangeEvent e) { + if (activePickmap == null || activePickmap.length() <= 0 || !tabpane.getTitleAt(tabpane.getSelectedIndex()).equals(activePickmap)) { + // new pickmap is active + control.updateActivePickmap(); + } + } + +} // class PickmapSelectionListener Property changes on: trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapSelectionListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/pickmapchooser/ArchNPickChangeListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/pickmapchooser/ArchNPickChangeListener.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/pickmapchooser/ArchNPickChangeListener.java 2007-01-07 15:36:39 UTC (rev 1500) @@ -0,0 +1,66 @@ +/* + * Gridarta Map Editor. + * Copyright (C) 2007 The Gridarta Developers + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package daieditor.gui.pickmapchooser; + +import daieditor.CMainView; +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +/** + * In the left-side panel, archlist and pickmaps are exclusive + * (only the one being displayed is active). + * This listener gets to know which of them is active and + * keeps the main view informed whenever the state changes. + */ +public final class ArchNPickChangeListener implements ChangeListener { + + private final CMainView mainView; // main view + + private final JTabbedPane tabpane; // parent pane for archlist & pickmaps + + private int selectedIndex; // current state of selection + + /** + * Create an ArchNPickChangeListener. + * @param mainView the main view + * @param pane the JTabbedPane containing both archlist and pickmaps + */ + public ArchNPickChangeListener(final CMainView mainView, final JTabbedPane pane) { + this.mainView = mainView; + tabpane = pane; + selectedIndex = tabpane.getSelectedIndex(); + } + + public void stateChanged(final ChangeEvent e) { + if (tabpane.getSelectedIndex() != selectedIndex) { + // the state has changed, user has switched panels + if (tabpane.getSelectedIndex() == 0) { + mainView.setPickmapActive(false); + } else { + mainView.setPickmapActive(true); + } + + selectedIndex = tabpane.getSelectedIndex(); // save new state + } + } + +} // class ArchNPickChangeListener Property changes on: trunk/daimonin/src/daieditor/gui/pickmapchooser/ArchNPickChangeListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapChooserControl.java 2007-01-07 15:14:50 UTC (rev 1499) +++ trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapChooserControl.java 2007-01-07 15:36:39 UTC (rev 1500) @@ -39,8 +39,6 @@ import java.util.Arrays; import java.util.List; import javax.swing.JTabbedPane; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -305,7 +303,7 @@ } /** Update info which pickmap is currently on top. */ - private void updateActivePickmap() { + void updateActivePickmap() { if (tabpane == null) { return; // for safety, shouldn't happen @@ -346,7 +344,7 @@ * @todo this method's name is a Bad Thing */ public void addPickmapSelectionListener(final JTabbedPane pickpane) { - pickpane.addChangeListener(new PickmapSelectionListener(pickpane)); + pickpane.addChangeListener(new PickmapSelectionListener(this, mainControl, pickpane)); } /** @@ -359,69 +357,4 @@ pane.addChangeListener(new ArchNPickChangeListener(mainControl.getMainView(), pane)); } - // ------------------------ nested and inner classes ------------------------ - - /** Listener class to keep track of the currently active pickmap. */ - private final class PickmapSelectionListener implements ChangeListener { - - private final String activePickmap; // file-name of active pickmap - - private final JTabbedPane tabpane; - - private PickmapSelectionListener(final JTabbedPane pane) { - tabpane = pane; - activePickmap = null; - } - - public void stateChanged(final ChangeEvent e) { - if (activePickmap == null || activePickmap.length() <= 0 || !tabpane.getTitleAt(tabpane.getSelectedIndex()).equals(activePickmap)) { - // new pickmap is active - updateActivePickmap(); - } - getInstance().getCurrentPickmap().getMapViewFrame().unHighlight(); - mainControl.showArchPanelQuickObject(null); // send it to quick view - } - - } // class PickmapSelectionListener - - /** - * In the left-side panel, archlist and pickmaps are exclusive - * (only the one being displayed is active). - * This listener gets to know which of them is active and - * keeps the main view informed whenever the state changes. - */ - private static final class ArchNPickChangeListener implements ChangeListener { - - private final CMainView mainView; // main view - - private final JTabbedPane tabpane; // parent pane for archlist & pickmaps - - private int selectedIndex; // current state of selection - - /** - * Create an ArchNPickChangeListener. - * @param mainView the main view - * @param pane the JTabbedPane containing both archlist and pickmaps - */ - private ArchNPickChangeListener(final CMainView mainView, final JTabbedPane pane) { - this.mainView = mainView; - tabpane = pane; - selectedIndex = tabpane.getSelectedIndex(); - } - - public void stateChanged(final ChangeEvent e) { - if (tabpane.getSelectedIndex() != selectedIndex) { - // the state has changed, user has switched panels - if (tabpane.getSelectedIndex() == 0) { - mainView.setPickmapActive(false); - } else { - mainView.setPickmapActive(true); - } - - selectedIndex = tabpane.getSelectedIndex(); // save new state - } - } - - } // class ArchNPickChangeListener - } // class PickmapChooserControl Added: trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapSelectionListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapSelectionListener.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapSelectionListener.java 2007-01-07 15:36:39 UTC (rev 1500) @@ -0,0 +1,55 @@ +/* + * Gridarta Map Editor. + * Copyright (C) 2007 The Gridarta Developers + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package daieditor.gui.pickmapchooser; + +import daieditor.CMainControl; +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +/** Listener class to keep track of the currently active pickmap. */ +public final class PickmapSelectionListener implements ChangeListener { + + private final PickmapChooserControl control; + + private final CMainControl mainControl; + + private final String activePickmap; // file-name of active pickmap + + private final JTabbedPane tabpane; + + public PickmapSelectionListener(final PickmapChooserControl control, final CMainControl mainControl, final JTabbedPane pane) { + this.control = control; + this.mainControl = mainControl; + tabpane = pane; + activePickmap = null; + } + + public void stateChanged(final ChangeEvent e) { + if (activePickmap == null || activePickmap.length() <= 0 || !tabpane.getTitleAt(tabpane.getSelectedIndex()).equals(activePickmap)) { + // new pickmap is active + control.updateActivePickmap(); + } + control.getCurrentPickmap().getMapViewFrame().unHighlight(); + mainControl.showArchPanelQuickObject(null); // send it to quick view + } + +} // class PickmapSelectionListener Property changes on: trunk/daimonin/src/daieditor/gui/pickmapchooser/PickmapSelectionListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |