Isis-fish-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
June 2009
- 5 participants
- 152 discussions
r2358 - in isis-fish/trunk/src/main: java/fr/ifremer/isisfish/simulator java/fr/ifremer/isisfish/ui/simulator java/fr/ifremer/isisfish/ui/simulator/rule java/fr/ifremer/isisfish/ui/widget/editor resources/i18n
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 17:50:12 +0000 (Tue, 09 Jun 2009)
New Revision: 2358
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleListModel.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleParametersTableCellEditor.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleParametersTableModel.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/EquationTableEditor.java
isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
Log:
Rule & rule parameters refactoring (they have thier own editors now)
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java 2009-06-09 17:49:09 UTC (rev 2357)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java 2009-06-09 17:50:12 UTC (rev 2358)
@@ -811,8 +811,14 @@
getRules().add(rule);
}
- public void removeRule(Rule rule) {
- getRules().remove(rule);
+ /**
+ * Remove a rule.
+ *
+ * @param rule rule to remove
+ * @return <tt>true</tt> if this list contained the specified element
+ */
+ public boolean removeRule(Rule rule) {
+ return getRules().remove(rule);
}
public void addAnalysePlan(AnalysePlan plan) {
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 2009-06-09 17:49:09 UTC (rev 2357)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2009-06-09 17:50:12 UTC (rev 2358)
@@ -36,6 +36,7 @@
import javax.swing.table.TableModel;
import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
import fr.ifremer.isisfish.ui.widget.editor.ParameterColumnEditor;
+import fr.ifremer.isisfish.ui.widget.editor.ParameterTableCellEditor;
import javax.swing.text.JTextComponent;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
@@ -47,18 +48,22 @@
import fr.ifremer.isisfish.ui.widget.renderer.SimpleToolTipTableColumnRenderer;
import fr.ifremer.isisfish.ui.widget.renderer.SimpleToolTipComboBoxRenderer;
import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener;
+import fr.ifremer.isisfish.ui.simulator.rule.RuleListModel;
+import fr.ifremer.isisfish.ui.simulator.rule.RuleParametersTableModel;
+import fr.ifremer.isisfish.ui.simulator.rule.RuleParametersTableCellEditor;
+import fr.ifremer.isisfish.rule.Rule;
// instances variables déclaration
SimulationServiceListener simulationListener;
SimulAction simulAction = getContextValue(SimulAction.class);
getContextValue(RegionMonitor.class).addRegionPropertyChangeListener(new PropertyChangeListener() {
-
@Override
public void propertyChange(PropertyChangeEvent evt) {
fieldSimulParamsRegion.setModel(new DefaultComboBoxModel(Common.getRegionItem()));
}
});
+
// end constructor code
simulationListener = new SimulationServiceListener() {
@Override
@@ -92,7 +97,7 @@
fieldSimulParamsDesc.setText(simulAction.getSimulationParameter().getDescription());
setListSimulParamsStrategiesItems();
setListSimulParamsPopulationsItems();
- setRulesItems();
+ setRulesListModel();
}
protected void regionChange(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
@@ -175,20 +180,8 @@
});
}
}
-protected void addRules(){
- simulAction.addRules(fieldSimulParamsMesuresSelect.getSelectedItem().toString());
- setRulesItems();
-}
-protected void removeRules(){
- simulAction.removeRules(listSimulParamsMesuresList.getSelectedValue().toString());
- setRulesItems();
-}
-protected void clearRules(){
- simulAction.getSimulationParameter().clearRules();
- setRulesItems();
-}
-protected void simul(){
- if (!isSensitivity()){
+protected void simul() {
+ if (!isSensitivity()) {
simulAction.launchSimulation(fieldSimulParamsName.getText(), (SimulatorLauncher)comboSelLauncher.getSelectedItem());
}
else{
@@ -196,21 +189,21 @@
}
getParentContainer(WelcomeTabUI.class).selTab(5);
}
-protected void enablePreSimul(){
+protected void enablePreSimul() {
simulAction.getSimulationParameter().setUsePreScript(fieldUseSimulPreScripts.isSelected());
if (!isSensitivity()){
SimulUI simul = getParentContainer(SimulUI.class);
simul.enablePreSimul(fieldUseSimulPreScripts.isSelected());
}
}
-protected void enableAnalysePlan(){
+protected void enableAnalysePlan() {
simulAction.getSimulationParameter().setUseAnalysePlan(fieldSimulUseAnalysePlan.isSelected());
- if (!isSensitivity()){
+ if (!isSensitivity()) {
SimulUI simul = getParentContainer(SimulUI.class);
simul.enableAnalysePlan(fieldSimulUseAnalysePlan.isSelected());
}
}
-protected void selTab(MouseEvent e, int i){
+protected void selTab(MouseEvent e, int i) {
if (((JCheckBox)e.getSource()).isSelected()){
SimulUI simul = getParentContainer(SimulUI.class);
simul.selTab(i);
@@ -265,12 +258,6 @@
populationSelected();
}
}
-protected void setRulesItems(){
- listSimulParamsMesuresList.setListData(simulAction.getRules().toArray());
- listSimulParamsMesuresList.setCellRenderer(new SimpleToolTipComboBoxRenderer(ToolTipListModelFactory.createRuleDescriptionsModel2(simulAction.getSimulationParameter().getRules(),buttonSimulParamsMesuresClear,listSimulParamsMesuresList)));
-
- setRulesButton();
-}
protected void populationSelected(){
if (listSimulParamsPopulations.getSelectedIndex() != -1){
simulAction.setPopulations(listSimulParamsPopulations.getSelectedValues());
@@ -280,65 +267,63 @@
protected void strategySelected(){
simulAction.setStrategies(listSimulParamsStrategies.getSelectedValues());
}
-protected void saveDescription(){
+protected void saveDescription() {
simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText());
}
-protected void setRulesButton(){
- if (simulAction.getRules().toArray().length == 0){
- buttonSimulParamsMesuresClear.setEnabled(false);
- buttonSimulParamsMesuresRemove.setEnabled(false);
- }
- else{
- if (listSimulParamsMesuresList.getSelectedIndex() != -1){
+
+protected void setRulesListModel() {
+ RuleListModel model = new RuleListModel(simulAction.getRules());
+ listSimulParamsMesuresList.setModel(model);
+ listSimulParamsMesuresList.setCellRenderer(model);
+
+ onRuleSelectionChange();
+}
+/**
+ * Called when selection change on rule list.
+ */
+protected void onRuleSelectionChange() {
+ if (simulAction.getRules().isEmpty()) {
+ buttonSimulParamsMesuresClear.setEnabled(false);
+ buttonSimulParamsMesuresRemove.setEnabled(false);
+ }
+ else {
+ if (listSimulParamsMesuresList.getSelectedIndex() != -1) {
buttonSimulParamsMesuresRemove.setEnabled(true);
setSimulParamsRulesModel();
}
buttonSimulParamsMesuresClear.setEnabled(true);
- }
+ }
}
- protected void setSimulParamsRulesModel(){
- DefaultTableModel model = new DefaultTableModel();
- Map<String, Class> values;
- if (listSimulParamsMesuresList.getSelectedIndex() != -1){
- values = simulAction.getRuleParameterName(listSimulParamsMesuresList.getSelectedValue().toString());
- model = new DefaultTableModel(){
- @Override
- public boolean isCellEditable(int row, int column) {
- boolean result = false;
- if (column > 0){
- result =true;
- }
- return result;
- }
- };
- java.util.List<Object> properties = new ArrayList<Object>();
- java.util.List<GenericCell> cells = new ArrayList<GenericCell>();
- for (Iterator<String> it = values.keySet().iterator(); it.hasNext();) {
- String name = it.next();
- Object propertie = simulAction.getRuleParameterValue(name, listSimulParamsMesuresList.getSelectedValue().toString());
- GenericCell value = new GenericCell(name, values.get(name), null);
- properties.add(propertie);
- cells.add(value);
- }
- model.addColumn(_("isisfish.common.name"), cells.toArray());
- model.addColumn(_("isisfish.common.value"), properties.toArray());
+
+protected void setSimulParamsRulesModel() {
+ int selectedRuleIndex = listSimulParamsMesuresList.getSelectedIndex();
+ if (selectedRuleIndex != -1) {
+ RuleListModel listModel = (RuleListModel)listSimulParamsMesuresList.getModel();
+ Rule selectedRule = listModel.getRules().get(selectedRuleIndex);
+ RuleParametersTableModel model = new RuleParametersTableModel(selectedRule);
+ RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule);
+ cellEditor.setRegion(simulAction.getRegionStorage());
+ simulParamsRules.setModel(model);
+ simulParamsRules.getColumnModel().getColumn(1).setCellEditor(cellEditor);
}
- simulParamsRules.setModel(model);
- ParameterColumnEditor cellEditor = new ParameterColumnEditor();
- cellEditor.setRegion(simulAction.getRegionStorage());
- simulParamsRules.getColumnModel().getColumn(1).setCellEditor(cellEditor);
- simulParamsRules.getModel().addTableModelListener(new TableModelListener() {
- @Override
- public void tableChanged(TableModelEvent e) {
- int row = e.getFirstRow();
- TableModel model = (TableModel)e.getSource();
- GenericCell data = (GenericCell) model.getValueAt(row, 0);
- simulAction.setRuleParameterValue(data.getName(), listSimulParamsMesuresList.getSelectedValue().toString(), model.getValueAt(row, 1));
- }
- });
- simulParamsRules.getColumnModel().getColumn(0).setCellRenderer(new SimpleToolTipTableColumnRenderer(ToolTipListModelFactory.createRuleParamsModel(listSimulParamsMesuresList.getSelectedValue().toString())));
}
-protected void selectFilter(){
+protected void addRules() {
+ String selectedRuleName = fieldSimulParamsMesuresSelect.getSelectedItem().toString();
+ simulAction.addRules(selectedRuleName);
+ setRulesListModel();
+}
+protected void removeRules() {
+ RuleListModel listModel = (RuleListModel)listSimulParamsMesuresList.getModel();
+ Rule selectedRule = listModel.getRules().get(listSimulParamsMesuresList.getSelectedIndex());
+ simulAction.removeRule(selectedRule);
+ setRulesListModel();
+}
+protected void clearRules() {
+ simulAction.getSimulationParameter().clearRules();
+ setRulesListModel();
+}
+
+protected void selectFilter() {
try {
simulAction.setOldSimulatorNames(fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil.filterSimulation(simulAction.getOldSimulationItem()));
refresh();
@@ -352,9 +337,11 @@
}
}
}
+
protected ComboBoxModel getSimulParamsSelectModel() {
return getSimulParamsSelectModel(false);
}
+
protected ComboBoxModel getSimulParamsSelectModel(boolean force) {
java.util.List<String> items = simulAction.getFilteredOldSimulatorNames(force);
DefaultComboBoxModel result = new DefaultComboBoxModel();
@@ -365,78 +352,35 @@
}
return result;
}
-protected ComboBoxModel getParamsMesuresSelectModel(){
- java.util.List values = simulAction.getRuleNames();
- DefaultComboBoxModel model = new DefaultComboBoxModel(values.toArray());
- fieldSimulParamsMesuresSelect.setRenderer(new SimpleToolTipComboBoxRenderer(ToolTipListModelFactory.createRuleDescriptionsModel(values)));
+
+protected ComboBoxModel getParamsMesuresSelectModel() {
+ java.util.List<String> rulesNames = simulAction.getAvailableRuleNames();
+ DefaultComboBoxModel model = new DefaultComboBoxModel(rulesNames.toArray());
+ fieldSimulParamsMesuresSelect.setRenderer(new SimpleToolTipComboBoxRenderer(ToolTipListModelFactory.createRuleDescriptionsModel(rulesNames)));
return model;
}
+
protected void resetFilter(){
simulAction.resetOldSimulatorNames();
}
protected void saveName(){
simulAction.setName(fieldSimulParamsName.getText());
}
-public Element save(){
- Element result = DocumentHelper.createElement("paramsUI");
- for (String name : $objectMap.keySet()){
- Object o = $objectMap.get(name);
- if (!name.matches("^\\$.*")){
- Element child = DocumentHelper.createElement(name);
- if (JComboBox.class.isInstance(o)){
- Object value = ((JComboBox)o).getSelectedItem();
- child.addAttribute("value", value.toString());
- }
- if (JList.class.isInstance(o)){
- Object[] values = ((JList)o).getSelectedValues();
- for (Object value : values){
- child.add(DocumentHelper.createElement("item").addAttribute("value", value.toString()));
- }
- }
- else if (JTextComponent.class.isInstance(o)){
- child.addText(((JTextComponent)o).getText());
- }
- else if (AbstractButton.class.isInstance(o)){
- child.addAttribute("selected", ((AbstractButton)o).isSelected() + "");
- }
- else if (JTable.class.isInstance(o)){
- JTable table = (JTable)o;
- for (int i=0;i<table.getColumnCount();i++){
- Element column = DocumentHelper.createElement("column");
- for (int j=0;j<table.getRowCount();j++){
- Element row = DocumentHelper.createElement("row");
- Object value = table.getValueAt(j, i);
- if (value != null){
- row.add(DocumentHelper.createElement("cell").addAttribute("value", value.toString()));
- }
- else {
- row.add(DocumentHelper.createElement("cell").addAttribute("value", null));
- }
- column.add(row);
- }
- child.add(column);
- }
- }
- result.add(child);
- }
- }
- return result;
-}
- /**
- * TODO : Common code with {@link SimulUI#saveSimulation()}
- * TODO duplicated code (simulUI, Params UI, SensitivityUI)
- */
- protected void saveSimulation() {
- JFileChooser fc = new JFileChooser();
- int returnVal = fc.showSaveDialog(null);
+/**
+ * TODO : Common code with {@link SimulUI#saveSimulation()}
+ * TODO duplicated code (simulUI, Params UI, SensitivityUI)
+ */
+protected void saveSimulation() {
+ JFileChooser fc = new JFileChooser();
+ int returnVal = fc.showSaveDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- //This is where a real application would open the file.
- simulAction.saveSimulation(file);
- }
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fc.getSelectedFile();
+ //This is where a real application would open the file.
+ simulAction.saveSimulation(file);
}
+}
]]>
</script>
@@ -575,9 +519,9 @@
</cell>
</row>
<row>
- <cell fill="both" weightx="1.0" weighty="1.0">
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="listSimulParamsMesuresList" selectionMode="0" model='{new DefaultComboBoxModel(simulAction.getRules().toArray())}' onMouseClicked='setRulesButton()'/>
+ <cell fill="both" weightx="1.0" weighty="1.0">
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <JList id="listSimulParamsMesuresList" selectionMode="0" model='{new DefaultComboBoxModel(simulAction.getRules().toArray())}' onMouseClicked='onRuleSelectionChange()'/>
</JScrollPane>
</cell>
</row>
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 2009-06-09 17:49:09 UTC (rev 2357)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-06-09 17:50:12 UTC (rev 2358)
@@ -107,7 +107,7 @@
protected SimulationStorage simulStorage = null;
protected RuleStorage ruleStorage = null;
protected List<String> analysePlan = null;
- protected Map<Rule, String> rules = new HashMap<Rule, String>();
+ protected List<Rule> rules = new ArrayList<Rule>();
protected Map<SensitivityExport, String> sensitivityExports = new HashMap<SensitivityExport, String>();
protected List<String> oldSimulNames = null;
@@ -380,12 +380,24 @@
************
*/
- // Gestion des rules
+ /**
+ * Get simulation parameters rule list.
+ *
+ * @return rules
+ */
+ public List<Rule> getRules() {
+ return param.getRules();
+ }
+
+ /**
+ * Add new rule by name.
+ *
+ * @param name rule name
+ */
public void addRules(String name) {
ruleStorage = RuleStorage.getRule(name);
try {
Rule ruleTmp = ruleStorage.getNewRuleInstance();
- rules.put(ruleTmp, name);
param.addRule(ruleTmp);
} catch (IsisFishException e) {
if (log.isErrorEnabled()) {
@@ -396,11 +408,21 @@
}
/**
+ * Retire une regle.
+ *
+ * @param rule rule to removes
+ * @return <tt>true</tt> if this list contained the specified element
+ */
+ public boolean removeRule(Rule rule) {
+ return param.removeRule(rule);
+ }
+
+ /**
* Return rules name without .java extention.
*
* @return rule names list
*/
- public List<String> getRuleNames() {
+ public List<String> getAvailableRuleNames() {
List<String> result = new ArrayList<String>();
for (String r : RuleStorage.getRuleNames()) {
// Remove .java extention
@@ -410,97 +432,6 @@
}
return result;
}
-
- public List<String> getRules() {
- List<String> result = new ArrayList<String>();
- for (Rule r : param.getRules()) {
- try {
- result.add(RuleStorage.getName(r));
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("Can't get rules", e);
- }
- showMsgBox(e);
- }
- }
- return result;
- }
-
- /**
- *
- * FIXME on ne peut pas retirer une regles par son nom (le nom n'est pas la clé)
- * il faudrait passer l'instance en parametre
- */
- public void removeRules(String name) {
- if (name != null) {
- /*for (Map.Entry<Rule, String> entry : rules.entrySet()) {
- if (entry.getValue().equals(name)) {
- param.removeRule(entry.getKey());
- rules.remove(entry.getKey());
- }
- }*/
- Iterator<Entry<Rule, String>> itEntries = rules.entrySet().iterator();
- while (itEntries.hasNext()) {
- Entry<Rule, String> currentEntry = itEntries.next();
- if (currentEntry.getValue().equals(name)) {
- param.removeRule(currentEntry.getKey());
- itEntries.remove();
- }
- }
- }
- }
-
- public Rule getRule(String ruleName) {
- Rule r = null;
- for (Map.Entry<Rule, String> entry : rules.entrySet()) {
- if (entry.getValue().equals(ruleName)) {
- r = entry.getKey();
- }
- }
- return r;
- }
-
- public Map<String, Class> getRuleParameterName(String ruleName) {
- Map<String, Class> result = null;
- if (ruleName != null) {
- Rule r = getRule(ruleName);
- if (r != null) {
- result = RuleStorage.getParameterNames(r);
- }
- }
- return result;
- }
-
- public Object getRuleParameterValue(String paramName, String ruleName) {
- Object result = null;
- if (ruleName != null) {
- try {
- result = RuleStorage.getParameterValue(getRule(ruleName),
- paramName);
- } catch (IsisFishException e) {
- if (log.isErrorEnabled()) {
- log.error("Can't get rule param value", e);
- }
- showMsgBox(e);
- }
- }
- return result;
- }
-
- public void setRuleParameterValue(String paramName, String ruleName,
- Object o) {
- if (ruleName != null) {
- try {
- RuleStorage.setParameterValue(getRule(ruleName), paramName, o);
- } catch (IsisFishException e) {
- if (log.isErrorEnabled()) {
- log.error("Can't set rule param value", e);
- }
- showMsgBox(e);
- }
- }
- }
-
// Strategies
public List<Strategy> getStrategies() {
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleListModel.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleListModel.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleListModel.java 2009-06-09 17:50:12 UTC (rev 2358)
@@ -0,0 +1,130 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.ui.simulator.rule;
+
+import java.awt.Component;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+
+import fr.ifremer.isisfish.datastore.RuleStorage;
+import fr.ifremer.isisfish.rule.Rule;
+
+/**
+ * Model pour la liste des regles des parametres d'une simulation.
+ *
+ * @author chatellier
+ * @version $Revision: 2350 $
+ *
+ * Last update : $Date: 2009-06-09 13:52:58 +0200 (mar. 09 juin 2009) $
+ * By : $Author: chatellier $
+ */
+public class RuleListModel extends AbstractListModel implements ListCellRenderer {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -4070846632975105788L;
+
+ protected List<Rule> rules;
+
+ /**
+ * Empty constructor.
+ */
+ public RuleListModel() {
+ this(null);
+ }
+
+ /**
+ * Constructor with rule list.
+ *
+ * @param rules rules
+ */
+ public RuleListModel(List<Rule> rules) {
+ super();
+ this.rules = rules;
+ }
+
+ /**
+ * Get rules list.
+ *
+ * @return the rules
+ */
+ public List<Rule> getRules() {
+ return rules;
+ }
+
+ /**
+ * Set rules list.
+ *
+ * @param rules the rules to set
+ */
+ public void setRules(List<Rule> rules) {
+ this.rules = rules;
+ }
+
+ /*
+ * @see javax.swing.ListModel#getElementAt(int)
+ */
+ @Override
+ public Object getElementAt(int index) {
+ return rules.get(index);
+ }
+
+ /*
+ * @see javax.swing.ListModel#getSize()
+ */
+ @Override
+ public int getSize() {
+ int size = 0;
+
+ if (rules != null) {
+ size = rules.size();
+ }
+ return size;
+ }
+
+ /*
+ * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
+ */
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus) {
+
+ Rule rule = rules.get(index);
+
+ JLabel label = new JLabel();
+
+ try {
+ label.setToolTipText(rule.getDescription());
+ } catch (Exception e) {
+ // can't get exception
+ }
+ label.setText(RuleStorage.getName(rule));
+
+ if(isSelected) {
+ label.setBackground(list.getSelectionBackground());
+ label.setForeground(list.getSelectionForeground());
+ label.setOpaque(true); // background won't work
+ }
+
+ return label;
+ }
+}
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleParametersTableCellEditor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleParametersTableCellEditor.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleParametersTableCellEditor.java 2009-06-09 17:50:12 UTC (rev 2358)
@@ -0,0 +1,70 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.ui.simulator.rule;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import fr.ifremer.isisfish.datastore.RuleStorage;
+import fr.ifremer.isisfish.rule.Rule;
+import fr.ifremer.isisfish.ui.widget.editor.ParameterTableCellEditor;
+
+/**
+ * Specific editor for rule parameters.
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 9 juin 2009 $
+ * By : $Author: chatellier $
+ */
+public class RuleParametersTableCellEditor extends ParameterTableCellEditor {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 8211639776194497615L;
+
+ protected Rule rule;
+
+ protected List<Class<?>> ruleParametersTypes;
+
+ /**
+ * Constructor with rule parameter.
+ *
+ * @param rule rule
+ */
+ public RuleParametersTableCellEditor(Rule rule) {
+ super();
+
+ this.rule = rule;
+ ruleParametersTypes = new ArrayList<Class<?>>();
+ //TODO map may be sorted
+ Map<String, Class> ruleParametersNamesAndTypes = RuleStorage.getParameterNames(rule);
+ for (Class<?> type : ruleParametersNamesAndTypes.values()) {
+ ruleParametersTypes.add(type);
+ }
+ }
+ /*
+ * @see fr.ifremer.isisfish.ui.widget.editor.ParameterTableCellEditor#getType(java.lang.Object, int, int)
+ */
+ @Override
+ protected Class<?> getType(Object value, int row, int column) {
+ return ruleParametersTypes.get(row);
+ }
+}
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleParametersTableModel.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleParametersTableModel.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/rule/RuleParametersTableModel.java 2009-06-09 17:50:12 UTC (rev 2358)
@@ -0,0 +1,193 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.ui.simulator.rule;
+
+import static org.codelutin.i18n.I18n._;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.table.AbstractTableModel;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import fr.ifremer.isisfish.IsisFishException;
+import fr.ifremer.isisfish.datastore.RuleStorage;
+import fr.ifremer.isisfish.rule.Rule;
+import fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoTargetSpeciesModel;
+
+/**
+ * Model de la table de definition de parametre d'une regle.
+ *
+ * Columns :
+ * <li>Parameter name</li>
+ * <li>Parameter value</li>
+ *
+ * @author chatellier
+ * @version $Revision: 2350 $
+ *
+ * Last update : $Date: 2009-06-09 13:52:58 +0200 (mar. 09 juin 2009) $
+ * By : $Author: chatellier $
+ */
+public class RuleParametersTableModel extends AbstractTableModel {
+
+ /** Log. */
+ private static Log log = LogFactory.getLog(MetierSeasonInfoTargetSpeciesModel.class);
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3169786638868209920L;
+
+ /** Columns names. */
+ public final static String[] COLUMN_NAMES = {
+ _("isisfish.common.name"),
+ _("isisfish.common.value") };
+
+ protected Rule rule;
+ protected List<String> ruleParametersNames;
+
+
+ /**
+ * Constructor with data.
+ *
+ * @param rule rule to edit parameters
+ */
+ public RuleParametersTableModel(Rule rule) {
+ super();
+ this.rule = rule;
+
+ //TODO map may be sorted
+ ruleParametersNames = new ArrayList<String>();
+ Map<String, Class> ruleParametersNamesAndTypes = RuleStorage.getParameterNames(rule);
+ for (String names : ruleParametersNamesAndTypes.keySet()) {
+ ruleParametersNames.add(names);
+ }
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnCount()
+ */
+ @Override
+ public int getColumnCount() {
+ return COLUMN_NAMES.length;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getRowCount()
+ */
+ @Override
+ public int getRowCount() {
+ return ruleParametersNames.size();
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getValueAt(int, int)
+ */
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+
+ Object result = null;
+
+ String name = ruleParametersNames.get(rowIndex);
+ switch (columnIndex) {
+ case 0:
+ result = name;
+ break;
+ case 1:
+ try {
+ result = RuleStorage.getParameterValue(rule, name);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.debug("Can't get parameters value", e);
+ }
+ }
+ break;
+ default:
+ throw new IndexOutOfBoundsException("No such column " + columnIndex);
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnClass(int)
+ */
+ @Override
+ public Class<?> getColumnClass(int columnIndex) {
+
+ Class<?> result = null;
+
+ switch (columnIndex) {
+ case 0:
+ result = String.class;
+ break;
+ case 1:
+ result = Object.class;
+ break;
+ default:
+ throw new IndexOutOfBoundsException("No such column " + columnIndex);
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnName(int)
+ */
+ @Override
+ public String getColumnName(int columnIndex) {
+ return COLUMN_NAMES[columnIndex];
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#isCellEditable(int, int)
+ */
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return columnIndex > 0;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
+ */
+ @Override
+ public void setValueAt(Object value, int rowIndex, int columnIndex) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Cell edition (column " + columnIndex + ") = " + value);
+ }
+
+ String name = ruleParametersNames.get(rowIndex);
+ switch (columnIndex) {
+ case 1:
+ try {
+ RuleStorage.setParameterValue(rule, name, value);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't set parameter value");
+ }
+ }
+ break;
+ default:
+ throw new IndexOutOfBoundsException("Can't edit column " + columnIndex);
+ }
+
+ }
+}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/EquationTableEditor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/EquationTableEditor.java 2009-06-09 17:49:09 UTC (rev 2357)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/EquationTableEditor.java 2009-06-09 17:50:12 UTC (rev 2358)
@@ -18,8 +18,6 @@
package fr.ifremer.isisfish.ui.widget.editor;
-import static org.codelutin.i18n.I18n._;
-
import java.awt.Component;
import java.awt.Window;
import java.awt.event.ActionEvent;
@@ -27,6 +25,7 @@
import java.util.EventObject;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
import javax.swing.JButton;
import javax.swing.JTable;
@@ -57,9 +56,10 @@
/** serialVersionUID. */
private static final long serialVersionUID = -2483612426979170213L;
- protected HashSet<CellEditorListener> listeners = new HashSet<CellEditorListener>();
+ protected Set<CellEditorListener> listeners = new HashSet<CellEditorListener>();
protected EquationEditorPaneUI frame = null;
+
protected Equation equation = null;
public EquationTableEditor() {
@@ -89,6 +89,7 @@
return frame;
}
+ @Override
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int row, int column) {
equation = (Equation) value;
@@ -104,16 +105,18 @@
return this;
}
+ @Override
public void addCellEditorListener(CellEditorListener l) {
listeners.add(l);
}
+ @Override
public void removeCellEditorListener(CellEditorListener l) {
listeners.remove(l);
}
+ @Override
public Object getCellEditorValue() {
- // Equation equation = getFrame().getEquationEditorPane().getEquation();
if (equation != null) {
String content = getFrame().getEditor().getText();
equation.setContent(content);
@@ -121,18 +124,21 @@
return equation;
}
+ @Override
public boolean isCellEditable(EventObject anEvent) {
return true;
}
+ @Override
public boolean shouldSelectCell(EventObject anEvent) {
return true;
}
+ @Override
public void cancelCellEditing() {
ChangeEvent e = new ChangeEvent(this);
- for (Iterator i = listeners.iterator(); i.hasNext();) {
- CellEditorListener l = (CellEditorListener) i.next();
+ for (Iterator<CellEditorListener> i = listeners.iterator(); i.hasNext();) {
+ CellEditorListener l = i.next();
l.editingCanceled(e);
}
@@ -141,10 +147,11 @@
}
}
+ @Override
public boolean stopCellEditing() {
ChangeEvent e = new ChangeEvent(this);
- for (Iterator i = listeners.iterator(); i.hasNext();) {
- CellEditorListener l = (CellEditorListener) i.next();
+ for (Iterator<CellEditorListener> i = listeners.iterator(); i.hasNext();) {
+ CellEditorListener l = i.next();
l.editingStopped(e);
}
@@ -155,4 +162,3 @@
}
} // EquationTableEditor
-
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java 2009-06-09 17:50:12 UTC (rev 2358)
@@ -0,0 +1,493 @@
+/* *##%
+ * Copyright (C) 2006 - 2009
+ * Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.ui.widget.editor;
+
+import java.awt.Component;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.util.ArrayList;
+import java.util.EventObject;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.table.TableCellEditor;
+
+import org.apache.commons.beanutils.ConvertUtilsBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.topia.TopiaContext;
+import org.codelutin.topia.persistence.TopiaEntity;
+import org.codelutin.util.EnumEditor;
+import org.codelutin.util.MonthEnum;
+
+import fr.ifremer.isisfish.datastore.RegionStorage;
+import fr.ifremer.isisfish.types.Date;
+import fr.ifremer.isisfish.types.Month;
+import fr.ifremer.isisfish.util.ConverterUtil;
+
+/**
+ * ParameterTableCellEditor.
+ *
+ * Un editeur generic de champs qui se base sur le le model de données
+ * a editer.
+ *
+ * Created: 25 sept. 06 12:35:21
+ *
+ * @author poussin
+ * @author chemit
+ * @version $Revision: 2336 $
+ *
+ * Last update: $Date: 2009-06-08 14:47:41 +0200 (lun. 08 juin 2009) $
+ * by : $Author: chatellier $
+ */
+public class ParameterTableCellEditor extends JComponent implements TableCellEditor {
+
+ /** Class logger. */
+ private static Log log = LogFactory.getLog(ParameterTableCellEditor.class);
+
+ private static enum TypeClassMapping {
+ /** for simple int. */
+ Int(int.class),
+ /** for a topia entity. */
+ Topia(TopiaEntity.class),
+ /** for a mounth. */
+ Mounth(Month.class),
+ /** for a simple date. */
+ Date(Date.class),
+ /** for a simple boolean. */
+ Double(double.class),
+ /** for a simple boolean. */
+ Boolean(boolean.class),
+ /** for a file location. */
+ File(java.io.File.class),
+ /** for a simple String. */
+ String(java.lang.String.class);
+
+ private final Class<?> klazz;
+
+ private TypeClassMapping(Class<?> klazz) {
+ this.klazz = klazz;
+ }
+
+ protected static TypeClassMapping getMapping(Class<?> klazz) {
+ for (TypeClassMapping t : TypeClassMapping.values()) {
+ if (t.klazz.isAssignableFrom(klazz)) {
+ return t;
+ }
+ }
+ throw new RuntimeException(
+ "could not found a TypeClassMapping for this class "
+ + klazz);
+ }
+ }
+
+ private static final long serialVersionUID = 6860330126841984303L;
+
+ protected Set<CellEditorListener> listeners = new HashSet<CellEditorListener>();
+
+ protected RegionStorage region = null;
+
+ protected Component editor = null;
+
+ protected Class<?> type = null;
+
+ /**
+ * @return Returns the topiaContext.
+ */
+ public RegionStorage getRegion() {
+ return this.region;
+ }
+
+ /**
+ * @param region
+ * The topiaContext to set.
+ */
+ public void setRegion(RegionStorage region) {
+ this.region = region;
+ }
+
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row, int column) {
+
+ // get value type
+ type = getType(value, row, column);
+ JComboBox c;
+ //if (!table.hasFocus()) return null;
+
+ TypeClassMapping mapping = TypeClassMapping.getMapping(type);
+ switch (mapping) {
+ case Topia:
+ // on a un bean comme parametre
+ try {
+ if (region == null) {
+ return null;
+ }
+ TopiaContext context = region.getStorage().beginTransaction();
+ if (context != null) {
+ List list = context.find("from " + type.getName());
+ c = new JComboBox(list.toArray());
+ c.setSelectedItem(value);
+ editor = c;
+ context.closeContext();
+ }
+
+ } catch (Exception eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't get entity object for combobox", eee);
+ }
+ }
+ break;
+ case Boolean:
+ List<Boolean> listB = new ArrayList<Boolean>();
+ listB.add(Boolean.TRUE);
+ listB.add(Boolean.FALSE);
+ c = new JComboBox(listB.toArray());
+ listB.clear();
+ // TODO See how to convert
+ c.setSelectedItem(value);
+ editor = c;
+ break;
+ case Date:
+ Date date = (Date) value;
+ if (date == null) {
+ date = new Date(0);
+ }
+ int month = date.getMonth().getMonthNumber();
+ int yea = date.getYear();
+ editor = new DateComponent(month, yea, region == null ? null : region
+ .getStorage());
+ //editor = new JTextField(String.valueOf(date.getDate()));
+ break;
+ case Mounth:
+ editor = DateComponent.createMounthCombo(((Month) value)
+ .getMonthNumber(), region == null ? null : region
+ .getStorage());
+ break;
+ case File:
+ // break;
+ default:
+ editor = new JTextField(value.toString());
+ }
+ if (editor != null) {
+ if (JComboBox.class.isInstance(editor)) {
+ ((JComboBox) editor).addActionListener(getComboListener());
+ } else if (JTextField.class.isInstance(editor)) {
+ ((JTextField) editor).addFocusListener(new FocusListener() {
+
+ @Override
+ public void focusGained(FocusEvent e) {
+
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ stopCellEditing();
+ }
+ });
+ } else if (DateComponent.class.isInstance(editor)) {
+ DateComponent date = ((DateComponent) editor);
+ if (date.getMounthCombo() != null) {
+ date.getMounthCombo().addActionListener(getComboListener());
+ }
+ if (date.getYearCombo() != null) {
+ date.getYearCombo().addActionListener(getComboListener());
+ }
+ }
+ }
+ if (log.isInfoEnabled()) {
+ log.info("getCellEditorValue [" + type + "] [mapping:" + mapping + "="
+ + editor);
+ }
+ //+ editor==null?null:editor.getClass().getSimpleName());
+ return editor;
+ }
+
+ /**
+ * Get type for value.
+ *
+ * Must be overriden (value can be null).
+ *
+ * @param value
+ * @param row
+ * @param column
+ * @return
+ */
+ protected Class<?> getType(Object value, int row, int column) {
+ // default to value's class
+ return value.getClass();
+ }
+
+ protected ActionListener getComboListener() {
+ return new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ stopCellEditing();
+ }
+ };
+ }
+
+ public Object getCellEditorValue() {
+
+ Object result = null;
+ TopiaContext context = null;
+ if (editor == null)
+ return "";
+ TypeClassMapping mapping = TypeClassMapping.getMapping(type);
+ switch (mapping) {
+ case Topia:
+ result = getComboBoxValue(editor);
+ break;
+ case Boolean:
+ result = getComboBoxValue(editor);
+ // TODO test
+ break;
+ case Mounth:
+ result = getComboBoxIndex(editor) + "";
+ break;
+ case Date:
+ result = ((DateComponent) editor).getSelectedValue() + "";
+ break;
+ case File:
+ //TODO
+ // result = getTextFieldValue(editor);break;
+ default:
+ if (editor instanceof JTextField) {
+ result = ((JTextField) editor).getText();
+ } else if (editor instanceof JComboBox) {
+ result = ((JComboBox) editor).getSelectedItem();
+ }
+ }
+
+ if (result instanceof String && !String.class.equals(type)) {
+ if (region != null)
+ context = region.getStorage();
+ ConvertUtilsBean cub = ConverterUtil.getConverter(context);
+ result = cub.convert((String) result, type);
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("getCellEditorValue [" + type + "] [mapping:" + mapping
+ + "]= " + result);
+ }
+
+ return result;
+ }
+
+ protected Object getTextFieldValue(Component editor) {
+ return ((JTextField) editor).getText();
+ }
+
+ protected Object getComboBoxValue(Component editor) {
+ return ((JComboBox) editor).getSelectedItem();
+ }
+
+ protected int getComboBoxIndex(Component editor) {
+ return (((JComboBox) editor)).getSelectedIndex();
+ }
+
+ public Object getCellEditorValueOld() {
+
+ Object result = null;
+ if (editor instanceof JTextField) {
+ result = ((JTextField) editor).getText();
+ } else if (editor instanceof JComboBox) {
+ result = ((JComboBox) editor).getSelectedItem();
+ }
+
+ if (result instanceof String && !String.class.equals(type)) {
+ TopiaContext context = null;
+ if (region != null) {
+ context = region.getStorage();
+ }
+ ConvertUtilsBean cub = ConverterUtil.getConverter(context);
+ result = cub.convert((String) result, type);
+ }
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.swing.CellEditor#addCellEditorListener(javax.swing.event.CellEditorListener)
+ */
+ public void addCellEditorListener(CellEditorListener l) {
+ listeners.add(l);
+ }
+
+ /*
+ * @see javax.swing.CellEditor#cancelCellEditing()
+ */
+ public void cancelCellEditing() {
+ if (log.isDebugEnabled()) {
+ log.debug("cancelCellEditing");
+ }
+ ChangeEvent e = new ChangeEvent(this);
+ for (CellEditorListener listener : listeners) {
+ listener.editingCanceled(e);
+ }
+ }
+
+ /*
+ * @see javax.swing.CellEditor#isCellEditable(java.util.EventObject)
+ */
+ public boolean isCellEditable(EventObject anEvent) {
+ return true;
+ }
+
+ /*
+ * @see javax.swing.CellEditor#removeCellEditorListener(javax.swing.event.CellEditorListener)
+ */
+ public void removeCellEditorListener(CellEditorListener l) {
+ listeners.remove(l);
+ }
+
+ /*
+ * @see javax.swing.CellEditor#shouldSelectCell(java.util.EventObject)
+ */
+ public boolean shouldSelectCell(EventObject anEvent) {
+ return true;
+ }
+
+ /*
+ * @see javax.swing.CellEditor#stopCellEditing()
+ */
+ public boolean stopCellEditing() {
+ // to prevent concurent modification exception
+ if (log.isDebugEnabled()) {
+ log.debug("stopCellEditing");
+ }
+ CellEditorListener[] list = listeners
+ .toArray(new CellEditorListener[listeners.size()]);
+
+ ChangeEvent e = new ChangeEvent(this);
+ for (CellEditorListener l : list) {
+ l.editingStopped(e);
+ }
+ return true;
+ }
+
+ public static class DateComponent extends JPanel {
+
+ private static final long serialVersionUID = -6694461572642939712L;
+
+ protected JComboBox mounth;
+
+ protected JComboBox year;
+
+ public DateComponent(int mounth, int year, TopiaContext context) {
+ super(new GridLayout(0, 2));
+
+ this.mounth = createMounthCombo(mounth, context);
+ this.year = createYearCombo(200, year);
+
+ this.add(this.mounth);
+ this.add(this.year);
+ }
+
+ public JComboBox getYearCombo() {
+ return year;
+ }
+
+ public JComboBox getMounthCombo() {
+ return mounth;
+ }
+
+ public int getSelectedMounth() {
+ return mounth.getSelectedIndex();
+ }
+
+ public int getSelectedYear() {
+ return year.getSelectedIndex();
+ }
+
+ public void setSelectedValue(int year, int mounth) {
+ this.mounth.setSelectedIndex(mounth);
+ this.year.setSelectedIndex(year);
+ }
+
+ public int getSelectedValue() {
+ int selectedYear = getSelectedYear();
+ int selectedMounth = getSelectedMounth();
+ if (log.isInfoEnabled()) {
+ log.info("selected mounth " + selectedMounth);
+ log.info("selected year " + selectedYear);
+ }
+ return selectedMounth + selectedYear * 12;
+ }
+
+ public static JComboBox createMounthCombo(int mounth,
+ TopiaContext context) {
+ JComboBox combo = EnumEditor.newEditor(MonthEnum.class);
+ combo.setSelectedIndex(mounth);
+ return combo;
+ }
+
+ /*public static JComboBox createMounthCombo(int mounth, TopiaContext context) {
+ JComboBox combo = createMounthCombo0(context);
+ combo.setSelectedIndex(mounth);
+ return combo;
+ }
+
+ private static JComboBox createMounthCombo0(TopiaContext context) {
+
+ List<String> listM = new ArrayList<String>();
+ // TODO Should use database ? data instead of thoses awfull hardcore
+ // code...
+ listM.add("janvier");
+ listM.add("fevrier");
+ listM.add("mars");
+ listM.add("avril");
+ listM.add("mai");
+ listM.add("juin");
+ listM.add("juillet");
+ listM.add("aout");
+ listM.add("septembre");
+ listM.add("octobre");
+ listM.add("novembre");
+ listM.add("decembre");
+ JComboBox combo = new JComboBox(listM.toArray());
+ listM.clear();
+ return combo;
+ }*/
+
+ public static JComboBox createYearCombo(int nb, int selectedYear) {
+ List<Integer> listI = new ArrayList<Integer>();
+ for (int i = 0; i < nb; i++)
+ listI.add(i);
+ JComboBox year = new JComboBox(listI.toArray());
+ listI.clear();
+ year.setSelectedIndex(selectedYear);
+ return year;
+ }
+ }
+}
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-06-09 17:49:09 UTC (rev 2357)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-06-09 17:50:12 UTC (rev 2358)
@@ -1077,7 +1077,7 @@
isisfish.wizardGroupCreation.groupWidth=Longueur du groupe
isisfish.wizardGroupCreation.groupWidthHelp=Longueur du groupe \= Longueur du groupe
isisfish.wizardGroupCreation.lastAge=Dernier age
-isisfish.wizardGroupCreation.lastAgeHelp=Dernier age \= Age maximal
+isisfish.wizardGroupCreation.lastAgeHelp=Dernier age \= age maximal
isisfish.wizardGroupCreation.maxGroupsLength=Taille maximale de groupes
isisfish.wizardGroupCreation.maxGroupsLengthHelp=Un point-virgule ';' doit s\u00E9parer les tailles maximales de chaque groupe
isisfish.wizardGroupCreation.numberGroup=Nombre de groupe
1
0
r2357 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 17:49:09 +0000 (Tue, 09 Jun 2009)
New Revision: 2357
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
Log:
Various minor fix (ident, comments...)
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2009-06-09 17:48:44 UTC (rev 2356)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2009-06-09 17:49:09 UTC (rev 2357)
@@ -109,17 +109,16 @@
Help.showURL(urlAlias);
}
+ /**
+ * Show about frame from nuiton-widgets.
+ */
protected void about() {
AboutFrame about = new AboutFrame();
- // about.setAboutHtmlText($jaxxObjectDescriptor)
- // AboutFrame about = new AboutFrame();
about.setTitle(_("isisfish.about.title"));
about.setIconPath("images/strategy.jpg");
about.setAboutHtmlText(_("isisfish.about.abouthtmltext", IsisConfig.getVersion()));
about.setLicenseText(_("isisfish.about.licensetext"));
about.setBackgroundColor(Color.WHITE);
- // center frame
- Dimension dim = getToolkit().getScreenSize();
about.setSize(640, 520);
org.codelutin.widget.SwingUtil.center(about);
about.setVisible(true);
1
0
r2356 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 17:48:44 +0000 (Tue, 09 Jun 2009)
New Revision: 2356
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/EffortDescriptionUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
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/PopulationGroupUI.jaxx
Log:
Various minor fix (ident, comments...)
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 2009-06-09 17:48:00 UTC (rev 2355)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-06-09 17:48:44 UTC (rev 2356)
@@ -42,8 +42,6 @@
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
- // remove previous binding on getBean()
- //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldCellName.setText("");
fieldCellLatitude.setText("");
fieldCellLongitude.setText("");
@@ -51,8 +49,7 @@
fieldCellLand.setSelected(false);
}
if (evt.getNewValue() != null) {
- // add binding on getBean()
- //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+
}
}
});
@@ -108,6 +105,8 @@
// avoid reentrant code
return;
}
+
+ // FIXME this can't work on sensitivity
getParentContainer(InputUI.class).setTreeSelection("$root/$cells/"+c.getTopiaId());
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-06-09 17:48:00 UTC (rev 2355)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-06-09 17:48:44 UTC (rev 2356)
@@ -145,7 +145,7 @@
<row>
<cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
<JScrollPane>
- <JList id="fieldEffortDescriptionMetierList" selectionMode="0" enabled='{isActif()}'/>
+ <JList id="fieldEffortDescriptionMetierList" selectionMode="0" enabled='{isActif()}' decorator='boxed' />
</JScrollPane>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-06-09 17:48:00 UTC (rev 2355)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-06-09 17:48:44 UTC (rev 2356)
@@ -275,12 +275,11 @@
protected void topiaCreate() {
- if (log.isTraceEnabled()) {
- log.trace("create called for " + type);
+ if (log.isDebugEnabled()) {
+ log.debug("Create called for " + type);
}
+
try {
- //TODO use the IsisFishEntityEnum for this purpose :
- //TopiaDAO<TopiaEntity> dao = IsisFishEntityEnum.getEntry(type).getDAO(isisContext);
String name = type + "_new";
Method method = MethodUtils.getAccessibleMethod(
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 2009-06-09 17:48:00 UTC (rev 2355)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-06-09 17:48:44 UTC (rev 2356)
@@ -18,7 +18,7 @@
*##%*/
-->
-<JPanel id="input" layout='{new BorderLayout()}'>
+<JPanel layout='{new BorderLayout()}'>
<javax.swing.tree.DefaultTreeSelectionModel id='navigationSelectionModel' selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/>
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 2009-06-09 17:48:00 UTC (rev 2355)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-06-09 17:48:44 UTC (rev 2356)
@@ -160,10 +160,10 @@
<cell anchor='east'>
<JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActif()}'/>
</cell>
- <cell fill='horizontal' weightx='0.5'>
+ <cell fill='horizontal' weightx='1.0'>
<JTextField id="fieldPopulationBasicsNbClasses" text='{getBean() == null ? "" : getBean().sizePopulationGroup()}' editable="false" enabled='{isActif()}' decorator='boxed'/>
</cell>
- <cell fill='horizontal' weightx='0.5'>
+ <cell fill='horizontal'>
<JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" onActionPerformed='createClasses()' enabled='{isActif()}' decorator='boxed'/>
</cell>
</row>
@@ -171,10 +171,10 @@
<cell anchor='east'>
<JLabel text="isisfish.populationBasics.maturityGroup" enabled='{isActif()}'/>
</cell>
- <cell fill='horizontal' weightx='0.5'>
+ <cell fill='horizontal' weightx='1.0'>
<JComboBox id="fieldPopulationBasicsMatureClass" onActionPerformed='matureClassChanged()' enabled='{isActif()}' decorator='boxed'/>
</cell>
- <cell fill='horizontal' weightx='0.5'>
+ <cell fill='horizontal'>
<JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" selected='{getBean().getPlusGroup()}' onActionPerformed='getBean().setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected())' enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"PlusGroup"'/>
</cell>
</row>
@@ -186,8 +186,8 @@
<row>
<cell columns='3' fill='both' weightx='1.0' weighty='1.0'>
<InputOneEquationUI id='growthEquation' constructorParams='this'
- lblText='{_("isisfish.populationBasics.growth")}'
- bean='{getBean()}' nameEquation='Growth' methodGet='Growth' methodSet='EquationGrowth'
+ lblText='{_("isisfish.populationBasics.growth")}' actif='{isActif()}'
+ bean='{getBean()}' nameEquation='Growth' methodGet='Growth' methodSet='EquationGrowth'
clazz='{fr.ifremer.isisfish.equation.PopulationGrowth.class}'
decorator='boxed' _bean='{PopulationImpl.class}' _method='"Growth"'/>
</cell>
@@ -195,8 +195,8 @@
<row>
<cell columns='3' fill='both' weightx='1.0' weighty='1.0'>
<InputOneEquationUI id='growthReverseEquation' constructorParams='this'
- lblText='{_("isisfish.populationBasics.growthReverse")}'
- bean='{getBean()}' nameEquation='GrowthReverse' methodGet='GrowthReverse' methodSet='EquationGrowthReverse'
+ lblText='{_("isisfish.populationBasics.growthReverse")}' actif='{isActif()}'
+ bean='{getBean()}' nameEquation='GrowthReverse' methodGet='GrowthReverse' methodSet='EquationGrowthReverse'
clazz='{fr.ifremer.isisfish.equation.PopulationGrowthReverse.class}'
decorator='boxed' _bean='{PopulationImpl.class}' _method='"GrowthReverse"'/>
</cell>
@@ -205,7 +205,7 @@
<cell anchor='east'>
<JLabel text="isisfish.population.comments" enabled='{isActif()}'/>
</cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.2'>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
<JScrollPane>
<JTextArea id="fieldPopulationBasicsComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldPopulationBasicsComment.getText())' enabled='{isActif()}' decorator='boxed'/>
</JScrollPane>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-06-09 17:48:00 UTC (rev 2355)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-06-09 17:48:44 UTC (rev 2356)
@@ -112,7 +112,7 @@
}
]]>
</script>
- <Table id='body'>
+ <Table>
<row>
<cell fill='horizontal' anchor='east'>
<JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
@@ -143,7 +143,7 @@
<cell fill='horizontal' anchor='east'>
<JLabel text="isisfish.populationGroup.naturalDeathRate" enabled='{isPopGroupNotNull()}'/>
</cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.5'>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
<org.codelutin.math.matrix.gui.JAXXMatrixEditor id ='fieldPopulationGroupNaturalDeathRate'
matrix='{getBean() == null || getPopulationGroup() == null ? null : ((AbstractMatrixND)getBean().getNaturalDeathRateMatrix()).getSubMatrixOnSemantic(0, getPopulationGroup())}'
enabled='{isPopGroupNotNull()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"NaturalDeathRateMatrix"'/>
1
0
r2355 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 17:48:00 +0000 (Tue, 09 Jun 2009)
New Revision: 2355
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java
Log:
Activate button on sensitivity too.
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java 2009-06-09 12:41:36 UTC (rev 2354)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java 2009-06-09 17:48:00 UTC (rev 2355)
@@ -55,6 +55,9 @@
ui = (InputContentUI) pane.getSelectedComponent();
ui.setSensitivity(true);
ui.setLayer(true);
+ // otherwise save.cancel buttons are active in last
+ // refreshed ui
+ ui.setActionButtons();
ui.refresh();
cacheSelectedIndex = pane.getSelectedIndex();
pane.addChangeListener(this);
1
0
r2354 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 12:41:36 +0000 (Tue, 09 Jun 2009)
New Revision: 2354
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java
Log:
Surround refresh cycle with try/catch (can be broken during new database creation)
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-06-09 12:23:14 UTC (rev 2353)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-06-09 12:41:36 UTC (rev 2354)
@@ -61,7 +61,18 @@
if (log.isDebugEnabled()) {
log.debug("Final refresh " + ui);
}
- ui.refresh();
+
+ // refresh can be broken
+ // especially during new region creation
+ // don't break refresh cycle
+ try {
+ ui.refresh();
+ }
+ catch (Exception eee) {
+ if(log.isErrorEnabled()) {
+ log.error("Error during UI refresh", eee);
+ }
+ }
// method only called for tabbed UI
// otherwise save.cancel buttons are active in last
1
0
r2353 - isis-fish/trunk/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 12:23:14 +0000 (Tue, 09 Jun 2009)
New Revision: 2353
Modified:
isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
Log:
Fix some i18n strings (en & fr)
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-06-09 12:14:28 UTC (rev 2352)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-06-09 12:23:14 UTC (rev 2353)
@@ -687,24 +687,24 @@
isisfish.population.group=Group
isisfish.population.groups=Groups
isisfish.population.mappingZoneReproZoneRecru=MappingZoneReproZoneRecru
-isisfish.population.matrixAbundance=matrixAbundance
+isisfish.population.matrixAbundance=Abundance matrix
isisfish.population.matrixAbundance1D=matrixAbundance1D
isisfish.population.recruitment=Recruitment
isisfish.population.reproduction=Reproduction
isisfish.population.season=Season
isisfish.population.zones=Zones
-isisfish.populationBasics.geographicID=geographicID
-isisfish.populationBasics.growth=growth
-isisfish.populationBasics.growthReverse=growthReverse
-isisfish.populationBasics.maturityGroup=maturity group
-isisfish.populationBasics.name=name
+isisfish.populationBasics.geographicID=Geographic identifier
+isisfish.populationBasics.growth=Growth
+isisfish.populationBasics.growthReverse=Reverse growth
+isisfish.populationBasics.maturityGroup=Maturity group
+isisfish.populationBasics.name=Name
isisfish.populationBasics.numberGroup=Number of group
isisfish.populationBasics.plusGroup=plusGroup
-isisfish.populationBasics.recreateClasses=Recreate the classes
-isisfish.populationBasics.title=inputPopulationBasics
+isisfish.populationBasics.recreateClasses=Recreate classes
+isisfish.populationBasics.title=Population input
isisfish.populationCapturability.comments=Comments
isisfish.populationCapturability.selectCoefficient=Select a coefficient per season and per class
-isisfish.populationCapturability.title=inputPopulationCapturability
+isisfish.populationCapturability.title=Capturability input
isisfish.populationEquation.meanWeight=Mean weight
isisfish.populationEquation.naturalDeathRate=Natural death rate
isisfish.populationEquation.price=Price
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-06-09 12:14:28 UTC (rev 2352)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-06-09 12:23:14 UTC (rev 2353)
@@ -697,11 +697,11 @@
isisfish.populationBasics.growth=Croissance
isisfish.populationBasics.growthReverse=Croissance inverse
isisfish.populationBasics.maturityGroup=Groupe de maturit\u00E9
-isisfish.populationBasics.name=nom
+isisfish.populationBasics.name=Nom
isisfish.populationBasics.numberGroup=Nombre de groupes
isisfish.populationBasics.plusGroup=plusGroup
isisfish.populationBasics.recreateClasses=Recruter les classes
-isisfish.populationBasics.title=Saisie des Populations
+isisfish.populationBasics.title=Saisie des populations
isisfish.populationCapturability.comments=Commentaires
isisfish.populationCapturability.selectCoefficient=S\u00E9lectionnez un coefficient par saison et par classe
isisfish.populationCapturability.title=Saisie de la capturabilit\u00E9
1
0
09 Jun '09
Author: chatellier
Date: 2009-06-09 12:14:28 +0000 (Tue, 09 Jun 2009)
New Revision: 2352
Modified:
isis-fish/trunk/src/main/resources/sensitivity.properties
Log:
Sort fil, remove duplicated entries
Modified: isis-fish/trunk/src/main/resources/sensitivity.properties
===================================================================
--- isis-fish/trunk/src/main/resources/sensitivity.properties 2009-06-09 11:53:17 UTC (rev 2351)
+++ isis-fish/trunk/src/main/resources/sensitivity.properties 2009-06-09 12:14:28 UTC (rev 2352)
@@ -1,69 +1,63 @@
+EffortDescription.CrewFoodCost
+EffortDescription.CrewShareRate
+EffortDescription.CrewSize
EffortDescription.FishingOperation
EffortDescription.FishingOperationDuration
-EffortDescription.GearsNumberPerOperation
-EffortDescription.CrewSize
-EffortDescription.UnitCostOfFishing
EffortDescription.FixedCrewSalary
-EffortDescription.CrewFoodCost
-EffortDescription.CrewShareRate
-EffortDescription.RepairAndMaintenanceGearCost
+EffortDescription.GearsNumberPerOperation
EffortDescription.LandingCosts
EffortDescription.OtherRunningCost
-Gear.StandardisationFactor
-Gear.PossibleValue
+EffortDescription.RepairAndMaintenanceGearCost
+EffortDescription.UnitCostOfFishing
Gear.PopulationSelectivity
+Gear.PossibleValue
+Gear.StandardisationFactor
Metier.GearParameterValue
-Metier.Zone
MetierSeasonInfo.SpeciesTargetSpecies
+Metier.Zone
+Population.Capturability
Population.GeographicId
-Population.PlusGroup
-Population.MappingZoneReproZoneRecru
+PopulationGroup.Age
+PopulationGroup.MaxLength
+PopulationGroup.MeanWeight
+PopulationGroup.MinLength
+PopulationGroup.Price
+PopulationGroup.ReproductionRate
Population.Growth
Population.GrowthReverse
+Population.MappingZoneReproZoneRecru
Population.MaturityGroup
Population.MeanWeight
+Population.MonthGapBetweenReproRecrutement
+Population.NaturalDeathRate
+Population.NaturalDeathRateMatrix
+Population.PlusGroup
Population.Price
+Population.RecruitmentDistribution
Population.ReproductionEquation
-Population.NaturalDeathRateMatrix
-Population.NaturalDeathRate
-Population.Capturability
-PopulationGroup.MeanWeight
-PopulationGroup.Price
-PopulationGroup.ReproductionRate
-PopulationGroup.Age
-PopulationGroup.MinLength
-PopulationGroup.MaxLength
-PopulationGroup.MeanWeight
PopulationSeasonInfo.EmigrationMatrix
+PopulationSeasonInfo.GroupChange
PopulationSeasonInfo.ImmigrationMatrix
+PopulationSeasonInfo.LengthChangeMatrix
PopulationSeasonInfo.MigrationMatrix
PopulationSeasonInfo.UseEquationMigration
-PopulationSeasonInfo.LengthChangeMatrix
-PopulationSeasonInfo.GroupChange
-Population.MonthGapBetweenReproRecrutement
-Population.RecruitmentDistribution
-StrategyMonthInfo.LengthChangeMatrix
-SetOfVessels.NumberOfVessels
SetOfVessels.FixedCosts
-Species.ScientificName
-Species.CodeRubbin
-Species.CodeCEE
-Species.AgeGroupType
-Species.AgeGroupType
SetOfVessels.NumberOfVessels
-SetOfVessels.FixedCosts
SetOfVessels.TechnicalEfficiencyEquation
+Species.AgeGroupType
+Species.CodeCEE
+Strategy.Inactivity
+StrategyMonthInfo.LengthChangeMatrix
StrategyMonthInfo.MinInactivityDays
StrategyMonthInfo.ProportionMetier
Strategy.ProportionSetOfVessels
Strategy.SetOfVessels
-Strategy.Inactivity
-TripType.TripDuration
TripType.MinTimeBetweenTrip
+TripType.TripDuration
+VesselType.ActivityRange
VesselType.Length
-VesselType.Speed
VesselType.MaxTripDuration
-VesselType.ActivityRange
VesselType.MinCrewSize
-VesselType.UnitFuelCostOfTravel
-VesselType.TripType
\ No newline at end of file
+VesselType.Speed
+VesselType.TripType
+VesselType.UnitFuelCostOfTravel
\ No newline at end of file
1
0
r2351 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input: . gear
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 11:53:17 +0000 (Tue, 09 Jun 2009)
New Revision: 2351
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx
Log:
Replace ui table model
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2009-06-09 11:52:58 UTC (rev 2350)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2009-06-09 11:53:17 UTC (rev 2351)
@@ -35,27 +35,17 @@
import fr.ifremer.isisfish.entities.PopulationImpl;
import fr.ifremer.isisfish.entities.Selectivity;
import fr.ifremer.isisfish.entities.Species;
+import fr.ifremer.isisfish.ui.input.gear.GearPopulationSelectivityModel;
import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor;
import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
-// TODO why it's commented ? to remove ?
-addPropertyChangeListener("bean", new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getOldValue() != null || evt.getNewValue() == null) {
- // remove previous binding on getBean()
- //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
- }
- if (evt.getNewValue() != null) {
- // add binding on getBean()
- //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
- }
- }
-});
-
selectivityTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
- removeSelectivityButton.setEnabled(selectivityTable.getSelectedRow() != -1);
+ // le bouton ne doit pas s'activer dans l'analyse de sensibilite
+ if (isActif()) {
+ removeSelectivityButton.setEnabled(selectivityTable.getSelectedRow() != -1);
+ }
}
});
@@ -70,11 +60,16 @@
setBean((GearImpl) gear);
if (getBean() != null) {
+ setSelectivityPopulationSelected(false);
setSelectivityTableModel();
fieldSelectivityPopulation.setModel(getSelectivityPopulationModel());
}
getVerifier().addCurrentPanel(selectivityEquation);
+ // reset to false after addCurrentPanel refresh
+ selectivityEquation.setActif(false);
+
+ setSelectivityPopulationSelected(false);
removeSelectivityButton.setEnabled(false);
}
@@ -84,34 +79,19 @@
}
protected void setSelectivityTableModel() {
- DefaultTableModel model = new DefaultTableModel() {
- @Override
- public boolean isCellEditable(int row, int column) {
- boolean result = false;
- if (column > 0) {
- result = true;
- }
- return result;
- }
- };
- Collection<Selectivity> selectivity = getBean().getPopulationSelectivity();
- java.util.List<Population> populations = new ArrayList<Population>();
- java.util.List<Equation> equations = new ArrayList<Equation>();
- if (selectivity != null) {
- for (Selectivity s : selectivity) {
- populations.add(s.getPopulation());
-
- Equation equation = s.getEquation();
- getVerifier().addCurrentEntity(equation);
- equations.add(equation);
- }
+ java.util.List<Selectivity> selectivitiesList = new ArrayList<Selectivity>();
+ // move collection to list
+ // and add all entity to verifier
+ for (Selectivity oneSelectivity : getBean().getPopulationSelectivity()) {
+ getVerifier().addCurrentEntity(oneSelectivity);
+ selectivitiesList.add(oneSelectivity);
}
- model.addColumn(_("isisfish.common.population"), populations.toArray());
- model.addColumn(_("isisfish.common.equation"), equations.toArray());
-
+
+ // set table model
+ GearPopulationSelectivityModel model = new GearPopulationSelectivityModel(selectivitiesList);
selectivityTable.setModel(model);
- EquationTableEditor cellEditor = new EquationTableEditor();
- selectivityTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
+ selectivityTable.setDefaultRenderer(Equation.class, model);
+ selectivityTable.setDefaultEditor(Equation.class, new EquationTableEditor());
}
protected void addSelectivity() {
@@ -120,8 +100,8 @@
}
protected void removeSelectivity() {
- Population selectedPopulation = (Population)selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0);
- Selectivity selectedSelectivity = (Selectivity)getBean().getPopulationSelectivity(selectedPopulation);
+ GearPopulationSelectivityModel model = (GearPopulationSelectivityModel)selectivityTable.getModel();
+ Selectivity selectedSelectivity = model.getSelectivities().get(selectivityTable.getSelectedRow());
getAction().removeSelectivity(getBean(), selectedSelectivity);
setSelectivityTableModel();
removeSelectivityButton.setEnabled(false);
@@ -165,7 +145,7 @@
<cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
<InputOneEquationUI id='selectivityEquation' constructorParams='this'
lblText='{_("isisfish.selectivity.equation")}'
- bean='{getBean()}' nameEquation='Selectivity' actif='{isActif()}'
+ bean='{getBean()}' nameEquation='Selectivity' actif='{isSelectivityPopulationSelected()}'
clazz='{fr.ifremer.isisfish.equation.SelectivityEquation.class}'/>
</cell>
</row>
@@ -177,7 +157,7 @@
<Table>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="addSelectivityButton" text="isisfish.common.add" onActionPerformed='addSelectivity()' enabled='{isActif()}'/>
+ <JButton id="addSelectivityButton" text="isisfish.common.add" onActionPerformed='addSelectivity()' enabled='{isSelectivityPopulationSelected()}'/>
</cell>
</row>
<row>
@@ -189,7 +169,7 @@
</row>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="removeSelectivityButton" text="isisfish.common.remove" onActionPerformed='removeSelectivity()' enabled='{isActif()}'/>
+ <JButton id="removeSelectivityButton" text="isisfish.common.remove" onActionPerformed='removeSelectivity()' enabled='false'/>
</cell>
</row>
</Table>
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java 2009-06-09 11:53:17 UTC (rev 2351)
@@ -0,0 +1,231 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.ui.input.gear;
+
+import static org.codelutin.i18n.I18n._;
+
+import java.awt.Component;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellRenderer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.Gear;
+import fr.ifremer.isisfish.entities.Selectivity;
+
+/**
+ * Table model for {@link Gear}#{@link Selectivity}.
+ *
+ * Columns :
+ * <li>selectivity population name</li>
+ * <li>selectivity equation</li>
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class GearPopulationSelectivityModel extends AbstractTableModel implements TableCellRenderer {
+
+ /** Log. */
+ private static Log log = LogFactory.getLog(GearPopulationSelectivityModel.class);
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3169786638868209920L;
+
+ /** Columns names. */
+ public final static String[] COLUMN_NAMES = {
+ _("isisfish.common.population"),
+ _("isisfish.common.equation")
+ };
+
+ protected List<Selectivity> selectivities;
+
+ /**
+ * Empty constructor.
+ */
+ public GearPopulationSelectivityModel() {
+ this(null);
+ }
+
+ /**
+ * Constructor with data.
+ *
+ * @param selectivities initial selectivities
+ */
+ public GearPopulationSelectivityModel(
+ List<Selectivity> selectivities) {
+ super();
+ this.selectivities = selectivities;
+ }
+
+ /**
+ * Set target species list.
+ *
+ * @param selectivities the selectivities to set
+ */
+ public void setSelectivities(List<Selectivity> selectivities) {
+ this.selectivities = selectivities;
+ }
+
+ /**
+ * Get selectivity list.
+ *
+ * @return selectivity list
+ */
+ public List<Selectivity> getSelectivities() {
+ return this.selectivities;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnCount()
+ */
+ @Override
+ public int getColumnCount() {
+ return COLUMN_NAMES.length;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getRowCount()
+ */
+ @Override
+ public int getRowCount() {
+ int rows = 0;
+ if (selectivities != null) {
+ rows = selectivities.size();
+ }
+ return rows;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getValueAt(int, int)
+ */
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+
+ Object result = null;
+
+ Selectivity selectivity = selectivities.get(rowIndex);
+ switch (columnIndex) {
+ case 0:
+ result = selectivity.getPopulation().getName();
+ break;
+ case 1:
+ result = selectivity.getEquation();
+ break;
+ default:
+ throw new IndexOutOfBoundsException("No such column " + columnIndex);
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnClass(int)
+ */
+ @Override
+ public Class<?> getColumnClass(int columnIndex) {
+
+ Class<?> result = null;
+
+ switch (columnIndex) {
+ case 0:
+ result = String.class;
+ break;
+ case 1:
+ result = Equation.class;
+ break;
+ default:
+ throw new IndexOutOfBoundsException("No such column " + columnIndex);
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnName(int)
+ */
+ @Override
+ public String getColumnName(int columnIndex) {
+ return COLUMN_NAMES[columnIndex];
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#isCellEditable(int, int)
+ */
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return columnIndex > 0;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
+ */
+ @Override
+ public void setValueAt(Object value, int rowIndex, int columnIndex) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Cell edition (column " + columnIndex + ") = " + value);
+ }
+
+ Selectivity selectivity = selectivities.get(rowIndex);
+ switch (columnIndex) {
+ case 1:
+ Equation eq = (Equation)value;
+ // two events for event to be fired
+ selectivity.setEquation(null);
+ selectivity.setEquation(eq);
+ break;
+ default:
+ throw new IndexOutOfBoundsException("Can't edit column " + columnIndex);
+ }
+
+ }
+
+ /*
+ * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)
+ */
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
+
+ Component c = null;
+ switch (column) {
+ case 0:
+ c = new JLabel(value.toString());
+ break;
+ case 1:
+ Equation equation = (Equation)value;
+ c = new JButton(equation.getName() + "(" + equation.getCategory() + ")");
+ break;
+ default:
+ throw new IndexOutOfBoundsException("No such column " + column);
+ }
+ return c;
+ }
+
+}
Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java
___________________________________________________________________
Name: svn:keywords
+ Date Author Revision
1
0
r2350 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input: . metier
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 11:52:58 +0000 (Tue, 09 Jun 2009)
New Revision: 2350
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesModel.java
Log:
Add some comment and various fix
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-06-09 09:08:10 UTC (rev 2349)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-06-09 11:52:58 UTC (rev 2350)
@@ -31,7 +31,7 @@
// (depends on sensitivity can't be done on constructor)
installChangeListener(gearTab);
- getVerifier().addCurrentPanel(selectivityUI, gearTabUI);
+ getVerifier().addCurrentPanel(gearTabUI, selectivityUI);
}
@Override
@@ -40,8 +40,8 @@
gearTabUI.setActionButtons();
}
]]></script>
- <JPanel id='body' layout='{new BorderLayout()}'>
- <JTabbedPane constraints='BorderLayout.CENTER' id="gearTab" name="Gear">
+ <JPanel layout='{new BorderLayout()}'>
+ <JTabbedPane constraints='BorderLayout.CENTER' id="gearTab">
<tab title='{_("isisfish.gear.title")}'>
<GearTabUI id="gearTabUI" constructorParams='this'/>
</tab>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-06-09 09:08:10 UTC (rev 2349)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-06-09 11:52:58 UTC (rev 2350)
@@ -64,8 +64,11 @@
ui.refresh();
// method only called for tabbed UI
- // oterwize save.cancel buttons are active in last
+ // otherwise save.cancel buttons are active in last
// refreshed ui
+ if (log.isDebugEnabled()) {
+ log.debug("Activating action buttons on " + ui);
+ }
ui.setActionButtons();
cacheSelectedIndex = pane.getSelectedIndex();
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx 2009-06-09 09:08:10 UTC (rev 2349)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx 2009-06-09 11:52:58 UTC (rev 2350)
@@ -86,10 +86,14 @@
protected void setTableTargetSpeciesModel() {
if (getMetierSeasonInfo() != null) {
java.util.List<TargetSpecies> targetSpecies = new ArrayList<TargetSpecies>();
+ // move collection to list
+ // and add all entity to verifier
for (TargetSpecies oneTargetSpecies : getMetierSeasonInfo().getSpeciesTargetSpecies()) {
getVerifier().addCurrentEntity(oneTargetSpecies);
targetSpecies.add(oneTargetSpecies);
}
+
+ // set table model
MetierSeasonInfoTargetSpeciesModel model = new MetierSeasonInfoTargetSpeciesModel(targetSpecies);
tableTargetSpecies.setModel(model);
tableTargetSpecies.setDefaultRenderer(Equation.class, model);
@@ -114,6 +118,7 @@
protected void remove() {
if (isMetierSeasonSelected()) {
+ // TODO change delete selected truc from model
Object[] targetSpecies = getMetierSeasonInfo().getSpeciesTargetSpecies().toArray();
Object o = targetSpecies[tableTargetSpecies.getSelectedRow()];
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-06-09 09:08:10 UTC (rev 2349)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-06-09 11:52:58 UTC (rev 2350)
@@ -85,7 +85,7 @@
// TODO what is this code for ???
MatrixND naturalDeathRateMatrix2 = naturalDeathRateMatrix.getSubMatrixOnSemantic(0, getPopulationGroup());
- fieldPopulationGroupNaturalDeathRate.setMatrix(naturalDeathRateMatrix2);
+ fieldPopulationGroupNaturalDeathRate.setMatrix(naturalDeathRateMatrix2.copy());
}
/**
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-06-09 09:08:10 UTC (rev 2349)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-06-09 11:52:58 UTC (rev 2350)
@@ -49,7 +49,7 @@
]]>
</script>
<JPanel id='body' layout='{new BorderLayout()}'>
- <JTabbedPane id="populationTab" name="Populations" constraints='BorderLayout.CENTER'>
+ <JTabbedPane id="populationTab" constraints='BorderLayout.CENTER'>
<tab title='{_("isisfish.populationBasics.title")}'>
<PopulationBasicsUI id='populationBasicsUI' constructorParams='this'/>
</tab>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesModel.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesModel.java 2009-06-09 09:08:10 UTC (rev 2349)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesModel.java 2009-06-09 11:52:58 UTC (rev 2350)
@@ -28,15 +28,12 @@
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JTable;
-import javax.swing.event.TableModelListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.entities.Equation;
import fr.ifremer.isisfish.entities.MetierSeasonInfo;
import fr.ifremer.isisfish.entities.TargetSpecies;
@@ -50,10 +47,10 @@
* <li>target species primaryCatch</li>
*
* @author chatellier
- * @version $Revision: 1.0 $
+ * @version $Revision$
*
- * Last update : $Date: 8 juin 2009 $
- * By : $Author: chatellier $
+ * Last update : $Date$
+ * By : $Author$
*/
public class MetierSeasonInfoTargetSpeciesModel extends AbstractTableModel implements TableCellRenderer {
Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesModel.java
___________________________________________________________________
Name: svn:keywords
+ Date Author Revision
1
0
r2349 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
by chatellier@users.labs.libre-entreprise.org 09 Jun '09
09 Jun '09
Author: chatellier
Date: 2009-06-09 09:08:10 +0000 (Tue, 09 Jun 2009)
New Revision: 2349
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx
Log:
Fix grid width
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2009-06-09 09:07:35 UTC (rev 2348)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2009-06-09 09:08:10 UTC (rev 2349)
@@ -133,7 +133,7 @@
</cell>
</row>
<row>
- <cell columns="2" fill='both' weightx='1.0'>
+ <cell columns="2" fill='both' weightx='1.0' weighty='0.5'>
<InputOneEquationUI id="strategyInactivity" constructorParams='this'
lblText='{_("isisfish.strategy.inactivity")}'
bean='{getBean()}' nameEquation='Inactivity' methodGet='InactivityEquation' methodSet='EquationInactivity'
@@ -145,7 +145,7 @@
<cell anchor='west'>
<JLabel text="isisfish.strategy.comments" enabled='{isActif()}'/>
</cell>
- <cell fill='both' weightx='1.0' weighty='0.3'>
+ <cell fill='both' weightx='1.0' weighty='0.5'>
<JScrollPane>
<JTextArea id="fieldStrategyComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldStrategyComment.getText())' enabled='{isActif()}' decorator='boxed'/>
</JScrollPane>
1
0