r3160 - in isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui: sensitivity simulator
Author: chatellier Date: 2011-03-16 16:57:13 +0000 (Wed, 16 Mar 2011) New Revision: 3160 Log: Begin simulator and sensitivity simulation launching Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java Removed: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java 2011-03-16 16:57:13 UTC (rev 3160) @@ -27,12 +27,11 @@ import static org.nuiton.i18n.I18n._; -import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; -import fr.ifremer.isisfish.ui.simulator.SimulAction; import java.io.Serializable; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; + import javax.swing.JComponent; import javax.swing.JOptionPane; @@ -40,8 +39,17 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaEntityAbstract; +import org.nuiton.topia.persistence.TopiaEntityContextable; +import fr.ifremer.isisfish.IsisFishDAOHelper; +import fr.ifremer.isisfish.entities.Equation; +import fr.ifremer.isisfish.entities.EquationDAO; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; +import fr.ifremer.isisfish.ui.simulator.SimulAction; + /** * Action for sensitivity package. * @@ -73,7 +81,7 @@ try { EquationContinuousPanelUI equationPanel = (EquationContinuousPanelUI) panel; - TopiaEntity bean = equationPanel.getBean(); + TopiaEntityContextable bean = (TopiaEntityContextable)equationPanel.getBean(); //String methodSet = equationPanel.getMethodSet(); String property = equationPanel.getBeanProperty(); property = StringUtils.capitalize(property) + "Content"; Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-03-16 16:57:13 UTC (rev 3160) @@ -0,0 +1,149 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.sensitivity; + +import java.awt.BorderLayout; + +import javax.swing.event.TreeSelectionEvent; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.persistence.TopiaEntityContextable; + +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.InputContentUI; +import fr.ifremer.isisfish.ui.input.InputHandler; +import fr.ifremer.isisfish.ui.input.InputUI; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeHelper; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeRenderer; + +/** + * Handler for sensitivity tab ui (fishery region factors). + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class SensitivityInputHandler extends InputHandler { + + /** Class logger. */ + private static Log log = LogFactory.getLog(SensitivityInputHandler.class); + + /** + * + * @param sensitivityTabUI + */ + public void loadFisheryRegionTree(SensitivityTabUI sensitivityTabUI) { + FisheryRegion fisheryRegion = sensitivityTabUI.getFisheryRegion(); + + if (fisheryRegion == null) { + // show empty region ui + sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(),"none"); + TreeModel model = new DefaultTreeModel(null); + sensitivityTabUI.getFisheryRegionTree().setModel(model); + } + else { + // init tree model loader with fishery region + FisheryTreeHelper treeHelper = new FisheryTreeHelper(); + FisheryDataProvider dataProvider = new FisheryDataProvider(fisheryRegion); + treeHelper.setDataProvider(dataProvider); + TreeModel model = treeHelper.createTreeModel(fisheryRegion); + sensitivityTabUI.getFisheryRegionTree().setModel(model); + sensitivityTabUI.getFisheryRegionTree().setCellRenderer(new FisheryTreeRenderer(dataProvider)); + treeHelper.setUI(sensitivityTabUI.getFisheryRegionTree(), true, false, null); + + // global context value : fisheryRegion, regionStorage, treeHelper + sensitivityTabUI.setContextValue(treeHelper); + sensitivityTabUI.setContextValue(model); + + sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(),"normale"); + } + } + + /** + * Changement de selection dans l'arbre de la pecherie. + * + * @param sensitivityTabUI + * @param event + */ + public void nodeSelectionChanged(SensitivityTabUI sensitivityTabUI, TreeSelectionEvent event) { + + TreePath newTreePath = event.getNewLeadSelectionPath(); + + if (newTreePath != null) { + Object lastTreePath = newTreePath.getLastPathComponent(); + if (lastTreePath instanceof FisheryTreeNode) { + FisheryTreeNode isisTreeNode = (FisheryTreeNode)lastTreePath; + + Class<?> internalClass = isisTreeNode.getInternalClass(); + + // noeud qui n'en charge pas d'autres (= un bean) + TopiaEntityContextable topiaEntity = null; + String topiaId = isisTreeNode.getId(); + + try { + if (isisTreeNode.isStaticNode()) { + FisheryRegion fisheryRegion = sensitivityTabUI.getContextValue(FisheryRegion.class); + TopiaContext topiaContext = fisheryRegion.getTopiaContext(); + topiaEntity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId); + } + + InputContentUI inputContentUI = getUIInstanceForBeanClass(internalClass, sensitivityTabUI); + + // mandatory set + inputContentUI.getVerifier().reset(); // before set bean !!! + if (topiaEntity != null) { + inputContentUI.getVerifier().addCurrentEntity(topiaEntity); + inputContentUI.getVerifier().setInputContentUI(inputContentUI); + } + + inputContentUI.setBean((TopiaEntityContextable)topiaEntity); + inputContentUI.setActive(topiaEntity != null); + inputContentUI.setActionButtons(); + inputContentUI.setLayer(true); + + // add initialized ui to panel + sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(), "normale"); + sensitivityTabUI.getInputPane().removeAll(); + sensitivityTabUI.getInputPane().add(inputContentUI, BorderLayout.CENTER); + sensitivityTabUI.getInputPane().repaint(); + sensitivityTabUI.getInputPane().validate(); + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't display bean " + topiaId, ex); + } + } + } + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java 2011-03-16 16:57:13 UTC (rev 3160) @@ -1,231 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.sensitivity; - -import static org.nuiton.i18n.I18n._; -import fr.ifremer.isisfish.entities.Cell; -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.Metier; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.Port; -import fr.ifremer.isisfish.entities.SetOfVessels; -import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.entities.TripType; -import fr.ifremer.isisfish.entities.VesselType; -import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.ui.input.*; -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder.ChildBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeSelectionAdapterWithCardLayout; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.persistence.TopiaEntity; - -import javax.swing.JPanel; -import javax.swing.event.TreeSelectionEvent; -import java.awt.Component; -import jaxx.runtime.PropertyDecorator; - -/** @author letellier */ -public class SensitivityNavigationTreeSelectionAdapter extends NavigationTreeSelectionAdapterWithCardLayout { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(SensitivityNavigationTreeSelectionAdapter.class); - - protected NavigationTreeNode currentNode = null; - protected InputContentUI currentUI = null; - protected TopiaEntity currentEntity = null; - - public SensitivityNavigationTreeSelectionAdapter(SensitivityTabUI context) { - super(SensitivityTabUI.class, null, context, Strategy.PER_UI_TYPE); - - if (context.getNavigation() == null) { - throw new IllegalArgumentException("could not have a null 'navigation' in ui " + context); - } - - // register in tree this listener - context.getNavigation().addTreeSelectionListener(this); - } - - @Override - protected JPanel getContentContainer() { - return ((SensitivityTabUI) context).getInputPane(); - } - - @Override - protected CardLayout2 getContentLayout() { - return ((SensitivityTabUI) context).getCardlayout(); - } - - @Override - protected NavigationTreeModel getNavigationTreeModel() { - return (NavigationTreeModel) ((SensitivityTabUI) context).getNavigation().getModel(); - } - - @Override - protected void goBackToPreviousNode(TreeSelectionEvent event, Exception e) { - if (e != null) { - if (log.isErrorEnabled()) { - log.error("Go bak to previous node", e); - } - } - // go back to previous node - // returnToPreviousNode(getNavigationTree(), event); - } - - - protected JAXXTree getNavigationTree() { - return ((SensitivityTabUI) context).getNavigation(); - } - - @Override - protected void openUI(Component newUI, NavigationTreeNode node) throws Exception { - super.openUI(newUI, node); - // apply refresh method (should a contract for all this ui with a method refresh...) - try { - currentUI = (InputContentUI) newUI; - if (currentUI != null){ - currentUI.setSensitivity(true); - context.getContextValue(InputSaveVerifier.class).addCurrentPanel(currentUI); - currentUI.setLayer(true); - // tabbed ui hack - currentUI.setActionButtons(); - } - currentNode = node; - } catch (Exception e) { - log.debug(e.getMessage(), e); - } - } - - @Override - protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception { - boolean exit = true; - return exit; - } - - @Override - protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { - if (log.isDebugEnabled()) { - log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass())); - } - InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class); - verif.removeAllEntity(); - if (TopiaEntity.class.isInstance(data)){ - verif.addCurrentEntity((TopiaEntity) data); - } - else{ - verif.addCurrentEntity(null); - } -// verif.refreshAll(); - verif.setCurrentNode(node); - } - - public static NavigationTreeModel getTreeModel(String regionName, FisheryRegion fisheryRegion) { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/"); - - if (regionName == null) { - return null; - } - - ChildBuilder<TopiaEntity> childBuilder = new ChildBuilder<TopiaEntity>(builder) { - - Decorator<? extends TopiaEntity> decorator; - - @Override - public void init(Class<? extends TopiaEntity> klass) { - decorator = jaxx.runtime.PropertyDecorator.newDecorator(klass, "name"); - } - - @Override - public Decorator<? extends TopiaEntity> getDecorator(TopiaEntity child) { - return decorator; - } - - @Override - public String getJXPath(TopiaEntity child) { - return "..[@topiaId=\"" + child.getTopiaId() + "\"]"; - } - - @Override - public String getNavigationPath(TopiaEntity child) { - return child.getTopiaId(); - } - }; - - try { - - NavigationTreeNode root = builder.build(null, regionName, JAXXContextEntryDef.newDef(FisheryRegion.class), "$root", FisheryRegionUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.cells"), "../cell", "$cells", CellUI.class, null), - true, Cell.class, fisheryRegion.getCell(), CellUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.zones"), "../zone", "$zones", ZoneUI.class, null), - true, Zone.class, fisheryRegion.getZone(), ZoneUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.ports"), "../port", "$ports", PortUI.class, null), - true, Port.class, fisheryRegion.getPort(), PortUI.class, null); - - NavigationTreeNode species = builder.build(root, _("isisfish.input.tree.species"), "../species", "$species", SpeciesUI.class, null); - - for (Species specie : fisheryRegion.getSpecies()) { - NavigationTreeNode speciesChild = builder.build(species, PropertyDecorator.newDecorator(Species.class, "name"), "..[@topiaId=\"" + specie.getTopiaId() + "\"]", specie.getTopiaId(), SpeciesUI.class, null); - NavigationTreeNode populations = builder.build(speciesChild, _("isisfish.input.tree.populations"), "../population", "$populations", PopulationUI.class, null); - childBuilder.build(populations, true, Population.class, specie.getPopulation(), PopulationUI.class, null); - } - - childBuilder.build(builder.build(root, _("isisfish.input.tree.gears"), "../gear", "$gears", GearUI.class, null), - true, Gear.class, fisheryRegion.getGear(), GearUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.metiers"), "../metier", "$metiers", MetierUI.class, null), - true, Metier.class, fisheryRegion.getMetier(), MetierUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.triptypes"), "../tripType", "$tripTypes", TripTypeUI.class, null), - true, TripType.class, fisheryRegion.getTripType(), TripTypeUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.vesseltypes"), "../vesselType", "$vesselTypes", VesselTypeUI.class, null), - true, VesselType.class, fisheryRegion.getVesselType(), VesselTypeUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.setofvessels"), "../setOfVessels", "$setOfVessels", SetOfVesselsUI.class, null), - true, SetOfVessels.class, fisheryRegion.getSetOfVessels(), SetOfVesselsUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.strategies"), "../strategy", "$strategies", StrategyUI.class, null), - true, fr.ifremer.isisfish.entities.Strategy.class, fisheryRegion.getStrategy(), StrategyUI.class, null); - - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - return builder.getModel(); - } - -} Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,18 +22,12 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel layout='{new BorderLayout()}'> +<fr.ifremer.isisfish.ui.NavigationUI> - <javax.swing.tree.DefaultTreeSelectionModel id='navigationSelectionModel' selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/> + <SensitivityInputHandler id="handler" /> - <fr.ifremer.isisfish.ui.input.InputNavigationTreeCellRenderer id='navigationTreeCellRenderer' constructorParams='this'/> + <fr.ifremer.isisfish.entities.FisheryRegion id='fisheryRegion' javaBean='null'/> - <jaxx.runtime.swing.CardLayout2 id='cardlayout'/> - - <java.awt.CardLayout id='cardlayoutPrincipal'/> - - <fr.ifremer.isisfish.entities.FisheryRegionImpl id='region' javaBean='null'/> - <script><![CDATA[ import javax.swing.JPopupMenu; import javax.swing.tree.DefaultTreeModel; @@ -50,37 +44,12 @@ import fr.ifremer.isisfish.simulator.sensitivity.group.FactorGroup; import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeModel; import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeCellRenderer; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationUtil; -// end code constructor -getVerifier().setSensPanel(this); -new fr.ifremer.isisfish.ui.sensitivity.SensitivityNavigationTreeSelectionAdapter(this); +protected void $afterCompleteSetup() { + // end code constructor + getVerifier().setSensPanel(this); +} -factorsTree.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - // clic droit - if (e.getButton() == MouseEvent.BUTTON3) { - JPopupMenu menu = new JPopupMenu(); - JMenuItem menuItemDelete = new JMenuItem(_("isisfish.common.delete")); - menuItemDelete.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - deleteSelectedFactors(); - } - }); - menu.add(menuItemDelete); - menu.show(e.getComponent(), e.getX(), e.getY()); - } - else { - // autre clic - factorSelected(); - } - } -}); - protected InputAction getInputAction() { return getContextValue(InputAction.class); } @@ -97,6 +66,34 @@ return getContextValue(RegionStorage.class); } +/** + * Mouse click on factors tree. + * + * <ul> + * <li>normal click : factor edit</li> + * <li>right click : popup menu</li> + * </ul> + */ +public void factorsTreeMouseClicked(MouseEvent e) { + // clic droit + if (e.getButton() == MouseEvent.BUTTON3) { + JPopupMenu menu = new JPopupMenu(); + JMenuItem menuItemDelete = new JMenuItem(_("isisfish.common.delete")); + menuItemDelete.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + deleteSelectedFactors(); + } + }); + menu.add(menuItemDelete); + menu.show(e.getComponent(), e.getX(), e.getY()); + } + else { + // autre clic + factorSelected(); + } +} + protected void factorSelected() { Object selectedObject = factorsTree.getSelectionValue(); if (selectedObject != null) { @@ -112,7 +109,7 @@ else { // method 2 - JComponent component2 = EditorHelper.getEditorForFactor(selectedFactor, getRegion().getTopiaContext()); + JComponent component2 = EditorHelper.getEditorForFactor(selectedFactor, getFisheryRegion().getTopiaContext()); if (component2 != null) { if (log.isDebugEnabled()) { log.debug("Component found is " + component2); @@ -131,48 +128,13 @@ } } public void setTreeModel() { - if (getRegion() != null) { + if (getFisheryRegion() != null) { getCardlayoutPrincipal().show(inputPanePrincipal,"normale"); - String regionName = getRegion().getName(); - setContextValue(getRegion()); - NavigationTreeModel model = SensitivityNavigationTreeSelectionAdapter.getTreeModel(regionName, getRegion()); - - setContextValue(model); - navigation.setModel(model); - setTreeSelection("$root"); - - /*TC-20090702 Fix bug #1772 - EC-20090706 no working solution found - model.nodeChanged(model.getRoot()); - java.util.Enumeration<?> e = model.getRoot().children(); - while (e.hasMoreElements()) { - NavigationTreeNode n = (NavigationTreeNode) e.nextElement(); - String contextPath = n.getContextPath(); - if (contextPath.equals("$root/$cells")) { - //TC-20090702 : ce noeud est trop long a recharger - continue; - } - log.debug("reload node " + contextPath); - model.nodeChanged(n); - java.util.Enumeration<?> e2 = n.children(); - while (e2.hasMoreElements()) { - NavigationTreeNode n2 = (NavigationTreeNode) e2.nextElement(); - n2.getJAXXContextValue(SensitivityTabUI.this); - } - }*/ + String regionName = getFisheryRegion().getName(); + setContextValue(getFisheryRegion()); + getHandler().loadFisheryRegionTree(this); } } -public void repaintNode(String path) { - NavigationTreeModel model = getContextValue(NavigationTreeModel.class); - NavigationTreeNode currentNode = model.findNode(path); - model.nodeChanged(currentNode); -} -public void setTreeSelection(String path) { - NavigationTreeNode node = NavigationUtil.findNode(this, null, path); - TreePath pathToRoot = new TreePath(getContextValue(NavigationTreeModel.class).getPathToRoot(node)); - navigation.setSelectionPath(pathToRoot); - navigation.scrollPathToVisible(pathToRoot); -} protected void setInfoText(String s) { WelcomePanelUI root = getParentContainer(WelcomePanelUI.class); root.setStatusMessage(s); @@ -180,7 +142,7 @@ protected void regionNull() { getCardlayoutPrincipal().show(inputPanePrincipal,"none"); DefaultTreeModel model = new DefaultTreeModel(null); - navigation.setModel(model); + fisheryRegionTree.setModel(model); } public void setFactorModel() { FactorGroup factorGroup = getSimulAction().getFactorGroup(); @@ -209,20 +171,16 @@ <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL" constraints='BorderLayout.CENTER'> <JPanel layout='{new BorderLayout()}'> <JSplitPane oneTouchExpandable="true" dividerLocation="400" orientation="VERTICAL" constraints='BorderLayout.CENTER'> + <JScrollPane> + <javax.swing.tree.DefaultTreeSelectionModel id='fisheryRegionTreeSelectionModel' + selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/> + <JTree id="fisheryRegionTree" rootVisible="true" selectionRow='0' + selectionModel='{getFisheryRegionTreeSelectionModel()}' + model='{new DefaultTreeModel(null)}' + onValueChanged="getHandler().nodeSelectionChanged(this, event)" /> + </JScrollPane> <Table> <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTree id="navigation" rootVisible="true" selectionRow='0' - selectionModel='{getNavigationSelectionModel()}' - cellRenderer='{getNavigationTreeCellRenderer()}' - model='{new DefaultTreeModel(null)}'/> - </JScrollPane> - </cell> - </row> - </Table> - <Table> - <row> <cell> <JButton icon="table.png" /> </cell> @@ -233,17 +191,23 @@ <row> <cell columns='2' fill="both" weightx='1.0' weighty='1.0'> <JScrollPane> - <JTree id="factorsTree" rootVisible="true" selectionRow='0' - model='{new DefaultTreeModel(null)}' cellRenderer='{new FactorTreeCellRenderer()}'/> + <JAXXTree id="factorsTree" rootVisible="true" selectionRow='0' + model='{new DefaultTreeModel(null)}' + cellRenderer='{new FactorTreeCellRenderer()}' + onMouseClicked='factorsTreeMouseClicked(event)'/> </JScrollPane> </cell> </row> </Table> </JSplitPane> </JPanel> + <java.awt.CardLayout id='cardlayoutPrincipal'/> <JPanel id='inputPanePrincipal' layout='{getCardlayoutPrincipal()}'> - <fr.ifremer.isisfish.ui.input.NoneUI id='noneUI' constraints='"none"'/> + <JPanel layout='{new BorderLayout()}' constraints='"none"'> + <JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/> + </JPanel> + <jaxx.runtime.swing.CardLayout2 id='cardlayout'/> <JPanel id="inputPane" layout='{getCardlayout()}' constraints='"normale"'/> </JPanel> </JSplitPane> -</JPanel> \ No newline at end of file +</fr.ifremer.isisfish.ui.NavigationUI> \ No newline at end of file Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,53 +23,63 @@ #L% --> <fr.ifremer.isisfish.ui.SimulationUI> + <script><![CDATA[ - import jaxx.runtime.JAXXInitialContext; - import fr.ifremer.isisfish.ui.input.InputAction; - import fr.ifremer.isisfish.ui.input.InputSaveVerifier; + import fr.ifremer.isisfish.ui.input.InputAction; + import fr.ifremer.isisfish.ui.input.InputSaveVerifier; + import jaxx.runtime.context.JAXXInitialContext; - @Override - public void refresh() { - paramsUI.refresh(); - } + /** + * Refresh all simulation launch UI. + */ + @Override + protected void regionStorageChanged() { + boolean enabled = getRegionStorage() != null; + bodyTabbedPane.setEnabledAt(1, enabled); + bodyTabbedPane.setEnabledAt(2, enabled); + } - @Override - public void selectParametersTab() { - bodyTabbedPane.setSelectedIndex(0); - } + @Override + public void refresh() { + paramsUI.refresh(); + } - @Override - public void setEnabledPrescriptTab(boolean selected) { - // no prescript in AS - } + @Override + public void selectParametersTab() { + bodyTabbedPane.setSelectedIndex(0); + } - @Override - public void setEnabledAnalysePlanTab(boolean selected) { - // no analyse plan in AS - } - ]]> - </script> + @Override + public void setEnabledPrescriptTab(boolean selected) { + // no prescript in AS + } + + @Override + public void setEnabledAnalysePlanTab(boolean selected) { + // no analyse plan in AS + } + ]]></script> <JTabbedPane id="bodyTabbedPane"> <tab title='isisfish.params.title'> - <fr.ifremer.isisfish.ui.simulator.ParamsUI id='paramsUI' sensitivity='{true}' constructorParams='this'/> + <fr.ifremer.isisfish.ui.simulator.ParamsUI id='paramsUI' sensitivity='{true}' regionStorage="{getRegionStorage()}" constructorParams='this'/> </tab> - <tab title='isisfish.sensitivity.title'> + <tab title='isisfish.sensitivity.title' enabled="false"> <fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI id="sensitivityTabUI" constructorParams='new JAXXInitialContext().add(new InputAction()).add(new SensitivityAction()).add(new InputSaveVerifier()).add(this)'/> </tab> - <tab title='isisfish.sensitivityChooser.title'> + <tab title='isisfish.sensitivityChooser.title' enabled="false"> <SensitivityChooserUI id="sensitivityChooserUI" constructorParams='this'/> </tab> - <tab id="exportUITab" title='isisfish.export.title'> + <tab title='isisfish.export.title'> <fr.ifremer.isisfish.ui.simulator.ExportUI id="exportUI" constructorParams='this'/> </tab> - <tab id="resultChoiceUITab" title='isisfish.resultChoice.title'> + <tab title='isisfish.resultChoice.title'> <fr.ifremer.isisfish.ui.simulator.ResultChoiceUI id="resultChoiceUI" constructorParams='this'/> </tab> - <tab id="advancedParamsUITab" title='isisfish.advancedParameters.title'> + <tab title='isisfish.advancedParameters.title'> <fr.ifremer.isisfish.ui.simulator.AdvancedParamsUI id="advancedParamsUI" constructorParams='this'/> </tab> - <tab id="secondPassUITab" title='isisfish.sensitivity.secondpass.title'> + <tab title='isisfish.sensitivity.secondpass.title'> <SensitivitySecondPassUI id="sensitivitySecondPassUI" constructorParams='this'/> </tab> </JTabbedPane> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -31,17 +31,19 @@ import javax.swing.table.DefaultTableModel; import java.util.Map.Entry; - /** - * Listener to enable/disable remove button. - */ - tableTagValues.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - setRemove(tableTagValues.getSelectedRow() != -1); - } - }); + protected void $afterCompleteSetup() { + /** + * Listener to enable/disable remove button. + */ + tableTagValues.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + setRemove(tableTagValues.getSelectedRow() != -1); + } + }); - refresh(); + refresh(); + } public void refresh() { setTableTagValues(); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2005 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -28,7 +28,9 @@ import fr.ifremer.isisfish.ui.models.export.ExportNameListModel; import javax.swing.event.ListSelectionEvent; - refresh(); + protected void $afterCompleteSetup() { + refresh(); + } protected SimulAction getSimulAction() { return getContextValue(SimulAction.class); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -1,32 +1,18 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin - %% - 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, see - <http://www.gnu.org/licenses/gpl-2.0.html>. - #L% - --> +<!-- #%L IsisFish $Id$ $HeadURL$ %% Copyright (C) 2009 - 2011 Ifremer, CodeLutin, + Chatellier Eric %% 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, see <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% --> <Table> - <Boolean id="regionLoaded" javaBean="false" /> + <fr.ifremer.isisfish.datastore.RegionStorage id="regionStorage" javaBean="null" /> <!-- ui state when editing --> - <Boolean id='sensitivity' javaBean='false'/> + <Boolean id='sensitivity' javaBean='false' /> <script><![CDATA[ import java.util.EventObject; @@ -38,7 +24,6 @@ import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.Strategy; import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.entities.FisheryRegionImpl; import fr.ifremer.isisfish.ui.SimulationUI; import fr.ifremer.isisfish.ui.WelcomePanelUI; import fr.ifremer.isisfish.ui.WelcomeTabUI; @@ -49,15 +34,18 @@ import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel; import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor; import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer; +import fr.ifremer.isisfish.ui.sensitivity.FactorWizardUI; import fr.ifremer.isisfish.ui.sensitivity.SensitivityUI; import fr.ifremer.isisfish.rule.Rule; import fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher; import fr.ifremer.isisfish.simulator.launcher.SimulationService; import fr.ifremer.isisfish.simulator.launcher.SimulationJob; import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener; +import fr.ifremer.isisfish.simulator.sensitivity.Factor; import org.nuiton.topia.TopiaException; import org.nuiton.topia.TopiaContext; import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.gui.MatrixPanelEditor; import org.apache.commons.lang.ArrayUtils; // instances variables déclaration @@ -74,10 +62,10 @@ }; RegionStorage.addStorageChangeListener(regionStorageListener); -// end constructor code simulationListener = new SimulationServiceListener() { @Override public void simulationStart(SimulationService simService, SimulationJob job) { + } @Override @@ -87,6 +75,7 @@ @Override public void clearJobDone(SimulationService simService) { + } } @@ -97,6 +86,8 @@ fieldSimulParamsDesc.setText(simulAction.getSimulationParameter().getDescription()); setListSimulParamsStrategiesItems(); setListSimulParamsPopulationsItems(); + + // rule component ruleChooser.setRegionStorage(simulAction.getRegionStorage()); } @@ -114,9 +105,7 @@ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - simulAction.regionChange(selected); - // not sure that setRegionLoaded is at the better place - setRegionLoaded(true); + simulAction.regionChange(ParamsUI.this, selected); refresh(); setSensitivityTabRegion(); getParentContainer(WelcomePanelUI.class).setStatusMessage(_("isisfish.message.region.loaded")); @@ -143,7 +132,7 @@ // FIXME this transation in nerver closed TopiaContext tx = simulAction.getRegionStorage().getStorage().beginTransaction(); FisheryRegion fisheryRegion = RegionStorage.getFisheryRegion(tx); - getParentContainer(SensitivityUI.class).getSensitivityTabUI().setRegion((FisheryRegionImpl) fisheryRegion); + getParentContainer(SensitivityUI.class).getSensitivityTabUI().setFisheryRegion(fisheryRegion); getParentContainer(SensitivityUI.class).getSensitivityTabUI().setTreeModel(); } catch (StorageException ex) { if (log.isErrorEnabled()) { @@ -189,7 +178,6 @@ fieldSimulParamsNbAnnees.setText(String.valueOf(simulAction.getNumberOfYear())); setPreScript(); setAnalysePlan(); - //setFactorRegion(); setExportSens(); setSensitivityCalculator(); setFactor(); @@ -286,10 +274,30 @@ for (Object selectedPopulationValue : selectedPopulationsValues) { Population selectedPopulation = (Population)selectedPopulationValue; - org.nuiton.math.matrix.gui.MatrixPanelEditor matrixPanel = new org.nuiton.math.matrix.gui.MatrixPanelEditor(); + // TODO add change listener on matrix panel !!! + final MatrixPanelEditor matrixPanel = new MatrixPanelEditor(); MatrixND populationEffectives = simulAction.getSimulationParameter().getNumberOf(selectedPopulation); matrixPanel.setMatrix(populationEffectives); - populationEffectivesTabbedPane.add(matrixPanel, _("isisfish.params.populationEffectives", selectedPopulation.getName())); + + JPanel matrixPanelComponent = new JPanel(new BorderLayout()); + matrixPanelComponent.add(matrixPanel, BorderLayout.CENTER); + + // add addFactorButton with matrixPanel (just in sensitivity cas) + if (isSensitivity()) { + // TODO choose another name than "id" + matrixPanel.putClientProperty("id", selectedPopulation.getName()); + // TODO add another thing that action + JButton addFactorButton = new JButton(); + addFactorButton.setAction(new AbstractAction() { + public void actionPerformed(ActionEvent e) { + addFactorWithComponent(matrixPanel); + } + }); + addFactorButton.setIcon(SwingUtil.createImageIcon("building_add.png")); + matrixPanelComponent.add(addFactorButton, BorderLayout.EAST); + } + + populationEffectivesTabbedPane.add(matrixPanelComponent, _("isisfish.params.populationEffectives", selectedPopulation.getName())); } layout.show(populationEffectivesPanel, "specific"); @@ -340,6 +348,47 @@ simulAction.resetOldSimulatorNames(); fieldSimulParamsSelect.setModel(getSimulParamsSelectModel(false)); } + +/** + * Action appelée lors du clic sur les boutons a coté des composants factorisables. + * + * Contrairement à l'interface 'input', on edite ici des facteurs existants, + * (créé à la première demande). + * + * @param e l'event initial intersepté par le layer + */ +protected void addFactorWithComponent(JComponent source) { + + if (log.isDebugEnabled()) { + log.debug("Event intercepted on " + source); + } + + // redo this, here manage just two case + Factor selectedFactor = null; + if (source instanceof RuleChooser) { + selectedFactor = simulAction.getFactors().get("parameters.rules"); + if (selectedFactor == null) { + selectedFactor = new Factor("parameters.rules"); + selectedFactor.setPath("parameters.rules"); + } + } + else { + if (source instanceof MatrixPanelEditor) { + // id here is not coherent with all other attributes (bean, beanID, method) + String property = (String)source.getClientProperty("id"); + selectedFactor = simulAction.getFactors().get("parameters.population." + property); + selectedFactor.setPath("parameters.population." + property); + } + } + + if (selectedFactor != null) { + FactorWizardUI wizard = new FactorWizardUI(this); + wizard.initExisting(source, selectedFactor); + wizard.pack(); + SwingUtil.center(this, wizard); + wizard.setVisible(true); + } +} ]]> </script> <row> @@ -347,16 +396,22 @@ <Table> <row> <cell fill="horizontal"> - <JLabel text="isisfish.params.loadOldSimulation"/> + <JLabel text="isisfish.params.loadOldSimulation" /> </cell> <cell fill="horizontal" weightx="1.0"> - <JComboBox id="fieldSimulParamsSelect" model='{getSimulParamsSelectModel()}' onActionPerformed='loadOldSimulation()'/> + <JComboBox id="fieldSimulParamsSelect" + model='{getSimulParamsSelectModel()}' + onActionPerformed='loadOldSimulation()' /> </cell> <cell> - <JButton text="isisfish.params.filter" id="buttonSimulParamsSelectFilter" onActionPerformed='selectFilter()' enabled="false"/> + <JButton text="isisfish.params.filter" + id="buttonSimulParamsSelectFilter" + onActionPerformed='selectFilter()' enabled="false" /> </cell> <cell> - <JButton text="isisfish.params.clearFilter" id="buttonSimulParamsSelectClearFilter" onActionPerformed='resetFilter()' enabled="false"/> + <JButton text="isisfish.params.clearFilter" + id="buttonSimulParamsSelectClearFilter" + onActionPerformed='resetFilter()' enabled="false" /> </cell> </row> </Table> @@ -375,12 +430,15 @@ <Table> <row> <cell fill="horizontal"> - <JLabel id='lblName' text='{isSensitivity() ? _("isisfish.params.sensitivityName") : _("isisfish.params.simulationName")}' - minimumSize='{new Dimension(195,25)}' preferredSize='{new Dimension(195,25)}' /> + <JLabel id='lblName' + text='{isSensitivity() ? _("isisfish.params.sensitivityName") : _("isisfish.params.simulationName")}' + minimumSize='{new Dimension(195,25)}' + preferredSize='{new Dimension(195,25)}' /> </cell> - <cell fill="both" weightx="1.0"> - <JTextField id="fieldSimulParamsName"/> - <javax.swing.text.Document javaBean="fieldSimulParamsName.getDocument()" + <cell fill="both" weightx="1.0"> + <JTextField id="fieldSimulParamsName" /> + <javax.swing.text.Document + javaBean="fieldSimulParamsName.getDocument()" onInsertUpdate='simulAction.setName(fieldSimulParamsName.getText())' onRemoveUpdate='simulAction.setName(fieldSimulParamsName.getText())' /> </cell> @@ -391,11 +449,13 @@ <Table> <row> <cell columns="2" fill="horizontal"> - <JLabel text="isisfish.common.region"/> + <JLabel text="isisfish.common.region" /> </cell> - <cell fill="horizontal" weightx="1.0"> - <JComboBox id="fieldSimulParamsRegion" model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}' - selectedItem='{getContextValue(SimulAction.class).getSimulationParameter().getRegionName()}' onActionPerformed='regionChange()'/> + <cell fill="horizontal" weightx="1.0"> + <JComboBox id="fieldSimulParamsRegion" + model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}' + selectedItem='{getContextValue(SimulAction.class).getSimulationParameter().getRegionName()}' + onActionPerformed='regionChange()' /> </cell> </row> </Table> @@ -403,16 +463,19 @@ </row> <row> <cell columns="4" fill="horizontal" weightx="1.0"> - <JLabel text="isisfish.params.description"/> + <JLabel text="isisfish.params.description" /> </cell> </row> <row> - <cell columns="4" fill="both" weightx="1.0" weighty="0.3"> + <cell columns="4" fill="both" weightx="1.0" + weighty="0.3"> <JScrollPane> - <JTextArea id="fieldSimulParamsDesc" text='{simulAction.getSimulationParameter().getDescription()}'/> - <javax.swing.text.Document javaBean="fieldSimulParamsDesc.getDocument()" - onInsertUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' - onRemoveUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' /> + <JTextArea id="fieldSimulParamsDesc" + text='{simulAction.getSimulationParameter().getDescription()}' /> + <javax.swing.text.Document + javaBean="fieldSimulParamsDesc.getDocument()" + onInsertUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' + onRemoveUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' /> </JScrollPane> </cell> </row> @@ -421,11 +484,16 @@ <Table> <row> <cell fill="horizontal"> - <JLabel text="isisfish.params.numberYear" minimumSize='{new Dimension(140,25)}' preferredSize='{new Dimension(140,25)}'/> + <JLabel text="isisfish.params.numberYear" + minimumSize='{new Dimension(140,25)}' + preferredSize='{new Dimension(140,25)}' /> </cell> <cell fill="both" weightx="1.0"> - <JTextField id="fieldSimulParamsNbAnnees" text='{simulAction.getSimulationParameter().getNumberOfYear()}'/> - <javax.swing.text.Document javaBean="fieldSimulParamsNbAnnees.getDocument()" + <JTextField + id="fieldSimulParamsNbAnnees" + text='{String.valueOf(simulAction.getSimulationParameter().getNumberOfYear())}' /> + <javax.swing.text.Document + javaBean="fieldSimulParamsNbAnnees.getDocument()" onInsertUpdate='simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText())' onRemoveUpdate='simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText())' /> </cell> @@ -433,49 +501,81 @@ </Table> </cell> <cell columns="2" fill="horizontal" weightx="0.5"> - <JPanel/> + <JPanel /> </cell> </row> <row> - <cell columns="4" fill="both" weightx="1.0" weighty="0.6"> - <JTabbedPane id="parametersTabbedPane" enabled="{isRegionLoaded()}"> - <tab title='{_("isisfish.params.stategiesAndPopulations")}'> + <cell columns="4" fill="both" weightx="1.0" + weighty="0.6"> + <JTabbedPane id="parametersTabbedPane" enabled="{getRegionStorage() != null}"> + <tab + title='{_("isisfish.params.stategiesAndPopulations")}'> <Table> <row> <cell fill="horizontal"> - <JLabel text="isisfish.common.strategies" enabled="{isRegionLoaded()}"/> + <JLabel text="isisfish.common.strategies" enabled="{getRegionStorage() != null}" /> </cell> <cell fill="horizontal"> - <JLabel text="isisfish.common.populations" enabled="{isRegionLoaded()}"/> + <JLabel text="isisfish.common.populations" enabled="{getRegionStorage() != null}" /> </cell> </row> <row> - <cell fill="both" weightx="1" weighty="1"> + <cell fill="both" weightx="1" + weighty="1"> <JScrollPane> - <JList id="listSimulParamsStrategies" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - onValueChanged='strategySelected()' enabled="{isRegionLoaded()}"/> + <JList id="listSimulParamsStrategies" + selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + onValueChanged='strategySelected()' + enabled="{getRegionStorage() != null}" /> </JScrollPane> </cell> - <cell fill="both" weightx="1" weighty="1"> + <cell fill="both" weightx="1" + weighty="1"> <JScrollPane> - <JList id="listSimulParamsPopulations" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - onValueChanged='populationSelected()' enabled="{isRegionLoaded()}"/> + <JList id="listSimulParamsPopulations" + selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + onValueChanged='populationSelected()' + enabled="{getRegionStorage() != null}" /> </JScrollPane> </cell> </row> <row> - <cell fill="both" weighty="1" columns="2"> - <JPanel id="populationEffectivesPanel" layout="{new CardLayout()}"> - <JLabel text="isisfish.params.nopopulation" horizontalAlignment="center" border="{BorderFactory.createEtchedBorder()}" - font-style="italic" constraints='"default"' enabled="{isRegionLoaded()}"/> - <JTabbedPane id="populationEffectivesTabbedPane" constraints='"specific"' enabled="{isRegionLoaded()}"/> + <cell fill="both" weighty="1" + columns="2"> + <JPanel + id="populationEffectivesPanel" + layout="{new CardLayout()}"> + <JLabel text="isisfish.params.nopopulation" + horizontalAlignment="center" + border="{BorderFactory.createEtchedBorder()}" + font-style="italic" + constraints='"default"' + enabled="{getRegionStorage() != null}" /> + <JTabbedPane id="populationEffectivesTabbedPane" + constraints='"specific"' + enabled="{getRegionStorage() != null}" /> </JPanel> </cell> </row> </Table> </tab> <tab title='{_("isisfish.params.rules")}'> - <RuleChooser id="ruleChooser" active="{isRegionLoaded()}" decorator="boxed"/> + <Table> + <row> + <cell fill="both" weightx="1" + weighty="1"> + <RuleChooser id="ruleChooser" + active="{getRegionStorage() != null}" /> + </cell> + <cell> + <JButton + id="addRuleFactorButton" + icon='{SwingUtil.createImageIcon("building_add.png")}' + onActionPerformed="addFactorWithComponent(ruleChooser)" + visible="{isSensitivity()}" /> + </cell> + </row> + </Table> </tab> </JTabbedPane> </cell> @@ -488,15 +588,20 @@ <Table> <row> <cell fill="horizontal" weightx="0.3"> - <JCheckBox text="isisfish.params.usePreSimulationScript" id="fieldUseSimulPreScripts" - selected='{simulAction.getSimulationParameter().getUsePreScript()}' - visible='{!isSensitivity()}' onItemStateChanged='enablePreScript()'/> + <JCheckBox + text="isisfish.params.usePreSimulationScript" + id="fieldUseSimulPreScripts" + selected='{simulAction.getSimulationParameter().getUsePreScript()}' + visible='{!isSensitivity()}' + onItemStateChanged='enablePreScript()' /> </cell> <cell fill="horizontal" weightx="0.3"> - <JCheckBox text="isisfish.params.useAnalysePlan" id="fieldSimulUseAnalysePlan" - selected='{simulAction.getSimulationParameter().getUseAnalysePlan()}' - visible='{!isSensitivity()}' onItemStateChanged='enableAnalysePlan()' - enabled="{isRegionLoaded()}" /> + <JCheckBox text="isisfish.params.useAnalysePlan" + id="fieldSimulUseAnalysePlan" + selected='{simulAction.getSimulationParameter().getUseAnalysePlan()}' + visible='{!isSensitivity()}' + onItemStateChanged='enableAnalysePlan()' + enabled="{getRegionStorage() != null}" /> </cell> </row> </Table> @@ -507,19 +612,23 @@ <Table> <row> <cell> - <JLabel text="isisfish.params.simulationLauncher"/> + <JLabel text="isisfish.params.simulationLauncher" /> </cell> <cell fill="horizontal" weightx="0.4"> - <JComboBox id="comboSelLauncher" model='{new DefaultComboBoxModel(simulAction.getSimulationLauncher().toArray())}'/> + <JComboBox id="comboSelLauncher" + model='{new DefaultComboBoxModel(simulAction.getSimulationLauncher().toArray())}' /> </cell> <cell fill="horizontal" weightx="0.4"> - <JButton id="buttonSimulParamsSimulate" text="isisfish.common.simulate" - onActionPerformed='launchSimulation()' enabled="{isRegionLoaded()}"/> + <JButton id="buttonSimulParamsSimulate" + text="isisfish.common.simulate" + onActionPerformed='launchSimulation()' + enabled="{getRegionStorage() != null}" /> </cell> <cell fill="horizontal" weightx="0.2"> - <JButton id="saveSimul" text="isisfish.simulation.menu.save" + <JButton id="saveSimul" + text="isisfish.simulation.menu.save" onActionPerformed='getParentContainer(fr.ifremer.isisfish.ui.SimulationUI.class).saveSimulation()' - enabled="{isRegionLoaded()}"/> + enabled="{getRegionStorage() != null}" /> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2005 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2005 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -28,7 +28,9 @@ import fr.ifremer.isisfish.ui.models.result.ResultListModel; import javax.swing.event.ListSelectionEvent; - refresh(); + protected void $afterCompleteSetup() { + refresh(); + } public void refresh() { Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -1,23 +1,27 @@ <!-- -/* *##% - * Copyright (C) 2010 Ifremer, Code Lutin, Eric Chatellier - * - * 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. - *##%*/ - --> - + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> <Table> <!-- Rules collection managed by current ui instance. --> <java.util.List genericType='fr.ifremer.isisfish.rule.Rule' id="rulesList" javaBean='new java.util.ArrayList<fr.ifremer.isisfish.rule.Rule>()'/> @@ -29,15 +33,18 @@ <fr.ifremer.isisfish.datastore.RegionStorage id="regionStorage" javaBean="null"/> <script><![CDATA[ - import fr.ifremer.isisfish.IsisFishException; - import fr.ifremer.isisfish.datastore.RuleStorage; - import fr.ifremer.isisfish.rule.Rule; - import fr.ifremer.isisfish.ui.models.rule.RuleListModel; - import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel; - import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor; - import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer; - import fr.ifremer.isisfish.ui.util.ErrorHelper; + import fr.ifremer.isisfish.IsisFishException; + import fr.ifremer.isisfish.datastore.RuleStorage; + import fr.ifremer.isisfish.rule.Rule; + import fr.ifremer.isisfish.ui.models.rule.RuleListModel; + import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel; + import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor; + import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer; + import fr.ifremer.isisfish.ui.util.ErrorHelper; + import java.beans.PropertyChangeEvent; + import java.beans.PropertyChangeListener; + protected void $afterCompleteSetup() { // Manage rule list change addPropertyChangeListener("rulesList", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { @@ -50,69 +57,70 @@ } } }); + } - /** - * Get new instance for selected rules names and add it to {@link rulesList} list. - */ - protected void addSelectedRules() { - Object[] availableRuleValues = availableRuleList.getSelectedValues(); - for (Object availableRuleValue : availableRuleValues) { - String availableRuleName = (String)availableRuleValue; - try { - RuleStorage ruleStorage = RuleStorage.getRule(availableRuleName); - Rule ruleTmp = ruleStorage.getNewRuleInstance(); - rulesList.add(ruleTmp); - } catch (IsisFishException e) { - if (log.isErrorEnabled()) { - log.error("Can't add rule", e); - } - ErrorHelper.showErrorDialog(_("isisfish.error.simulation.addrule"), e); + /** + * Get new instance for selected rules names and add it to {@link rulesList} list. + */ + protected void addSelectedRules() { + Object[] availableRuleValues = availableRuleList.getSelectedValues(); + for (Object availableRuleValue : availableRuleValues) { + String availableRuleName = (String)availableRuleValue; + try { + RuleStorage ruleStorage = RuleStorage.getRule(availableRuleName); + Rule ruleTmp = ruleStorage.getNewRuleInstance(); + rulesList.add(ruleTmp); + } catch (IsisFishException e) { + if (log.isErrorEnabled()) { + log.error("Can't add rule", e); } + ErrorHelper.showErrorDialog(_("isisfish.error.simulation.addrule"), e); } - - //TODO replace this by a better fire() event - selectedRulesList.setModel(new RuleListModel(rulesList)); } - /** - * Remove selected rules for selected rules list. - */ - protected void removeSelectedRules() { - Object[] selectedRuleValues = selectedRulesList.getSelectedValues(); - for (Object selectedRuleValue : selectedRuleValues) { - rulesList.remove(selectedRuleValue); - } - //TODO replace this by a better fire() event - selectedRulesList.setModel(new RuleListModel(rulesList)); + //TODO replace this by a better fire() event + selectedRulesList.setModel(new RuleListModel(rulesList)); + } + + /** + * Remove selected rules for selected rules list. + */ + protected void removeSelectedRules() { + Object[] selectedRuleValues = selectedRulesList.getSelectedValues(); + for (Object selectedRuleValue : selectedRuleValues) { + rulesList.remove(selectedRuleValue); } - - /** - * Clear selected rule list. - */ - protected void clearAllRules() { - rulesList.clear(); - //TODO replace this by a better fire() event - selectedRulesList.setModel(new RuleListModel(rulesList)); + //TODO replace this by a better fire() event + selectedRulesList.setModel(new RuleListModel(rulesList)); + } + + /** + * Clear selected rule list. + */ + protected void clearAllRules() { + rulesList.clear(); + //TODO replace this by a better fire() event + selectedRulesList.setModel(new RuleListModel(rulesList)); + } + + /** + * Display paramters table form single selected list. + */ + protected void displayRuleParameters() { + Rule selectedRule = (Rule)selectedRulesList.getSelectedValue(); + if (selectedRule != null) { + RuleParametersTableModel model = new RuleParametersTableModel(selectedRule); + selectedRuleParameterTable.setModel(model); + RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule); + cellEditor.setRegion(getRegionStorage()); + RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule); + selectedRuleParameterTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer); + selectedRuleParameterTable.getColumnModel().getColumn(1).setCellEditor(cellEditor); } - - /** - * Display paramters table form single selected list. - */ - protected void displayRuleParameters() { - Rule selectedRule = (Rule)selectedRulesList.getSelectedValue(); - if (selectedRule != null) { - RuleParametersTableModel model = new RuleParametersTableModel(selectedRule); - selectedRuleParameterTable.setModel(model); - RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule); - cellEditor.setRegion(getRegionStorage()); - RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule); - selectedRuleParameterTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer); - selectedRuleParameterTable.getColumnModel().getColumn(1).setCellEditor(cellEditor); - } - else { - selectedRuleParameterTable.setModel(new RuleParametersTableModel()); - } + else { + selectedRuleParameterTable.setModel(new RuleParametersTableModel()); } + } ]]></script> <row> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -41,13 +41,16 @@ // to be notified of storage change event StorageChangeListener analyzePlanStorageListener; - analyzePlanStorageListener = new StorageChangeListener() { - @Override - public void versionDataChanged(StorageChangeEvent e) { - refresh(); - } - }; - AnalysePlanStorage.addStorageChangeListener(analyzePlanStorageListener); + + protected void $afterCompleteSetup() { + analyzePlanStorageListener = new StorageChangeListener() { + @Override + public void versionDataChanged(StorageChangeEvent e) { + refresh(); + } + }; + AnalysePlanStorage.addStorageChangeListener(analyzePlanStorageListener); + } public void refresh() { // analyse plans names list Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2011-03-16 16:57:13 UTC (rev 3160) @@ -52,6 +52,7 @@ import fr.ifremer.isisfish.IsisFish; import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.AnalysePlanStorage; import fr.ifremer.isisfish.datastore.ExportStorage; import fr.ifremer.isisfish.datastore.RegionStorage; @@ -61,6 +62,7 @@ import fr.ifremer.isisfish.datastore.SensitivityStorage; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.datastore.SimulatorStorage; +import fr.ifremer.isisfish.datastore.StorageException; import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.Species; import fr.ifremer.isisfish.entities.Strategy; @@ -82,6 +84,7 @@ import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.group.FactorGroup; +import fr.ifremer.isisfish.ui.SimulationUI; import fr.ifremer.isisfish.ui.util.ErrorHelper; /** @@ -255,28 +258,14 @@ /** * Change region in simulation launcher - * + * + * @param paramsUI paramsUI * @param regionName region name */ - public void regionChange(String regionName) { - try { - regionStorage = RegionStorage.getRegion(regionName); - - // chatellier, on ne peut pas le reinitialiser, on - // perd toutes les info apres un rechergement d'une anciennes simulation - //init(); // reinitialise param pour le vider - param.setRegionName(regionName); - - // poussin 20090519 quel est l'interet de faire ca ? et encore plus maintenant qu'on reinitialise - // for (Rule r : param.getRules()) { - // rules.put(r, RuleStorage.getName(r)); - // } - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't change region", e); - } - ErrorHelper.showErrorDialog(_("isisfish.error.simulation.openregion"), e); - } + public void regionChange(ParamsUI paramsUI, String regionName) { + regionStorage = RegionStorage.getRegion(regionName); + paramsUI.getParentContainer(SimulationUI.class).setRegionStorage(regionStorage); + param.setRegionName(regionName); } /** @@ -309,13 +298,6 @@ param.setAnalysePlanNumber(-1); regionStorage = param.getRegion(); - // Chargement des exports de sensibilites - /* not used anymore - * sensitivityExports.clear(); - for (SensitivityExport ex : param.getSensitivityExport()){ - sensitivityExports.put(ex, ex.getExportFilename()); - }*/ - // Chargement des facteurs // clear list even if mexico file doesn't exists factors.clear(); @@ -339,10 +321,7 @@ } } } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't load old Simulation: " + simulName, eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.simulation.loadoldsimulation"), eee); + throw new IsisFishRuntimeException(_("isisfish.error.simulation.loadoldsimulation"), eee); } } @@ -860,6 +839,10 @@ return result; } + public SortedMap<String, Factor> getFactors() { + return factors; + } + public void addFactor(Factor f, JComponent c) { if (log.isDebugEnabled()) { log.debug("Add factor (" + f.getName() + ") : " +f.getPath()); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2005 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -25,55 +25,62 @@ <fr.ifremer.isisfish.ui.SimulationUI> <script><![CDATA[ - @Override - public void refresh() { - paramsUI.refresh(); - preScriptUI.refresh(); - sensUI.refresh(); - exportUI.refresh(); - resultChoiceUI.refresh(); - advancedParamsUI.refresh(); - } + @Override + public void refresh() { + paramsUI.refresh(); + preScriptUI.refresh(); + sensUI.refresh(); + exportUI.refresh(); + resultChoiceUI.refresh(); + advancedParamsUI.refresh(); + } + + /** + * Refresh all simulation launch UI. + */ + @Override + protected void regionStorageChanged() { + + } + + @Override + public void selectParametersTab() { + bodyTabbedPane.setSelectedIndex(0); + } - @Override - public void selectParametersTab() { - bodyTabbedPane.setSelectedIndex(0); + @Override + public void setEnabledPrescriptTab(boolean selected) { + bodyTabbedPane.setEnabledAt(1, selected); + if (selected) { + bodyTabbedPane.setSelectedIndex(1); } - - @Override - public void setEnabledPrescriptTab(boolean selected) { - bodyTabbedPane.setEnabledAt(1, selected); - if (selected) { - bodyTabbedPane.setSelectedIndex(1); - } + } + + @Override + public void setEnabledAnalysePlanTab(boolean selected) { + bodyTabbedPane.setEnabledAt(2, selected); + if (selected) { + bodyTabbedPane.setSelectedIndex(2); } - - @Override - public void setEnabledAnalysePlanTab(boolean selected) { - bodyTabbedPane.setEnabledAt(2, selected); - if (selected) { - bodyTabbedPane.setSelectedIndex(2); - } - } - ]]> - </script> + } + ]]></script> <JTabbedPane id="bodyTabbedPane"> - <tab id="paramsUITab" title='isisfish.params.title'> - <ParamsUI id="paramsUI" constructorParams='this' /> + <tab title='isisfish.params.title'> + <ParamsUI id="paramsUI" constructorParams='this' regionStorage="{getRegionStorage()}"/> </tab> - <tab id="preScriptUITab" title='isisfish.preScript.title' enabled='false'> + <tab title='isisfish.preScript.title' enabled='false'> <PreScriptsUI id="preScriptUI" constructorParams='this' /> </tab> - <tab id="sensUITab" title='isisfish.sens.title' enabled='false'> + <tab title='isisfish.sens.title' enabled='false'> <SensUI id="sensUI" constructorParams='this' /> </tab> - <tab id="exportUITab" title='isisfish.export.title'> + <tab title='isisfish.export.title'> <ExportUI id="exportUI" constructorParams='this' /> </tab> - <tab id="resultChoiceUITab" title='isisfish.resultChoice.title'> + <tab title='isisfish.resultChoice.title'> <ResultChoiceUI id="resultChoiceUI" constructorParams='this' /> </tab> - <tab id="advancedParamsUITab" title='isisfish.advancedParameters.title'> + <tab title='isisfish.advancedParameters.title'> <AdvancedParamsUI id="advancedParamsUI" constructorParams='this' /> </tab> </JTabbedPane>
participants (1)
-
chatellier@users.labs.libre-entreprise.org