Author: tchemit Date: 2008-01-22 01:49:37 +0000 (Tue, 22 Jan 2008) New Revision: 352 Added: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTab.java Removed: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java Log: renommage de SimEplorerTabManager en SimExplorerTab Copied: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTab.java (from rev 348, trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java) =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTab.java (rev 0) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTab.java 2008-01-22 01:49:37 UTC (rev 352) @@ -0,0 +1,110 @@ +/* +* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, +* Tony Chemit +* +* 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 fr.cemagref.simexplorer.is.ui.swing; + +import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel; +import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel; +import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel; +import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationDetailTab; +import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationListTab; +import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationSynchronizeTab; +import jaxx.runtime.JAXXObject; +import jaxx.runtime.builder.TabContentConfig; +import jaxx.runtime.builder.TabFactory; +import jaxx.runtime.builder.TabModel; + +import javax.swing.JComponent; +import javax.swing.JTabbedPane; + +/** @author tony */ + +public enum SimExplorerTab { + + @TabContentConfig( + impl = JApplicationDetailTab.class, + model = DetailTabModel.class, + parentImpl = JTabbedPane.class, + name = "simexplorer.tab.detail", + shortDescription = "simexplorer.tab.detail.tooltip" + )detail, + + @TabContentConfig( + impl = JApplicationListTab.class, + parentImpl = JTabbedPane.class, + model = ListTabModel.class, + useToogle = true, + name = "simexplorer.tab.local", + shortDescription = "simexplorer.tab.local.tooltip" + )local, + + @TabContentConfig( + impl = JApplicationListTab.class, + parentImpl = JTabbedPane.class, + model = ListTabModel.class, + useToogle = true, + name = "simexplorer.tab.remote", + shortDescription = "simexplorer.tab.remote.tooltip" + )remote, + + @TabContentConfig( + impl = JApplicationSynchronizeTab.class, + parentImpl = JTabbedPane.class, + model = SynchronizeTabModel.class, + useToogle = true, + name = "simexplorer.tab.synchronize", + shortDescription = "simexplorer.tab.synchronize.tooltip" + )synchronize; + + /** l'usine de tabs */ + private static TabFactory factory; + + public static TabFactory getFactory() { + if (factory == null) { + factory = new SimExplorerTabFactory(); + } + return factory; + } + + public JAXXObject getUI() { + return (JAXXObject) getFactory().getUI(name()); + } + + public TabModel getModel() { + return getFactory().getModel(name()); + } + + public boolean isTabVisible(JTabbedPane container) { + JAXXObject ui = getUI(); + return ui != null && getFactory().getTabIndex(container, (JComponent) ui) > -1; + } + + public int getTabIndex(JTabbedPane container) { + JAXXObject ui = getUI(); + return ui == null ? -1 : getFactory().getTabIndex(container, (JComponent) ui); + } + + public void showTab(final JTabbedPane container) { + getFactory().showTab(container, name()); + } + + public void closeTab(JTabbedPane container) { + getFactory().closeTab(container, name()); + } + +} Deleted: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java 2008-01-22 01:06:24 UTC (rev 351) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java 2008-01-22 01:49:37 UTC (rev 352) @@ -1,107 +0,0 @@ -/* -* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, -* Tony Chemit -* -* 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 fr.cemagref.simexplorer.is.ui.swing; - -import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationDetailTab; -import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationListTab; -import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationSynchronizeTab; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.builder.TabContentConfig; -import jaxx.runtime.builder.TabModel; -import jaxx.runtime.builder.TabFactory; - -import javax.swing.JComponent; -import javax.swing.JTabbedPane; - -/** @author tony */ - -public enum SimExplorerTabManager { - - @TabContentConfig( - impl = JApplicationDetailTab.class, - model=TabModel.class, - parentImpl = JTabbedPane.class, - name = "simexplorer.tab.detail", - shortDescription = "simexplorer.tab.detail.tooltip" - )detail, - - @TabContentConfig( - impl = JApplicationListTab.class, - parentImpl = JTabbedPane.class, - model=TabModel.class, - useToogle = true, - name = "simexplorer.tab.local", - shortDescription = "simexplorer.tab.local.tooltip" - )local, - - @TabContentConfig( - impl = JApplicationListTab.class, - parentImpl = JTabbedPane.class, - model=TabModel.class, - useToogle = true, - name = "simexplorer.tab.remote", - shortDescription = "simexplorer.tab.remote.tooltip" - )remote, - - @TabContentConfig( - impl = JApplicationSynchronizeTab.class, - parentImpl = JTabbedPane.class, - model=TabModel.class, - useToogle = true, - name = "simexplorer.tab.synchronize", - shortDescription = "simexplorer.tab.synchronize.tooltip" - )synchronize; - - /** l'usine de tabs */ - private static TabFactory factory; - - public static TabFactory getFactory() { - if (factory == null) { - factory = new SimExplorerTabFactory(); - } - return factory; - } - - public JAXXObject getUI() { - return (JAXXObject) getFactory().getUI(name()); - } - - public TabModel getModel() { - return getFactory().getModel(name()); - } - - public boolean isTabVisible(JTabbedPane container) { - JAXXObject ui = getUI(); - return ui != null && getFactory().getTabIndex(container, (JComponent) ui) > -1; - } - - public int getTabIndex(JTabbedPane container) { - JAXXObject ui = getUI(); - return ui == null ? -1 : getFactory().getTabIndex(container, (JComponent) ui); - } - - public void showTab(final JTabbedPane container) { - getFactory().showTab(container, name()); - } - - public void closeTab(JTabbedPane container) { - getFactory().closeTab(container, name()); - } - -}