Author: tchemit Date: 2008-02-02 17:02:01 +0000 (Sat, 02 Feb 2008) New Revision: 601 Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowLocalTabAction.java trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowRemoteTabAction.java Log: utilisation de l'action de base Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowLocalTabAction.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowLocalTabAction.java 2008-02-02 17:01:43 UTC (rev 600) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowLocalTabAction.java 2008-02-02 17:02:01 UTC (rev 601) @@ -45,65 +45,10 @@ mnemonic = 'A', hideActionText = false ) -public class ShowLocalTabAction extends ShowTabAbstractAction { +public class ShowLocalTabAction extends ShowListTabAbstractAction { + private static final long serialVersionUID = 7009836674867908237L; - private static final long serialVersionUID = -5349479338237813002L; - - protected Boolean firstTime; - public ShowLocalTabAction(String name) { super(name); } - - @Override - protected boolean beforeAction(ActionEvent e) throws Exception { - JTabbedPane tabbedPane = getTabContainer(); - JAXXObject ui = getUI(); - - if (getTab().isTabVisible(tabbedPane)) { - // tab is already visible, just select it - tabbedPane.setSelectedComponent((Component) ui); - return false; - } - - // mark it, after action will push table model - firstTime = ui == null; - - ListTabModel model = (ListTabModel) getModel(); - - MetaData[] data = model.getList(); - - if (data == null) { - // first coming here, init model - model.initTabModel(false, getContext()); - } - return true; - } - - @Override - protected void afterAction(ActionEvent e) { - if (firstTime) { - final ListTabModel model = (ListTabModel) getModel(); - - // push model into tableModel - final JApplicationListTab container = (JApplicationListTab) getUI(); - JApplicationTableModel modelTab = (JApplicationTableModel) container.getTable().getModel(); - modelTab.setData(model.getList()); - // add search actions listeners - container.getSearchText().addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - getMainUI().refreshSearchActions(container, model); - } - }); - // refresh ui - getMainUI().refreshListTabUI(model, container); - } - } - - @Override - protected void clear() { - super.clear(); - firstTime = null; - } } \ No newline at end of file Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowRemoteTabAction.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowRemoteTabAction.java 2008-02-02 17:01:43 UTC (rev 600) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowRemoteTabAction.java 2008-02-02 17:02:01 UTC (rev 601) @@ -18,19 +18,6 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.swing.action.tab; -import fr.cemagref.simexplorer.is.entities.metadata.MetaData; -import fr.cemagref.simexplorer.is.ui.swing.action.ShowTabAbstractAction; -import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel; -import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel; -import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationListTab; -import jaxx.runtime.JAXXObject; - -import javax.swing.JTabbedPane; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; - /** * Action pour afficher le tab local * @@ -45,71 +32,10 @@ mnemonic = 'p', hideActionText = false ) -public class ShowRemoteTabAction extends ShowTabAbstractAction { +public class ShowRemoteTabAction extends ShowListTabAbstractAction { + private static final long serialVersionUID = -5791049785753596347L; - private static final long serialVersionUID = -5349479338237813002L; - - protected Boolean firstTime; - public ShowRemoteTabAction(String name) { super(name); } - - @Override - protected boolean beforeAction(ActionEvent e) throws Exception { - if (!super.beforeAction(e)) { - return false; - } - JTabbedPane tabbedPane = getTabContainer(); - JAXXObject ui = getUI(); - - if (getTab().isTabVisible(tabbedPane)) { - // tab is already visible, just select it - tabbedPane.setSelectedComponent((Component) ui); - return false; - } - - // mark it, after action will push table model - firstTime = ui == null; - - ListTabModel model = (ListTabModel) getModel(); - - MetaData[] data = model.getList(); - - if (data == null) { - // first coming here, init model - model.initTabModel(true, getContext()); - } - return true; - } - - @Override - protected void afterAction(ActionEvent e) { - - if (firstTime) { - final ListTabModel model = (ListTabModel) getModel(); - // push model into TableModel - final JApplicationListTab container = (JApplicationListTab) getUI(); - JApplicationTableModel modelTab = (JApplicationTableModel) container.getTable().getModel(); - modelTab.setData(model.getList()); - - // add search actions listeners - container.getSearchText().addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - getMainUI().refreshSearchActions(container, model); - } - }); - - // refresh ui - getMainUI().refreshListTabUI(model, container); - } - } - - - @Override - protected void clear() { - super.clear(); - firstTime = null; - } } \ No newline at end of file
participants (1)
-
tchemit@users.labs.libre-entreprise.org