Author: sletellier Date: 2008-12-19 13:45:22 +0000 (Fri, 19 Dec 2008) New Revision: 1702 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java Log: Debug final ! Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -63,7 +63,6 @@ import org.codelutin.topia.TopiaException; -protected IsisMapBean cellMap = null; protected OpenMapToolPanel toolMap = new OpenMapToolPanel(); protected OMToolSet toolSet = new OMToolSet(); protected OpenMapEvents mapListener = null; @@ -92,16 +91,13 @@ Cell cell = action.getCell(); setBean((CellImpl) cell); jaxx.runtime.swing.Utils.fillComboBox(fieldCell,action.getFisheryRegion().getCell(), cell); + cellMap.setFisheryRegion(action.getFisheryRegion()); if (cellMap == null){ - cellMap = new IsisMapBean(); cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION); cellMap.setActiveMouseMode(new SelectMouseMode()); - cellMap.setFisheryRegion(action.getFisheryRegion()); toolSet.setupListeners(cellMap); toolMap.add((Component)toolSet); setMapListener(); - cellMapPanel.add(toolMap, BorderLayout.NORTH); - cellMapPanel.add(cellMap, BorderLayout.CENTER); } if (cell != null){ @@ -212,7 +208,7 @@ </cell> </row> </Table> - <JPanel id="cellMapPanel" layout='{new BorderLayout()}'/> + <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'/> </JSplitPane> </cell> </row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -40,6 +40,7 @@ <Boolean id='changed' javaBean='false'/> + <script> <![CDATA[ import fr.ifremer.isisfish.entities.FisheryRegion; @@ -51,7 +52,6 @@ import fr.ifremer.isisfish.ui.WelcomePanelUI; protected FisheryRegion region = null; - protected IsisMapBean cellMap = null; protected OpenMapToolPanel toolMap = new OpenMapToolPanel(); protected OMToolSet toolSet = new OMToolSet(); @@ -60,34 +60,34 @@ setContextValue(action); } protected void init(){ - cellMap = new IsisMapBean(); - cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION); - cellMap.setActiveMouseMode(new SelectMouseMode()); - toolSet.setupListeners(cellMap); - toolMap.add((Component)toolSet); - fisheryRegionMapPanel.add(toolMap, BorderLayout.NORTH); - fisheryRegionMapPanel.add(cellMap, BorderLayout.CENTER); - + region = getContextValue(InputAction.class).getFisheryRegion(); + if (region != null){ + cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION); + cellMap.setActiveMouseMode(new SelectMouseMode()); + cellMap.setFisheryRegion(region); + toolSet.setupListeners(cellMap); + toolMap.add((Component)toolSet); + } } public void refresh(){ - jaxx.runtime.Util.assignment(region = getContextValue(InputAction.class).getFisheryRegion(), "region", fr.ifremer.isisfish.ui.input.FisheryRegionUI.this); - fieldRegion.setText(region.getName()); - fieldLatMin.setText(region.getMinLatitude() + ""); - fieldLatMax.setText(region.getMaxLatitude() + ""); - fieldLongMin.setText(region.getMinLongitude() + ""); - fieldLongMax.setText(region.getMaxLongitude() + ""); - fieldCellLengthLatitude.setText(region.getCellLengthLatitude() + ""); - fieldCellLengthLongitude.setText(region.getCellLengthLongitude() + ""); - setFieldMapfilesModel(region); - fieldComment.setText(region.getComment()); - refreshMap(); + if (region != getContextValue(InputAction.class).getFisheryRegion()){ + init(); + } + if (region != null){ + fieldRegion.setText(region.getName()); + fieldLatMin.setText(region.getMinLatitude() + ""); + fieldLatMax.setText(region.getMaxLatitude() + ""); + fieldLongMin.setText(region.getMinLongitude() + ""); + fieldLongMax.setText(region.getMaxLongitude() + ""); + fieldCellLengthLatitude.setText(region.getCellLengthLatitude() + ""); + fieldCellLengthLongitude.setText(region.getCellLengthLongitude() + ""); + setFieldMapfilesModel(region); + fieldComment.setText(region.getComment()); + refreshMap(); + } } protected void refreshMap(){ -// cellMap = new IsisMapBean(); -// cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION); -// cellMap.setActiveMouseMode(new SelectMouseMode()); - cellMap.setFisheryRegion(region); - cellMap.repaint(); +// cellMap.repaint(); } protected void setFieldMapfilesModel(FisheryRegion region){ DefaultListModel model = new DefaultListModel(); @@ -166,7 +166,8 @@ setMsg(_("isisfish.message.checking.cell")); getContextValue(InputAction.class).saveFisheryRegion("FisheryRegion"); valueChanged(false); - getParentContainer(InputUI.class).repaintNode("$root"); + getParentContainer(InputUI.class).setTreeModel(); + getParentContainer(InputUI.class).setFieldCurrentRegionModel(); setMsg(_("isisfish.message.save.finished")); refresh(); } @@ -331,7 +332,8 @@ </cell> </row> </Table> - <JPanel id="fisheryRegionMapPanel" layout='{new BorderLayout()}'/> + <!--JPanel id="fisheryRegionMapPanel" layout='{new BorderLayout()}'/--> + <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'/> </JSplitPane> </cell> </row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -96,6 +96,9 @@ setContextValue(action); } + protected void setFieldCurrentRegionModel(){ + fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); + } protected DefaultComboBoxModel getFieldCurrentRegionModel(){ return new DefaultComboBoxModel(Common.getRegionItem()); } @@ -110,138 +113,20 @@ } }); } -/* protected void setTreeModel(){ - tree.setModel(getTreeModel()); - } - protected DefaultTreeModel getTreeModel(){ - String regionName = getContextValue(InputAction.class).getFisheryRegionName(); - DefaultTreeModel treeModel = null; - if (regionName != null){ - try { - DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(new GenericCell(regionName, null, null)); - treeModel = new DefaultTreeModel(rootNode); - DefaultMutableTreeNode cellsTreeNode = new DefaultMutableTreeNode(new GenericCell("Cells", null, Cell.class)); - DefaultMutableTreeNode zonesTreeNode = new DefaultMutableTreeNode(new GenericCell("Zones", null, Zone.class)); - DefaultMutableTreeNode ports = new DefaultMutableTreeNode(new GenericCell("Ports", null, Port.class)); - DefaultMutableTreeNode species = new DefaultMutableTreeNode(new GenericCell("Species", null, Species.class)); - DefaultMutableTreeNode gears = new DefaultMutableTreeNode(new GenericCell("Gears", null, Gear.class)); - DefaultMutableTreeNode metiers = new DefaultMutableTreeNode(new GenericCell("Metiers", null, Metier.class)); - DefaultMutableTreeNode tripTypes = new DefaultMutableTreeNode(new GenericCell("TripTypes", null, TripType.class)); - DefaultMutableTreeNode vesselTypes = new DefaultMutableTreeNode(new GenericCell("VesselTypes", null, VesselType.class)); - DefaultMutableTreeNode setOfVessels = new DefaultMutableTreeNode(new GenericCell("SetOfVessels", null, SetOfVessels.class)); - DefaultMutableTreeNode strategies = new DefaultMutableTreeNode(new GenericCell("Strategies", null, Strategy.class)); - - setNode(cellsTreeNode, getContextValue(InputAction.class).getFisheryRegion().getCell().toArray(), Cell.class); - setNode(zonesTreeNode, getContextValue(InputAction.class).getFisheryRegion().getZone().toArray(), Zone.class); - setNode(ports, getContextValue(InputAction.class).getFisheryRegion().getPort().toArray(), Port.class); - setSpeciesNode(species, getContextValue(InputAction.class).getFisheryRegion().getSpecies().toArray(), Species.class); - setNode(gears, getContextValue(InputAction.class).getFisheryRegion().getGear().toArray(), Gear.class); - setNode(metiers, getContextValue(InputAction.class).getFisheryRegion().getMetier().toArray(), Metier.class); - setNode(tripTypes, getContextValue(InputAction.class).getFisheryRegion().getTripType().toArray(), TripType.class); - setNode(vesselTypes, getContextValue(InputAction.class).getFisheryRegion().getVesselType().toArray(), VesselType.class); - setNode(setOfVessels, getContextValue(InputAction.class).getFisheryRegion().getSetOfVessels().toArray(), SetOfVessels.class); - setNode(strategies, getContextValue(InputAction.class).getFisheryRegion().getStrategy().toArray(), Strategy.class); - - treeModel.insertNodeInto(cellsTreeNode, rootNode, 0); - treeModel.insertNodeInto(zonesTreeNode, rootNode, 1); - treeModel.insertNodeInto(ports, rootNode, 2); - treeModel.insertNodeInto(species, rootNode, 3); - treeModel.insertNodeInto(gears, rootNode, 4); - treeModel.insertNodeInto(metiers, rootNode, 5); - treeModel.insertNodeInto(tripTypes, rootNode, 6); - treeModel.insertNodeInto(vesselTypes, rootNode, 7); - treeModel.insertNodeInto(setOfVessels, rootNode, 8); - treeModel.insertNodeInto(strategies, rootNode, 9); - } catch (Exception ex) { - Logger.getLogger(InputUI.class.getName()).log(Level.SEVERE, null, ex); - } - } - return treeModel; - } - protected void setSpeciesNode (DefaultMutableTreeNode node, Object[] values, Class type){ - for (Object value : values){ - DefaultMutableTreeNode population = new DefaultMutableTreeNode(new GenericCell("Population", null, Population.class)); - DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(new GenericCell(value.toString(), value, type)); - setNode(population, ((Species)value).getPopulation().toArray(), Population.class); - childNode.add(population); - node.add(childNode); - } - } - protected void setNode (DefaultMutableTreeNode node, Object[] values, Class type) { - for (Object value : values){ - DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(new GenericCell(value.toString(), value, type)); - node.add(childNode); - } - } - protected void setTreeSelection(TopiaEntity topia, Class type){ - String name = null; - if (topia != null){ - if (type == Zone.class){ - name = ((Zone) topia).getName(); - } else if (type == Cell.class){ - name = ((Cell) topia).getName(); - } else if (type == Port.class){ - name = ((Port) topia).getName(); - } else if (type == Species.class){ - name = ((Species) topia).getName(); - } else if (type == Population.class){ - name = ((Population) topia).getName(); - } else if (type == Gear.class){ - name = ((Gear) topia).getName(); - } else if (type == Metier.class){ - name = ((Metier) topia).getName(); - } else if (type == TripType.class){ - name = ((TripType) topia).getName(); - } else if (type == VesselType.class){ - name = ((VesselType) topia).getName(); - } else if (type == SetOfVessels.class){ - name = ((SetOfVessels) topia).getName(); - } else if (type == Strategy.class){ - name = ((Strategy) topia).getName(); - } - } - DefaultMutableTreeNode element = null; - element = findNode((DefaultMutableTreeNode) tree.getModel().getRoot(), type, name); - TreeNode[] path = element.getPath(); - if (log.isDebugEnabled()) { - log.debug("chemin du prochain noeud selectionnée: " + Arrays.toString(path)); - } - TreePath newSelectionPath = new TreePath(path); - tree.setSelectionPath(newSelectionPath); - } - protected DefaultMutableTreeNode findNode(DefaultMutableTreeNode root, Class type, String name){ - DefaultMutableTreeNode result = null; - for (Enumeration e = root.children(); e.hasMoreElements();){ - DefaultMutableTreeNode node = (DefaultMutableTreeNode)e.nextElement(); - GenericCell g = (GenericCell)node.getUserObject(); - if (type == g.getType()){ - result = node; - if (name != null){ - for (e = result.children(); e.hasMoreElements();){ - node = (DefaultMutableTreeNode)e.nextElement(); - g = (GenericCell)node.getUserObject(); - if (name.equals(g.getName())){ - result = node; - break; - } - } - } - } - } - return result; - } */ protected void setTreeModel(){ String regionName = getContextValue(InputAction.class).getFisheryRegionName(); FisheryRegion fisheryRegion = getContextValue(InputAction.class).getFisheryRegion(); - setContextValue(fisheryRegion); - NavigationTreeModel model = InputNavigationTreeSelectionAdapter.getTreeModel(regionName, fisheryRegion); - navigation.setSelectionModel(navigationSelectionModel); - navigation.setCellRenderer(new NavigationTreeCellRenderer(this)); + if (fisheryRegion != null){ + setContextValue(fisheryRegion); + NavigationTreeModel model = InputNavigationTreeSelectionAdapter.getTreeModel(regionName, fisheryRegion); + navigation.setSelectionModel(navigationSelectionModel); + navigation.setCellRenderer(new NavigationTreeCellRenderer(this)); - setContextValue(model); - navigation.setModel(model); - new InputNavigationTreeSelectionAdapter(this, true); - setTreeSelection("$root"); + setContextValue(model); + navigation.setModel(model); + new InputNavigationTreeSelectionAdapter(this, true); + setTreeSelection("$root"); + } } public void repaintNode(String path){ @@ -264,7 +149,7 @@ setInfoText(_("isisfish.message.creating.region", name)); getContextValue(InputAction.class).newRegion(name); setInfoText(_("isisfish.message.creating.region", name)); - fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); + setFieldCurrentRegionModel(); fieldCurrentRegion.setSelectedItem(name); JButtonNewRegion.setEnabled(false); setInfoText(_("isisfish.message.creation.finished")); @@ -274,17 +159,17 @@ } protected void importRegion(){ setInfoText(_("isisfish.message.import.zip" + getContextValue(InputAction.class).importRegion())); - fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); + setFieldCurrentRegionModel(); setInfoText(_("isisfish.message.import.finished")); } protected void importRegionAndRename(){ setInfoText(_("isisfish.message.import.zip" + getContextValue(InputAction.class).importRegionAndRename())); - fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); + setFieldCurrentRegionModel(); setInfoText(_("isisfish.message.import.finished")); } protected void importV2Region(){ setInfoText(_("isisfish.message.import.xml.v2.file") + getContextValue(InputAction.class).importV2Region()); - fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); + setFieldCurrentRegionModel(); setInfoText(_("isisfish.message.import.finished")); } protected void importRegionFromSimulation(){ @@ -292,17 +177,17 @@ } protected void exportRegion(){ setInfoText(_("isisfish.message.export.zip", getContextValue(InputAction.class).exportRegion())); - fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); + setFieldCurrentRegionModel(); setInfoText(_("isisfish.message.export.done")); } protected void copyRegion(){ setInfoText(_("isisfish.message.copy.region", getContextValue(InputAction.class).copyRegion())); - fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); + setFieldCurrentRegionModel(); setInfoText(_("isisfish.message.copy.finished")); } protected void removeRegion(){ setInfoText(_("isisfish.message.removing.region" + getContextValue(InputAction.class).getRegionStorage().getName())); - fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); + setFieldCurrentRegionModel(); setInfoText(getContextValue(InputAction.class).removeRegion(false)); } protected void commitRegionInCVS(){ Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -77,7 +77,6 @@ growthReverseChanged(); basicsGrowthChanged(); setTableAgeLengthModel(); - valueChanged(false); } else{ // pop = (Population) getContextValue(InputAction.class).create("Population"); @@ -91,7 +90,6 @@ basicsGrowthChanged(); DefaultTableModel tableModel = new DefaultTableModel(); tableAgeLength.setModel(tableModel); - valueChanged(false); } } @@ -198,6 +196,7 @@ } else { wizard.setCard("beginGroupLength"); } + valueChanged(true); refresh(); } } @@ -217,26 +216,30 @@ } } protected void saveGrowthModel(){ - Equation e = getEquation(); - if (e != null){ - getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent()); - } + getContextValue(InputAction.class).saveAsModel("Population", "Java", editor.getText()); + setFieldPopulationBasicsGrowthModel(); + setInfoText(_("isisfish.message.saveModel.finished")); +// Equation e = getEquation(); +// if (e != null){ +// getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent()); +// } } protected void openGrowthEditor(){ - Equation e = getEquation(); - if (e != null){ - getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), fr.ifremer.isisfish.equation.PopulationGrowth.class, e.getContent(), editor); - } + getContextValue(InputAction.class).openEditor("PopulationGrowth","new",fr.ifremer.isisfish.equation.PopulationGrowth.class, editor.getText(), editor); +// Equation e = getEquation(); +// if (e != null){ +// getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), fr.ifremer.isisfish.equation.PopulationGrowth.class, e.getContent(), editor); +// } } protected void growthReverseChanged(){ - Equation f = getEquation(); + Equation f = getReverseEquation(); if (f != null){ editorReverse.setText(f.getContent()); } } protected void saveGrowthReverseModel(){ - getContextValue(InputAction.class).saveAsModel("Population", "Java", editor.getText()); + setfieldPopulationBasicsGrowthReverseModel(); setInfoText(_("isisfish.message.saveModel.finished")); // Equation e = getEquation(); // if (e != null){ Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -56,9 +56,8 @@ import org.codelutin.topia.persistence.TopiaEntity; import org.codelutin.topia.TopiaException; - protected IsisMapBean portMap = null; - protected OpenMapToolPanel toolMap = new OpenMapToolPanel(); protected OMToolSet toolSet = new OMToolSet(); + protected OpenMapToolPanel toolMap = new OpenMapToolPanel(); protected OpenMapEvents mapListener = null; public PortUI (InputAction action){ @@ -93,16 +92,13 @@ } + portMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion()); if(portMap == null){ - portMap = new IsisMapBean(); portMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION); portMap.setActiveMouseMode(new SelectMouseMode()); - portMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion()); toolSet.setupListeners(portMap); toolMap.add((Component)toolSet); setMapListener(); - portMapPanel.add(toolMap, BorderLayout.NORTH); - portMapPanel.add(portMap, BorderLayout.CENTER); } refreshMap(); } @@ -110,7 +106,6 @@ java.util.List<Cell> cells = new ArrayList<Cell>(); cells.add((Cell)portCell.getSelectedValue()); portMap.setSelectedCells(cells); - portMap.setSelectedCells(cells); } protected void setMapListener(){ if (mapListener == null){ @@ -242,7 +237,7 @@ </cell> </row> </Table> - <JPanel id="portMapPanel" layout='{new BorderLayout()}'/> + <fr.ifremer.isisfish.map.IsisMapBean id='portMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'/> </JSplitPane> </cell> </row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -56,9 +56,9 @@ protected double step = 1; protected PopulationBasicsUI popBasic; - +// setCard("endInputGroupLength"); public WizardGroupCreationUI(InputAction action, PopulationBasicsUI p){ - + setContextValue(action); popBasic = p; } @@ -341,11 +341,83 @@ setSameSizeType(beginGroupLengthTypeSameSize.isSelected()); setGrowthCurveType(beginGroupLengthTypeGrowthCurve.isSelected()); } + protected void stepChanged(){ + if (!fieldStep.getText().equals("")){ + setStep(Double.parseDouble(fieldStep.getText())); + } + } + protected void firstAgeChanged(){ + if (!firstAge.getText().equals("")){ + setFirst(Double.parseDouble(firstAge.getText())); + } + } + protected void lastAgeChanged(){ + if(!lastAge.getText().equals("")){ + setLast(Double.parseDouble(lastAge.getText())); + } + } + protected void firstInputLengthChanged(){ + if(!firstInputLength.getText().equals("")){ + setFirst(Double.parseDouble(firstInputLength.getText())); + } + } + protected void maximalGroupsLengthChanged(){ + if(!maximalGroupsLength.getText().equals("")){ + setMaxLength(maximalGroupsLength.getText()); + } + } + protected void firstSizeLengthChanged(){ + if(!firstSizeLength.getText().equals("")){ + setFirst(Double.parseDouble(firstSizeLength.getText())); + } + } + protected void sameSizeNumberOfGroupChanged(){ + if(!sameSizeNumberOfGroup.getText().equals("")){ + setNumberOfGroup(Integer.parseInt(sameSizeNumberOfGroup.getText())); + } + } + protected void groupWidthChanged(){ + if(!groupWidth.getText().equals("")){ + setGroupSize(Double.parseDouble(groupWidth.getText())); + } + } + protected void growthCurveFirstGroupChanged(){ + if(!growthCurveFirstGroup.getText().equals("")){ + setFirst(Double.parseDouble(growthCurveFirstGroup.getText())); + } + } + protected void fieldNumberOfGroupChanged(){ + if(!fieldNumberOfGroup.getText().equals("")){ + setNumberOfGroup(Integer.parseInt(fieldNumberOfGroup.getText())); + } + } ]]> </script> <JPanel id="wizardPanels" layout='{new CardLayout()}' constraints='BorderLayout.CENTER'> - <Table constraints='"singleGroupAge"'> + <Table constraints='"beginGroupLength"'> <row> + <cell fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.wizardGroupCreation.selectGroupLengthType" horizontalAlignment="CENTER"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JRadioButton id="beginGroupLengthTypeInput" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.allValues" onActionPerformed='refreshChoice()'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JRadioButton id="beginGroupLengthTypeSameSize" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.allGroupsSameSize" onActionPerformed='refreshChoice()'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JRadioButton id="beginGroupLengthTypeGrowthCurve" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.computedGrowthCurve" onActionPerformed='refreshChoice()'/> + </cell> + </row> + </Table> + <Table constraints='"singleGroupAge"'> + <row> <cell fill='horizontal' weightx='1.0' columns='2'> <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> </cell> @@ -355,7 +427,7 @@ <JLabel text="isisfish.wizardGroupCreation.firstAge"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="firstAge" onKeyTyped='setFirst(Double.parseDouble(firstAge.getText()))'/> + <JTextField id="firstAge" onFocusLost=''/> </cell> </row> <row> @@ -363,7 +435,7 @@ <JLabel text="isisfish.wizardGroupCreation.lastAge"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="lastAge" onFocusLost='setLast(Double.parseDouble(lastAge.getText()))'/> + <JTextField id="lastAge" onFocusLost='lastAgeChanged()'/> </cell> </row> <row> @@ -382,28 +454,6 @@ </cell> </row> </Table> - <Table constraints='"beginGroupLength"'> - <row> - <cell fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.wizardGroupCreation.selectGroupLengthType" horizontalAlignment="CENTER"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JRadioButton id="beginGroupLengthTypeInput" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.allValues" onActionPerformed='refreshChoice()'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JRadioButton id="beginGroupLengthTypeSameSize" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.allGroupsSameSize" onActionPerformed='refreshChoice()'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JRadioButton id="beginGroupLengthTypeGrowthCurve" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.computedGrowthCurve" onActionPerformed='refreshChoice()'/> - </cell> - </row> - </Table> <Table constraints='"endInputGroupLength"'> <row> <cell columns='2' fill='horizontal' weightx='1.0'> @@ -415,7 +465,7 @@ <JLabel text="isisfish.wizardGroupCreation.firstLength"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="firstInputLength" onFocusLost='setFirst(Double.parseDouble(firstInputLength.getText()))'/> + <JTextField id="firstInputLength" onFocusLost='firstInputLengthChanged()'/> </cell> </row> <row> @@ -423,7 +473,7 @@ <JLabel text="isisfish.wizardGroupCreation.maxGroupsLength"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="maximalGroupsLength" onKeyTyped='setMaxLength(maximalGroupsLength.getText())'/> + <JTextField id="maximalGroupsLength" onFocusLost='maximalGroupsLengthChanged()'/> </cell> </row> <row> @@ -443,7 +493,7 @@ <JLabel text="isisfish.wizardGroupCreation.firstLength"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="firstSizeLength" onFocusLost='setFirst(Double.parseDouble(firstSizeLength.getText()))'/> + <JTextField id="firstSizeLength" onFocusLost='firstSizeLengthChanged()'/> </cell> </row> <row> @@ -451,7 +501,7 @@ <JLabel text="isisfish.wizardGroupCreation.numberGroup"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="sameSizeNumberOfGroup" onFocusLost='setNumberOfGroup(Integer.parseInt(sameSizeNumberOfGroup.getText()))'/> + <JTextField id="sameSizeNumberOfGroup" onFocusLost='sameSizeNumberOfGroupChanged()'/> </cell> </row> <row> @@ -459,7 +509,7 @@ <JLabel text="isisfish.wizardGroupCreation.groupWidth"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="groupWidth" onFocusLost='setGroupSize(Double.parseDouble(groupWidth.getText()))'/> + <JTextField id="groupWidth" onFocusLost='groupWidthChanged()'/> </cell> </row> <row> @@ -489,7 +539,7 @@ <JLabel text="isisfish.wizardGroupCreation.firstGroup"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="growthCurveFirstGroup" onFocusLost='setFirst(Double.parseDouble(growthCurveFirstGroup.getText()))'/> + <JTextField id="growthCurveFirstGroup" onFocusLost='growthCurveFirstGroupChanged()'/> </cell> </row> <row> @@ -497,7 +547,7 @@ <JLabel text="isisfish.wizardGroupCreation.numberGroups"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldNumberOfGroup" onFocusLost='setNumberOfGroup(Integer.parseInt(fieldNumberOfGroup.getText()))'/> + <JTextField id="fieldNumberOfGroup" onFocusLost='fieldNumberOfGroupChanged()'/> </cell> </row> <row> @@ -505,7 +555,7 @@ <JLabel text="isisfish.wizardGroupCreation.timeStep"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldStep" onFocusLost='setStep(Double.parseDouble(fieldStep.getText()))'/> + <JTextField id="fieldStep" onFocusLost='stepChanged()'/> </cell> </row> <row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -58,7 +58,6 @@ import java.util.logging.Level; import java.util.logging.Logger; - protected IsisMapBean zoneMap = null; protected OpenMapToolPanel toolMap = new OpenMapToolPanel(); protected OMToolSet toolSet = new OMToolSet(); protected MapMouseListener mapListener = null; @@ -103,16 +102,13 @@ fieldZoneName.setText(""); fieldZoneComment.setText(""); } + zoneMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion()); if (zoneMap == null){ - zoneMap = new IsisMapBean(); zoneMap.setActiveMouseMode(new SelectMouseMode(false)); zoneMap.setSelectionMode(CellSelectionLayer.MULT_SELECTION); - zoneMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion()); toolSet.setupListeners(zoneMap); toolMap.add((Component)toolSet); setMapListener(); - zoneMapPanel.add(toolMap, BorderLayout.NORTH); - zoneMapPanel.add(zoneMap, BorderLayout.CENTER); } refreshMap(); } @@ -254,7 +250,7 @@ </cell> </row> </Table> - <JPanel enabled='{isActif()}' id="zoneMapPanel" layout='{new BorderLayout()}'/> + <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'/> </JSplitPane> </cell> </row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -33,6 +33,7 @@ <Table> <script><![CDATA[ + import jaxx.runtime.swing.Item; refresh(); public ExportUI (SimulAction action){ @@ -40,10 +41,20 @@ } public void refresh(){ fieldSimulExportFolder.setText(getContextValue(SimulAction.class).getSimulationParameter().getExportDirectory()); - listSimulExportChoose.setModel(getListSimulExportChooseModel()); + setListSimulExportChooseModel(); } - protected DefaultComboBoxModel getListSimulExportChooseModel(){ - return new DefaultComboBoxModel(getContextValue(SimulAction.class).getExportNames().toArray()); + protected void setListSimulExportChooseModel(){ + java.util.List<String> values = getContextValue(SimulAction.class).getExportNames(); + java.util.List<String> selectedValue = getContextValue(SimulAction.class).getSimulationParameter().getExportNames(); + java.util.List<Item> items = new ArrayList<Item>(); + for (String s : values){ + boolean selected = false; + for (String sv : selectedValue){ + selected = sv.equals(s); + } + items.add(new Item(s, s, s, selected)); + } + listSimulExportChoose.setItems(items); } protected void exportChanged(){ if (listSimulExportChoose.getSelectedIndex() > -1){ @@ -60,7 +71,7 @@ <row> <cell columns="4" fill="both" weightx="1.0" weighty="1.0"> <JScrollPane> - <JList id="listSimulExportChoose" selectionMode="2" model='{getListSimulExportChooseModel()}' onValueChanged='exportChanged()'/> + <JList id="listSimulExportChoose" selectionMode="2" onValueChanged='exportChanged()'/> </JScrollPane> </cell> </row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -564,4 +564,4 @@ </Table> </cell> </row> -</Table> \ No newline at end of file +</Table> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2008-12-19 13:45:22 UTC (rev 1702) @@ -33,15 +33,26 @@ <JPanel id="ResultChoice" name="isisfish.resultChoice.title" layout='{new BorderLayout()}'> <script><![CDATA[ import fr.ifremer.isisfish.ui.WelcomePanelUI; + import jaxx.runtime.swing.Item; public ResultChoiceUI (SimulAction action){ setContextValue(action); } public void refresh(){ - listResultNames.setModel(getListResultNameModel()); + setListSimulExportChooseModel(); } - protected DefaultComboBoxModel getListResultNameModel(){ - return new DefaultComboBoxModel(getContextValue(SimulAction.class).getResultNames().toArray()); + protected void setListSimulExportChooseModel(){ + java.util.List<String> values = getContextValue(SimulAction.class).getResultNames(); + java.util.List<String> selectedValue = getContextValue(SimulAction.class).getDefaultResultNames(); + java.util.List<Item> items = new ArrayList<Item>(); + for (String s : values){ + boolean selected = false; + for (String sv : selectedValue){ + selected = sv.equals(s); + } + items.add(new Item(s, s, s, selected)); + } + listResultNames.setItems(items); } protected void saveResultNames(){ if (listResultNames.getSelectedIndex() != -1){ @@ -57,7 +68,7 @@ </script> <JLabel text="isisfish.resultChoice.save" horizontalAlignment="0" constraints='BorderLayout.NORTH'/> <JScrollPane constraints='BorderLayout.CENTER'> - <JList id="listResultNames" selectionMode="2" model='{getListResultNameModel()}'/> + <JList id="listResultNames" selectionMode="2"/> </JScrollPane> <JButton constraints='BorderLayout.SOUTH' text="isisfish.common.saveNextSimulation" onActionPerformed='saveResultNames()'/> </JPanel> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2008-12-19 13:42:41 UTC (rev 1701) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2008-12-19 13:45:22 UTC (rev 1702) @@ -463,7 +463,7 @@ */ // Gestion des TagValues - + public void addTagValue(String tag, String value) { param.getTagValue().put(tag, value); } @@ -509,7 +509,10 @@ resultNamesString.add(o.toString()); } IsisFish.config.setDefaultResultNames(resultNamesString); - } + } + public List<String> getDefaultResultNames(){ + return IsisFish.config.getDefaultResultNamesAsList(); + } /** ************