Author: tchemit Date: 2008-02-18 23:04:17 +0000 (Mon, 18 Feb 2008) New Revision: 1096 Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractAction.java trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractTabAction.java Log: ajout m?\195?\169thode findTab pour retrouver l'onglet ?\195?\160 partir d'ActionEvent suppression methode afterAction, on utilise directement updateUI Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractAction.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractAction.java 2008-02-18 23:03:19 UTC (rev 1095) +++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractAction.java 2008-02-18 23:04:17 UTC (rev 1096) @@ -39,11 +39,13 @@ static protected Log log = LogFactory.getLog(SimExplorerAbstractAction.class); + protected ActionEvent e; + public void actionPerformed(java.awt.event.ActionEvent e) { log.info("------------------------------------------------------------"); - log.info("event : " + e); - log.info("source : " + e.getSource()); + log.debug("event : " + e); + log.debug("source : " + e.getSource()); try { boolean accepted = beforeAction(e); log.info("action : " + this); @@ -55,7 +57,8 @@ if (accepted) { setStatus(toString()); doAction(e); - afterAction(e); + this.e=e; + updateUI(); } } catch (Exception e1) { SimExplorer.showError(e1); @@ -98,16 +101,12 @@ // nothing by default } - protected void afterAction(ActionEvent e) throws Exception { - updateUI(); - } - public void updateUI() { // nothing by default } protected void clear() { - // nothing by default + e=null; } protected JComponent getUIObject(String name, JAXXObject container) { @@ -116,10 +115,4 @@ } return (JComponent) container.getObjectById(name); } - - protected String getToken() { - String token; - token = getContext().getToken(); - return token; - } } Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractTabAction.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractTabAction.java 2008-02-18 23:03:19 UTC (rev 1095) +++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractTabAction.java 2008-02-18 23:04:17 UTC (rev 1096) @@ -122,6 +122,20 @@ return getTab() == SimExplorerTab.remote; } + /** + * @param e l'évènement d'action + * @return le tab d'où l'action a été lancée + */ + protected SimExplorerTab findTab(ActionEvent e) { + SimExplorerTab sourceTab; + sourceTab = SimExplorerTab.findTab((Component) e.getSource()); + return sourceTab; + } + + /** + * @param e l'évènement d'action + * @return le dataentity sélectionné dans le tab d'où a été lancée l'action + */ protected DataEntityModel findSelectedItem(ActionEvent e) { SimExplorerTab sourceTab = SimExplorerTab.findTab((Component) e.getSource()); log.info("incoming tab " + sourceTab); @@ -131,12 +145,8 @@ return null; } DataEntityModel entityModel = sourceTab.getModel().getSelectedItem(); - if (entityModel!=null) { - try { - entityModel = entityModel.clone(); - } catch (CloneNotSupportedException e1) { - e1.printStackTrace(); - } + if (entityModel != null) { + entityModel = entityModel.cloneSafe(); } return entityModel; }